From baf552ea093cdf21dcd85355fa02ba9ea4135334 Mon Sep 17 00:00:00 2001 From: Kosh Date: Sat, 18 Mar 2017 20:01:17 +0800 Subject: [PATCH] made repo interaction icons to has bigger clickable area to fix #137 --- .../ui/modules/feeds/FeedsPresenter.java | 10 +- .../ui/modules/repos/RepoPagerView.java | 36 ++++-- .../ui/widgets/ForegroundImageView.java | 21 ++- .../layout-land/header_title_with_toolbar.xml | 65 +--------- .../header_title_with_toolbar.xml | 66 +--------- .../layout/header_title_with_toolbar.xml | 66 +--------- .../layout/repo_header_icons_layout.xml | 121 ++++++++++++++++++ .../layout/title_header_layout.xml | 5 +- 8 files changed, 170 insertions(+), 220 deletions(-) create mode 100644 app/src/main/res/layouts/main_layouts/layout/repo_header_icons_layout.xml diff --git a/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsPresenter.java index f1a7477c..fd765da7 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsPresenter.java +++ b/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsPresenter.java @@ -7,11 +7,11 @@ import android.view.View; import com.annimon.stream.Collectors; import com.annimon.stream.Stream; +import com.fastaccess.data.dao.NameParser; +import com.fastaccess.data.dao.SimpleUrlsModel; import com.fastaccess.data.dao.model.Event; import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.NameParser; import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.data.dao.SimpleUrlsModel; import com.fastaccess.data.dao.types.EventsType; import com.fastaccess.helper.InputHelper; import com.fastaccess.helper.RxHelper; @@ -107,14 +107,14 @@ class FeedsPresenter extends BasePresenter implements FeedsMvp.Pr RepoPagerView.startRepoPager(v.getContext(), parser); } else { if (item.getPayload() != null && item.getPayload().getIssue() != null) { - SchemeParser.launchUri(v.getContext(), Uri.parse(item.getPayload().getIssue().getHtmlUrl())); + SchemeParser.launchUri(v.getContext(), Uri.parse(item.getPayload().getIssue().getHtmlUrl()), true); } else if (item.getPayload() != null && item.getPayload().getPullRequest() != null) { - SchemeParser.launchUri(v.getContext(), Uri.parse(item.getPayload().getPullRequest().getHtmlUrl())); + SchemeParser.launchUri(v.getContext(), Uri.parse(item.getPayload().getPullRequest().getHtmlUrl()), true); } else { Repo repoModel = item.getRepo(); String name = InputHelper.isEmpty(repoModel.getName()) ? repoModel.getFullName() : repoModel.getName(); if (name == null) return; - if (item.getRepo() != null) SchemeParser.launchUri(v.getContext(), Uri.parse(name)); + if (item.getRepo() != null) SchemeParser.launchUri(v.getContext(), Uri.parse(name), true); } } } diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerView.java b/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerView.java index 7666a14d..6803af20 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerView.java +++ b/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerView.java @@ -15,6 +15,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; +import android.widget.LinearLayout; import com.fastaccess.R; import com.fastaccess.data.dao.NameParser; @@ -33,6 +34,7 @@ import com.fastaccess.ui.modules.repos.code.RepoCodePagerView; import com.fastaccess.ui.modules.repos.issues.RepoIssuesPagerView; import com.fastaccess.ui.widgets.AvatarLayout; import com.fastaccess.ui.widgets.FontTextView; +import com.fastaccess.ui.widgets.ForegroundImageView; import com.fastaccess.ui.widgets.color.ColorGenerator; import com.fastaccess.ui.widgets.dialog.MessageDialogView; @@ -66,6 +68,13 @@ public class RepoPagerView extends BaseActivity { - if (toast != null) toast.cancel(); - toast = Toast.makeText(getContext(), getContentDescription(), Toast.LENGTH_SHORT); - toast.setGravity(Gravity.CENTER, 0, 0); - toast.show(); - return true; - }); + if (getContentDescription() != null) { + setOnLongClickListener(view -> { + if (toast != null) toast.cancel(); + toast = Toast.makeText(getContext(), getContentDescription(), Toast.LENGTH_SHORT); + toast.setGravity(Gravity.CENTER, 0, 0); + toast.show(); + return true; + }); + } } public ForegroundImageView(Context context, AttributeSet attrs, int defStyleAttr) { @@ -113,6 +116,10 @@ public class ForegroundImageView extends AppCompatImageView { } } + public void tintDrawableColor(@ColorInt int colorRes) { + tintDrawableFromColor(colorRes); + } + public void tintDrawable(@ColorRes int colorRes) { tintDrawableFromColor(ContextCompat.getColor(getContext(), colorRes)); } diff --git a/app/src/main/res/layouts/main_layouts/layout-land/header_title_with_toolbar.xml b/app/src/main/res/layouts/main_layouts/layout-land/header_title_with_toolbar.xml index 6b766fb7..1d445ee0 100644 --- a/app/src/main/res/layouts/main_layouts/layout-land/header_title_with_toolbar.xml +++ b/app/src/main/res/layouts/main_layouts/layout-land/header_title_with_toolbar.xml @@ -21,70 +21,7 @@ android:minHeight="?actionBarSize" app:theme="@style/ToolbarStyleDark"> - - - - - - - - - - + diff --git a/app/src/main/res/layouts/main_layouts/layout-large/header_title_with_toolbar.xml b/app/src/main/res/layouts/main_layouts/layout-large/header_title_with_toolbar.xml index e3eaceb4..bdb6c0e6 100644 --- a/app/src/main/res/layouts/main_layouts/layout-large/header_title_with_toolbar.xml +++ b/app/src/main/res/layouts/main_layouts/layout-large/header_title_with_toolbar.xml @@ -21,71 +21,7 @@ android:minHeight="?actionBarSize" app:theme="@style/ToolbarStyleDark"> - - - - - - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/header_title_with_toolbar.xml b/app/src/main/res/layouts/main_layouts/layout/header_title_with_toolbar.xml index b346cd54..f826442b 100644 --- a/app/src/main/res/layouts/main_layouts/layout/header_title_with_toolbar.xml +++ b/app/src/main/res/layouts/main_layouts/layout/header_title_with_toolbar.xml @@ -3,7 +3,6 @@ android:id="@+id/appbar" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/transparent" @@ -20,70 +19,7 @@ android:minHeight="?actionBarSize" app:theme="@style/ToolbarStyleDark"> - - - - - - - - - - + diff --git a/app/src/main/res/layouts/main_layouts/layout/repo_header_icons_layout.xml b/app/src/main/res/layouts/main_layouts/layout/repo_header_icons_layout.xml new file mode 100644 index 00000000..caa3d7bf --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/repo_header_icons_layout.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/title_header_layout.xml b/app/src/main/res/layouts/main_layouts/layout/title_header_layout.xml index 4a3e2d63..4b33521f 100644 --- a/app/src/main/res/layouts/main_layouts/layout/title_header_layout.xml +++ b/app/src/main/res/layouts/main_layouts/layout/title_header_layout.xml @@ -47,12 +47,13 @@ android:textColor="@color/primary_text" tools:text="One must invent the visitor in order to Bliss happens when you follow art so compassionately that whatsoever you are luring is your relativity.praise the sinner of remarkable vision."/> - @@ -60,7 +61,7 @@