From 53605bc67bd3f23eff72d0e526884ad47a993d5f Mon Sep 17 00:00:00 2001 From: Stefan Niedermann Date: Wed, 10 Jun 2020 13:30:18 +0200 Subject: [PATCH] Adjust styling --- .../android/fragment/PreferencesFragment.java | 4 +++- .../owncloud/notes/model/ItemAdapter.java | 2 +- .../owncloud/notes/util/NoteUtil.java | 2 +- .../layout/item_notes_list_note_item_grid.xml | 17 ++++++++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/PreferencesFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/PreferencesFragment.java index d8034ae6..e5121b2e 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/PreferencesFragment.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/PreferencesFragment.java @@ -11,6 +11,7 @@ import androidx.preference.ListPreference; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; +import it.niedermann.owncloud.notes.BuildConfig; import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.android.DarkModeSetting; import it.niedermann.owncloud.notes.branding.Branded; @@ -60,11 +61,12 @@ public class PreferencesFragment extends PreferenceFragmentCompat implements Bra gridViewPref = findPreference(getString(R.string.pref_key_gridview)); if (gridViewPref != null) { + gridViewPref.setVisible(BuildConfig.DEBUG); gridViewPref.setOnPreferenceChangeListener((Preference preference, Object newValue) -> { final Boolean gridView = (Boolean) newValue; - NotesDatabase.getInstance(requireContext()).regenerateExcerpts(!gridView); Log.v(TAG, "gridView: " + gridView); requireActivity().setResult(Activity.RESULT_OK); + new Thread(() -> NotesDatabase.getInstance(requireContext()).regenerateExcerpts(!gridView)).start(); return true; }); } else { diff --git a/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java b/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java index 32fa3f1a..0bba4f33 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java @@ -53,7 +53,7 @@ public class ItemAdapter extends RecyclerView.Adapter i @Override public long getItemId(int position) { return getItemViewType(position) == TYPE_SECTION - ? ((SectionItem) getItem(position)).getTitle().hashCode() + ? ((SectionItem) getItem(position)).getTitle().hashCode() * -1 : ((DBNote) getItem(position)).getId(); } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/util/NoteUtil.java b/app/src/main/java/it/niedermann/owncloud/notes/util/NoteUtil.java index 11802b2b..337fb521 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/util/NoteUtil.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/util/NoteUtil.java @@ -102,7 +102,7 @@ public class NoteUtil { return ""; } return stripMarkdown - ? truncateString(removeMarkDown(content.replaceFirst("^.*\n", "")), 200).replace("\n", " ") + ? truncateString(removeMarkDown(content.replaceFirst("^.*\n", "")), 150).replace("\n", " ") : truncateString(content.replaceFirst("^.*\n", ""), 200); } diff --git a/app/src/main/res/layout/item_notes_list_note_item_grid.xml b/app/src/main/res/layout/item_notes_list_note_item_grid.xml index c3fe3676..98b6cb2b 100644 --- a/app/src/main/res/layout/item_notes_list_note_item_grid.xml +++ b/app/src/main/res/layout/item_notes_list_note_item_grid.xml @@ -19,7 +19,7 @@ android:layout_height="wrap_content" android:layout_marginStart="@dimen/spacer_2x" android:layout_marginLeft="@dimen/spacer_2x" - android:layout_marginTop="@dimen/spacer_2x" + android:layout_marginTop="@dimen/spacer_1x" android:background="@drawable/border" android:maxLines="1" android:paddingLeft="@dimen/spacer_1x" @@ -35,6 +35,7 @@ @@ -45,7 +46,6 @@ android:layout_weight="1" android:paddingStart="@dimen/spacer_2x" android:paddingLeft="@dimen/spacer_2x" - android:paddingTop="@dimen/spacer_2x" android:paddingEnd="@dimen/spacer_2x" android:paddingRight="@dimen/spacer_2x" android:textAppearance="?android:attr/textAppearanceMedium" @@ -58,7 +58,7 @@ + android:layout_height="match_parent">