Browse Source

fix: disable broken Uploads

develop
Ezerous 2 years ago
parent
commit
8711121b11
  1. 44
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
  2. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java
  3. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java
  4. 32
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  5. 22
      app/src/main/res/layout/activity_downloads.xml
  6. 12
      app/src/main/res/xml-v26/app_preferences_user.xml
  7. 12
      app/src/main/res/xml/app_preferences_user.xml

44
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;

4
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();
}

2
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);

32
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();

22
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"></androidx.appcompat.widget.Toolbar>
app:popupTheme="@style/ToolbarTheme" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
@ -31,7 +31,7 @@
android:background="@color/background"
android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="gr.thmmy.mthmmy.activities.downloads.DownloadsActivity"></androidx.recyclerview.widget.RecyclerView>
tools:context="gr.thmmy.mthmmy.activities.downloads.DownloadsActivity" />
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar"
@ -45,13 +45,13 @@
app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/upload_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="@dimen/fab_margins"
android:layout_marginEnd="@dimen/fab_margins"
app:layout_behavior="gr.thmmy.mthmmy.utils.ui.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_file_upload_white_24dp" />
<!-- <com.google.android.material.floatingactionbutton.FloatingActionButton-->
<!-- android:id="@+id/upload_fab"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="bottom|end"-->
<!-- android:layout_marginBottom="@dimen/fab_margins"-->
<!-- android:layout_marginEnd="@dimen/fab_margins"-->
<!-- app:layout_behavior="gr.thmmy.mthmmy.utils.ui.ScrollAwareFABBehavior"-->
<!-- app:srcCompat="@drawable/ic_file_upload_white_24dp" />-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>

12
app/src/main/res/xml-v26/app_preferences_user.xml

@ -40,18 +40,6 @@
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory
android:key="@string/pref_category_uploading_key"
android:title="@string/pref_category_uploading"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/pref_uploading_app_signature_enable_key"
android:title="@string/pref_title_uploading_app_signature_enable"
android:summary="@string/pref_summary_uploading_app_signature_enable"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory
android:key="@string/pref_category_privacy_key"
android:title="@string/pref_category_privacy"

12
app/src/main/res/xml/app_preferences_user.xml

@ -61,18 +61,6 @@
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory
android:key="@string/pref_category_uploading_key"
android:title="@string/pref_category_uploading"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/pref_uploading_app_signature_enable_key"
android:title="@string/pref_title_uploading_app_signature_enable"
android:summary="@string/pref_summary_uploading_app_signature_enable"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory
android:key="@string/pref_category_privacy_key"
android:title="@string/pref_category_privacy"

Loading…
Cancel
Save