From: David A. Velasco Date: Fri, 30 Nov 2012 10:58:46 +0000 (+0100) Subject: Added scroll to generic explanation activity. Enabled the copy of past uploads into... X-Git-Tag: oc-android-1.4.3~80^2~11 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/3ef64834e94d4f2f21e3fceafec0987e67e5c893?ds=inline Added scroll to generic explanation activity. Enabled the copy of past uploads into ownCloud folder during synchronization. --- diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e0328d3a..b2998b56 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -132,7 +132,7 @@ - + diff --git a/res/layout/explanation.xml b/res/layout/explanation.xml deleted file mode 100644 index b1619165..00000000 --- a/res/layout/explanation.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/res/layout/generic_explanation.xml b/res/layout/generic_explanation.xml new file mode 100644 index 00000000..45305532 --- /dev/null +++ b/res/layout/generic_explanation.xml @@ -0,0 +1,44 @@ + + + + + + + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 878d084e..b6fe74fc 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -118,7 +118,7 @@ Contents of %1$d files could not be sync\'ed (%2$d conflicts) Some local files were forgotten %1$d files out of the ownCloud directory could not be copied into - "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: + "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. "Remote: " "Local: " diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 36c3f3f0..3671ca0e 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/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 { } } } - */ } } diff --git a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java index 285b1522..2d88646e 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/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 remotePaths = new ArrayList(); ArrayList localPaths = new ArrayList(); 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); diff --git a/src/com/owncloud/android/ui/activity/ExplanationActivity.java b/src/com/owncloud/android/ui/activity/ExplanationActivity.java deleted file mode 100644 index d6849ffa..00000000 --- a/src/com/owncloud/android/ui/activity/ExplanationActivity.java +++ /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 list = intent.getStringArrayListExtra(EXTRA_LIST); - ArrayList 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(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 { - - ArrayList mList; - ArrayList mList2; - - ExplanationListAdapterView(Context context, ArrayList list, ArrayList 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 index 00000000..ccf3de86 --- /dev/null +++ b/src/com/owncloud/android/ui/activity/GenericExplanationActivity.java @@ -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 list = intent.getStringArrayListExtra(EXTRA_LIST); + ArrayList 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(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 { + + ArrayList mList; + ArrayList mList2; + + ExplanationListAdapterView(Context context, ArrayList list, ArrayList 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; + } + } + +}