mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-01-09 19:38:14 -05:00
Improve restore complete dialog for old device.
This commit is contained in:
committed by
Greyson Parrelli
parent
862bab55af
commit
6d90330e86
@@ -3,12 +3,15 @@ package org.thoughtcrime.securesms.devicetransfer.olddevice;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.signal.devicetransfer.DeviceToDeviceTransferService;
|
||||
import org.signal.devicetransfer.TransferStatus;
|
||||
@@ -28,14 +31,18 @@ public final class OldDeviceTransferInstructionsFragment extends LoggingFragment
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
Toolbar toolbar = view.findViewById(R.id.old_device_transfer_instructions_fragment_toolbar);
|
||||
toolbar.setNavigationOnClickListener(v -> {
|
||||
if (!Navigation.findNavController(v).popBackStack()) {
|
||||
requireActivity().finish();
|
||||
}
|
||||
});
|
||||
toolbar.setNavigationOnClickListener(v -> showConfirmExitDialog());
|
||||
|
||||
view.findViewById(R.id.old_device_transfer_instructions_fragment_continue)
|
||||
.setOnClickListener(v -> SafeNavigation.safeNavigate(Navigation.findNavController(v), R.id.action_oldDeviceTransferInstructions_to_oldDeviceTransferSetup));
|
||||
|
||||
requireActivity().getOnBackPressedDispatcher()
|
||||
.addCallback(getViewLifecycleOwner(), new OnBackPressedCallback(true) {
|
||||
@Override
|
||||
public void handleOnBackPressed() {
|
||||
showConfirmExitDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,4 +55,19 @@ public final class OldDeviceTransferInstructionsFragment extends LoggingFragment
|
||||
DeviceToDeviceTransferService.stop(requireContext());
|
||||
}
|
||||
}
|
||||
|
||||
private void showConfirmExitDialog() {
|
||||
new MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(R.string.OldDeviceTransferInstructions__confirm_exit_title)
|
||||
.setMessage(R.string.OldDeviceTransferInstructions__confirm_exit_message)
|
||||
.setPositiveButton(R.string.OldDeviceTransferInstructions__stop_transfer, (d, w) -> exit())
|
||||
.setNegativeButton(R.string.OldDeviceTransferInstructions__continue_transfer, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void exit() {
|
||||
if (!Navigation.findNavController(requireView()).popBackStack()) {
|
||||
requireActivity().finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4972,6 +4972,14 @@
|
||||
<string name="OldDeviceTransferInstructions__third_bullet">3.</string>
|
||||
<string name="OldDeviceTransferInstructions__select_transfer_from_android_device_when_prompted_and_then_continue">Select "Transfer from Android device" when prompted and then "Continue". Keep both devices nearby.</string>
|
||||
<string name="OldDeviceTransferInstructions__continue">Continue</string>
|
||||
<!-- Title for exit device transfer confirmation dialog -->
|
||||
<string name="OldDeviceTransferInstructions__confirm_exit_title">Stop device transfer?</string>
|
||||
<!-- Message for exit device transfer confirmation dialog -->
|
||||
<string name="OldDeviceTransferInstructions__confirm_exit_message">No data has been transferred to your new device.</string>
|
||||
<!-- Confirm button for exit device transfer confirmation dialog -->
|
||||
<string name="OldDeviceTransferInstructions__stop_transfer">Stop transfer</string>
|
||||
<!-- Negative/cancel button for exit device transfer confirmation dialog -->
|
||||
<string name="OldDeviceTransferInstructions__continue_transfer">Continue transfer</string>
|
||||
|
||||
<!-- OldDeviceTransferComplete -->
|
||||
<string name="OldDeviceTransferComplete__go_to_your_new_device">Go to your new device</string>
|
||||
@@ -8654,9 +8662,9 @@
|
||||
<string name="TransferAccount_continue_on_your_other_device_details">Continue transferring your account on your other device.</string>
|
||||
|
||||
<!-- Restore Complete bottom sheet dialog title -->
|
||||
<string name="RestoreCompleteBottomSheet_restore_complete">Restore complete</string>
|
||||
<string name="RestoreCompleteBottomSheet_restore_complete">Finish on your other device</string>
|
||||
<!-- Restore Complete bottom sheet dialog message -->
|
||||
<string name="RestoreCompleteBottomSheet_restore_complete_message">Your Signal account and messages have started transferring to your other device. Signal is now inactive on this device.</string>
|
||||
<string name="RestoreCompleteBottomSheet_restore_complete_message">Your Signal account and messages are ready to restore on your other device. Signal is now inactive on this device.</string>
|
||||
<!-- Restore Complete bottom sheet dialog title after device transfer -->
|
||||
<string name="RestoreCompleteBottomSheet_transfer_complete">Transfer complete</string>
|
||||
<!-- Restore Complete bottom sheet dialog message after device transfer -->
|
||||
|
||||
Reference in New Issue
Block a user