use of us.koller.cameraroll.data.models.File_POJO in project Camera-Roll-Android-App by kollerlukas.
the class ItemActivity method renameAlbumItem.
public void renameAlbumItem() {
File_POJO file = new File_POJO(albumItem.getPath(), true).setName(albumItem.getName());
Rename.Util.getRenameDialog(this, file, new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
switch(intent.getAction()) {
case FileOperation.RESULT_DONE:
// refresh data
final Activity activity = ItemActivity.this;
String newFilePath = intent.getStringExtra(Rename.NEW_FILE_PATH);
if (newFilePath == null) {
return;
}
int index = newFilePath.lastIndexOf("/");
final String albumPath = newFilePath.substring(0, index);
getIntent().putExtra(ALBUM_PATH, albumPath);
getIntent().putExtra(ITEM_POSITION, album.getAlbumItems().indexOf(albumItem));
boolean hiddenFolders = Settings.getInstance(activity).getHiddenFolders();
new MediaProvider(activity).loadAlbums(activity, hiddenFolders, new MediaProvider.OnMediaLoadedCallback() {
@Override
public void onMediaLoaded(ArrayList<Album> albums) {
// reload activity
MediaProvider.loadAlbum(activity, albumPath, new MediaProvider.OnAlbumLoadedCallback() {
@Override
public void onAlbumLoaded(Album album) {
ItemActivity.this.albumItem = null;
ItemActivity.this.album = album;
ItemActivity.this.onAlbumLoaded(null);
// notify AlbumActivity
LocalBroadcastManager.getInstance(ItemActivity.this).sendBroadcast(new Intent(AlbumActivity.ALBUM_ITEM_RENAMED));
}
});
}
@Override
public void timeout() {
finish();
}
@Override
public void needPermission() {
finish();
}
});
break;
default:
break;
}
}
}).show();
}
use of us.koller.cameraroll.data.models.File_POJO in project Camera-Roll-Android-App by kollerlukas.
the class ExcludePathsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_excluded_paths);
currentDir = new File_POJO("", false);
final Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerViewAdapter = new RecyclerViewAdapter(directoryChangeCallback, excludedPathChangeCallback);
recyclerViewAdapter.notifyDataSetChanged();
recyclerView.setAdapter(recyclerViewAdapter);
final ViewGroup rootView = findViewById(R.id.root_view);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
rootView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
@RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
toolbar.setPadding(toolbar.getPaddingStart() + insets.getSystemWindowInsetLeft(), toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(), toolbar.getPaddingEnd() + insets.getSystemWindowInsetRight(), toolbar.getPaddingBottom());
recyclerView.setPadding(recyclerView.getPaddingStart() + insets.getSystemWindowInsetLeft(), recyclerView.getPaddingTop(), recyclerView.getPaddingEnd() + insets.getSystemWindowInsetRight(), recyclerView.getPaddingBottom() + insets.getSystemWindowInsetBottom());
// clear this listener so insets aren't re-applied
rootView.setOnApplyWindowInsetsListener(null);
return insets.consumeSystemWindowInsets();
}
});
} else {
rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// hacky way of getting window insets on pre-Lollipop
int[] screenSize = Util.getScreenSize(ExcludePathsActivity.this);
int[] windowInsets = new int[] { Math.abs(screenSize[0] - rootView.getLeft()), Math.abs(screenSize[1] - rootView.getTop()), Math.abs(screenSize[2] - rootView.getRight()), Math.abs(screenSize[3] - rootView.getBottom()) };
toolbar.setPadding(toolbar.getPaddingStart() + windowInsets[0], toolbar.getPaddingTop() + windowInsets[1], toolbar.getPaddingEnd() + windowInsets[2], toolbar.getPaddingBottom());
recyclerView.setPadding(recyclerView.getPaddingStart() + windowInsets[0], recyclerView.getPaddingTop(), recyclerView.getPaddingEnd() + windowInsets[2], recyclerView.getPaddingBottom() + windowInsets[3]);
rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
}
// needed to achieve transparent statusBar in landscape; don't ask me why, but its working
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
// load files
if (savedInstanceState != null && savedInstanceState.containsKey(CURRENT_DIR) && savedInstanceState.containsKey(ROOTS)) {
roots = savedInstanceState.getParcelable(ROOTS);
currentDir = savedInstanceState.getParcelable(CURRENT_DIR);
recyclerViewAdapter.setFiles(currentDir);
recyclerViewAdapter.notifyDataSetChanged();
onPathChanged();
} else {
loadRoots();
}
Log.d("ExcludedPathsActivity", "onCreate: " + Provider.getExcludedPaths());
}
Aggregations