mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Add success fragment after sending an activate remote wipe signal
This commit is contained in:
@@ -71,6 +71,7 @@ import org.briarproject.briar.android.remotewipe.RemoteWipeSuccessFragment;
|
|||||||
import org.briarproject.briar.android.remotewipe.WiperSelectorFragment;
|
import org.briarproject.briar.android.remotewipe.WiperSelectorFragment;
|
||||||
import org.briarproject.briar.android.remotewipe.activate.ActivateRemoteWipeActivity;
|
import org.briarproject.briar.android.remotewipe.activate.ActivateRemoteWipeActivity;
|
||||||
import org.briarproject.briar.android.remotewipe.activate.ActivateRemoteWipeExplainerFragment;
|
import org.briarproject.briar.android.remotewipe.activate.ActivateRemoteWipeExplainerFragment;
|
||||||
|
import org.briarproject.briar.android.remotewipe.activate.ActivateRemoteWipeSuccessFragment;
|
||||||
import org.briarproject.briar.android.reporting.CrashFragment;
|
import org.briarproject.briar.android.reporting.CrashFragment;
|
||||||
import org.briarproject.briar.android.reporting.CrashReportActivity;
|
import org.briarproject.briar.android.reporting.CrashReportActivity;
|
||||||
import org.briarproject.briar.android.reporting.ReportFormFragment;
|
import org.briarproject.briar.android.reporting.ReportFormFragment;
|
||||||
@@ -324,4 +325,6 @@ public interface ActivityComponent {
|
|||||||
void inject(RemoteWipeSuccessFragment remoteWipeSuccessFragment);
|
void inject(RemoteWipeSuccessFragment remoteWipeSuccessFragment);
|
||||||
|
|
||||||
void inject(ActivateRemoteWipeExplainerFragment activateRemoteWipeExplainerFragment);
|
void inject(ActivateRemoteWipeExplainerFragment activateRemoteWipeExplainerFragment);
|
||||||
|
|
||||||
|
void inject(ActivateRemoteWipeSuccessFragment activateRemoteWipeSuccessFragment);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,16 +56,9 @@ public class ActivateRemoteWipeActivity extends BriarActivity implements
|
|||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
break;
|
break;
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
// showNextFragment(new ActivateRemoteWipeSuccessFragment());
|
showNextFragment(new ActivateRemoteWipeSuccessFragment());
|
||||||
Toast.makeText(this,
|
|
||||||
R.string.remote_wipe_activate_success,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
finish();
|
|
||||||
break;
|
break;
|
||||||
case FINISHED:
|
default: // FINISHED or CANCELLED
|
||||||
finish();
|
|
||||||
break;
|
|
||||||
case CANCELLED:
|
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package org.briarproject.briar.android.remotewipe.activate;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import org.briarproject.briar.R;
|
||||||
|
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||||
|
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
public class ActivateRemoteWipeSuccessFragment extends BaseFragment {
|
||||||
|
|
||||||
|
public static final String TAG =
|
||||||
|
ActivateRemoteWipeSuccessFragment.class.getName();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ViewModelProvider.Factory viewModelFactory;
|
||||||
|
|
||||||
|
private ActivateRemoteWipeViewModel viewModel;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void injectFragment(ActivityComponent component) {
|
||||||
|
component.inject(this);
|
||||||
|
viewModel = new ViewModelProvider(requireActivity(), viewModelFactory)
|
||||||
|
.get(ActivateRemoteWipeViewModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
|
@Nullable ViewGroup container,
|
||||||
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_activate_remote_wipe_success,
|
||||||
|
container, false);
|
||||||
|
|
||||||
|
Button button = view.findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(e -> viewModel.onSuccessDismissed());
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUniqueTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,6 +63,10 @@ public class ActivateRemoteWipeViewModel extends AndroidViewModel {
|
|||||||
state.postValue(ActivateRemoteWipeState.CANCELLED);
|
state.postValue(ActivateRemoteWipeState.CANCELLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onSuccessDismissed() {
|
||||||
|
state.postValue(ActivateRemoteWipeState.FINISHED);
|
||||||
|
}
|
||||||
|
|
||||||
public void onConfirmClicked() {
|
public void onConfirmClicked() {
|
||||||
activateWipe();
|
activateWipe();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/linearLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingLeft="@dimen/margin_large"
|
||||||
|
android:paddingTop="@dimen/margin_medium"
|
||||||
|
android:paddingRight="@dimen/margin_large"
|
||||||
|
android:paddingBottom="@dimen/margin_medium">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:text="@string/button_confirm"
|
||||||
|
android:textSize="24sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView2" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/remote_wipe_activate_success"
|
||||||
|
android:textSize="30sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/imageView2" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:layout_marginLeft="32dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:layout_marginRight="32dp"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/ic_baseline_done_outline_24" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="32dp"
|
||||||
android:text="@string/backup_done_dismiss"
|
android:text="@string/button_confirm"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
@@ -760,4 +760,5 @@
|
|||||||
<string name="remote_wipe_activate_explain_short">Activate a remote wipe of this contact\'s device</string>
|
<string name="remote_wipe_activate_explain_short">Activate a remote wipe of this contact\'s device</string>
|
||||||
<string name="remote_wipe_activate_explain_long">If confirmed by a second contact, sending this signal will remove all briar contacts and messages from this contact\s device.</string>
|
<string name="remote_wipe_activate_explain_long">If confirmed by a second contact, sending this signal will remove all briar contacts and messages from this contact\s device.</string>
|
||||||
|
|
||||||
|
<string name="button_confirm">Ok</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user