mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 05:39:53 +01:00
Improve visual feedback for threshold selector
This commit is contained in:
@@ -2,6 +2,9 @@ package org.briarproject.briar.android.socialbackup;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.style.ImageSpan;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
@@ -16,6 +19,8 @@ import org.briarproject.briar.android.activity.ActivityComponent;
|
|||||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||||
import org.magmacollective.darkcrystal.secretsharingwrapper.SecretSharingWrapper;
|
import org.magmacollective.darkcrystal.secretsharingwrapper.SecretSharingWrapper;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -145,15 +150,20 @@ public class ThresholdSelectorFragment extends BaseFragment {
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildThresholdRepresentationString() {
|
private SpannableString buildThresholdRepresentationString() {
|
||||||
String thresholdRepresentationText = "";
|
char[] charArray = new char[numberOfCustodians];
|
||||||
for (int i = 0; i < threshold; i++) {
|
Arrays.fill(charArray, ' ');
|
||||||
thresholdRepresentationText += getString(R.string.filled_bullet);
|
SpannableString string = new SpannableString(new String(charArray));
|
||||||
|
|
||||||
|
for (int i = 0; i < numberOfCustodians; i++) {
|
||||||
|
int drawable = i < threshold
|
||||||
|
? R.drawable.ic_custodian_required
|
||||||
|
: R.drawable.ic_custodian_optional;
|
||||||
|
string.setSpan(new ImageSpan(getContext(), drawable), i,
|
||||||
|
i+1,
|
||||||
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < (numberOfCustodians - threshold); i++) {
|
return string;
|
||||||
thresholdRepresentationText += getString(R.string.linear_bullet);
|
|
||||||
}
|
|
||||||
return thresholdRepresentationText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SeekBarListener implements SeekBar.OnSeekBarChangeListener {
|
private class SeekBarListener implements SeekBar.OnSeekBarChangeListener {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#660066"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#FF00FF"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||||
|
</vector>
|
||||||
Reference in New Issue
Block a user