#378 Enhance category handling

- Enhanced paddings
- Only display keyboard when no category is given yet
This commit is contained in:
stefan-niedermann 2020-01-24 21:03:44 +01:00
parent 0f8e517a7f
commit f8e1fa930c
3 changed files with 12 additions and 7 deletions

View file

@ -99,7 +99,7 @@ public class CategoryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
this.categories.add(0, clearItem);
if (currentSearchString != null && currentSearchString.trim().length() > 0) {
boolean currentSearchStringIsInCategories = false;
for (NavigationItem category : categories) {
for (NavigationItem category : categories.subList(1, categories.size())) {
if (currentSearchString.equals(category.label)) {
currentSearchStringIsInCategories = true;
break;

View file

@ -155,11 +155,13 @@ public class CategoryDialogFragment extends AppCompatDialogFragment {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
editCategory.requestFocus();
if (getDialog().getWindow() != null) {
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
} else {
Log.w(TAG, "can not set SOFT_INPUT_STATE_ALWAYAS_VISIBLE because getWindow() == null");
if (editCategory.getText() == null || editCategory.getText().length() == 0) {
editCategory.requestFocus();
if (getDialog().getWindow() != null) {
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
} else {
Log.w(TAG, "can not set SOFT_INPUT_STATE_ALWAYAS_VISIBLE because getWindow() == null");
}
}
}

View file

@ -6,7 +6,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="?dialogPreferredPadding">
android:paddingStart="?dialogPreferredPadding"
android:paddingLeft="?dialogPreferredPadding"
android:paddingEnd="?dialogPreferredPadding"
android:paddingRight="?dialogPreferredPadding">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"