From ac13e06128ce4c58e7279dfabde0476ee8141baa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 May 2021 01:05:09 +0000 Subject: [PATCH 1/2] Bump appcompat from 1.2.0 to 1.3.0 Bumps appcompat from 1.2.0 to 1.3.0. Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2b28719f87..61dc052399 100644 --- a/build.gradle +++ b/build.gradle @@ -285,7 +285,7 @@ dependencies { implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.google.android.material:material:1.3.0' implementation 'com.jakewharton:disklrucache:2.0.2' - implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.exifinterface:exifinterface:1.3.2' implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1" From 7f82183bad2db38bd292db411f956514cbc909b6 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 20 May 2021 08:42:20 +0200 Subject: [PATCH 2/2] Fix: Using android:onClick on older version of the platform is broken Move to view bindings Signed-off-by: tobiasKaminsky --- .../ui/activity/CommunityActivity.java | 60 ++++++++----------- src/main/res/layout/community_layout.xml | 7 +-- 2 files changed, 28 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java b/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java index a19f364d85..11ad51cf26 100644 --- a/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java @@ -25,26 +25,28 @@ import android.os.Bundle; import android.text.Html; import android.text.method.LinkMovementMethod; import android.view.MenuItem; -import android.view.View; import android.widget.TextView; import com.google.android.material.button.MaterialButton; import com.owncloud.android.R; +import com.owncloud.android.databinding.CommunityLayoutBinding; import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.theme.ThemeButtonUtils; import com.owncloud.android.utils.theme.ThemeColorUtils; -import com.owncloud.android.utils.theme.ThemeUtils; /** * Activity providing information about ways to participate in the app's development. */ public class CommunityActivity extends DrawerActivity { + private CommunityLayoutBinding binding; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.community_layout); + binding = CommunityLayoutBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); // setup toolbar setupToolbar(); @@ -58,17 +60,16 @@ public class CommunityActivity extends DrawerActivity { } private void setupContent() { - TextView rcView = findViewById(R.id.community_release_candidate_text); - rcView.setMovementMethod(LinkMovementMethod.getInstance()); + binding.communityReleaseCandidateText.setMovementMethod(LinkMovementMethod.getInstance()); - TextView contributeIrcView = findViewById(R.id.community_contribute_irc_text); + TextView contributeIrcView = binding.communityContributeIrcText; contributeIrcView.setMovementMethod(LinkMovementMethod.getInstance()); contributeIrcView.setText(Html.fromHtml(getString(R.string.community_contribute_irc_text) + " " + getString(R.string.community_contribute_irc_text_link, ThemeColorUtils.primaryColorToHexString(this), getString(R.string.irc_weblink)))); - TextView contributeForumView = findViewById(R.id.community_contribute_forum_text); + TextView contributeForumView = binding.communityContributeForumText; contributeForumView.setMovementMethod(LinkMovementMethod.getInstance()); contributeForumView.setText(Html.fromHtml(getString(R.string.community_contribute_forum_text) + " " + getString(R.string.community_contribute_forum_text_link, @@ -76,7 +77,7 @@ public class CommunityActivity extends DrawerActivity { getString(R.string.help_link), getString(R.string.community_contribute_forum_forum)))); - TextView contributeTranslationView = findViewById(R.id.community_contribute_translate_text); + TextView contributeTranslationView = binding.communityContributeTranslateText; contributeTranslationView.setMovementMethod(LinkMovementMethod.getInstance()); contributeTranslationView.setText(Html.fromHtml( getString(R.string.community_contribute_translate_link, @@ -85,7 +86,7 @@ public class CommunityActivity extends DrawerActivity { getString(R.string.community_contribute_translate_translate)) + " " + getString(R.string.community_contribute_translate_text))); - TextView contributeGithubView = findViewById(R.id.community_contribute_github_text); + TextView contributeGithubView = binding.communityContributeGithubText; contributeGithubView.setMovementMethod(LinkMovementMethod.getInstance()); contributeGithubView.setText(Html.fromHtml( getString(R.string.community_contribute_github_text, @@ -93,43 +94,34 @@ public class CommunityActivity extends DrawerActivity { ThemeColorUtils.primaryColorToHexString(this), getString(R.string.contributing_link))))); - MaterialButton reportButton = findViewById(R.id.community_testing_report); + MaterialButton reportButton = binding.communityTestingReport; ThemeButtonUtils.colorPrimaryButton(reportButton, this); reportButton.setOnClickListener(v -> DisplayUtils.startLinkIntent(this, R.string.report_issue_link)); - } - public void onGetBetaFDroidClick(View view) { - DisplayUtils.startLinkIntent(this, R.string.fdroid_beta_link); - } + binding.communityBetaFdroid.setOnClickListener( + l -> DisplayUtils.startLinkIntent(this, R.string.fdroid_beta_link)); - public void onGetRCFDroidClick(View view) { - DisplayUtils.startLinkIntent(this, R.string.fdroid_link); - } + binding.communityReleaseCandidateFdroid.setOnClickListener( + l -> DisplayUtils.startLinkIntent(this, R.string.fdroid_link)); - public void onGetRCPlayStoreClick(View view) { - DisplayUtils.startLinkIntent(this, R.string.play_store_register_beta); - } + binding.communityReleaseCandidatePlaystore.setOnClickListener( + l -> DisplayUtils.startLinkIntent(this, R.string.play_store_register_beta)); - public void onGetBetaApkClick(View view) { - DisplayUtils.startLinkIntent(this, R.string.beta_apk_link); + binding.communityBetaApk.setOnClickListener( + l -> DisplayUtils.startLinkIntent(this, R.string.beta_apk_link)); } @Override public boolean onOptionsItemSelected(MenuItem item) { boolean retval = true; - switch (item.getItemId()) { - case android.R.id.home: { - if (isDrawerOpen()) { - closeDrawer(); - } else { - openDrawer(); - } - break; + if (item.getItemId() == android.R.id.home) { + if (isDrawerOpen()) { + closeDrawer(); + } else { + openDrawer(); } - - default: - retval = super.onOptionsItemSelected(item); - break; + } else { + retval = super.onOptionsItemSelected(item); } return retval; } diff --git a/src/main/res/layout/community_layout.xml b/src/main/res/layout/community_layout.xml index 0fd8e127c5..050cc46534 100755 --- a/src/main/res/layout/community_layout.xml +++ b/src/main/res/layout/community_layout.xml @@ -24,7 +24,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true" - android:fitsSystemWindows="true"> + android:fitsSystemWindows="true" + android:focusable="true"> @@ -150,7 +150,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/bg_default" - android:onClick="onGetRCPlayStoreClick" android:padding="@dimen/zero" android:src="@drawable/playstore" android:contentDescription="@string/community_rc_play_store" /> @@ -181,7 +180,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/bg_default" - android:onClick="onGetBetaFDroidClick" android:padding="@dimen/zero" android:src="@drawable/fdroid" android:contentDescription="@string/community_dev_fdroid" /> @@ -191,7 +189,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/bg_default" - android:onClick="onGetBetaApkClick" android:padding="@dimen/zero" android:src="@drawable/apk" android:contentDescription="@string/community_dev_direct_download" />