Add button when displaying remote wipers allowing the list of wipers to be modified

This commit is contained in:
ameba23
2021-09-07 13:20:01 +02:00
parent 336866da51
commit b9c614acfb
6 changed files with 29 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import org.briarproject.briar.R;
@@ -52,8 +53,9 @@ public class RemoteWipeDisplayFragment extends
}
TextView textViewThreshold = view.findViewById(R.id.textViewWipers);
textViewThreshold.setText(custodianNamesString.toString());
// Button button = view.findViewById(R.id.button);
// button.setOnClickListener(e -> viewModel.onErrorTryAgain());
Button button = view.findViewById(R.id.button);
button.setOnClickListener(e -> viewModel.onModifyWipers());
return view;
}
@Override

View File

@@ -38,11 +38,11 @@ public class RemoteWipeSetupActivity extends BriarActivity implements
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_distributed_backup);
// if (viewModel.remoteWipeIsSetup()) {
// showInitialFragment(new RemoteWipeDisplayFragment());
// } else {
if (viewModel.remoteWipeIsSetup()) {
showInitialFragment(new RemoteWipeDisplayFragment());
} else {
showInitialFragment(WiperSelectorFragment.newInstance());
// }
}
}
@@ -68,6 +68,8 @@ public class RemoteWipeSetupActivity extends BriarActivity implements
finish();
} else if (state.equals(RemoteWipeSetupState.FINISHED)) {
finish();
} else if (state.equals(RemoteWipeSetupState.MODIFY)) {
showNextFragment(WiperSelectorFragment.newInstance());
}
}
}

View File

@@ -3,5 +3,6 @@ package org.briarproject.briar.android.remotewipe;
public enum RemoteWipeSetupState {
FAILED,
SUCCESS,
FINISHED
FINISHED,
MODIFY
}

View File

@@ -74,6 +74,11 @@ public class RemoteWipeSetupViewModel extends AndroidViewModel {
state.postValue(RemoteWipeSetupState.FINISHED);
}
@UiThread
public void onModifyWipers() {
state.postValue(RemoteWipeSetupState.MODIFY);
}
public void setupRemoteWipe(Collection<ContactId> wipers)
throws DbException, FormatException {
db.transaction(false, txn -> {

View File

@@ -31,4 +31,15 @@ android:layout_height="match_parent">
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewThreshold" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="@string/remote_wipe_modify_contacts"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewWipers" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -766,6 +766,7 @@
<string name="activity_name_revoke_remote_wipe">Revoke Remote Wipe</string>
<string name="revoke_remote_wipe">Revoke remote wipe status</string>
<string name="remote_wipe_revoke_success">Remote wipe status revoked</string>
<string name="remote_wipe_modify_contacts">Change remote wipers</string>
<string name="button_confirm">Ok</string>
</resources>