|
@@ -124,6 +124,7 @@ import static com.owncloud.android.db.PreferenceManager.getSortOrder;
|
|
public class FileDisplayActivity extends HookActivity
|
|
public class FileDisplayActivity extends HookActivity
|
|
implements FileFragment.ContainerActivity,
|
|
implements FileFragment.ContainerActivity,
|
|
OnEnforceableRefreshListener, SortingOrderDialogFragment.OnSortingOrderListener {
|
|
OnEnforceableRefreshListener, SortingOrderDialogFragment.OnSortingOrderListener {
|
|
|
|
+ private static final String KEY_SHOW_ACCOUNT_WARNING = "SHOW_ACCOUNT_WARNING";
|
|
|
|
|
|
private SyncBroadcastReceiver mSyncBroadcastReceiver;
|
|
private SyncBroadcastReceiver mSyncBroadcastReceiver;
|
|
private UploadFinishReceiver mUploadFinishReceiver;
|
|
private UploadFinishReceiver mUploadFinishReceiver;
|
|
@@ -274,6 +275,7 @@ public class FileDisplayActivity extends HookActivity
|
|
// always AFTER setContentView(...) in onCreate(); to work around bug in its implementation
|
|
// always AFTER setContentView(...) in onCreate(); to work around bug in its implementation
|
|
|
|
|
|
upgradeNotificationForInstantUpload();
|
|
upgradeNotificationForInstantUpload();
|
|
|
|
+ upgradeNotificationForCorruptAccounts();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -283,7 +285,7 @@ public class FileDisplayActivity extends HookActivity
|
|
private void upgradeNotificationForInstantUpload() {
|
|
private void upgradeNotificationForInstantUpload() {
|
|
// check for Android 6+ if legacy instant upload is activated --> disable + show info
|
|
// check for Android 6+ if legacy instant upload is activated --> disable + show info
|
|
if (PreferenceManager.instantPictureUploadEnabled(this) ||
|
|
if (PreferenceManager.instantPictureUploadEnabled(this) ||
|
|
- PreferenceManager.instantPictureUploadEnabled(this)) {
|
|
|
|
|
|
+ PreferenceManager.instantPictureUploadEnabled(this)) {
|
|
|
|
|
|
// remove legacy shared preferences
|
|
// remove legacy shared preferences
|
|
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
|
|
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
|
|
@@ -322,6 +324,45 @@ public class FileDisplayActivity extends HookActivity
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * TODO: remove after 2.0.0 final release
|
|
|
|
+ */
|
|
|
|
+ private void upgradeNotificationForCorruptAccounts() {
|
|
|
|
+ boolean showWarning = PreferenceManager.getDefaultSharedPreferences(this)
|
|
|
|
+ .getBoolean(KEY_SHOW_ACCOUNT_WARNING, true);
|
|
|
|
+ int version = getVersion();
|
|
|
|
+
|
|
|
|
+ // check show warning, version > 1.4.3 and <= 2.0.0RCx
|
|
|
|
+ if (showWarning && version > 10040299 && version < 20000099) {
|
|
|
|
+ final Context context = this;
|
|
|
|
+
|
|
|
|
+ // show info pop-up
|
|
|
|
+ new AlertDialog.Builder(this, R.style.Theme_ownCloud_Dialog)
|
|
|
|
+ .setTitle(R.string.common_warning)
|
|
|
|
+ .setMessage(R.string.corrupt_account_info)
|
|
|
|
+ .setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
+ dialog.dismiss();
|
|
|
|
+ PreferenceManager.getDefaultSharedPreferences(context)
|
|
|
|
+ .edit().putBoolean(KEY_SHOW_ACCOUNT_WARNING, false).apply();
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .setIcon(R.drawable.ic_warning)
|
|
|
|
+ .setCancelable(false)
|
|
|
|
+ .show();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int getVersion() {
|
|
|
|
+ int version = 0;
|
|
|
|
+ try {
|
|
|
|
+ version = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
|
|
|
+ } catch (PackageManager.NameNotFoundException e) {
|
|
|
|
+ return version;
|
|
|
|
+ }
|
|
|
|
+ return version;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void onRequestPermissionsResult(int requestCode,
|
|
public void onRequestPermissionsResult(int requestCode,
|
|
String permissions[], int[] grantResults) {
|
|
String permissions[], int[] grantResults) {
|
|
@@ -474,7 +515,7 @@ public class FileDisplayActivity extends HookActivity
|
|
@Override
|
|
@Override
|
|
protected void onNewIntent(Intent intent) {
|
|
protected void onNewIntent(Intent intent) {
|
|
super.onNewIntent(intent);
|
|
super.onNewIntent(intent);
|
|
- if(intent.getAction()!=null && intent.getAction().equalsIgnoreCase(ACTION_DETAILS)){
|
|
|
|
|
|
+ if (intent.getAction() != null && intent.getAction().equalsIgnoreCase(ACTION_DETAILS)) {
|
|
setIntent(intent);
|
|
setIntent(intent);
|
|
setFile(intent.getParcelableExtra(EXTRA_FILE));
|
|
setFile(intent.getParcelableExtra(EXTRA_FILE));
|
|
}
|
|
}
|
|
@@ -1034,10 +1075,10 @@ public class FileDisplayActivity extends HookActivity
|
|
// all closed
|
|
// all closed
|
|
|
|
|
|
//if PreviewImageActivity called this activity and mDualPane==false then calls PreviewImageActivity again
|
|
//if PreviewImageActivity called this activity and mDualPane==false then calls PreviewImageActivity again
|
|
- if((getIntent().getAction()!=null && getIntent().getAction().equalsIgnoreCase(ACTION_DETAILS)) && !mDualPane){
|
|
|
|
- getIntent().setAction(null);
|
|
|
|
- getIntent().putExtra(EXTRA_FILE, (OCFile) null);
|
|
|
|
- startImagePreview(getFile());
|
|
|
|
|
|
+ if ((getIntent().getAction() != null && getIntent().getAction().equalsIgnoreCase(ACTION_DETAILS)) && !mDualPane) {
|
|
|
|
+ getIntent().setAction(null);
|
|
|
|
+ getIntent().putExtra(EXTRA_FILE, (OCFile) null);
|
|
|
|
+ startImagePreview(getFile());
|
|
}
|
|
}
|
|
|
|
|
|
OCFileListFragment listOfFiles = getListOfFilesFragment();
|
|
OCFileListFragment listOfFiles = getListOfFilesFragment();
|