Browse Source

Drawer fix, suppressed uploads once again

pull/61/merge
Ezerous 6 years ago
parent
commit
c4394a4a54
  1. 46
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
  2. 38
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

46
app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java

@ -127,29 +127,29 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
parseDownloadPageTask.execute(downloadsUrl); parseDownloadPageTask.execute(downloadsUrl);
} }
@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() {

38
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -241,6 +241,22 @@ public abstract class BaseActivity extends AppCompatActivity {
.withIcon(homeIcon) .withIcon(homeIcon)
.withSelectedIcon(homeIconSelected); .withSelectedIcon(homeIconSelected);
downloadsItem = new PrimaryDrawerItem() // Don't put it in the if below
.withTextColor(primaryColor)
.withSelectedColor(selectedPrimaryColor)
.withSelectedTextColor(selectedSecondaryColor)
.withIdentifier(DOWNLOADS_ID)
.withName(R.string.downloads)
.withIcon(downloadsIcon)
.withSelectedIcon(downloadsIconSelected);
// uploadItem = new PrimaryDrawerItem()
// .withTextColor(primaryColor)
// .withSelectedColor(selectedPrimaryColor)
// .withSelectedTextColor(selectedSecondaryColor)
// .withIdentifier(UPLOAD_ID)
// .withName(R.string.upload)
// .withIcon(uploadIcon)
// .withSelectedIcon(uploadIconSelected);
if (sessionManager.isLoggedIn()) //When logged in if (sessionManager.isLoggedIn()) //When logged in
{ {
@ -251,22 +267,6 @@ public abstract class BaseActivity extends AppCompatActivity {
.withName(R.string.logout) .withName(R.string.logout)
.withIcon(logoutIcon) .withIcon(logoutIcon)
.withSelectable(false); .withSelectable(false);
downloadsItem = new PrimaryDrawerItem()
.withTextColor(primaryColor)
.withSelectedColor(selectedPrimaryColor)
.withSelectedTextColor(selectedSecondaryColor)
.withIdentifier(DOWNLOADS_ID)
.withName(R.string.downloads)
.withIcon(downloadsIcon)
.withSelectedIcon(downloadsIconSelected);
// uploadItem = new PrimaryDrawerItem()
// .withTextColor(primaryColor)
// .withSelectedColor(selectedPrimaryColor)
// .withSelectedTextColor(selectedSecondaryColor)
// .withIdentifier(UPLOAD_ID)
// .withName(R.string.upload)
// .withIcon(uploadIcon)
// .withSelectedIcon(uploadIconSelected);
} else } else
loginLogoutItem = new PrimaryDrawerItem() loginLogoutItem = new PrimaryDrawerItem()
.withTextColor(primaryColor) .withTextColor(primaryColor)
@ -410,16 +410,16 @@ public abstract class BaseActivity extends AppCompatActivity {
if (!sessionManager.isLoggedIn()) //When logged out or if user is guest if (!sessionManager.isLoggedIn()) //When logged out or if user is guest
{ {
drawer.removeItem(DOWNLOADS_ID); drawer.removeItem(DOWNLOADS_ID);
drawer.removeItem(UPLOAD_ID); // drawer.removeItem(UPLOAD_ID);
loginLogoutItem.withName(R.string.login).withIcon(loginIcon); //Swap logout with login loginLogoutItem.withName(R.string.login).withIcon(loginIcon); //Swap logout with login
profileDrawerItem.withName(sessionManager.getUsername()); profileDrawerItem.withName(sessionManager.getUsername());
setDefaultAvatar(); setDefaultAvatar();
} else { } else {
if (!drawer.getDrawerItems().contains(downloadsItem)) { if (!drawer.getDrawerItems().contains(downloadsItem)) {
drawer.addItemAtPosition(downloadsItem, 2); drawer.addItemAtPosition(downloadsItem, 3);
} }
// if (!drawer.getDrawerItems().contains(uploadItem)) { // if (!drawer.getDrawerItems().contains(uploadItem)) {
// drawer.addItemAtPosition(uploadItem, 3); // drawer.addItemAtPosition(uploadItem, 4);
// } // }
loginLogoutItem.withName(R.string.logout).withIcon(logoutIcon); //Swap login with logout loginLogoutItem.withName(R.string.logout).withIcon(logoutIcon); //Swap login with logout
profileDrawerItem.withName(sessionManager.getUsername()); profileDrawerItem.withName(sessionManager.getUsername());

Loading…
Cancel
Save