convert conflicts and create folder dialogs to MaterialAlterDialogs

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-09-12 15:45:36 +02:00 committed by Álvaro Brey
parent ee170a4e4c
commit a131656d8f
No known key found for this signature in database
GPG key ID: 2585783189A62105
2 changed files with 10 additions and 2 deletions

View file

@ -29,6 +29,7 @@ import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.nextcloud.client.account.User;
import com.nextcloud.client.di.Injectable;
import com.owncloud.android.R;
@ -162,7 +163,7 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable
viewThemeUtils.platform.themeCheckbox(binding.existingCheckbox);
// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setView(binding.getRoot())
.setPositiveButton(R.string.common_ok, (dialog, which) -> {
if (listener != null) {
@ -234,6 +235,8 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable
positiveButton.setEnabled(binding.newCheckbox.isChecked() || binding.existingCheckbox.isChecked());
});
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.existingFileContainer.getContext(), builder);
return builder.create();
}

View file

@ -33,6 +33,7 @@ import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import android.widget.TextView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.common.collect.Sets;
import com.nextcloud.client.di.Injectable;
import com.owncloud.android.R;
@ -168,11 +169,14 @@ public class CreateFolderDialogFragment
});
// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setView(view)
.setPositiveButton(R.string.folder_confirm_create, this)
.setNeutralButton(R.string.common_cancel, this)
.setTitle(R.string.uploader_info_dirname);
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.userInputContainer.getContext(), builder);
AlertDialog d = builder.create();
Window window = d.getWindow();
@ -202,6 +206,7 @@ public class CreateFolderDialogFragment
}
String path = mParentFolder.getDecryptedRemotePath() + newFolderName + OCFile.PATH_SEPARATOR;
((ComponentsGetter) getActivity()).getFileOperationsHelper().createFolder(path);
}
}