|
@ -57,7 +57,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. |
|
|
private MaterialProgressBar progressBar; |
|
|
private MaterialProgressBar progressBar; |
|
|
private RecyclerView recyclerView; |
|
|
private RecyclerView recyclerView; |
|
|
private DownloadsAdapter downloadsAdapter; |
|
|
private DownloadsAdapter downloadsAdapter; |
|
|
private FloatingActionButton uploadFAB; |
|
|
// private FloatingActionButton uploadFAB;
|
|
|
|
|
|
|
|
|
private ParseDownloadPageTask parseDownloadPageTask; |
|
|
private ParseDownloadPageTask parseDownloadPageTask; |
|
|
private int numberOfPages = -1; |
|
|
private int numberOfPages = -1; |
|
@ -124,9 +124,9 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
uploadFAB = findViewById(R.id.upload_fab); |
|
|
// uploadFAB = findViewById(R.id.upload_fab);
|
|
|
uploadFAB.setEnabled(false); |
|
|
// uploadFAB.setEnabled(false);
|
|
|
uploadFAB.hide(); |
|
|
// uploadFAB.hide();
|
|
|
|
|
|
|
|
|
parseDownloadPageTask = new ParseDownloadPageTask(); |
|
|
parseDownloadPageTask = new ParseDownloadPageTask(); |
|
|
parseDownloadPageTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, downloadsUrl); |
|
|
parseDownloadPageTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, downloadsUrl); |
|
@ -135,26 +135,26 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. |
|
|
@Override |
|
|
@Override |
|
|
public boolean onCreateOptionsMenu(Menu menu) { |
|
|
public boolean onCreateOptionsMenu(Menu menu) { |
|
|
// Inflates the menu; this adds items to the action bar if it is present.
|
|
|
// Inflates the menu; this adds items to the action bar if it is present.
|
|
|
getMenuInflater().inflate(R.menu.downloads_menu, menu); |
|
|
// getMenuInflater().inflate(R.menu.downloads_menu, menu);
|
|
|
super.onCreateOptionsMenu(menu); |
|
|
super.onCreateOptionsMenu(menu); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
// @Override
|
|
|
public boolean onOptionsItemSelected(MenuItem item) { |
|
|
// public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
// Handle presses on the action bar items
|
|
|
// // Handle presses on the action bar items
|
|
|
switch (item.getItemId()) { |
|
|
// switch (item.getItemId()) {
|
|
|
case R.id.menu_upload: |
|
|
// case R.id.menu_upload:
|
|
|
Intent intent = new Intent(DownloadsActivity.this, UploadActivity.class); |
|
|
// Intent intent = new Intent(DownloadsActivity.this, UploadActivity.class);
|
|
|
Bundle extras = new Bundle(); |
|
|
// Bundle extras = new Bundle();
|
|
|
extras.putString(BUNDLE_UPLOAD_CATEGORY, downloadsNav); |
|
|
// extras.putString(BUNDLE_UPLOAD_CATEGORY, downloadsNav);
|
|
|
intent.putExtras(extras); |
|
|
// intent.putExtras(extras);
|
|
|
startActivity(intent); |
|
|
// startActivity(intent);
|
|
|
return true; |
|
|
// return true;
|
|
|
default: |
|
|
// default:
|
|
|
return super.onOptionsItemSelected(item); |
|
|
// return super.onOptionsItemSelected(item);
|
|
|
} |
|
|
// }
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onLoadMore() { |
|
|
public void onLoadMore() { |
|
@ -210,7 +210,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. |
|
|
@Override |
|
|
@Override |
|
|
protected void onPreExecute() { |
|
|
protected void onPreExecute() { |
|
|
if (!isLoadingMore) progressBar.setVisibility(ProgressBar.VISIBLE); |
|
|
if (!isLoadingMore) progressBar.setVisibility(ProgressBar.VISIBLE); |
|
|
if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(false); |
|
|
// if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(false);
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -312,7 +312,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. |
|
|
toolbar.setTitle(downloadsTitle); |
|
|
toolbar.setTitle(downloadsTitle); |
|
|
|
|
|
|
|
|
++pagesLoaded; |
|
|
++pagesLoaded; |
|
|
if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(true); |
|
|
// if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(true);
|
|
|
progressBar.setVisibility(ProgressBar.INVISIBLE); |
|
|
progressBar.setVisibility(ProgressBar.INVISIBLE); |
|
|
downloadsAdapter.notifyDataSetChanged(); |
|
|
downloadsAdapter.notifyDataSetChanged(); |
|
|
isLoadingMore = false; |
|
|
isLoadingMore = false; |
|
|