From 98cad92f403c9c0bac9602d708e7db3a42cc6d81 Mon Sep 17 00:00:00 2001 From: Thodoris1999 Date: Sun, 14 Oct 2018 13:15:27 +0300 Subject: [PATCH] include privacy policy in about --- .../mthmmy/activities/AboutActivity.java | 10 ++++++++ .../gr/thmmy/mthmmy/base/BaseActivity.java | 2 +- app/src/main/res/layout/activity_about.xml | 24 ++++++++++++++++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java index 896a5fb5..34ed4c32 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java @@ -6,6 +6,9 @@ import android.support.design.widget.AppBarLayout; import android.support.design.widget.CoordinatorLayout; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AlertDialog; +import android.text.SpannableString; +import android.text.method.LinkMovementMethod; +import android.text.style.UnderlineSpan; import android.view.LayoutInflater; import android.view.View; import android.webkit.WebView; @@ -81,6 +84,13 @@ public class AboutActivity extends BaseActivity { }); } + TextView privacyPolicy = findViewById(R.id.privacy_policy_header); + privacyPolicy.setMovementMethod(new LinkMovementMethod()); + SpannableString spannableString = new SpannableString(privacyPolicy.getText()); + spannableString.setSpan(new UnderlineSpan(), 0, spannableString.length(), 0); + privacyPolicy.setText(spannableString); + privacyPolicy.setOnClickListener(view -> showPrivacyPolicyDialog()); + } @Override diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java index fc492b7a..79b377ea 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java @@ -754,7 +754,7 @@ public abstract class BaseActivity extends AppCompatActivity { alertDialog.show(); } - private void showPrivacyPolicyDialog() { + protected void showPrivacyPolicyDialog() { TextView privacyPolicyTextView = new TextView(this); privacyPolicyTextView.setPadding(30,20,30,20); privacyPolicyTextView.setTextColor(ContextCompat.getColor(this, R.color.primary_text)); diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 020c6e03..c4ecc43d 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -128,13 +128,35 @@ android:text="@string/the_mit_libraries" android:textColor="@color/accent" /> + + + Open Source The source code of mTHMMY can be found on Github (https://github.com/ThmmyNoLife/mTHMMY) along with further details of how one can contribute. You should see a funny pic! + Privacy policy Remove