#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); this.categories.add(0, clearItem);
if (currentSearchString != null && currentSearchString.trim().length() > 0) { if (currentSearchString != null && currentSearchString.trim().length() > 0) {
boolean currentSearchStringIsInCategories = false; boolean currentSearchStringIsInCategories = false;
for (NavigationItem category : categories) { for (NavigationItem category : categories.subList(1, categories.size())) {
if (currentSearchString.equals(category.label)) { if (currentSearchString.equals(category.label)) {
currentSearchStringIsInCategories = true; currentSearchStringIsInCategories = true;
break; break;

View file

@ -155,6 +155,7 @@ public class CategoryDialogFragment extends AppCompatDialogFragment {
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
if (editCategory.getText() == null || editCategory.getText().length() == 0) {
editCategory.requestFocus(); editCategory.requestFocus();
if (getDialog().getWindow() != null) { if (getDialog().getWindow() != null) {
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
@ -162,6 +163,7 @@ public class CategoryDialogFragment extends AppCompatDialogFragment {
Log.w(TAG, "can not set SOFT_INPUT_STATE_ALWAYAS_VISIBLE because getWindow() == null"); Log.w(TAG, "can not set SOFT_INPUT_STATE_ALWAYAS_VISIBLE because getWindow() == null");
} }
} }
}
private class LoadCategoriesTask extends AsyncTask<String, Void, List<NavigationAdapter.NavigationItem>> { private class LoadCategoriesTask extends AsyncTask<String, Void, List<NavigationAdapter.NavigationItem>> {

View file

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