summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas <tschneider.ac@gmail.com>2023-09-20 12:37:02 +0200
committerThomas <tschneider.ac@gmail.com>2023-09-20 12:37:02 +0200
commitea636124fa6588903c3cb75784985fcde02d99aa (patch)
treebbaa8e5dc81d735cc5034acd3426a93088b1c5bb
parent7d7311f9710416f9003f5ac8ff7a8c907925cdbd (diff)
horizontal scroll view
-rw-r--r--app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Status.java1
-rw-r--r--app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java133
-rw-r--r--app/src/main/res/layouts/mastodon/layout/drawer_status.xml177
-rw-r--r--app/src/main/res/values/strings.xml1
4 files changed, 156 insertions, 156 deletions
diff --git a/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Status.java b/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Status.java
index c9d7efed6..f9e30cc57 100644
--- a/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Status.java
+++ b/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Status.java
@@ -129,7 +129,6 @@ public class Status implements Serializable, Cloneable {
public boolean translationShown;
public boolean mathsShown = false;
public boolean markdownShown = false;
- public boolean extraFeaturesShown = false;
public boolean canLoadMedia = false;
public transient boolean isFocused = false;
public transient boolean setCursorToEnd = false;
diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java
index 8ae89f705..05cfc9873 100644
--- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java
+++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java
@@ -756,12 +756,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.statusContent.setText(statusToDeal.contentSpan, TextView.BufferType.SPANNABLE);
}
}
- if (statusToDeal.extraFeaturesShown) {
- holder.binding.extraFeaturesPanel.setVisibility(View.VISIBLE);
- holder.binding.extraFeaturesPanel.requestFocus();
- } else {
- holder.binding.extraFeaturesPanel.setVisibility(View.GONE);
- }
if (statusToDeal.mathsShown) {
holder.binding.statusContentMaths.setVisibility(View.VISIBLE);
holder.binding.statusContent.setVisibility(View.GONE);
@@ -1032,46 +1026,43 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
return true;
});
- holder.binding.actionButtonExtra.setAnimation(null);
-
- holder.binding.actionButtonExtra.setOnClickListener(v -> {
- if (displayTranslate) {
- if (statusToDeal.language != null && statusToDeal.language.trim().length() > 0 && statusToDeal.language.equalsIgnoreCase(MyTransL.getLocale())) {
- holder.binding.actionButtonTranslate.setVisibility(View.GONE);
- } else {
- holder.binding.actionButtonTranslate.setVisibility(View.VISIBLE);
- }
- } else {
+ holder.binding.actionButtonReply.setAnimation(null);
+ holder.binding.actionButtonQuote.setAnimation(null);
+ holder.binding.actionButtonTranslate.setAnimation(null);
+ holder.binding.actionButtonMaths.setAnimation(null);
+ holder.binding.actionButtonMarkdown.setAnimation(null);
+ holder.binding.statusAddCustomEmoji.setAnimation(null);
+ holder.binding.statusEmoji.setAnimation(null);
+ holder.binding.actionButtonMore.setAnimation(null);
+
+ if (displayTranslate) {
+ if (statusToDeal.language != null && statusToDeal.language.trim().length() > 0 && statusToDeal.language.equalsIgnoreCase(MyTransL.getLocale())) {
holder.binding.actionButtonTranslate.setVisibility(View.GONE);
+ } else {
+ holder.binding.actionButtonTranslate.setVisibility(View.VISIBLE);
}
- if (statusToDeal.isMaths == null) {
- if (statusToDeal.content != null && Helper.mathsPattern.matcher(statusToDeal.content).find()) {
- holder.binding.actionButtonMaths.setVisibility(View.VISIBLE);
- statusToDeal.isMaths = true;
- } else {
- holder.binding.actionButtonMaths.setVisibility(View.GONE);
- }
+ } else {
+ holder.binding.actionButtonTranslate.setVisibility(View.GONE);
+ }
+ if (statusToDeal.isMaths == null) {
+ if (statusToDeal.content != null && Helper.mathsPattern.matcher(statusToDeal.content).find()) {
+ holder.binding.actionButtonMaths.setVisibility(View.VISIBLE);
+ statusToDeal.isMaths = true;
} else {
- if (statusToDeal.isMaths) {
- holder.binding.actionButtonMaths.setVisibility(View.VISIBLE);
- } else {
- holder.binding.actionButtonMaths.setVisibility(View.GONE);
- }
+ holder.binding.actionButtonMaths.setVisibility(View.GONE);
}
- if (statusToDeal.contentMarkdownSpan != null) {
- holder.binding.actionButtonMarkdown.setVisibility(View.VISIBLE);
+ } else {
+ if (statusToDeal.isMaths) {
+ holder.binding.actionButtonMaths.setVisibility(View.VISIBLE);
} else {
- holder.binding.actionButtonMarkdown.setVisibility(View.GONE);
+ holder.binding.actionButtonMaths.setVisibility(View.GONE);
}
- holder.binding.extraFeaturesPanel.setVisibility(View.VISIBLE);
- holder.binding.actionButtonExtra.setChecked(false);
- });
-
- holder.binding.buttonCloseExtraFeaturesPanel.setOnClickListener(v -> {
- statusToDeal.extraFeaturesShown = !statusToDeal.extraFeaturesShown;
- adapter.notifyItemChanged(holder.getBindingAdapterPosition());
- });
-
+ }
+ if (statusToDeal.contentMarkdownSpan != null) {
+ holder.binding.actionButtonMarkdown.setVisibility(View.VISIBLE);
+ } else {
+ holder.binding.actionButtonMarkdown.setVisibility(View.GONE);
+ }
holder.binding.actionButtonBoost.setOnClickListener(v -> {
boolean needToWarnForMissingDescription = false;
if (warnNoMedia && statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0) {
@@ -1241,32 +1232,22 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
//Button sizes depending of the defined scale
float normalSize = Helper.convertDpToPixel(28, context);
- holder.binding.actionButtonReply.getLayoutParams().width = (int) (normalSize * scaleIcon);
- holder.binding.actionButtonReply.getLayoutParams().height = (int) (normalSize * scaleIcon);
- holder.binding.actionButtonReply.requestLayout();
-
- holder.binding.actionButtonTranslate.getLayoutParams().width = (int) (normalSize * scaleIcon);
- holder.binding.actionButtonTranslate.getLayoutParams().height = (int) (normalSize * scaleIcon);
- holder.binding.actionButtonTranslate.requestLayout();
-
+ holder.binding.actionButtonReply.setImageSize((int) (normalSize * scaleIcon));
holder.binding.actionButtonBoost.setImageSize((int) (normalSize * scaleIcon));
holder.binding.actionButtonFavorite.setImageSize((int) (normalSize * scaleIcon));
holder.binding.actionButtonBookmark.setImageSize((int) (normalSize * scaleIcon));
-
+ holder.binding.actionButtonQuote.setImageSize((int) (normalSize * scaleIcon));
+ holder.binding.actionButtonTranslate.setImageSize((int) (normalSize * scaleIcon));
+ holder.binding.actionButtonMaths.setImageSize((int) (normalSize * scaleIcon));
+ holder.binding.actionButtonMarkdown.setImageSize((int) (normalSize * scaleIcon));
+ holder.binding.statusAddCustomEmoji.setImageSize((int) (normalSize * scaleIcon));
+ holder.binding.statusEmoji.setImageSize((int) (normalSize * scaleIcon));
+ holder.binding.actionButtonMore.setImageSize((int) (normalSize * scaleIcon));
holder.binding.statusAddCustomEmoji.getLayoutParams().width = (int) (normalSize * scaleIcon);
holder.binding.statusAddCustomEmoji.getLayoutParams().height = (int) (normalSize * scaleIcon);
holder.binding.statusAddCustomEmoji.requestLayout();
- holder.binding.actionButtonQuote.getLayoutParams().width = (int) (normalSize * scaleIcon);
- holder.binding.actionButtonQuote.getLayoutParams().height = (int) (normalSize * scaleIcon);
- holder.binding.actionButtonQuote.requestLayout();
-
- holder.binding.statusEmoji.getLayoutParams().width = (int) (normalSize * scaleIcon);
- holder.binding.statusEmoji.getLayoutParams().height = (int) (normalSize * scaleIcon);
- holder.binding.actionButtonMore.getLayoutParams().width = (int) (normalSize * scaleIcon);
- holder.binding.actionButtonMore.getLayoutParams().height = (int) (normalSize * scaleIcon);
- holder.binding.actionButtonMore.requestLayout();
holder.binding.actionShare.getLayoutParams().width = (int) (normalSize * scaleIcon);
holder.binding.actionShare.getLayoutParams().height = (int) (normalSize * scaleIcon);
holder.binding.actionShare.requestLayout();
@@ -2090,14 +2071,9 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
}
} else {
- if (statusToDeal.extraFeaturesShown) {
- statusToDeal.extraFeaturesShown = false;
- adapter.notifyItemChanged(holder.getBindingAdapterPosition());
- } else {
- Intent intent = new Intent(context, ContextActivity.class);
- intent.putExtra(Helper.ARG_STATUS, statusToDeal);
- context.startActivity(intent);
- }
+ Intent intent = new Intent(context, ContextActivity.class);
+ intent.putExtra(Helper.ARG_STATUS, statusToDeal);
+ context.startActivity(intent);
}
}
});
@@ -2864,10 +2840,16 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
if (theme_icons_color != -1) {
Helper.changeDrawableColor(context, R.drawable.ic_round_reply_24, theme_icons_color);
- // Helper.changeDrawableColor(context, holder.binding.statusAddCustomEmoji, theme_icons_color);
- // Helper.changeDrawableColor(context, holder.binding.actionButtonQuote, theme_icons_color);
- // Helper.changeDrawableColor(context, holder.binding.statusEmoji, theme_icons_color);
- Helper.changeDrawableColor(context, holder.binding.actionButtonMore, theme_icons_color);
+
+ Helper.changeDrawableColor(context, R.drawable.ic_baseline_format_quote_24, theme_icons_color);
+ Helper.changeDrawableColor(context, R.drawable.ic_baseline_translate_24, theme_icons_color);
+ Helper.changeDrawableColor(context, R.drawable.ic_round_repeat_24, theme_icons_color);
+ Helper.changeDrawableColor(context, R.drawable.ic_baseline_functions_24, theme_icons_color);
+ Helper.changeDrawableColor(context, R.drawable.baseline_code_24, theme_icons_color);
+ Helper.changeDrawableColor(context, R.drawable.ic_baseline_emoji_emotions_24, theme_icons_color);
+ Helper.changeDrawableColor(context, R.drawable.ic_baseline_add_reaction_24, theme_icons_color);
+
+ Helper.changeDrawableColor(context, R.drawable.ic_round_more_horiz_24, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_round_star_24, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_round_repeat_24, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.visibility, theme_icons_color);
@@ -2875,11 +2857,20 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
Helper.changeDrawableColor(context, R.drawable.ic_person, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_bot, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_round_reply_24, theme_icons_color);
- // Helper.changeDrawableColor(context, holder.binding.actionButtonTranslate, theme_icons_color);
+
holder.binding.actionButtonBoost.setInActiveImageTintColor(theme_icons_color);
holder.binding.actionButtonFavorite.setInActiveImageTintColor(theme_icons_color);
holder.binding.actionButtonBookmark.setInActiveImageTintColor(theme_icons_color);
holder.binding.actionButtonReplyCount.setTextColor(theme_icons_color);
+
+ holder.binding.actionButtonQuote.setInActiveImageTintColor(theme_icons_color);
+ holder.binding.actionButtonTranslate.setInActiveImageTintColor(theme_icons_color);
+ holder.binding.actionButtonMaths.setInActiveImageTintColor(theme_icons_color);
+ holder.binding.actionButtonMarkdown.setInActiveImageTintColor(theme_icons_color);
+ holder.binding.statusAddCustomEmoji.setInActiveImageTintColor(theme_icons_color);
+ holder.binding.statusEmoji.setInActiveImageTintColor(theme_icons_color);
+ holder.binding.actionButtonMore.setInActiveImageTintColor(theme_icons_color);
+
}
if (theme_statuses_color != -1) {
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
diff --git a/app/src/main/res/layouts/mastodon/layout/drawer_status.xml b/app/src/main/res/layouts/mastodon/layout/drawer_status.xml
index 13f4d8714..f61e869cf 100644
--- a/app/src/main/res/layouts/mastodon/layout/drawer_status.xml
+++ b/app/src/main/res/layouts/mastodon/layout/drawer_status.xml
@@ -632,6 +632,7 @@
android:clipChildren="false"
android:clipToPadding="false">
+
<com.varunest.sparkbutton.SparkButton
android:id="@+id/action_button_reply"
android:layout_width="48dp"
@@ -733,111 +734,119 @@
app:animationSpeed="1.5"
app:inactiveImage="@drawable/ic_round_bookmark_border_24"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/action_button_extra"
+ app:layout_constraintEnd_toStartOf="@+id/action_button_extra_container"
app:layout_constraintStart_toEndOf="@+id/action_button_favorite"
app:layout_constraintTop_toTopOf="parent"
app:primaryColor="@color/marked_icon"
app:secondaryColor="@color/marked_icon"
sparkbutton:iconSize="28dp" />
- <com.varunest.sparkbutton.SparkButton
- android:id="@+id/action_button_extra"
- android:layout_width="48dp"
- android:layout_height="48dp"
- android:layout_gravity="center"
- android:adjustViewBounds="true"
- android:contentDescription="@string/set_extand_extra_features_title"
- app:activeImage="@drawable/baseline_more_actions"
- app:inactiveImage="@drawable/baseline_more_actions"
+ <HorizontalScrollView
+ android:id="@+id/action_button_extra_container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:fillViewport="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/action_button_more"
app:layout_constraintStart_toEndOf="@+id/action_button_bookmark"
- app:layout_constraintTop_toTopOf="parent"
- sparkbutton:iconSize="28dp" />
-
-
- <androidx.constraintlayout.helper.widget.Flow
- android:id="@+id/extra_features_panel"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/bg_compose_panels"
- android:padding="6dp"
- android:visibility="gone"
- app:constraint_referenced_ids="button_close_extra_features_panel, action_button_quote, action_button_translate, action_button_maths, status_add_custom_emoji, status_emoji, action_button_markdown"
- app:flow_horizontalGap="10dp"
- app:flow_horizontalStyle="spread_inside"
- app:flow_maxElementsWrap="10"
- app:flow_wrapMode="aligned"
- app:layout_constraintBottom_toBottomOf="@id/action_buttons"
- app:layout_constraintEnd_toEndOf="@id/action_button_extra" />
-
+ app:layout_constraintTop_toTopOf="parent">
- <com.google.android.material.button.MaterialButton
- android:id="@+id/button_close_extra_features_panel"
- style="@style/Widget.Material3.Button.IconButton.Outlined"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:icon="@drawable/ic_baseline_close_24" />
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/action_button_quote"
- style="@style/Widget.Material3.Button.IconButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:icon="@drawable/ic_baseline_format_quote_24" />
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/action_button_translate"
- style="@style/Widget.Material3.Button.IconButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:icon="@drawable/ic_baseline_translate_24" />
-
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/action_button_maths"
- style="@style/Widget.Material3.Button.IconButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:icon="@drawable/ic_baseline_functions_24" />
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/action_button_markdown"
- style="@style/Widget.Material3.Button.IconButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:icon="@drawable/baseline_code_24" />
+ <androidx.appcompat.widget.LinearLayoutCompat
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <com.varunest.sparkbutton.SparkButton
+ android:id="@+id/action_button_quote"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="center"
+ android:adjustViewBounds="true"
+ android:contentDescription="@string/quote"
+ app:activeImage="@drawable/ic_baseline_format_quote_24"
+ app:animationSpeed="1.5"
+ app:inactiveImage="@drawable/ic_baseline_format_quote_24"
+ sparkbutton:iconSize="28dp" />
+
+ <com.varunest.sparkbutton.SparkButton
+ android:id="@+id/action_button_translate"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="center"
+ android:adjustViewBounds="true"
+ android:contentDescription="@string/translate"
+ app:activeImage="@drawable/ic_baseline_translate_24"
+ app:animationSpeed="1.5"
+ app:inactiveImage="@drawable/ic_baseline_translate_24"
+ sparkbutton:iconSize="28dp" />
+
+ <com.varunest.sparkbutton.SparkButton
+ android:id="@+id/action_button_maths"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="center"
+ android:adjustViewBounds="true"
+ android:contentDescription="@string/formula"
+ app:activeImage="@drawable/ic_baseline_functions_24"
+ app:animationSpeed="1.5"
+ app:inactiveImage="@drawable/ic_baseline_functions_24"
+ sparkbutton:iconSize="28dp" />
+
+ <com.varunest.sparkbutton.SparkButton
+ android:id="@+id/action_button_markdown"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="center"
+ android:adjustViewBounds="true"
+ android:contentDescription="@string/markdown"
+ app:activeImage="@drawable/baseline_code_24"
+ app:animationSpeed="1.5"
+ app:inactiveImage="@drawable/baseline_code_24"
+ sparkbutton:iconSize="28dp" />
+
+ <com.varunest.sparkbutton.SparkButton
+ android:id="@+id/status_add_custom_emoji"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="center"
+ android:adjustViewBounds="true"
+ android:contentDescription="@string/add_reaction"
+ app:activeImage="@drawable/ic_baseline_emoji_emotions_24"
+ app:animationSpeed="1.5"
+ app:inactiveImage="@drawable/ic_baseline_emoji_emotions_24"
+ sparkbutton:iconSize="28dp" />
+
+ <com.varunest.sparkbutton.SparkButton
+ android:id="@+id/status_emoji"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="center"
+ android:adjustViewBounds="true"
+ android:contentDescription="@string/add_reaction"
+ app:activeImage="@drawable/ic_baseline_add_reaction_24"
+ app:animationSpeed="1.5"
+ app:inactiveImage="@drawable/ic_baseline_add_reaction_24"
+ sparkbutton:iconSize="28dp" />
- <com.google.android.material.button.MaterialButton
- android:id="@+id/status_add_custom_emoji"
- style="@style/Widget.Material3.Button.IconButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:icon="@drawable/ic_baseline_emoji_emotions_24" />
+ </androidx.appcompat.widget.LinearLayoutCompat>
- <com.google.android.material.button.MaterialButton
- android:id="@+id/status_emoji"
- style="@style/Widget.Material3.Button.IconButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:icon="@drawable/ic_baseline_add_reaction_24" />
+ </HorizontalScrollView>
- <androidx.appcompat.widget.AppCompatImageView
+ <com.varunest.sparkbutton.SparkButton
android:id="@+id/action_button_more"
- android:layout_width="28dp"
- android:layout_height="28dp"
- android:layout_gravity="center|end"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="center"
android:adjustViewBounds="true"
- android:background="@color/transparent"
- android:clickable="true"
android:contentDescription="@string/display_options"
- android:focusable="true"
+ app:activeImage="@drawable/ic_round_more_horiz_24"
+ app:inactiveImage="@drawable/ic_round_more_horiz_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
- app:srcCompat="@drawable/ic_round_more_horiz_24" />
+ sparkbutton:iconSize="28dp" />
+
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index aeff5353f..635361c63 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1928,6 +1928,7 @@
<string name="set_disable_release_notes">Disable release notes</string>
<string name="set_disable_release_notes_indication">When a new version is published, you will not be alerted inside the app.</string>
<string name="formula">Formula</string>
+ <string name="markdown">Markdown</string>
<string name="set_maths_support">Write formula</string>
<string name="maths_format">Maths format</string>
<string name="hide_single_media_with_card">Hide single media when there is a link preview</string>