|
@@ -60,6 +60,7 @@ import android.widget.ProgressBar;
|
|
import android.widget.Spinner;
|
|
import android.widget.Spinner;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
+import com.nextcloud.client.preferences.AppPreferences;
|
|
import com.owncloud.android.MainApp;
|
|
import com.owncloud.android.MainApp;
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
@@ -158,6 +159,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|
private TextView mEmptyListHeadline;
|
|
private TextView mEmptyListHeadline;
|
|
private ImageView mEmptyListIcon;
|
|
private ImageView mEmptyListIcon;
|
|
private ProgressBar mEmptyListProgress;
|
|
private ProgressBar mEmptyListProgress;
|
|
|
|
+ private AppPreferences preferences;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -175,6 +177,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|
mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
|
|
mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
|
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
|
|
+ preferences = PreferenceManager.fromContext(this);
|
|
|
|
|
|
// Listen for sync messages
|
|
// Listen for sync messages
|
|
IntentFilter syncIntentFilter = new IntentFilter(RefreshFolderOperation.
|
|
IntentFilter syncIntentFilter = new IntentFilter(RefreshFolderOperation.
|
|
@@ -340,6 +343,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|
private int mFileCategory;
|
|
private int mFileCategory;
|
|
|
|
|
|
private Spinner mSpinner;
|
|
private Spinner mSpinner;
|
|
|
|
+ private AppPreferences preferences;
|
|
|
|
|
|
public static DialogInputUploadFilename newInstance(String subjectText, String extraText) {
|
|
public static DialogInputUploadFilename newInstance(String subjectText, String extraText) {
|
|
DialogInputUploadFilename dialog = new DialogInputUploadFilename();
|
|
DialogInputUploadFilename dialog = new DialogInputUploadFilename();
|
|
@@ -350,6 +354,12 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|
return dialog;
|
|
return dialog;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void onAttach(Context context) {
|
|
|
|
+ super.onAttach(context);
|
|
|
|
+ preferences = PreferenceManager.fromContext(context);
|
|
|
|
+ }
|
|
|
|
+
|
|
@NonNull
|
|
@NonNull
|
|
@Override
|
|
@Override
|
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
@@ -401,7 +411,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|
mFilenameSuffix.add(DESKTOP_FILE_SUFFIX);
|
|
mFilenameSuffix.add(DESKTOP_FILE_SUFFIX);
|
|
adapter.add(String.format(str,DESKTOP_FILE_SUFFIX));
|
|
adapter.add(String.format(str,DESKTOP_FILE_SUFFIX));
|
|
|
|
|
|
- selectPos = PreferenceManager.getUploadUrlFileExtensionUrlSelectedPos(getActivity());
|
|
|
|
|
|
+ selectPos = preferences.getUploadUrlFileExtensionUrlSelectedPos();
|
|
mFileCategory = CATEGORY_URL;
|
|
mFileCategory = CATEGORY_URL;
|
|
} else if (isIntentFromGoogleMap(subjectText, extraText)) {
|
|
} else if (isIntentFromGoogleMap(subjectText, extraText)) {
|
|
String str = getString(R.string.upload_file_dialog_filetype_googlemap_shortcut);
|
|
String str = getString(R.string.upload_file_dialog_filetype_googlemap_shortcut);
|
|
@@ -421,7 +431,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|
mFilenameSuffix.add(DESKTOP_FILE_SUFFIX);
|
|
mFilenameSuffix.add(DESKTOP_FILE_SUFFIX);
|
|
adapter.add(String.format(str,DESKTOP_FILE_SUFFIX));
|
|
adapter.add(String.format(str,DESKTOP_FILE_SUFFIX));
|
|
|
|
|
|
- selectPos = PreferenceManager.getUploadMapFileExtensionUrlSelectedPos(getActivity());
|
|
|
|
|
|
+ selectPos = preferences.getUploadMapFileExtensionUrlSelectedPos();
|
|
mFileCategory = CATEGORY_MAPS_URL;
|
|
mFileCategory = CATEGORY_MAPS_URL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -501,10 +511,10 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|
private void saveSelection(int selectPos) {
|
|
private void saveSelection(int selectPos) {
|
|
switch (mFileCategory) {
|
|
switch (mFileCategory) {
|
|
case CATEGORY_URL:
|
|
case CATEGORY_URL:
|
|
- PreferenceManager.setUploadUrlFileExtensionUrlSelectedPos(getActivity(), selectPos);
|
|
|
|
|
|
+ preferences.setUploadUrlFileExtensionUrlSelectedPos(selectPos);
|
|
break;
|
|
break;
|
|
case CATEGORY_MAPS_URL:
|
|
case CATEGORY_MAPS_URL:
|
|
- PreferenceManager.setUploadMapFileExtensionUrlSelectedPos(getActivity(), selectPos);
|
|
|
|
|
|
+ preferences.setUploadMapFileExtensionUrlSelectedPos(selectPos);
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
Log_OC.d(TAG, "Simple text snippet only: no selection to be persisted");
|
|
Log_OC.d(TAG, "Simple text snippet only: no selection to be persisted");
|
|
@@ -948,7 +958,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|
UriUploader.UriUploaderResultCode resultCode = uploader.uploadUris();
|
|
UriUploader.UriUploaderResultCode resultCode = uploader.uploadUris();
|
|
|
|
|
|
// Save the path to shared preferences; even if upload is not possible, user chose the folder
|
|
// Save the path to shared preferences; even if upload is not possible, user chose the folder
|
|
- PreferenceManager.setLastUploadPath(this, mUploadPath);
|
|
|
|
|
|
+ preferences.setLastUploadPath(mUploadPath);
|
|
|
|
|
|
if (resultCode == UriUploader.UriUploaderResultCode.OK) {
|
|
if (resultCode == UriUploader.UriUploaderResultCode.OK) {
|
|
finish();
|
|
finish();
|
|
@@ -1022,7 +1032,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|
}
|
|
}
|
|
|
|
|
|
if (mParents.empty()) {
|
|
if (mParents.empty()) {
|
|
- String lastPath = PreferenceManager.getLastUploadPath(this);
|
|
|
|
|
|
+ String lastPath = preferences.getLastUploadPath();
|
|
// "/" equals root-directory
|
|
// "/" equals root-directory
|
|
if ("/".equals(lastPath)) {
|
|
if ("/".equals(lastPath)) {
|
|
mParents.add("");
|
|
mParents.add("");
|