Skip to content

Commit 028d62b

Browse files
committed
add timestamp prop (android)
1 parent fbdc164 commit 028d62b

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

android/src/main/java/io/rumors/reactnativefirebaseui/storage/ExtendedImageView.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.bumptech.glide.load.resource.bitmap.FitCenter;
1818
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
1919
import com.bumptech.glide.load.MultiTransformation;
20+
import com.bumptech.glide.signature.MediaStoreSignature;
2021
import static com.bumptech.glide.request.RequestOptions.bitmapTransform;
2122

2223
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
@@ -27,6 +28,7 @@ public class ExtendedImageView extends ImageView {
2728
protected String mPath = null;
2829
protected Map<CornerType, Integer> mBorderRadii = new HashMap<CornerType, Integer>();
2930
protected ScaleType mScaleType;
31+
protected long mTimestamp = 0;
3032

3133
protected ThemedReactContext mContext = null;
3234

@@ -39,6 +41,10 @@ public void setPath(String path) {
3941
mPath = path;
4042
}
4143

44+
public void setTimestamp(long timestamp) {
45+
mTimestamp = timestamp;
46+
}
47+
4248
@Override
4349
public void setScaleType(ScaleType scaleType) {
4450
mScaleType = scaleType;
@@ -73,6 +79,8 @@ public void updateView() {
7379
GlideApp.with(mContext)
7480
.load(storageReference)
7581
.apply(bitmapTransform(multi))
82+
//(String mimeType, long dateModified, int orientation)
83+
.signature(new MediaStoreSignature("", mTimestamp, 0))
7684
.into(this);
7785
}
7886
}

android/src/main/java/io/rumors/reactnativefirebaseui/storage/ExtendedPhotoView.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.bumptech.glide.load.resource.bitmap.FitCenter;
1818
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
1919
import com.bumptech.glide.load.MultiTransformation;
20+
import com.bumptech.glide.signature.MediaStoreSignature;
2021
import static com.bumptech.glide.request.RequestOptions.bitmapTransform;
2122

2223
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
@@ -27,6 +28,7 @@ public class ExtendedPhotoView extends PhotoView {
2728
protected String mPath = null;
2829
protected Map<CornerType, Integer> mBorderRadii = new HashMap<CornerType, Integer>();
2930
protected ScaleType mScaleType;
31+
protected long mTimestamp = 0;
3032

3133
protected ThemedReactContext mContext = null;
3234

@@ -39,6 +41,10 @@ public void setPath(String path) {
3941
mPath = path;
4042
}
4143

44+
public void setTimestamp(long timestamp) {
45+
mTimestamp = timestamp;
46+
}
47+
4248
@Override
4349
public void setScaleType(ScaleType scaleType) {
4450
mScaleType = scaleType;
@@ -72,6 +78,8 @@ public void updateView() {
7278
GlideApp.with(mContext)
7379
.load(storageReference)
7480
.apply(bitmapTransform(multi))
81+
//(String mimeType, long dateModified, int orientation)
82+
.signature(new MediaStoreSignature("", mTimestamp, 0))
7583
.into(this);
7684
}
7785
}

android/src/main/java/io/rumors/reactnativefirebaseui/storage/FirebaseImageViewManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public void setPath(ExtendedImageView imageView, @Nullable String path) {
3232
imageView.setPath(path);
3333
}
3434

35+
@ReactProp(name = "timestamp")
36+
public void setTimestamp(ExtendedImageView imageView, @Nullable double timestamp) {
37+
imageView.setTimestamp((long)timestamp);
38+
}
39+
3540
@ReactProp(name = ViewProps.RESIZE_MODE)
3641
public void setResizeMode(ExtendedImageView imageView, @Nullable String resizeMode) {
3742
ScaleType scaleType = ScaleType.CENTER_INSIDE;

android/src/main/java/io/rumors/reactnativefirebaseui/storage/FirebasePhotoViewManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public void setPath(ExtendedPhotoView imageView, @Nullable String path) {
3333
imageView.setPath(path);
3434
}
3535

36+
@ReactProp(name = "timestamp")
37+
public void setTimestamp(ExtendedImageView imageView, @Nullable double timestamp) {
38+
imageView.setTimestamp((long)timestamp);
39+
}
40+
3641
@ReactProp(name = ViewProps.RESIZE_MODE)
3742
public void setResizeMode(ExtendedPhotoView imageView, @Nullable String resizeMode) {
3843
ScaleType scaleType = ScaleType.CENTER_INSIDE;

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var iface = {
66
propTypes: {
77
...Image.propTypes,
88
path: PropTypes.string,
9+
timestamp: PropTypes.number,
910
resizeMode: PropTypes.oneOf(['cover', 'contain', 'stretch']),
1011
},
1112
}

0 commit comments

Comments
 (0)