Small layout improvement

This commit is contained in:
M66B 2019-01-14 12:31:23 +00:00
parent 6a2a7e88cd
commit 69dda06e91
2 changed files with 9 additions and 2 deletions

View File

@ -68,6 +68,8 @@ public class FragmentSetup extends FragmentEx {
private Button btnData;
private int textColorPrimary;
private int colorWarning;
private Drawable check;
private static final String[] permissions = new String[]{
@ -79,6 +81,8 @@ public class FragmentSetup extends FragmentEx {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
setSubtitle(R.string.title_setup);
textColorPrimary = Helper.resolveColor(getContext(), android.R.attr.textColorPrimary);
colorWarning = Helper.resolveColor(getContext(), R.attr.colorWarning);
check = getResources().getDrawable(R.drawable.baseline_check_24, getContext().getTheme());
view = (ViewGroup) inflater.inflate(R.layout.fragment_setup, container, false);
@ -249,6 +253,7 @@ public class FragmentSetup extends FragmentEx {
btnIdentity.setEnabled(done);
tvAccountDone.setText(done ? R.string.title_setup_done : R.string.title_setup_to_do);
tvAccountDone.setTextColor(done ? textColorPrimary : colorWarning);
tvAccountDone.setCompoundDrawablesWithIntrinsicBounds(done ? check : null, null, null, null);
if (livePrimaryDrafts == null)
@ -288,6 +293,7 @@ public class FragmentSetup extends FragmentEx {
public void onChanged(@Nullable List<EntityIdentity> identities) {
boolean done = (identities != null && identities.size() > 0);
tvIdentityDone.setText(done ? R.string.title_setup_done : R.string.title_setup_to_do);
tvIdentityDone.setTextColor(done ? textColorPrimary : colorWarning);
tvIdentityDone.setCompoundDrawablesWithIntrinsicBounds(done ? check : null, null, null, null);
}
});
@ -307,6 +313,7 @@ public class FragmentSetup extends FragmentEx {
}
btnDoze.setEnabled(!ignoring);
tvDozeDone.setText(ignoring ? R.string.title_setup_done : R.string.title_setup_to_do);
tvDozeDone.setTextColor(ignoring ? textColorPrimary : colorWarning);
tvDozeDone.setCompoundDrawablesWithIntrinsicBounds(ignoring ? check : null, null, null, null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
@ -332,6 +339,7 @@ public class FragmentSetup extends FragmentEx {
btnPermissions.setEnabled(!has);
tvPermissionsDone.setText(has ? R.string.title_setup_done : R.string.title_setup_to_do);
tvPermissionsDone.setTextColor(has ? textColorPrimary : colorWarning);
tvPermissionsDone.setCompoundDrawablesWithIntrinsicBounds(has ? check : null, null, null, null);
if (has && !init)

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="6dp"
android:layout_margin="12dp"
android:orientation="vertical"
tools:context=".ActivitySetup">
@ -16,7 +16,6 @@
android:id="@+id/btnQuick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_setup_quick"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"