use of us.koller.cameraroll.data.provider.FilesProvider in project Camera-Roll-Android-App by kollerlukas.
the class ExcludePathsActivity method loadDirectory.
public void loadDirectory(final String path) {
final Snackbar snackbar = Snackbar.make(findViewById(R.id.root_view), getString(R.string.loading), Snackbar.LENGTH_INDEFINITE);
Util.showSnackbar(snackbar);
filesProvider = new FilesProvider(this);
final FilesProvider.Callback callback = new FilesProvider.Callback() {
@Override
public void onDirLoaded(final File_POJO dir) {
runOnUiThread(new Runnable() {
@Override
public void run() {
filesProvider.onDestroy();
snackbar.dismiss();
if (dir == null) {
return;
}
File_POJO currentDir = removeFiles(dir);
if (currentDir == null) {
return;
}
ExcludePathsActivity.this.currentDir = currentDir;
if (recyclerViewAdapter != null) {
recyclerViewAdapter.setFiles(currentDir);
recyclerViewAdapter.notifyDataSetChanged();
onPathChanged();
}
}
});
}
@Override
public void timeout() {
runOnUiThread(new Runnable() {
@Override
public void run() {
finish();
}
});
}
@Override
public void needPermission() {
runOnUiThread(new Runnable() {
@Override
public void run() {
finish();
}
});
}
};
filesProvider.loadDir(this, path, callback);
}
use of us.koller.cameraroll.data.provider.FilesProvider in project Camera-Roll-Android-App by kollerlukas.
the class FileExplorerActivity method loadDirectory.
public void loadDirectory(final String path) {
Log.d("FileExplorerActivity", "loadDirectory(): " + path);
final Snackbar snackbar = Snackbar.make(findViewById(R.id.root_view), getString(R.string.loading), Snackbar.LENGTH_INDEFINITE);
Util.showSnackbar(snackbar);
final FilesProvider.Callback callback = new FilesProvider.Callback() {
@Override
public void onDirLoaded(final File_POJO dir) {
runOnUiThread(new Runnable() {
@Override
public void run() {
filesProvider.onDestroy();
filesProvider = null;
if (dir != null) {
FileExplorerActivity.this.currentDir = dir;
if (recyclerViewAdapter != null) {
recyclerViewAdapter.setFiles(currentDir);
recyclerViewAdapter.notifyDataSetChanged();
onDataChanged();
}
}
snackbar.dismiss();
}
});
}
@Override
public void timeout() {
runOnUiThread(new Runnable() {
@Override
public void run() {
snackbar.dismiss();
final Snackbar snackbar = Snackbar.make(findViewById(R.id.root_view), R.string.loading_failed, Snackbar.LENGTH_INDEFINITE);
snackbar.setAction(getString(R.string.retry), new View.OnClickListener() {
@Override
public void onClick(View view) {
loadDirectory(path);
}
});
Util.showSnackbar(snackbar);
}
});
}
@Override
public void needPermission() {
runOnUiThread(new Runnable() {
@Override
public void run() {
snackbar.dismiss();
}
});
}
};
filesProvider = new FilesProvider(this);
filesProvider.loadDir(this, path, callback);
}
Aggregations