Browse Source

include privacy policy in about

pull/61/merge
Thodoris1999 6 years ago
parent
commit
98cad92f40
  1. 10
      app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java
  2. 2
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  3. 24
      app/src/main/res/layout/activity_about.xml
  4. 1
      app/src/main/res/values/strings.xml

10
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

2
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));

24
app/src/main/res/layout/activity_about.xml

@ -128,13 +128,35 @@
android:text="@string/the_mit_libraries"
android:textColor="@color/accent" />
<TextView
android:id="@+id/privacy_policy_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/mit_libs"
android:layout_marginTop="20dp"
android:text="@string/privacy_policy"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/accent"
android:textStyle="bold"/>
<TextView
android:id="@+id/privacy_policy_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/contact_header"
android:autoLink="email|web"
android:text="@string/contact_text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/iron" />
<TextView
android:id="@+id/contact_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/mit_libs"
android:layout_below="@+id/privacy_policy_header"
android:layout_marginTop="20dp"
android:text="@string/contact"
android:textAppearance="?android:attr/textAppearanceMedium"

1
app/src/main/res/values/strings.xml

@ -89,6 +89,7 @@
<string name="open_source">Open Source</string>
<string name="open_source_text">The source code of mTHMMY can be found on Github (https://github.com/ThmmyNoLife/mTHMMY) along with further details of how one can contribute.</string>
<string name="trollPic">You should see a funny pic!</string>
<string name="privacy_policy">Privacy policy</string>
<!--Bookmarks-->
<string name="remove_bookmark">Remove</string>

Loading…
Cancel
Save