From 1fc88d9ec8cadcc0254e8ea69a185fb50fcb3d08 Mon Sep 17 00:00:00 2001 From: Kasun Date: Mon, 17 Jun 2019 08:50:54 +0530 Subject: [PATCH 1/3] Make tooltips appear in SDK < 26 --- .../app/fedilab/android/drawers/StatusListAdapter.java | 9 +++++++++ app/src/main/res/layout/drawer_status.xml | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java index 2a7247138..577c84b1e 100644 --- a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java @@ -34,6 +34,7 @@ import android.os.CountDownTimer; import android.os.Environment; import android.os.Handler; import androidx.annotation.NonNull; +import androidx.appcompat.widget.TooltipCompat; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; import androidx.appcompat.app.AlertDialog; @@ -1001,6 +1002,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct } if( holder.fedilab_features != null) { + TooltipCompat.setTooltipText(holder.fedilab_features, context.getString(R.string.app_features)); holder.fedilab_features.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -1029,11 +1031,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct else holder.custom_feature_bookmark.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark_white)); + TooltipCompat.setTooltipText(holder.custom_feature_translate, context.getString(R.string.translate)); holder.custom_feature_translate.setOnClickListener(view -> { translateToot(status); status.setCustomFeaturesDisplayed(false); notifyStatusChanged(status); }); + holder.custom_feature_bookmark.setOnClickListener(view -> { bookmark(status); status.setCustomFeaturesDisplayed(false); @@ -1045,24 +1049,29 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct notifyStatusChanged(status); return false; }); + + TooltipCompat.setTooltipText(holder.custom_feature_timed_mute, context.getString(R.string.timed_mute)); holder.custom_feature_timed_mute.setOnClickListener(view -> { timedMuteAction(status); status.setCustomFeaturesDisplayed(false); notifyStatusChanged(status); }); + TooltipCompat.setTooltipText(holder.custom_feature_schedule, context.getString(R.string.schedule_boost)); holder.custom_feature_schedule.setOnClickListener(view -> { scheduleBoost(status); status.setCustomFeaturesDisplayed(false); notifyStatusChanged(status); }); + TooltipCompat.setTooltipText(holder.custom_feature_mention, context.getString(R.string.mention_status)); holder.custom_feature_mention.setOnClickListener(view -> { mention(status); status.setCustomFeaturesDisplayed(false); notifyStatusChanged(status); }); + TooltipCompat.setTooltipText(holder.custom_feature_cache, context.getString(R.string.refresh_cache)); holder.custom_feature_cache.setOnClickListener(view -> { new ManageCachedStatusAsyncTask(context, status.getId(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); status.setCustomFeaturesDisplayed(false); diff --git a/app/src/main/res/layout/drawer_status.xml b/app/src/main/res/layout/drawer_status.xml index 1cc4037da..113b2cdb9 100644 --- a/app/src/main/res/layout/drawer_status.xml +++ b/app/src/main/res/layout/drawer_status.xml @@ -201,7 +201,6 @@ android:padding="2dp" android:scaleType="fitCenter" android:src="@drawable/ic_logo_button" - android:tooltipText="@string/app_features" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@id/status_pp_section" app:layout_constraintStart_toStartOf="@id/status_pp_section" @@ -948,7 +947,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="5dp" - android:layout_marginLeft="5dp" android:background="@color/custom_features_panel_background" android:paddingStart="2dp" android:paddingTop="4dp" @@ -969,7 +967,6 @@ android:background="@color/mastodonC4" android:contentDescription="@string/bookmark_add" android:src="@drawable/ic_bookmark_white" - android:tooltipText="@string/bookmark_add" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/custom_feature_translate" app:layout_constraintStart_toStartOf="parent" @@ -985,7 +982,6 @@ android:background="@color/mastodonC4" android:contentDescription="@string/translate" android:src="@drawable/ic_translate_white" - android:tooltipText="@string/translate" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/custom_feature_timed_mute" app:layout_constraintStart_toEndOf="@id/custom_feature_bookmark" @@ -1001,7 +997,6 @@ android:background="@color/mastodonC4" android:contentDescription="@string/timed_mute" android:src="@drawable/ic_timelapse" - android:tooltipText="@string/timed_mute" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/custom_feature_schedule" app:layout_constraintStart_toEndOf="@id/custom_feature_translate" @@ -1017,7 +1012,6 @@ android:background="@color/mastodonC4" android:contentDescription="@string/schedule" android:src="@drawable/ic_schedule" - android:tooltipText="@string/schedule_boost" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/custom_feature_mention" app:layout_constraintStart_toEndOf="@id/custom_feature_timed_mute" @@ -1034,7 +1028,6 @@ android:background="@color/mastodonC4" android:contentDescription="@string/mention_account" android:src="@drawable/ic_mention_white" - android:tooltipText="@string/mention_status" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/custom_feature_cache" app:layout_constraintStart_toEndOf="@id/custom_feature_schedule" @@ -1050,7 +1043,6 @@ android:background="@color/mastodonC4" android:contentDescription="@string/refresh_cache" android:src="@drawable/ic_refresh" - android:tooltipText="@string/refresh_cache" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/custom_feature_mention" From eed9c6ee3d268a77de167fb3f711e19653379e3f Mon Sep 17 00:00:00 2001 From: Kasun Date: Mon, 17 Jun 2019 14:12:48 +0530 Subject: [PATCH 2/3] new icons for 'timed mute' and 'schedule boost' --- app/src/main/res/drawable/ic_schedule_boost.xml | 15 +++++++++++++++ app/src/main/res/drawable/ic_timed_mute.xml | 15 +++++++++++++++ app/src/main/res/layout/drawer_status.xml | 4 ++-- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/ic_schedule_boost.xml create mode 100644 app/src/main/res/drawable/ic_timed_mute.xml diff --git a/app/src/main/res/drawable/ic_schedule_boost.xml b/app/src/main/res/drawable/ic_schedule_boost.xml new file mode 100644 index 000000000..87aee6942 --- /dev/null +++ b/app/src/main/res/drawable/ic_schedule_boost.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_timed_mute.xml b/app/src/main/res/drawable/ic_timed_mute.xml new file mode 100644 index 000000000..69b580ed5 --- /dev/null +++ b/app/src/main/res/drawable/ic_timed_mute.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/layout/drawer_status.xml b/app/src/main/res/layout/drawer_status.xml index 113b2cdb9..0140a5ae6 100644 --- a/app/src/main/res/layout/drawer_status.xml +++ b/app/src/main/res/layout/drawer_status.xml @@ -996,7 +996,7 @@ android:layout_marginEnd="2dp" android:background="@color/mastodonC4" android:contentDescription="@string/timed_mute" - android:src="@drawable/ic_timelapse" + android:src="@drawable/ic_timed_mute" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/custom_feature_schedule" app:layout_constraintStart_toEndOf="@id/custom_feature_translate" @@ -1011,7 +1011,7 @@ android:layout_marginEnd="2dp" android:background="@color/mastodonC4" android:contentDescription="@string/schedule" - android:src="@drawable/ic_schedule" + android:src="@drawable/ic_schedule_boost" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/custom_feature_mention" app:layout_constraintStart_toEndOf="@id/custom_feature_timed_mute" From 13bd2d2e39327f868503179bdd936c3100ca0e5c Mon Sep 17 00:00:00 2001 From: Kasun Date: Mon, 17 Jun 2019 14:21:18 +0530 Subject: [PATCH 3/3] increase timed mute icon size --- app/src/main/res/drawable/ic_timed_mute.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/drawable/ic_timed_mute.xml b/app/src/main/res/drawable/ic_timed_mute.xml index 69b580ed5..050d278c8 100644 --- a/app/src/main/res/drawable/ic_timed_mute.xml +++ b/app/src/main/res/drawable/ic_timed_mute.xml @@ -5,11 +5,11 @@ android:viewportHeight="24"> + android:pathData="m3.4192,8.25l0,7.5l5,0l1.3218,1.3218c0,-2.8299 2.4641,-5.6597 4.9282,-5.6597L14.6692,9.507 14.6692,2L8.4192,8.25Z" /> + android:pathData="m15.6526,12.1436c-2.713,0 -4.9282,2.2152 -4.9282,4.9282 0,2.713 2.2152,4.9282 4.9282,4.9282 2.713,0 4.9282,-2.2152 4.9282,-4.9282 0,-2.713 -2.2152,-4.9282 -4.9282,-4.9282zM15.6526,13.6221c1.9145,0 3.4515,1.5352 3.4515,3.4497 0,1.9145 -1.537,3.4515 -3.4515,3.4515 -1.9145,0 -3.4497,-1.537 -3.4497,-3.4515 0,-1.9145 1.5352,-3.4497 3.4497,-3.4497z" /> + android:pathData="m15.6526,14.1776a2.8942,2.8942 135,0 1,2.7956 2.1451,2.8942 2.8942,0 0,1 -1.3485,3.2555 2.8942,2.8942 135,0 1,-3.4936 -0.4599l2.0465,-2.0465z" />