aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-15 15:31:18 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-15 15:31:18 -0700
commit9de00f4464e5cab586c578ce6ccb337d3c9416d9 (patch)
treee0463c90102127bdc27bb8397a8251c5d015f88b /src
parentae7e2acb924dc15e9f0083aaf388de21bce8fefa (diff)
downloaddsub-9de00f4464e5cab586c578ce6ccb337d3c9416d9.tar.gz
dsub-9de00f4464e5cab586c578ce6ccb337d3c9416d9.tar.bz2
dsub-9de00f4464e5cab586c578ce6ccb337d3c9416d9.zip
#368 When trying to enter Admin tab, confirm password for admin users
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index 92775f3e..a2f8ab22 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -180,22 +180,20 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
drawerList.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ public void onItemClick(AdapterView<?> parent, final View view, final int position, long id) {
position = drawerAdapter.getActualPosition(position);
if("Settings".equals(drawerItemsDescriptions[position])) {
startActivity(new Intent(SubsonicActivity.this, SettingsActivity.class));
drawer.closeDrawers();
- } else {
- startFragmentActivity(drawerItemsDescriptions[position]);
-
- if(lastSelectedView != view) {
- if(lastSelectedView != null) {
- lastSelectedView.setTextAppearance(SubsonicActivity.this, R.style.DSub_TextViewStyle);
+ } else if("Admin".equals(drawerItemsDescriptions[position]) && UserUtil.isCurrentAdmin()) {
+ UserUtil.confirmCredentials(context, new Runnable() {
+ @Override
+ public void run() {
+ drawerItemSelected(position, view);
}
- lastSelectedView = (TextView) view.findViewById(R.id.drawer_name);
- lastSelectedView.setTextAppearance(SubsonicActivity.this, R.style.DSub_TextViewStyle_Bold);
- lastSelectedPosition = position;
- }
+ });
+ } else {
+ drawerItemSelected(position, view);
}
}
});
@@ -468,6 +466,20 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
}
}
}
+
+ private void drawerItemSelected(int position, View view) {
+ startFragmentActivity(drawerItemsDescriptions[position]);
+
+ if(lastSelectedView != view) {
+ if(lastSelectedView != null) {
+ lastSelectedView.setTextAppearance(this, R.style.Dsub_TextViewStyle);
+ }
+
+ lastSelectedView = (TextView) view.findViewById(R.id.drawer_name);
+ lastSelectedView.setTextAppearance(this, R.style.Dsub_TextViewStyle_Bold);
+ lastSelectedPosition = position;
+ }
+ }
public void startFragmentActivity(String fragmentType) {
Intent intent = new Intent();