Adjust styling

This commit is contained in:
Stefan Niedermann 2020-06-10 13:30:18 +02:00
parent 56ab5105e7
commit 53605bc67b
4 changed files with 17 additions and 8 deletions

View file

@ -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 {

View file

@ -53,7 +53,7 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> 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();
}

View file

@ -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);
}

View file

@ -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 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacer_1x"
android:gravity="center_vertical|end"
android:orientation="horizontal">
@ -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 @@
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<ImageView
android:id="@+id/noteFavorite"
@ -66,7 +66,10 @@
android:layout_height="match_parent"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/menu_favorite"
android:padding="@dimen/spacer_2x"
android:paddingStart="@dimen/spacer_2x"
android:paddingLeft="@dimen/spacer_2x"
android:paddingEnd="@dimen/spacer_2x"
android:paddingRight="@dimen/spacer_2x"
tools:src="@drawable/ic_star_yellow_24dp" />
<androidx.appcompat.widget.AppCompatImageView
@ -86,7 +89,11 @@
android:id="@+id/noteContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/spacer_2x"
android:paddingStart="@dimen/spacer_2x"
android:paddingLeft="@dimen/spacer_2x"
android:paddingEnd="@dimen/spacer_2x"
android:paddingRight="@dimen/spacer_2x"
android:paddingBottom="@dimen/spacer_2x"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/fg_default"
android:textIsSelectable="true"