use of io.storj.libstorj.Bucket in project hello-storj by kaloyan-raev.
the class FileInfoFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Bucket bucket = (Bucket) getArguments().getSerializable(FilesFragment.BUCKET);
final File file = (File) getArguments().getSerializable(FILE);
// Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.title_fileinfo).setMessage(String.format("ID: %s\nBucket: %s\nName: %s\nCreated: %s\nDecrypted: %b\nSize: %s\nMIME Type: %s\nErasure: %s\nIndex: %s\nHMAC: %s", file.getId(), file.getBucketId(), file.getName(), file.getCreated(), file.isDecrypted(), Formatter.formatFileSize(getContext(), file.getSize()), file.getMimeType(), file.getErasure(), file.getIndex(), file.getHMAC())).setPositiveButton(R.string.button_download, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
((DownloadListener) getActivity()).onDownload(bucket, file);
}
});
// Create the AlertDialog object and return it
return builder.create();
}
use of io.storj.libstorj.Bucket in project hello-storj by kaloyan-raev.
the class FilesActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Show the Up button in new Intent(this, DetailActivity.class)the action bar.
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
//
if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity_main
// using a fragment transaction.
Bundle extras = getIntent().getExtras();
if (extras != null) {
Bucket bucket = (Bucket) extras.getSerializable(FilesFragment.BUCKET);
setTitle(bucket.getName());
FilesFragment fragment = new FilesFragment();
Bundle bundle = new Bundle();
bundle.putSerializable(FilesFragment.BUCKET, bucket);
fragment.setArguments(bundle);
getSupportFragmentManager().beginTransaction().add(R.id.detail_container, fragment).commit();
}
}
}
Aggregations