From 8711121b11acd671769619de41bd1af262a8dd4a Mon Sep 17 00:00:00 2001 From: Ezerous Date: Wed, 14 Jun 2023 09:05:50 +0300 Subject: [PATCH] fix: disable broken Uploads --- .../downloads/DownloadsActivity.java | 44 +++++++++---------- .../activities/upload/UploadActivity.java | 4 +- .../upload/UploadFieldsBuilderActivity.java | 2 +- .../gr/thmmy/mthmmy/base/BaseActivity.java | 32 +++++++------- .../main/res/layout/activity_downloads.xml | 22 +++++----- .../main/res/xml-v26/app_preferences_user.xml | 12 ----- app/src/main/res/xml/app_preferences_user.xml | 12 ----- 7 files changed, 52 insertions(+), 76 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java index 0ffdaf9c..793a6bba 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java @@ -57,7 +57,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. private MaterialProgressBar progressBar; private RecyclerView recyclerView; private DownloadsAdapter downloadsAdapter; - private FloatingActionButton uploadFAB; +// private FloatingActionButton uploadFAB; private ParseDownloadPageTask parseDownloadPageTask; private int numberOfPages = -1; @@ -124,9 +124,9 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. } }); - uploadFAB = findViewById(R.id.upload_fab); - uploadFAB.setEnabled(false); - uploadFAB.hide(); +// uploadFAB = findViewById(R.id.upload_fab); +// uploadFAB.setEnabled(false); +// uploadFAB.hide(); parseDownloadPageTask = new ParseDownloadPageTask(); parseDownloadPageTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, downloadsUrl); @@ -135,26 +135,26 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. @Override public boolean onCreateOptionsMenu(Menu menu) { // 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); return true; } - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Handle presses on the action bar items - switch (item.getItemId()) { - case R.id.menu_upload: - Intent intent = new Intent(DownloadsActivity.this, UploadActivity.class); - Bundle extras = new Bundle(); - extras.putString(BUNDLE_UPLOAD_CATEGORY, downloadsNav); - intent.putExtras(extras); - startActivity(intent); - return true; - default: - return super.onOptionsItemSelected(item); - } - } +// @Override +// public boolean onOptionsItemSelected(MenuItem item) { +// // Handle presses on the action bar items +// switch (item.getItemId()) { +// case R.id.menu_upload: +// Intent intent = new Intent(DownloadsActivity.this, UploadActivity.class); +// Bundle extras = new Bundle(); +// extras.putString(BUNDLE_UPLOAD_CATEGORY, downloadsNav); +// intent.putExtras(extras); +// startActivity(intent); +// return true; +// default: +// return super.onOptionsItemSelected(item); +// } +// } @Override public void onLoadMore() { @@ -210,7 +210,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. @Override protected void onPreExecute() { if (!isLoadingMore) progressBar.setVisibility(ProgressBar.VISIBLE); - if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(false); +// if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(false); } @Override @@ -312,7 +312,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter. toolbar.setTitle(downloadsTitle); ++pagesLoaded; - if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(true); +// if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(true); progressBar.setVisibility(ProgressBar.INVISIBLE); downloadsAdapter.notifyDataSetChanged(); isLoadingMore = false; diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java index 3f64a81c..2cffbfc8 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java @@ -169,7 +169,7 @@ public class UploadActivity extends BaseActivity { } createDrawer(); - drawer.setSelection(UPLOAD_ID); +// drawer.setSelection(UPLOAD_ID); progressBar = findViewById(R.id.progressBar); @@ -434,7 +434,7 @@ public class UploadActivity extends BaseActivity { @Override protected void onResume() { - drawer.setSelection(UPLOAD_ID); +// drawer.setSelection(UPLOAD_ID); super.onResume(); } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java index b4d88805..5e7af4b6 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java @@ -99,7 +99,7 @@ public class UploadFieldsBuilderActivity extends BaseActivity { } createDrawer(); - drawer.setSelection(UPLOAD_ID, false); +// drawer.setSelection(UPLOAD_ID, false); semesterChooserLinear = findViewById(R.id.upload_fields_builder_choose_semester); semesterRadio = findViewById(R.id.upload_fields_builder_semester_radio_group); diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java index 7c3a009c..9a8f45d4 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java @@ -167,7 +167,7 @@ public abstract class BaseActivity extends AppCompatActivity { //------------------------------------------DRAWER STUFF---------------------------------------- protected static final int HOME_ID = 0; protected static final int DOWNLOADS_ID = 1; - protected static final int UPLOAD_ID = 2; + //protected static final int UPLOAD_ID = 2; //Removed until fixed protected static final int BOOKMARKS_ID = 3; protected static final int LOG_ID = 4; protected static final int ABOUT_ID = 5; @@ -267,14 +267,14 @@ public abstract class BaseActivity extends AppCompatActivity { .withIcon(downloadsIcon) .withSelectedIcon(downloadsIconSelected); - uploadItem = new PrimaryDrawerItem() - .withTextColor(primaryColor) - .withSelectedColor(selectedPrimaryColor) - .withSelectedTextColor(selectedSecondaryColor) - .withIdentifier(UPLOAD_ID) - .withName(R.string.upload) - .withIcon(uploadIcon) - .withSelectedIcon(uploadIconSelected); +// uploadItem = new PrimaryDrawerItem() +// .withTextColor(primaryColor) +// .withSelectedColor(selectedPrimaryColor) +// .withSelectedTextColor(selectedSecondaryColor) +// .withIdentifier(UPLOAD_ID) +// .withName(R.string.upload) +// .withIcon(uploadIcon) +// .withSelectedIcon(uploadIconSelected); shoutboxItem = new PrimaryDrawerItem() .withTextColor(primaryColor) @@ -395,12 +395,12 @@ public abstract class BaseActivity extends AppCompatActivity { startActivity(intent); } } - else if (drawerItem.equals(UPLOAD_ID)) { - if (!(BaseActivity.this instanceof UploadActivity)) { - Intent intent = new Intent(BaseActivity.this, UploadActivity.class); - startActivity(intent); - } - } +// else if (drawerItem.equals(UPLOAD_ID)) { +// if (!(BaseActivity.this instanceof UploadActivity)) { +// Intent intent = new Intent(BaseActivity.this, UploadActivity.class); +// startActivity(intent); +// } +// } else if (drawerItem.equals(BOOKMARKS_ID)) { if (!(BaseActivity.this instanceof BookmarksActivity)) { Intent intent = new Intent(BaseActivity.this, BookmarksActivity.class); @@ -453,7 +453,7 @@ public abstract class BaseActivity extends AppCompatActivity { if (drawer != null) { if (!sessionManager.isLoggedIn()) { //When logged out or if user is guest drawer.removeItem(DOWNLOADS_ID); - drawer.removeItem(UPLOAD_ID); + //drawer.removeItem(UPLOAD_ID); loginLogoutItem.withName(R.string.login).withIcon(loginIcon); //Swap logout with login profileDrawerItem.withName(sessionManager.getUsername()); setDefaultAvatar(); diff --git a/app/src/main/res/layout/activity_downloads.xml b/app/src/main/res/layout/activity_downloads.xml index ed65473e..23e8ad45 100644 --- a/app/src/main/res/layout/activity_downloads.xml +++ b/app/src/main/res/layout/activity_downloads.xml @@ -20,7 +20,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" - app:popupTheme="@style/ToolbarTheme"> + app:popupTheme="@style/ToolbarTheme" /> + tools:context="gr.thmmy.mthmmy.activities.downloads.DownloadsActivity" /> - + + + + + + + + + diff --git a/app/src/main/res/xml-v26/app_preferences_user.xml b/app/src/main/res/xml-v26/app_preferences_user.xml index 6d5489b5..47ca581e 100644 --- a/app/src/main/res/xml-v26/app_preferences_user.xml +++ b/app/src/main/res/xml-v26/app_preferences_user.xml @@ -40,18 +40,6 @@ app:iconSpaceReserved="false" /> - - - - - - - -