Added scroll to generic explanation activity. Enabled the copy of past uploads into...
authorDavid A. Velasco <dvelasco@solidgear.es>
Fri, 30 Nov 2012 10:58:46 +0000 (11:58 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 30 Nov 2012 10:58:46 +0000 (11:58 +0100)
AndroidManifest.xml
res/layout/explanation.xml [deleted file]
res/layout/generic_explanation.xml [new file with mode: 0644]
res/values/strings.xml
src/com/owncloud/android/operations/SynchronizeFolderOperation.java
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
src/com/owncloud/android/ui/activity/ExplanationActivity.java [deleted file]
src/com/owncloud/android/ui/activity/GenericExplanationActivity.java [new file with mode: 0644]

index e0328d3..b2998b5 100644 (file)
         <activity android:name=".extensions.ExtensionsListActivity"></activity>\r
         <activity android:name=".ui.activity.AccountSelectActivity" android:uiOptions="none" android:label="@string/prefs_accounts"></activity>\r
         <activity android:name=".ui.activity.ConflictsResolveActivity"/>
-        <activity android:name=".ui.activity.ExplanationActivity"/>\r
+        <activity android:name="com.owncloud.android.ui.activity.GenericExplanationActivity"/>\r
         
         <service android:name=".files.services.FileUploader" >\r
         </service>
diff --git a/res/layout/explanation.xml b/res/layout/explanation.xml
deleted file mode 100644 (file)
index b161916..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 
-  ownCloud Android client application
-
-  Copyright (C) 2012  Bartek Przybylski
-  This program is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="@color/owncloud_white" 
-    android:id="@+id/explanation"
-    android:orientation="vertical">
-
-       <TextView
-               android:id="@+id/message"
-               android:layout_width="match_parent"
-               android:layout_height="1dp"
-               android:layout_weight="1"
-           android:padding="10dip"
-           android:scrollbarAlwaysDrawVerticalTrack="true"
-               android:text="@string/text_placeholder" 
-               />
-    
-       <ListView 
-           android:id="@+id/list"
-           android:layout_width="match_parent"
-           android:layout_height="0dp"
-               android:layout_weight="1"
-           android:padding="10dip"
-           />
-           
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/generic_explanation.xml b/res/layout/generic_explanation.xml
new file mode 100644 (file)
index 0000000..4530553
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+  ownCloud Android client application
+
+  Copyright (C) 2012  Bartek Przybylski
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/owncloud_white" 
+    android:id="@+id/explanation"
+    android:orientation="vertical">
+
+       <TextView
+               android:id="@+id/message"
+               android:layout_width="match_parent"
+               android:layout_height="0dp"
+               android:layout_weight="2"
+           android:padding="10dip"
+           android:scrollbarAlwaysDrawVerticalTrack="true"
+               android:text="@string/text_placeholder" 
+               />
+    
+       <ListView 
+           android:id="@+id/list"
+           android:layout_width="match_parent"
+           android:layout_height="0dp"
+               android:layout_weight="3"
+           android:padding="10dip"
+           />
+           
+</LinearLayout>
\ No newline at end of file
index 878d084..b6fe74f 100644 (file)
        <string name="sync_fail_in_favourites_content">Contents of %1$d files could not be sync\'ed (%2$d conflicts)</string>
        <string name="sync_foreign_files_forgotten_ticker">Some local files were forgotten</string>
        <string name="sync_foreign_files_forgotten_content">%1$d files out of the ownCloud directory could not be copied into</string>
-       <string name="sync_foreign_files_forgotten_explanation">"From version 1.3.16, uploaded files are copied to the local ownCloud folder to avoid problems when the same local file is uploaded to different folders or accounts.\n\nSome files uploaded in the past could not be copied during the account synchronization. %1$s will not track their current location anymore. You will need to download them again to access their contents from this app.\n\nSee below the list of untracked local files and the remote files in in %2$s they were linked to:</string>
+       <string name="sync_foreign_files_forgotten_explanation">"From version 1.3.16, uploaded files are copied to the local ownCloud folder to avoid problems when the same local file is uploaded to different folders or accounts.\n\nSome files uploaded in the past could not be copied during the account synchronization. %1$s will not track their current location anymore. You will need to download them again to access their contents from this app.\n\nSee below the list of untracked local files and the remote files in in %2$s they were linked to.</string>
     <string name="sync_foreign_files_forgotten_remote_prefix">"Remote: "</string>
     <string name="sync_foreign_files_forgotten_local_prefix">"Local: "</string>
        
index 36c3f3f..3671ca0 100644 (file)
@@ -300,9 +300,6 @@ public class SynchronizeFolderOperation extends RemoteOperation {
         if (storagePath != null && !storagePath.equals(expectedPath)) {
             /// fix storagePaths out of the local ownCloud folder
             File originalFile = new File(storagePath);
-            mForgottenLocalFiles.put(file.getRemotePath(), storagePath);    // TODO REMOVE
-            
-            /*  TO TEST NOTIFICATION!!! - TODO UNCOMMENT
             if (ocLocalFolder.getUsableSpace() < originalFile.length()) {
                 mForgottenLocalFiles.put(file.getRemotePath(), storagePath);
                 file.setStoragePath(null);
@@ -338,7 +335,6 @@ public class SynchronizeFolderOperation extends RemoteOperation {
                     }
                 }
             }
-            */
         }
     }
 
index 285b152..2d88646 100644 (file)
@@ -35,7 +35,7 @@ import com.owncloud.android.operations.RemoteOperationResult;
 import com.owncloud.android.operations.SynchronizeFolderOperation;\r
 import com.owncloud.android.operations.UpdateOCVersionOperation;\r
 import com.owncloud.android.operations.RemoteOperationResult.ResultCode;\r
-import com.owncloud.android.ui.activity.ExplanationActivity;\r
+import com.owncloud.android.ui.activity.GenericExplanationActivity;\r
 import android.accounts.Account;\r
 import android.app.Notification;\r
 import android.app.NotificationManager;\r
@@ -346,17 +346,17 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
         notification.flags |= Notification.FLAG_AUTO_CANCEL;\r
 \r
         /// includes a pending intent in the notification showing a more detailed explanation\r
-        Intent explanationIntent = new Intent(getContext(), ExplanationActivity.class);\r
+        Intent explanationIntent = new Intent(getContext(), GenericExplanationActivity.class);\r
         String message = String.format(getContext().getString(R.string.sync_foreign_files_forgotten_explanation), getContext().getString(R.string.app_name), getAccount().name);\r
-        explanationIntent.putExtra(ExplanationActivity.MESSAGE, message);\r
+        explanationIntent.putExtra(GenericExplanationActivity.MESSAGE, message);\r
         ArrayList<String> remotePaths = new ArrayList<String>();\r
         ArrayList<String> localPaths = new ArrayList<String>();\r
         for (String remote : mForgottenLocalFiles.keySet()) {\r
            remotePaths.add(getContext().getString(R.string.sync_foreign_files_forgotten_remote_prefix) + remote);\r
            localPaths.add(getContext().getString(R.string.sync_foreign_files_forgotten_local_prefix) + mForgottenLocalFiles.get(remote));\r
         }\r
-        explanationIntent.putExtra(ExplanationActivity.EXTRA_LIST, localPaths);\r
-        explanationIntent.putExtra(ExplanationActivity.EXTRA_LIST_2, remotePaths);  \r
+        explanationIntent.putExtra(GenericExplanationActivity.EXTRA_LIST, localPaths);\r
+        explanationIntent.putExtra(GenericExplanationActivity.EXTRA_LIST_2, remotePaths);  \r
         explanationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r
         \r
         notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), explanationIntent, 0);\r
diff --git a/src/com/owncloud/android/ui/activity/ExplanationActivity.java b/src/com/owncloud/android/ui/activity/ExplanationActivity.java
deleted file mode 100644 (file)
index d6849ff..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.owncloud.android.ui.activity;
-
-import java.util.ArrayList;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ListAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import com.actionbarsherlock.app.SherlockFragmentActivity;
-import com.owncloud.android.R;
-
-/**
- * Activity showing a text message and, optionally, a couple of scrollable lists of texts.
- * 
- * Added to show explanations for notifications when the user clicks on them, and there no place
- * better to show them.
- * 
- * @author David A. Velasco
- */
-public class ExplanationActivity  extends SherlockFragmentActivity {
-
-    public static final String EXTRA_LIST = ExplanationActivity.class.getCanonicalName() + ".EXTRA_LIST";
-    public static final String EXTRA_LIST_2 = ExplanationActivity.class.getCanonicalName() + ".EXTRA_LIST_2";
-    public static final String MESSAGE = ExplanationActivity.class.getCanonicalName() + ".MESSAGE";
-    
-    
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        
-        Intent intent = getIntent();
-        String message = intent.getStringExtra(MESSAGE); 
-        ArrayList<String> list = intent.getStringArrayListExtra(EXTRA_LIST);
-        ArrayList<String> list2 = intent.getStringArrayListExtra(EXTRA_LIST_2);
-        
-        setContentView(R.layout.explanation);
-        
-        if (message != null) {
-            TextView textView = (TextView) findViewById(R.id.message);
-            textView.setText(message);
-        }
-        
-        ListView listView = (ListView) findViewById(R.id.list);
-        if (list != null && list.size() > 0) {
-            //ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
-            ListAdapter adapter = new ExplanationListAdapterView(this, list, list2);
-            listView.setAdapter(adapter);
-        } else {
-            listView.setVisibility(View.GONE);
-        }
-    }
-    
-    public class ExplanationListAdapterView extends ArrayAdapter<String> {
-        
-        ArrayList<String> mList;
-        ArrayList<String> mList2;
-        
-        ExplanationListAdapterView(Context context, ArrayList<String> list, ArrayList<String> list2) {
-            //super(context, android.R.layout.two_line_list_item, android.R.id.text1, list);
-            super(context, android.R.layout.two_line_list_item, android.R.id.text1, list);
-            mList = list;
-            mList2 = list2;
-        }
-
-        @Override
-        public boolean isEnabled(int position) {
-            return false;
-        }
-        
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public View getView (int position, View convertView, ViewGroup parent) {
-            View view = super.getView(position, convertView, parent);
-            if (view != null)  {
-                if (mList2 != null && mList2.size() > 0 && position >= 0 && position < mList2.size()) {
-                    TextView text2 = (TextView) view.findViewById(android.R.id.text2);
-                    if (text2 != null) {
-                        text2.setText(mList2.get(position));
-                    }
-                }
-            }
-            return view;
-        }
-    }
-
-}
diff --git a/src/com/owncloud/android/ui/activity/GenericExplanationActivity.java b/src/com/owncloud/android/ui/activity/GenericExplanationActivity.java
new file mode 100644 (file)
index 0000000..ccf3de8
--- /dev/null
@@ -0,0 +1,95 @@
+package com.owncloud.android.ui.activity;
+
+import java.util.ArrayList;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.method.ScrollingMovementMethod;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.SherlockFragmentActivity;
+import com.owncloud.android.R;
+
+/**
+ * Activity showing a text message and, optionally, a couple of scrollable lists of texts.
+ * 
+ * Added to show explanations for notifications when the user clicks on them, and there no place
+ * better to show them.
+ * 
+ * @author David A. Velasco
+ */
+public class GenericExplanationActivity  extends SherlockFragmentActivity {
+
+    public static final String EXTRA_LIST = GenericExplanationActivity.class.getCanonicalName() + ".EXTRA_LIST";
+    public static final String EXTRA_LIST_2 = GenericExplanationActivity.class.getCanonicalName() + ".EXTRA_LIST_2";
+    public static final String MESSAGE = GenericExplanationActivity.class.getCanonicalName() + ".MESSAGE";
+    
+    
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        
+        Intent intent = getIntent();
+        String message = intent.getStringExtra(MESSAGE); 
+        ArrayList<String> list = intent.getStringArrayListExtra(EXTRA_LIST);
+        ArrayList<String> list2 = intent.getStringArrayListExtra(EXTRA_LIST_2);
+        
+        setContentView(R.layout.generic_explanation);
+        
+        if (message != null) {
+            TextView textView = (TextView) findViewById(R.id.message);
+            textView.setText(message);
+            textView.setMovementMethod(new ScrollingMovementMethod());
+        }
+        
+        ListView listView = (ListView) findViewById(R.id.list);
+        if (list != null && list.size() > 0) {
+            //ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
+            ListAdapter adapter = new ExplanationListAdapterView(this, list, list2);
+            listView.setAdapter(adapter);
+        } else {
+            listView.setVisibility(View.GONE);
+        }
+    }
+    
+    public class ExplanationListAdapterView extends ArrayAdapter<String> {
+        
+        ArrayList<String> mList;
+        ArrayList<String> mList2;
+        
+        ExplanationListAdapterView(Context context, ArrayList<String> list, ArrayList<String> list2) {
+            super(context, android.R.layout.two_line_list_item, android.R.id.text1, list);
+            mList = list;
+            mList2 = list2;
+        }
+
+        @Override
+        public boolean isEnabled(int position) {
+            return false;
+        }
+        
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public View getView (int position, View convertView, ViewGroup parent) {
+            View view = super.getView(position, convertView, parent);
+            if (view != null)  {
+                if (mList2 != null && mList2.size() > 0 && position >= 0 && position < mList2.size()) {
+                    TextView text2 = (TextView) view.findViewById(android.R.id.text2);
+                    if (text2 != null) {
+                        text2.setText(mList2.get(position));
+                    }
+                }
+            }
+            return view;
+        }
+    }
+
+}