add About section

This commit is contained in:
tibbi 2016-06-02 15:47:13 +02:00
parent b7b5f8e8e8
commit 0bf05bfc53
13 changed files with 141 additions and 3 deletions

View File

@ -17,12 +17,18 @@
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:theme="@style/FullScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".AboutActivity"
android:label="@string/about"
android:screenOrientation="portrait"/>
</application>
</manifest>

View File

@ -0,0 +1,52 @@
package com.simplemobiletools.camera;
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.BindView;
import butterknife.ButterKnife;
public class AboutActivity extends AppCompatActivity {
@BindView(R.id.about_copyright) TextView copyright;
@BindView(R.id.about_version) TextView version;
@BindView(R.id.about_email) TextView emailTV;
private Resources res;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_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 = "<a href=\"mailto:" + email + "?subject=" + appName + "\">" + email + "</a>";
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);
}
}

View File

@ -1,5 +1,6 @@
package com.simplemobiletools.camera;
import android.content.Intent;
import android.hardware.Camera;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
@ -75,6 +76,12 @@ public class MainActivity extends AppCompatActivity {
preview.takePicture();
}
@OnClick(R.id.about)
public void launchAbout() {
final Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
startActivity(intent);
}
private void hideNavigationBarIcons() {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
}

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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_margin="@dimen/activity_margin">
<TextView
android:id="@+id/about_website"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:text="@string/website"/>
<TextView
android:id="@+id/about_email_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/about_website"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/email_label"/>
<TextView
android:id="@+id/about_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/about_email_label"
android:text="@string/email"/>
<TextView
android:id="@+id/about_license"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/about_email"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/license"/>
<TextView
android:id="@+id/about_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/about_copyright"
android:gravity="center_horizontal"
android:text="v 1.0"/>
<TextView
android:id="@+id/about_copyright"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:text="Copyright © Simple Mobile Tools 2000"/>
</RelativeLayout>

View File

@ -10,6 +10,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/about"
android:layout_width="@dimen/side_icon_size"
android:layout_height="@dimen/side_icon_size"
android:layout_alignParentRight="true"
android:layout_margin="@dimen/activity_margin"
android:src="@mipmap/about"/>
<LinearLayout
android:id="@+id/btn_holder"
android:layout_width="match_parent"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -1,7 +1,6 @@
<resources>
<style name="AppTheme" parent="AppTheme.Base">
<style name="FullScreenTheme" parent="AppTheme.Base">
<item name="android:windowTranslucentNavigation">true</item>
</style>
</resources>

View File

@ -1,4 +1,13 @@
<resources>
<string name="app_name">Simple Camera</string>
<string name="camera_open_error">An error occurred at obtaining the camera</string>
<!-- About -->
<string name="about">About</string>
<string name="website">For more simple apps please visit:\nhttp://simplemobiletools.com</string>
<string name="email_label">You can send your feedback and new app suggestions at:</string>
<string name="email">hello@simplemobiletools.com</string>
<string name="license">License</string>
<string name="version">v %1$s</string>
<string name="copyright">Copyright © Simple Mobile Tools %1$d</string>
</resources>

View File

@ -9,6 +9,8 @@
<item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item>
</style>
<style name="FullScreenTheme" parent="AppTheme.Base"/>
<style name="AppTheme.ActionBarStyle" parent="@style/Base.Widget.AppCompat.ActionBar">
<item name="background">@color/colorPrimary</item>
<item name="titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>