From 4ac9b18fd57e2deb9fc4255358c1f45b26d454fa Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 6 Apr 2016 23:12:17 +0200 Subject: [PATCH] add a couple info in the About section --- app/src/main/AndroidManifest.xml | 1 + .../calculator/AboutActivity.java | 40 +++++++++++++++++- app/src/main/res/layout/activity_about.xml | 41 ++++++++++++++++++- app/src/main/res/values/strings.xml | 5 +++ 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f8239d6..e36a202 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -42,6 +42,7 @@ diff --git a/app/src/main/java/com/simplemobiletools/calculator/AboutActivity.java b/app/src/main/java/com/simplemobiletools/calculator/AboutActivity.java index 392698d..562b39c 100644 --- a/app/src/main/java/com/simplemobiletools/calculator/AboutActivity.java +++ b/app/src/main/java/com/simplemobiletools/calculator/AboutActivity.java @@ -1,14 +1,52 @@ package com.simplemobiletools.calculator; +import android.content.res.Resources; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.text.method.LinkMovementMethod; +import android.widget.TextView; + +import java.util.Calendar; + +import butterknife.Bind; +import butterknife.ButterKnife; public class AboutActivity extends AppCompatActivity { + @Bind(R.id.about_copyright) TextView copyright; + @Bind(R.id.about_version) TextView version; + @Bind(R.id.about_email) TextView emailTV; + private Resources res; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); - setTitle(getResources().getString(R.string.about)); + ButterKnife.bind(this); + res = getResources(); + + setupEmail(); + setupVersion(); + setupCopyright(); + } + + private void setupEmail() { + final String email = res.getString(R.string.email); + final String appName = res.getString(R.string.app_name); + final String href = "" + email + ""; + emailTV.setText(Html.fromHtml(href)); + emailTV.setMovementMethod(LinkMovementMethod.getInstance()); + } + + private void setupVersion() { + final String versionName = BuildConfig.VERSION_NAME; + final String versionText = String.format(res.getString(R.string.version), versionName); + version.setText(versionText); + } + + private void setupCopyright() { + final int year = Calendar.getInstance().get(Calendar.YEAR); + final String copyrightText = String.format(res.getString(R.string.copyright), year); + copyright.setText(copyrightText); } } diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index cb8fc40..2e57f14 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -3,4 +3,43 @@ android:id="@+id/about_holder" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent"/> + android:layout_height="match_parent" + android:layout_margin="@dimen/activity_margin"> + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8eec160..69259c2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,9 @@ Simple Calculator About + For more simple apps please visit:\nhttp://simplemobiletools.com + You can send your feedback and new app suggestions at: + hello@simplemobiletools.com + v %1$s + Copyright © Simple Mobile Tools %1$d