mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-29 15:51:17 +00:00
#200 - Cannot change folder type or pull order in wrapper UI #202 - User selections are lost if screen rotation changes during folder edit #203 - Edit folder dialog - AlertDialogs leak on screen rotation
This commit is contained in:
parent
a1fef79c2e
commit
c96786bcb9
4 changed files with 28 additions and 33 deletions
|
@ -596,17 +596,13 @@ public class DeviceActivity extends SyncthingActivity
|
|||
}
|
||||
|
||||
private void showCompressionDialog(){
|
||||
mCompressionDialog = createCompressionDialog();
|
||||
mCompressionDialog.show();
|
||||
}
|
||||
|
||||
private Dialog createCompressionDialog(){
|
||||
return new AlertDialog.Builder(this)
|
||||
mCompressionDialog = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.compression)
|
||||
.setSingleChoiceItems(R.array.compress_entries,
|
||||
Compression.fromValue(this, mDevice.compression).getIndex(),
|
||||
mCompressionEntrySelectedListener)
|
||||
.create();
|
||||
mCompressionDialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -223,10 +223,8 @@ public class FolderActivity extends SyncthingActivity
|
|||
|
||||
if (mIsCreateMode) {
|
||||
if (savedInstanceState != null) {
|
||||
mFolder = new Gson().fromJson(savedInstanceState.getString("folder"), Folder.class);
|
||||
if (savedInstanceState.getBoolean(IS_SHOW_DISCARD_DIALOG)){
|
||||
showDiscardDialog();
|
||||
}
|
||||
mFolder = new Gson().fromJson(savedInstanceState.getString("mFolder"), Folder.class);
|
||||
mFolderUri = savedInstanceState.getParcelable("mFolderUri");
|
||||
}
|
||||
if (mFolder == null) {
|
||||
initFolder();
|
||||
|
@ -244,15 +242,11 @@ public class FolderActivity extends SyncthingActivity
|
|||
mPathView.setEnabled(false);
|
||||
}
|
||||
|
||||
if (savedInstanceState != null){
|
||||
if (savedInstanceState.getBoolean(IS_SHOWING_DELETE_DIALOG)){
|
||||
showDeleteDialog();
|
||||
}
|
||||
}
|
||||
|
||||
if (savedInstanceState != null){
|
||||
if (savedInstanceState.getBoolean(IS_SHOWING_DELETE_DIALOG)){
|
||||
if (savedInstanceState != null) {
|
||||
if (savedInstanceState.getBoolean(IS_SHOWING_DELETE_DIALOG)) {
|
||||
showDeleteDialog();
|
||||
} else if (savedInstanceState.getBoolean(IS_SHOW_DISCARD_DIALOG)) {
|
||||
showDiscardDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -387,12 +381,16 @@ public class FolderActivity extends SyncthingActivity
|
|||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
outState.putBoolean(IS_SHOWING_DELETE_DIALOG, mDeleteDialog != null && mDeleteDialog.isShowing());
|
||||
Util.dismissDialogSafe(mDeleteDialog, this);
|
||||
|
||||
if (mIsCreateMode){
|
||||
outState.putBoolean(IS_SHOW_DISCARD_DIALOG, mDiscardDialog != null && mDiscardDialog.isShowing());
|
||||
Util.dismissDialogSafe(mDiscardDialog, this);
|
||||
outState.putBoolean(IS_SHOW_DISCARD_DIALOG, mDiscardDialog != null && mDiscardDialog.isShowing());
|
||||
Util.dismissDialogSafe(mDiscardDialog, this);
|
||||
|
||||
if (mIsCreateMode) {
|
||||
outState.putString("mFolder", new Gson().toJson(mFolder));
|
||||
outState.putParcelable("mFolderUri", mFolderUri);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,7 +408,13 @@ public class FolderActivity extends SyncthingActivity
|
|||
|
||||
@Override
|
||||
public void onServiceStateChange(SyncthingService.State currentState) {
|
||||
if (mFolderNeedsToUpdate) {
|
||||
Log.d(TAG, "onServiceStateChange: Suppressing reload of folder config as changes were made to that folder in the meantime.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mIsCreateMode) {
|
||||
Log.d(TAG, "onServiceStateChange: (Re)loading folder config ...");
|
||||
RestApi restApi = getApi();
|
||||
List<Folder> folders = mConfig.getFolders(restApi);
|
||||
String passedId = getIntent().getStringExtra(EXTRA_FOLDER_ID);
|
||||
|
@ -427,7 +431,6 @@ public class FolderActivity extends SyncthingActivity
|
|||
return;
|
||||
}
|
||||
mConfig.getFolderIgnoreList(restApi, mFolder, this::onReceiveFolderIgnoreList);
|
||||
checkWriteAndUpdateUI();
|
||||
}
|
||||
|
||||
// If the extra is set, we should automatically share the current folder with the given device.
|
||||
|
@ -438,8 +441,8 @@ public class FolderActivity extends SyncthingActivity
|
|||
mFolderNeedsToUpdate = true;
|
||||
}
|
||||
|
||||
checkWriteAndUpdateUI();
|
||||
attemptToApplyVersioningConfig();
|
||||
|
||||
updateViewsAndSetListeners();
|
||||
}
|
||||
|
||||
|
@ -578,12 +581,7 @@ public class FolderActivity extends SyncthingActivity
|
|||
}
|
||||
|
||||
private void showDeleteDialog(){
|
||||
mDeleteDialog = createDeleteDialog();
|
||||
mDeleteDialog.show();
|
||||
}
|
||||
|
||||
private Dialog createDeleteDialog(){
|
||||
return new AlertDialog.Builder(this)
|
||||
mDeleteDialog = new AlertDialog.Builder(this)
|
||||
.setMessage(R.string.remove_folder_confirm)
|
||||
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> {
|
||||
mConfig.removeFolder(getApi(), mFolder.id);
|
||||
|
@ -592,6 +590,7 @@ public class FolderActivity extends SyncthingActivity
|
|||
})
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
.create();
|
||||
mDeleteDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,8 +16,8 @@ import java.util.List;
|
|||
|
||||
public class FolderTypeDialogActivity extends AppCompatActivity {
|
||||
|
||||
public static final String EXTRA_FOLDER_TYPE = "com.nutomic.syncthinandroid.activities.FolderTypeDialogActivity.FOLDER_TYPE";
|
||||
public static final String EXTRA_RESULT_FOLDER_TYPE = "com.nutomic.syncthinandroid.activities.FolderTypeDialogActivity.EXTRA_RESULT_FOLDER_TYPE";
|
||||
public static final String EXTRA_FOLDER_TYPE = "com.github.catfriend1.syncthingandroid.activities.FolderTypeDialogActivity.FOLDER_TYPE";
|
||||
public static final String EXTRA_RESULT_FOLDER_TYPE = "com.github.catfriend1.syncthingandroid.activities.FolderTypeDialogActivity.EXTRA_RESULT_FOLDER_TYPE";
|
||||
|
||||
private String selectedType;
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ import java.util.List;
|
|||
|
||||
public class PullOrderDialogActivity extends AppCompatActivity {
|
||||
|
||||
public static final String EXTRA_PULL_ORDER = "com.nutomic.syncthinandroid.activities.PullOrderDialogActivity.PULL_ORDER";
|
||||
public static final String EXTRA_RESULT_PULL_ORDER = "com.nutomic.syncthinandroid.activities.PullOrderDialogActivity.EXTRA_RESULT_PULL_ORDER";
|
||||
public static final String EXTRA_PULL_ORDER = "com.github.catfriend1.syncthingandroid.activities.PullOrderDialogActivity.PULL_ORDER";
|
||||
public static final String EXTRA_RESULT_PULL_ORDER = "com.github.catfriend1.syncthingandroid.activities.PullOrderDialogActivity.EXTRA_RESULT_PULL_ORDER";
|
||||
|
||||
private String selectedType;
|
||||
|
||||
|
|
Loading…
Reference in a new issue