use of us.koller.cameraroll.data.models.AlbumItem in project Camera-Roll-Android-App by kollerlukas.
the class AlbumActivity method onActivityReenter.
@Override
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void onActivityReenter(int requestCode, Intent data) {
super.onActivityReenter(requestCode, data);
Log.d("AlbumActivity", "onActivityReenter: " + this);
if (data != null) {
sharedElementReturnPosition = data.getIntExtra(EXTRA_CURRENT_ALBUM_POSITION, -1);
if (sharedElementReturnPosition > -1 && album != null && sharedElementReturnPosition < album.getAlbumItems().size()) {
AlbumItem albumItem = album.getAlbumItems().get(sharedElementReturnPosition);
albumItem.isSharedElement = true;
postponeEnterTransition();
recyclerView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int l, int t, int r, int b, int oL, int oT, int oR, int oB) {
recyclerView.removeOnLayoutChangeListener(this);
startPostponedEnterTransition();
}
});
recyclerView.scrollToPosition(sharedElementReturnPosition);
}
}
/*super.onActivityReenter(requestCode, data);*/
}
use of us.koller.cameraroll.data.models.AlbumItem in project Camera-Roll-Android-App by kollerlukas.
the class AlbumActivity method setPhotosResult.
public void setPhotosResult() {
final AlbumItem[] selected_items = SelectorModeManager.createAlbumItemArray(recyclerViewAdapter.cancelSelectorMode(this));
Intent intent = new Intent("us.koller.RESULT_ACTION");
if (allowMultiple) {
ClipData clipData = createClipData(selected_items);
intent.setClipData(clipData);
} else {
intent.setData(selected_items[0].getUri(this));
}
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
setResult(RESULT_OK, intent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
finishAfterTransition();
} else {
finish();
}
}
use of us.koller.cameraroll.data.models.AlbumItem in project Camera-Roll-Android-App by kollerlukas.
the class AlbumActivity method removeAlbumItem.
private void removeAlbumItem(String path) {
Log.d("AlbumActivity", "removeAlbumItem() called with: path = [" + path + "]");
int index = -1;
for (int i = 0; i < album.getAlbumItems().size(); i++) {
AlbumItem albumItem = album.getAlbumItems().get(i);
if (albumItem.getPath().equals(path)) {
index = i;
break;
}
}
Log.d("AlbumActivity", "removeAlbumItem: " + index);
if (index > -1) {
album.getAlbumItems().remove(index);
}
recyclerViewAdapter.notifyDataSetChanged();
if (album.getAlbumItems().size() == 0) {
finish();
}
}
Aggregations