mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 06:09:55 +01:00
Redesign password screen of setup wizard
This commit is contained in:
@@ -31,7 +31,9 @@ import static android.view.View.VISIBLE;
|
|||||||
import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE;
|
import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE;
|
||||||
import static androidx.core.content.ContextCompat.checkSelfPermission;
|
import static androidx.core.content.ContextCompat.checkSelfPermission;
|
||||||
import static org.briarproject.bramble.api.crypto.PasswordStrengthEstimator.QUITE_WEAK;
|
import static org.briarproject.bramble.api.crypto.PasswordStrengthEstimator.QUITE_WEAK;
|
||||||
|
import static org.briarproject.briar.android.util.UiUtils.hideViewOnSmallScreen;
|
||||||
import static org.briarproject.briar.android.util.UiUtils.setError;
|
import static org.briarproject.briar.android.util.UiUtils.setError;
|
||||||
|
import static org.briarproject.briar.android.util.UiUtils.showOnboardingDialog;
|
||||||
|
|
||||||
@MethodsNotNullByDefault
|
@MethodsNotNullByDefault
|
||||||
@ParametersNotNullByDefault
|
@ParametersNotNullByDefault
|
||||||
@@ -57,7 +59,6 @@ public class SetPasswordFragment extends SetupFragment {
|
|||||||
public View onCreateView(LayoutInflater inflater,
|
public View onCreateView(LayoutInflater inflater,
|
||||||
@Nullable ViewGroup container,
|
@Nullable ViewGroup container,
|
||||||
@Nullable Bundle savedInstanceState) {
|
@Nullable Bundle savedInstanceState) {
|
||||||
requireActivity().setTitle(getString(R.string.setup_password_intro));
|
|
||||||
View v = inflater.inflate(R.layout.fragment_setup_password, container,
|
View v = inflater.inflate(R.layout.fragment_setup_password, container,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
@@ -67,11 +68,14 @@ public class SetPasswordFragment extends SetupFragment {
|
|||||||
passwordConfirmationWrapper =
|
passwordConfirmationWrapper =
|
||||||
v.findViewById(R.id.password_confirm_wrapper);
|
v.findViewById(R.id.password_confirm_wrapper);
|
||||||
passwordConfirmation = v.findViewById(R.id.password_confirm);
|
passwordConfirmation = v.findViewById(R.id.password_confirm);
|
||||||
|
Button infoButton = v.findViewById(R.id.info_button);
|
||||||
nextButton = v.findViewById(R.id.next);
|
nextButton = v.findViewById(R.id.next);
|
||||||
ProgressBar progressBar = v.findViewById(R.id.progress);
|
ProgressBar progressBar = v.findViewById(R.id.progress);
|
||||||
|
|
||||||
passwordEntry.addTextChangedListener(this);
|
passwordEntry.addTextChangedListener(this);
|
||||||
passwordConfirmation.addTextChangedListener(this);
|
passwordConfirmation.addTextChangedListener(this);
|
||||||
|
infoButton.setOnClickListener(view ->
|
||||||
|
showOnboardingDialog(requireContext(), getHelpText()));
|
||||||
nextButton.setOnClickListener(this);
|
nextButton.setOnClickListener(this);
|
||||||
|
|
||||||
if (!viewModel.needToShowDozeFragment()) {
|
if (!viewModel.needToShowDozeFragment()) {
|
||||||
@@ -94,6 +98,12 @@ public class SetPasswordFragment extends SetupFragment {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
hideViewOnSmallScreen(requireView().findViewById(R.id.logo));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUniqueTag() {
|
public String getUniqueTag() {
|
||||||
return TAG;
|
return TAG;
|
||||||
|
|||||||
@@ -16,6 +16,33 @@
|
|||||||
android:paddingRight="@dimen/margin_activity_horizontal"
|
android:paddingRight="@dimen/margin_activity_horizontal"
|
||||||
android:paddingBottom="@dimen/margin_activity_vertical">
|
android:paddingBottom="@dimen/margin_activity_vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/logo"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/hero_square"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:src="@drawable/splash_screen"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/intro"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHeight_default="percent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/intro"
|
||||||
|
style="@style/TextAppearance.AppCompat.Large"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/setup_password_intro"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/password_entry_wrapper"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/logo" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/password_entry_wrapper"
|
android:id="@+id/password_entry_wrapper"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -23,9 +50,10 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
app:errorEnabled="true"
|
app:errorEnabled="true"
|
||||||
app:hintEnabled="false"
|
app:hintEnabled="false"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/strength_meter"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/intro"
|
||||||
app:passwordToggleEnabled="true">
|
app:passwordToggleEnabled="true">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
@@ -46,9 +74,10 @@
|
|||||||
<org.briarproject.briar.android.login.StrengthMeter
|
<org.briarproject.briar.android.login.StrengthMeter
|
||||||
android:id="@+id/strength_meter"
|
android:id="@+id/strength_meter"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="10dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/password_confirm_wrapper"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/password_entry_wrapper"
|
app:layout_constraintTop_toBottomOf="@+id/password_entry_wrapper"
|
||||||
@@ -61,6 +90,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
app:errorEnabled="true"
|
app:errorEnabled="true"
|
||||||
app:hintEnabled="false"
|
app:hintEnabled="false"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/info_button"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/strength_meter"
|
app:layout_constraintTop_toBottomOf="@+id/strength_meter"
|
||||||
@@ -76,6 +106,19 @@
|
|||||||
android:maxLines="1" />
|
android:maxLines="1" />
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
|
android:id="@+id/info_button"
|
||||||
|
style="@style/BriarButtonFlat.Positive"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableStart="@drawable/ic_info_white"
|
||||||
|
android:drawablePadding="8dp"
|
||||||
|
android:text="@string/more_info"
|
||||||
|
app:drawableTint="@color/briar_button_text_positive"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/next"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/password_confirm_wrapper" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/next"
|
android:id="@+id/next"
|
||||||
style="@style/BriarButton"
|
style="@style/BriarButton"
|
||||||
@@ -86,8 +129,6 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/password_confirm_wrapper"
|
|
||||||
app:layout_constraintVertical_bias="1.0"
|
|
||||||
tools:enabled="true" />
|
tools:enabled="true" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
|
|||||||
Reference in New Issue
Block a user