mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 05:55:39 +03:00
Merge pull request #2310 from nextcloud/chore/noid/lovelyDialogs
Remove lovely dialogs uses
This commit is contained in:
commit
93c6c0638b
4 changed files with 107 additions and 163 deletions
|
@ -63,6 +63,7 @@ import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber;
|
||||||
import com.facebook.imagepipeline.image.CloseableImage;
|
import com.facebook.imagepipeline.image.CloseableImage;
|
||||||
import com.facebook.imagepipeline.request.ImageRequest;
|
import com.facebook.imagepipeline.request.ImageRequest;
|
||||||
import com.google.android.material.button.MaterialButton;
|
import com.google.android.material.button.MaterialButton;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.nextcloud.talk.R;
|
import com.nextcloud.talk.R;
|
||||||
import com.nextcloud.talk.activities.MainActivity;
|
import com.nextcloud.talk.activities.MainActivity;
|
||||||
|
@ -103,8 +104,6 @@ import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew;
|
||||||
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
||||||
import com.nextcloud.talk.utils.rx.SearchViewObservable;
|
import com.nextcloud.talk.utils.rx.SearchViewObservable;
|
||||||
import com.nextcloud.ui.popupbubble.PopupBubble;
|
import com.nextcloud.ui.popupbubble.PopupBubble;
|
||||||
import com.yarolegovich.lovelydialog.LovelySaveStateHandler;
|
|
||||||
import com.yarolegovich.lovelydialog.LovelyStandardDialog;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.CompareToBuilder;
|
import org.apache.commons.lang3.builder.CompareToBuilder;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
@ -124,6 +123,7 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.widget.SearchView;
|
import androidx.appcompat.widget.SearchView;
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
|
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
|
||||||
|
@ -154,7 +154,6 @@ import static com.nextcloud.talk.utils.Mimetype.TEXT_PLAIN;
|
||||||
public class ConversationsListController extends BaseController implements FlexibleAdapter.OnItemClickListener, FlexibleAdapter.OnItemLongClickListener, ConversationMenuInterface {
|
public class ConversationsListController extends BaseController implements FlexibleAdapter.OnItemClickListener, FlexibleAdapter.OnItemLongClickListener, ConversationMenuInterface {
|
||||||
|
|
||||||
public static final String TAG = "ConvListController";
|
public static final String TAG = "ConvListController";
|
||||||
public static final int ID_DELETE_CONVERSATION_DIALOG = 0;
|
|
||||||
public static final int UNREAD_BUBBLE_DELAY = 2500;
|
public static final int UNREAD_BUBBLE_DELAY = 2500;
|
||||||
private static final String KEY_SEARCH_QUERY = "ContactsController.searchQuery";
|
private static final String KEY_SEARCH_QUERY = "ContactsController.searchQuery";
|
||||||
|
|
||||||
|
@ -219,8 +218,6 @@ public class ConversationsListController extends BaseController implements Flexi
|
||||||
|
|
||||||
private boolean isRefreshing;
|
private boolean isRefreshing;
|
||||||
|
|
||||||
private LovelySaveStateHandler saveStateHandler;
|
|
||||||
|
|
||||||
private Bundle conversationMenuBundle = null;
|
private Bundle conversationMenuBundle = null;
|
||||||
|
|
||||||
private boolean showShareToScreen = false;
|
private boolean showShareToScreen = false;
|
||||||
|
@ -267,10 +264,6 @@ public class ConversationsListController extends BaseController implements Flexi
|
||||||
getActionBar().show();
|
getActionBar().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveStateHandler == null) {
|
|
||||||
saveStateHandler = new LovelySaveStateHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (adapter == null) {
|
if (adapter == null) {
|
||||||
adapter = new FlexibleAdapter<>(conversationItems, getActivity(), true);
|
adapter = new FlexibleAdapter<>(conversationItems, getActivity(), true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -857,7 +850,6 @@ public class ConversationsListController extends BaseController implements Flexi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveViewState(@NonNull View view, @NonNull Bundle outState) {
|
public void onSaveViewState(@NonNull View view, @NonNull Bundle outState) {
|
||||||
saveStateHandler.saveInstanceState(outState);
|
|
||||||
|
|
||||||
if (searchView != null && !TextUtils.isEmpty(searchView.getQuery())) {
|
if (searchView != null && !TextUtils.isEmpty(searchView.getQuery())) {
|
||||||
outState.putString(KEY_SEARCH_QUERY, searchView.getQuery().toString());
|
outState.putString(KEY_SEARCH_QUERY, searchView.getQuery().toString());
|
||||||
|
@ -872,11 +864,6 @@ public class ConversationsListController extends BaseController implements Flexi
|
||||||
if (savedViewState.containsKey(KEY_SEARCH_QUERY)) {
|
if (savedViewState.containsKey(KEY_SEARCH_QUERY)) {
|
||||||
searchQuery = savedViewState.getString(KEY_SEARCH_QUERY, "");
|
searchQuery = savedViewState.getString(KEY_SEARCH_QUERY, "");
|
||||||
}
|
}
|
||||||
if (LovelySaveStateHandler.wasDialogOnScreen(savedViewState)) {
|
|
||||||
//Dialog won't be restarted automatically, so we need to call this method.
|
|
||||||
//Each dialog knows how to restore its state
|
|
||||||
showLovelyDialog(LovelySaveStateHandler.getSavedDialogId(savedViewState), savedViewState);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1051,25 +1038,26 @@ public class ConversationsListController extends BaseController implements Flexi
|
||||||
selectedConversation.getDisplayName());
|
selectedConversation.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
new LovelyStandardDialog(getActivity())
|
MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(floatingActionButton.getContext())
|
||||||
.setPositiveButtonColorRes(R.color.nc_darkGreen)
|
.setIcon(viewThemeUtils.colorMaterialAlertDialogIcon(context, R.drawable.upload))
|
||||||
.setTitle(confirmationQuestion)
|
.setTitle(confirmationQuestion)
|
||||||
.setMessage(fileNamesWithLineBreaks.toString())
|
.setMessage(fileNamesWithLineBreaks.toString())
|
||||||
.setPositiveButton(R.string.nc_yes, new View.OnClickListener() {
|
.setPositiveButton(R.string.nc_yes, (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
upload();
|
upload();
|
||||||
openConversation();
|
openConversation();
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.nc_no, new View.OnClickListener() {
|
.setNegativeButton(R.string.nc_no, (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Log.d(TAG, "sharing files aborted, going back to share-to screen");
|
Log.d(TAG, "sharing files aborted, going back to share-to screen");
|
||||||
showShareToScreen = true;
|
showShareToScreen = true;
|
||||||
}
|
});
|
||||||
})
|
|
||||||
.show();
|
viewThemeUtils.colorMaterialAlertDialogBackground(floatingActionButton.getContext(), dialogBuilder);
|
||||||
|
|
||||||
|
AlertDialog dialog = dialogBuilder.show();
|
||||||
|
|
||||||
|
viewThemeUtils.colorTextButtons(
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE));
|
||||||
} else {
|
} else {
|
||||||
UploadAndShareFilesWorker.Companion.requestStoragePermission(ConversationsListController.this);
|
UploadAndShareFilesWorker.Companion.requestStoragePermission(ConversationsListController.this);
|
||||||
}
|
}
|
||||||
|
@ -1232,58 +1220,54 @@ public class ConversationsListController extends BaseController implements Flexi
|
||||||
}, 2500);
|
}, 2500);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDeleteConversationDialog(Bundle savedInstanceState) {
|
@Override
|
||||||
if (getActivity() != null && conversationMenuBundle != null && currentUser != null && conversationMenuBundle.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID()) == currentUser.getId()) {
|
public void showDeleteConversationDialog(@NonNull Bundle bundle) {
|
||||||
|
conversationMenuBundle = bundle;
|
||||||
|
if (getActivity() != null &&
|
||||||
|
conversationMenuBundle != null &&
|
||||||
|
currentUser != null &&
|
||||||
|
conversationMenuBundle.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID()) == currentUser.getId()) {
|
||||||
|
|
||||||
Conversation conversation =
|
Conversation conversation =
|
||||||
Parcels.unwrap(conversationMenuBundle.getParcelable(BundleKeys.INSTANCE.getKEY_ROOM()));
|
Parcels.unwrap(conversationMenuBundle.getParcelable(BundleKeys.INSTANCE.getKEY_ROOM()));
|
||||||
|
|
||||||
if (conversation != null) {
|
if (conversation != null) {
|
||||||
new LovelyStandardDialog(getActivity(), LovelyStandardDialog.ButtonLayout.HORIZONTAL)
|
MaterialAlertDialogBuilder dialogBuilder =
|
||||||
.setTopColorRes(R.color.nc_darkRed)
|
new MaterialAlertDialogBuilder(floatingActionButton.getContext())
|
||||||
.setIcon(DisplayUtils.getTintedDrawable(context.getResources(),
|
.setIcon(viewThemeUtils.colorMaterialAlertDialogIcon(context, R.drawable.ic_delete_black_24dp))
|
||||||
R.drawable.ic_delete_black_24dp, R.color.bg_default))
|
|
||||||
.setPositiveButtonColor(context.getResources().getColor(R.color.nc_darkRed))
|
|
||||||
.setTitle(R.string.nc_delete_call)
|
.setTitle(R.string.nc_delete_call)
|
||||||
.setMessage(R.string.nc_delete_conversation_more)
|
.setMessage(R.string.nc_delete_conversation_more)
|
||||||
.setPositiveButton(R.string.nc_delete, new View.OnClickListener() {
|
.setPositiveButton(R.string.nc_delete, (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Data.Builder data = new Data.Builder();
|
Data.Builder data = new Data.Builder();
|
||||||
data.putLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID(),
|
data.putLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID(),
|
||||||
conversationMenuBundle.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID()));
|
conversationMenuBundle.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID()));
|
||||||
data.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), conversation.getToken());
|
data.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), conversation.getToken());
|
||||||
conversationMenuBundle = null;
|
conversationMenuBundle = null;
|
||||||
deleteConversation(data.build());
|
deleteConversation(data.build());
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.nc_cancel, new View.OnClickListener() {
|
.setNegativeButton(R.string.nc_cancel, (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
conversationMenuBundle = null;
|
conversationMenuBundle = null;
|
||||||
}
|
});
|
||||||
})
|
|
||||||
.setInstanceStateHandler(ID_DELETE_CONVERSATION_DIALOG, saveStateHandler)
|
viewThemeUtils.colorMaterialAlertDialogBackground(floatingActionButton.getContext(), dialogBuilder);
|
||||||
.setSavedInstanceState(savedInstanceState)
|
|
||||||
.show();
|
AlertDialog dialog = dialogBuilder.show();
|
||||||
|
|
||||||
|
viewThemeUtils.colorTextButtons(
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showUnauthorizedDialog() {
|
private void showUnauthorizedDialog() {
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
|
MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(floatingActionButton.getContext())
|
||||||
new LovelyStandardDialog(getActivity(), LovelyStandardDialog.ButtonLayout.HORIZONTAL)
|
.setIcon(viewThemeUtils.colorMaterialAlertDialogIcon(context, R.drawable.ic_delete_black_24dp))
|
||||||
.setTopColorRes(R.color.nc_darkRed)
|
|
||||||
.setIcon(DisplayUtils.getTintedDrawable(context.getResources(),
|
|
||||||
R.drawable.ic_delete_black_24dp, R.color.bg_default))
|
|
||||||
.setPositiveButtonColor(context.getResources().getColor(R.color.nc_darkRed))
|
|
||||||
.setCancelable(false)
|
|
||||||
.setTitle(R.string.nc_dialog_invalid_password)
|
.setTitle(R.string.nc_dialog_invalid_password)
|
||||||
.setMessage(R.string.nc_dialog_reauth_or_delete)
|
.setMessage(R.string.nc_dialog_reauth_or_delete)
|
||||||
.setPositiveButton(R.string.nc_delete, new View.OnClickListener() {
|
.setCancelable(false)
|
||||||
@Override
|
.setPositiveButton(R.string.nc_delete, (dialog, which) -> {
|
||||||
public void onClick(View v) {
|
|
||||||
boolean otherUserExists = userManager
|
boolean otherUserExists = userManager
|
||||||
.scheduleUserForDeletionWithId(currentUser.getId())
|
.scheduleUserForDeletionWithId(currentUser.getId())
|
||||||
.blockingGet();
|
.blockingGet();
|
||||||
|
@ -1300,35 +1284,31 @@ public class ConversationsListController extends BaseController implements Flexi
|
||||||
.pushChangeHandler(new VerticalChangeHandler())
|
.pushChangeHandler(new VerticalChangeHandler())
|
||||||
.popChangeHandler(new VerticalChangeHandler()));
|
.popChangeHandler(new VerticalChangeHandler()));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.nc_settings_reauthorize, new View.OnClickListener() {
|
.setNegativeButton(R.string.nc_settings_reauthorize, (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
getRouter().pushController(RouterTransaction.with(
|
getRouter().pushController(RouterTransaction.with(
|
||||||
new WebViewLoginController(currentUser.getBaseUrl(), true))
|
new WebViewLoginController(currentUser.getBaseUrl(), true))
|
||||||
.pushChangeHandler(new VerticalChangeHandler())
|
.pushChangeHandler(new VerticalChangeHandler())
|
||||||
.popChangeHandler(new VerticalChangeHandler()));
|
.popChangeHandler(new VerticalChangeHandler()));
|
||||||
}
|
});
|
||||||
})
|
|
||||||
.setInstanceStateHandler(ID_DELETE_CONVERSATION_DIALOG, saveStateHandler)
|
viewThemeUtils.colorMaterialAlertDialogBackground(floatingActionButton.getContext(), dialogBuilder);
|
||||||
.show();
|
|
||||||
|
AlertDialog dialog = dialogBuilder.show();
|
||||||
|
|
||||||
|
viewThemeUtils.colorTextButtons(
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showServerEOLDialog() {
|
private void showServerEOLDialog() {
|
||||||
new LovelyStandardDialog(getActivity(), LovelyStandardDialog.ButtonLayout.HORIZONTAL)
|
MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(floatingActionButton.getContext())
|
||||||
.setTopColorRes(R.color.nc_darkRed)
|
.setIcon(viewThemeUtils.colorMaterialAlertDialogIcon(context, R.drawable.ic_warning_white))
|
||||||
.setIcon(DisplayUtils.getTintedDrawable(context.getResources(),
|
|
||||||
R.drawable.ic_warning_white,
|
|
||||||
R.color.bg_default))
|
|
||||||
.setPositiveButtonColor(context.getResources().getColor(R.color.nc_darkRed))
|
|
||||||
.setCancelable(false)
|
|
||||||
.setTitle(R.string.nc_settings_server_eol_title)
|
.setTitle(R.string.nc_settings_server_eol_title)
|
||||||
.setMessage(R.string.nc_settings_server_eol)
|
.setMessage(R.string.nc_settings_server_eol)
|
||||||
.setPositiveButton(R.string.nc_settings_remove_account, new View.OnClickListener() {
|
.setCancelable(false)
|
||||||
@Override
|
.setPositiveButton(R.string.nc_settings_remove_account, (dialog, which) -> {
|
||||||
public void onClick(View v) {
|
|
||||||
boolean otherUserExists = userManager
|
boolean otherUserExists = userManager
|
||||||
.scheduleUserForDeletionWithId(currentUser.getId())
|
.scheduleUserForDeletionWithId(currentUser.getId())
|
||||||
.blockingGet();
|
.blockingGet();
|
||||||
|
@ -1345,21 +1325,23 @@ public class ConversationsListController extends BaseController implements Flexi
|
||||||
.pushChangeHandler(new VerticalChangeHandler())
|
.pushChangeHandler(new VerticalChangeHandler())
|
||||||
.popChangeHandler(new VerticalChangeHandler()));
|
.popChangeHandler(new VerticalChangeHandler()));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.nc_cancel, new View.OnClickListener() {
|
.setNegativeButton(R.string.nc_cancel, (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (userManager.getUsers().blockingGet().size() > 0) {
|
if (userManager.getUsers().blockingGet().size() > 0) {
|
||||||
getRouter().pushController(RouterTransaction.with(new SwitchAccountController()));
|
getRouter().pushController(RouterTransaction.with(new SwitchAccountController()));
|
||||||
} else {
|
} else {
|
||||||
getActivity().finishAffinity();
|
getActivity().finishAffinity();
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
})
|
|
||||||
.setInstanceStateHandler(ID_DELETE_CONVERSATION_DIALOG, saveStateHandler)
|
viewThemeUtils.colorMaterialAlertDialogBackground(floatingActionButton.getContext(), dialogBuilder);
|
||||||
.show();
|
|
||||||
|
AlertDialog dialog = dialogBuilder.show();
|
||||||
|
|
||||||
|
viewThemeUtils.colorTextButtons(
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteConversation(Data data) {
|
private void deleteConversation(Data data) {
|
||||||
|
@ -1368,28 +1350,6 @@ public class ConversationsListController extends BaseController implements Flexi
|
||||||
WorkManager.getInstance().enqueue(deleteConversationWorker);
|
WorkManager.getInstance().enqueue(deleteConversationWorker);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showLovelyDialog(int dialogId, Bundle savedInstanceState) {
|
|
||||||
switch (dialogId) {
|
|
||||||
case ID_DELETE_CONVERSATION_DIALOG:
|
|
||||||
showDeleteConversationDialog(savedInstanceState);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openLovelyDialogWithIdAndBundle(int dialogId, Bundle bundle) {
|
|
||||||
conversationMenuBundle = bundle;
|
|
||||||
switch (dialogId) {
|
|
||||||
case ID_DELETE_CONVERSATION_DIALOG:
|
|
||||||
showLovelyDialog(dialogId, null);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppBarLayoutType getAppBarLayoutType() {
|
public AppBarLayoutType getAppBarLayoutType() {
|
||||||
return AppBarLayoutType.SEARCH_BAR;
|
return AppBarLayoutType.SEARCH_BAR;
|
||||||
|
|
|
@ -91,7 +91,6 @@ import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
|
||||||
import com.nextcloud.talk.utils.database.user.CurrentUserProviderNew
|
import com.nextcloud.talk.utils.database.user.CurrentUserProviderNew
|
||||||
import com.nextcloud.talk.utils.preferences.MagicUserInputModule
|
import com.nextcloud.talk.utils.preferences.MagicUserInputModule
|
||||||
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder
|
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder
|
||||||
import com.yarolegovich.lovelydialog.LovelySaveStateHandler
|
|
||||||
import io.reactivex.Observer
|
import io.reactivex.Observer
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
|
@ -364,12 +363,6 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showLovelyDialog(dialogId: Int, savedInstanceState: Bundle?) {
|
|
||||||
if (dialogId == ID_REMOVE_ACCOUNT_WARNING_DIALOG) {
|
|
||||||
showRemoveAccountWarning(savedInstanceState)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun sendLogs() {
|
fun sendLogs() {
|
||||||
if (resources!!.getBoolean(R.bool.nc_is_debug)) {
|
if (resources!!.getBoolean(R.bool.nc_is_debug)) {
|
||||||
sendMailWithAttachment((context)!!)
|
sendMailWithAttachment((context)!!)
|
||||||
|
@ -378,14 +371,9 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
||||||
|
|
||||||
override fun onRestoreViewState(view: View, savedViewState: Bundle) {
|
override fun onRestoreViewState(view: View, savedViewState: Bundle) {
|
||||||
super.onRestoreViewState(view, savedViewState)
|
super.onRestoreViewState(view, savedViewState)
|
||||||
if (LovelySaveStateHandler.wasDialogOnScreen(savedViewState)) {
|
|
||||||
// Dialog won't be restarted automatically, so we need to call this method.
|
|
||||||
// Each dialog knows how to restore its state
|
|
||||||
showLovelyDialog(LovelySaveStateHandler.getSavedDialogId(savedViewState), savedViewState)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showRemoveAccountWarning(savedInstanceState: Bundle?) {
|
private fun showRemoveAccountWarning() {
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
val materialAlertDialogBuilder = MaterialAlertDialogBuilder(binding.messageText.context)
|
val materialAlertDialogBuilder = MaterialAlertDialogBuilder(binding.messageText.context)
|
||||||
.setTitle(R.string.nc_settings_remove_account)
|
.setTitle(R.string.nc_settings_remove_account)
|
||||||
|
@ -492,7 +480,7 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
||||||
setupProfileQueryDisposable()
|
setupProfileQueryDisposable()
|
||||||
|
|
||||||
binding.settingsRemoveAccount.addPreferenceClickListener {
|
binding.settingsRemoveAccount.addPreferenceClickListener {
|
||||||
showLovelyDialog(ID_REMOVE_ACCOUNT_WARNING_DIALOG, null)
|
showRemoveAccountWarning()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setupMessageView()
|
setupMessageView()
|
||||||
|
@ -1067,7 +1055,6 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "SettingsController"
|
private const val TAG = "SettingsController"
|
||||||
private const val ID_REMOVE_ACCOUNT_WARNING_DIALOG = 0
|
|
||||||
private const val DURATION: Long = 2500
|
private const val DURATION: Long = 2500
|
||||||
private const val START_DELAY: Long = 5000
|
private const val START_DELAY: Long = 5000
|
||||||
private const val DISABLED_ALPHA: Float = 0.38f
|
private const val DISABLED_ALPHA: Float = 0.38f
|
||||||
|
|
|
@ -23,5 +23,5 @@ package com.nextcloud.talk.interfaces
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
|
||||||
interface ConversationMenuInterface {
|
interface ConversationMenuInterface {
|
||||||
fun openLovelyDialogWithIdAndBundle(dialogId: Int, bundle: Bundle)
|
fun showDeleteConversationDialog(bundle: Bundle)
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,10 +204,7 @@ class ConversationsListBottomDialog(
|
||||||
bundle.putLong(KEY_INTERNAL_USER_ID, currentUser.id!!)
|
bundle.putLong(KEY_INTERNAL_USER_ID, currentUser.id!!)
|
||||||
bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
|
bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
|
||||||
|
|
||||||
controller.openLovelyDialogWithIdAndBundle(
|
controller.showDeleteConversationDialog(bundle)
|
||||||
ConversationsListController.ID_DELETE_CONVERSATION_DIALOG,
|
|
||||||
bundle
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dismiss()
|
dismiss()
|
||||||
|
|
Loading…
Reference in a new issue