use of com.thecoolguy.rumaan.fileio.data.UploadItemViewModel in project file.io-app by rumaan.
the class UploadHistoryActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload_history);
ButterKnife.bind(this);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(getString(R.string.upload_history_title));
actionBar.setDisplayHomeAsUpEnabled(true);
}
final UploadHistoryListAdapter uploadHistoryListAdapter = new UploadHistoryListAdapter(this);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
uploadItemViewModel = ViewModelProviders.of(this).get(UploadItemViewModel.class);
uploadItemViewModel.getUploadHistoryList().observe(this, new Observer<List<UploadItem>>() {
@Override
public void onChanged(@Nullable List<UploadItem> uploadItems) {
if ((uploadItems == null) || uploadItems.isEmpty()) {
noUploadsView.setVisibility(View.VISIBLE);
recyclerView.setVisibility(View.INVISIBLE);
} else {
noUploadsView.setVisibility(View.INVISIBLE);
recyclerView.setVisibility(View.VISIBLE);
uploadHistoryListAdapter.setUploadItemList(uploadItems);
recyclerView.addItemDecoration(getSectionCallback(uploadItemViewModel.getUploadHistoryList().getValue()));
}
}
});
recyclerView.setAdapter(uploadHistoryListAdapter);
uploadHistoryListAdapter.setOnUploadItemLongClickListener(this);
LayoutAnimationController layoutAnimationController = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_anim_fall_down);
recyclerView.setLayoutAnimation(layoutAnimationController);
}
use of com.thecoolguy.rumaan.fileio.data.UploadItemViewModel in project file.io-app by rumaan.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/* This neat lil trick though! */
setTheme(R.style.NoActionBarTheme);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
/* Get the view model */
uploadItemViewModel = ViewModelProviders.of(this).get(UploadItemViewModel.class);
/* Handle incoming intent content */
Intent intent = getIntent();
String action = intent.getAction();
String type = intent.getType();
// FIXME: Google photos URI
if (type != null) {
Log.d(TAG, "Receive Type: " + type);
Uri fileUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
Log.d(TAG, "\nURI: " + fileUri);
if (Intent.ACTION_SEND.equals(action) && fileUri != null) {
handleExplicitFileShare(intent);
}
}
}
Aggregations