Skip to content

Commit

Permalink
#158 Camera snapshot image should not be cached
Browse files Browse the repository at this point in the history
#158  Camera snapshot image should not be cached
  • Loading branch information
galadril committed Dec 31, 2015
1 parent 5f02f19 commit b2b994d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.MemoryPolicy;
import com.squareup.picasso.NetworkPolicy;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;
Expand Down Expand Up @@ -73,7 +75,12 @@ public void onBindViewHolder(DataObjectHolder holder, int position) {
String text = mContext.getResources().getQuantityString(R.plurals.devices, numberOfDevices, numberOfDevices);

holder.name.setText(name);
Picasso.with(mContext).load(cameraInfo.getFullURL()).into(holder.camera);

Picasso.with(mContext)
.load(cameraInfo.getFullURL())
.memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
.networkPolicy(NetworkPolicy.NO_CACHE)
.into(holder.camera);
}
}

Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/nl/hnogames/domoticz/Fragments/Camera.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.squareup.picasso.MemoryPolicy;
import com.squareup.picasso.NetworkPolicy;
import com.squareup.picasso.Picasso;

import java.io.File;
Expand Down Expand Up @@ -114,7 +116,11 @@ private void processImage() {
public void setImage(String url) {
this.url = url;
if (root != null && !root.equals(null))
Picasso.with(getActivity()).load(url).into(root);
Picasso.with(getActivity())
.load(url)
.memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
.networkPolicy(NetworkPolicy.NO_CACHE)
.into(root);
}

// Returns the URI path to the Bitmap displayed in specified ImageView
Expand Down

0 comments on commit b2b994d

Please sign in to comment.