Эх сурвалжийг харах

Added scroll to generic explanation activity. Enabled the copy of past uploads into ownCloud folder during synchronization.

David A. Velasco 12 жил өмнө
parent
commit
3ef64834e9

+ 1 - 1
AndroidManifest.xml

@@ -132,7 +132,7 @@
         <activity android:name=".extensions.ExtensionsListActivity"></activity>
         <activity android:name=".ui.activity.AccountSelectActivity" android:uiOptions="none" android:label="@string/prefs_accounts"></activity>
         <activity android:name=".ui.activity.ConflictsResolveActivity"/>
-        <activity android:name=".ui.activity.ExplanationActivity"/>
+        <activity android:name="com.owncloud.android.ui.activity.GenericExplanationActivity"/>
         
         <service android:name=".files.services.FileUploader" >
         </service>

+ 3 - 3
res/layout/explanation.xml → res/layout/generic_explanation.xml

@@ -26,8 +26,8 @@
 	<TextView
 		android:id="@+id/message"
 		android:layout_width="match_parent"
-		android:layout_height="1dp"
-		android:layout_weight="1"
+		android:layout_height="0dp"
+		android:layout_weight="2"
 	    android:padding="10dip"
 	    android:scrollbarAlwaysDrawVerticalTrack="true"
 		android:text="@string/text_placeholder" 
@@ -37,7 +37,7 @@
 	    android:id="@+id/list"
 	    android:layout_width="match_parent"
 	    android:layout_height="0dp"
-		android:layout_weight="1"
+		android:layout_weight="3"
 	    android:padding="10dip"
 	    />
 	    

+ 1 - 1
res/values/strings.xml

@@ -118,7 +118,7 @@
 	<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>
 	

+ 0 - 4
src/com/owncloud/android/operations/SynchronizeFolderOperation.java

@@ -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 {
                     }
                 }
             }
-            */
         }
     }
 

+ 5 - 5
src/com/owncloud/android/syncadapter/FileSyncAdapter.java

@@ -35,7 +35,7 @@ import com.owncloud.android.operations.RemoteOperationResult;
 import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UpdateOCVersionOperation;
 import com.owncloud.android.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.ui.activity.ExplanationActivity;
+import com.owncloud.android.ui.activity.GenericExplanationActivity;
 import android.accounts.Account;
 import android.app.Notification;
 import android.app.NotificationManager;
@@ -346,17 +346,17 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
         notification.flags |= Notification.FLAG_AUTO_CANCEL;
 
         /// includes a pending intent in the notification showing a more detailed explanation
-        Intent explanationIntent = new Intent(getContext(), ExplanationActivity.class);
+        Intent explanationIntent = new Intent(getContext(), GenericExplanationActivity.class);
         String message = String.format(getContext().getString(R.string.sync_foreign_files_forgotten_explanation), getContext().getString(R.string.app_name), getAccount().name);
-        explanationIntent.putExtra(ExplanationActivity.MESSAGE, message);
+        explanationIntent.putExtra(GenericExplanationActivity.MESSAGE, message);
         ArrayList<String> remotePaths = new ArrayList<String>();
         ArrayList<String> localPaths = new ArrayList<String>();
         for (String remote : mForgottenLocalFiles.keySet()) {
            remotePaths.add(getContext().getString(R.string.sync_foreign_files_forgotten_remote_prefix) + remote);
            localPaths.add(getContext().getString(R.string.sync_foreign_files_forgotten_local_prefix) + mForgottenLocalFiles.get(remote));
         }
-        explanationIntent.putExtra(ExplanationActivity.EXTRA_LIST, localPaths);
-        explanationIntent.putExtra(ExplanationActivity.EXTRA_LIST_2, remotePaths);  
+        explanationIntent.putExtra(GenericExplanationActivity.EXTRA_LIST, localPaths);
+        explanationIntent.putExtra(GenericExplanationActivity.EXTRA_LIST_2, remotePaths);  
         explanationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         
         notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), explanationIntent, 0);

+ 7 - 6
src/com/owncloud/android/ui/activity/ExplanationActivity.java → src/com/owncloud/android/ui/activity/GenericExplanationActivity.java

@@ -5,6 +5,7 @@ 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;
@@ -23,11 +24,11 @@ import com.owncloud.android.R;
  * 
  * @author David A. Velasco
  */
-public class ExplanationActivity  extends SherlockFragmentActivity {
+public class GenericExplanationActivity  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";
+    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
@@ -39,11 +40,12 @@ public class ExplanationActivity  extends SherlockFragmentActivity {
         ArrayList<String> list = intent.getStringArrayListExtra(EXTRA_LIST);
         ArrayList<String> list2 = intent.getStringArrayListExtra(EXTRA_LIST_2);
         
-        setContentView(R.layout.explanation);
+        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);
@@ -62,7 +64,6 @@ public class ExplanationActivity  extends SherlockFragmentActivity {
         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;