diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-12-09 20:31:32 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-12-09 20:31:32 +0300 |
commit | f0eef908292633f4fbf26ca2f351f0ee582edb97 (patch) | |
tree | c182484988f1608c309f175f1fa4310abbd92d24 /app | |
parent | c9a7af81204f89ee2f72e108a5a83665b82089f1 (diff) |
Markdown editor
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/card/details/CardDetailsFragment.java | 8 | ||||
-rw-r--r-- | app/src/main/res/layout/fragment_card_edit_tab_details.xml | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/details/CardDetailsFragment.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/details/CardDetailsFragment.java index 0b8541193..9db572867 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/details/CardDetailsFragment.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/details/CardDetailsFragment.java @@ -42,6 +42,7 @@ import it.niedermann.nextcloud.deck.R; import it.niedermann.nextcloud.deck.databinding.FragmentCardEditTabDetailsBinding; import it.niedermann.nextcloud.deck.model.Label; import it.niedermann.nextcloud.deck.model.User; +import it.niedermann.nextcloud.deck.model.full.FullCard; import it.niedermann.nextcloud.deck.persistence.sync.adapters.db.util.WrappedLiveData; import it.niedermann.nextcloud.deck.ui.branding.BrandedDatePickerDialog; import it.niedermann.nextcloud.deck.ui.branding.BrandedFragment; @@ -136,14 +137,16 @@ public class CardDetailsFragment extends BrandedFragment implements OnDateSetLis private void setupDescription() { if (viewModel.canEdit()) { - binding.descriptionToggle.setVisibility(VISIBLE); + binding.descriptionBar.setOnClickListener((v) -> binding.descriptionEditor.requestFocus()); binding.descriptionToggle.setOnClickListener((v) -> { editorActive = !editorActive; if (editorActive) { + binding.descriptionBar.setOnClickListener((view) -> binding.descriptionEditor.requestFocus()); binding.descriptionEditor.setVisibility(VISIBLE); binding.descriptionViewer.setVisibility(GONE); binding.descriptionToggle.setImageResource(R.drawable.ic_baseline_eye_24); } else { + binding.descriptionBar.setOnClickListener(null); binding.descriptionEditor.setVisibility(GONE); binding.descriptionViewer.setVisibility(VISIBLE); binding.descriptionToggle.setImageResource(R.drawable.ic_edit_grey600_24dp); @@ -155,8 +158,9 @@ public class CardDetailsFragment extends BrandedFragment implements OnDateSetLis viewModel.getFullCard().getCard().setDescription(newText == null ? "" : newText.toString()); binding.descriptionViewer.setMarkdownString(viewModel.getFullCard().getCard().getDescription()); } else { - DeckLog.logError(new IllegalStateException("FullCard was empty when trying to setup description")); + DeckLog.logError(new IllegalStateException(FullCard.class.getSimpleName() + " was empty when trying to setup description")); } + binding.descriptionToggle.setVisibility(TextUtils.isEmpty(newText) ? GONE : VISIBLE); }); } else { binding.descriptionEditor.setEnabled(false); diff --git a/app/src/main/res/layout/fragment_card_edit_tab_details.xml b/app/src/main/res/layout/fragment_card_edit_tab_details.xml index 58df34fd3..a2f5e5b21 100644 --- a/app/src/main/res/layout/fragment_card_edit_tab_details.xml +++ b/app/src/main/res/layout/fragment_card_edit_tab_details.xml @@ -131,13 +131,14 @@ tools:listitem="@tools:sample/avatars" /> <LinearLayout + android:id="@+id/descriptionBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:layout_width="@dimen/icon_size_details" - android:layout_height="match_parent" + android:layout_height="wrap_content" android:layout_marginEnd="@dimen/spacer_2x" android:contentDescription="@null" app:srcCompat="@drawable/ic_baseline_subject_24" /> @@ -159,7 +160,7 @@ android:paddingEnd="@dimen/spacer_1x" android:visibility="gone" app:srcCompat="@drawable/ic_baseline_eye_24" - tools:visibility="visible" /> + tools:visibility="gone" /> </LinearLayout> </LinearLayout> @@ -172,13 +173,14 @@ android:textSize="@dimen/font_size_description" /> <it.niedermann.android.markdown.MarkdownViewerImpl - android:visibility="gone" android:id="@+id/descriptionViewer" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/spacer_2x" android:textColor="?attr/colorAccent" - android:textSize="@dimen/font_size_description" /> + android:textIsSelectable="true" + android:textSize="@dimen/font_size_description" + android:visibility="gone" /> </LinearLayout> <TextView |