Move 'Logs' from Settings to Navigation Drawer
authormasensio <masensio@solidgear.es>
Tue, 26 May 2015 07:11:27 +0000 (09:11 +0200)
committermasensio <masensio@solidgear.es>
Tue, 26 May 2015 07:11:27 +0000 (09:11 +0200)
res/values/strings.xml
res/xml/preferences.xml
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
src/com/owncloud/android/ui/activity/Preferences.java

index d17fdb5..84ede4f 100644 (file)
@@ -25,6 +25,7 @@
            <item>All Files</item>
            <!--<item>On device</item>-->
            <item>Settings</item>
            <item>All Files</item>
            <!--<item>On device</item>-->
            <item>Settings</item>
+        <item>Logs</item>
     </string-array>
     <string name="drawer_open">ownCloud</string>
        <string name="drawer_close">Close</string>
     </string-array>
     <string name="drawer_open">ownCloud</string>
        <string name="drawer_close">Close</string>
index e1d0a47..4823a83 100644 (file)
@@ -56,7 +56,6 @@
        
        <PreferenceCategory android:title="@string/prefs_category_more" android:key="more">
     <Preference android:title="@string/prefs_help" android:key="help" />
        
        <PreferenceCategory android:title="@string/prefs_category_more" android:key="more">
     <Preference android:title="@string/prefs_help" android:key="help" />
-    <Preference android:title="@string/actionbar_logger" android:key="log" />
     <Preference android:title="@string/prefs_recommend" android:key="recommend" />
     <Preference android:title="@string/prefs_feedback" android:key="feedback" />
     <Preference android:title="@string/prefs_imprint" android:key="imprint" />
     <Preference android:title="@string/prefs_recommend" android:key="recommend" />
     <Preference android:title="@string/prefs_feedback" android:key="feedback" />
     <Preference android:title="@string/prefs_imprint" android:key="imprint" />
index c248f82..26992ad 100644 (file)
@@ -167,7 +167,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
     
     private DrawerLayout mDrawerLayout;
     private ActionBarDrawerToggle mDrawerToggle;
     
     private DrawerLayout mDrawerLayout;
     private ActionBarDrawerToggle mDrawerToggle;
-    private boolean showAccounts = false;
+    private boolean mShowAccounts = false;
     
     @Override
     protected void onCreate(Bundle savedInstanceState) {
     
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -242,29 +242,39 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         listView.setOnItemClickListener(new OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
         listView.setOnItemClickListener(new OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                if (showAccounts && position > 0){
+                if (mShowAccounts && position > 0){
                     position = position - 1;
                 }
                 switch (position){
                     position = position - 1;
                 }
                 switch (position){
-                case 0:
-                    showAccounts = !showAccounts;
-                    adapter.setShowAccounts(showAccounts);
-                    adapter.notifyDataSetChanged();
-                    break;
-                case 1:
+                    case 0: // Accounts
+                        mShowAccounts = !mShowAccounts;
+                        adapter.setShowAccounts(mShowAccounts);
+                        adapter.notifyDataSetChanged();
+                        break;
+
+                    case 1: // All Files
+                        // TODO Enable when "On Device" is recovered ?
+                        //MainApp.showOnlyFilesOnDevice(false);
+                        mDrawerLayout.closeDrawers();
+                        break;
+
                     // TODO Enable when "On Device" is recovered ?
                     // TODO Enable when "On Device" is recovered ?
-                    //MainApp.showOnlyFilesOnDevice(false);
-                    mDrawerLayout.closeDrawers();
-                    break;
-                // TODO Enable when "On Device" is recovered ?
 //                case 2:
 //                    MainApp.showOnlyFilesOnDevice(true);
 //                    mDrawerLayout.closeDrawers();
 //                    break;
 //                case 2:
 //                    MainApp.showOnlyFilesOnDevice(true);
 //                    mDrawerLayout.closeDrawers();
 //                    break;
-                case 2:
-                    Intent settingsIntent = new Intent(getApplicationContext(), Preferences.class);
-                    startActivity(settingsIntent);
-                    break;
+
+                    case 2: // Settings
+                        Intent settingsIntent = new Intent(getApplicationContext(),
+                                Preferences.class);
+                        startActivity(settingsIntent);
+                        break;
+
+                    case 3: // Logs
+                        Intent loggerIntent = new Intent(getApplicationContext(),
+                                LogHistoryActivity.class);
+                        startActivity(loggerIntent);
+                        break;
                 }
             }
         });
                 }
             }
         });
index e7e7679..39fc314 100644 (file)
@@ -203,7 +203,7 @@ public class Preferences extends SherlockPreferenceActivity
             }
             
         }
             }
             
         }
-        
+
         if (BuildConfig.DEBUG) {
             Preference pLog =  findPreference("log");
             if (pLog != null ){
         if (BuildConfig.DEBUG) {
             Preference pLog =  findPreference("log");
             if (pLog != null ){
@@ -215,7 +215,7 @@ public class Preferences extends SherlockPreferenceActivity
                         return true;
                     }
                 });
                         return true;
                     }
                 });
-            } 
+            }
         }
         
        boolean recommendEnabled = getResources().getBoolean(R.bool.recommend_enabled);
         }
         
        boolean recommendEnabled = getResources().getBoolean(R.bool.recommend_enabled);
@@ -236,7 +236,8 @@ public class Preferences extends SherlockPreferenceActivity
                         Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(Preferences.this);
                         String username = currentAccount.name.substring(0, currentAccount.name.lastIndexOf('@'));
                         
                         Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(Preferences.this);
                         String username = currentAccount.name.substring(0, currentAccount.name.lastIndexOf('@'));
                         
-                        String recommendSubject = String.format(getString(R.string.recommend_subject), appName);
+                        String recommendSubject = String.format(getString(R.string.recommend_subject),
+                                appName);
                         String recommendText = String.format(getString(R.string.recommend_text),
                                 appName, downloadUrl, username);
                         
                         String recommendText = String.format(getString(R.string.recommend_text),
                                 appName, downloadUrl, username);