mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
add About section
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity
|
<activity
|
||||||
android:name="com.simplemobiletools.calendar.MainActivity"
|
android:name=".MainActivity"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.simplemobiletools.calendar.MyWidgetProvider"
|
android:name=".MyWidgetProvider"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="Simple Calendar">
|
android:label="Simple Calendar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@@ -33,13 +33,18 @@
|
|||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.simplemobiletools.calendar.MyWidgetConfigure"
|
android:name=".MyWidgetConfigure"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/MyWidgetConfigTheme">
|
android:theme="@style/MyWidgetConfigTheme">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".AboutActivity"
|
||||||
|
android:label="@string/about"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@@ -0,0 +1,52 @@
|
|||||||
|
package com.simplemobiletools.calendar;
|
||||||
|
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,12 +1,16 @@
|
|||||||
package com.simplemobiletools.calendar;
|
package com.simplemobiletools.calendar;
|
||||||
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.DatePicker;
|
import android.widget.DatePicker;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
@@ -62,6 +66,25 @@ public class MainActivity extends AppCompatActivity implements Calendar {
|
|||||||
calendar.updateCalendar(new DateTime());
|
calendar.updateCalendar(new DateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.menu, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.about:
|
||||||
|
final Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateDays(List<Day> days) {
|
private void updateDays(List<Day> days) {
|
||||||
final int len = days.size();
|
final int len = days.size();
|
||||||
|
|
||||||
|
55
app/src/main/res/layout/activity_about.xml
Normal file
55
app/src/main/res/layout/activity_about.xml
Normal 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>
|
8
app/src/main/res/menu/menu.xml
Normal file
8
app/src/main/res/menu/menu.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/about"
|
||||||
|
android:title="@string/about"
|
||||||
|
app:showAsAction="never"/>
|
||||||
|
</menu>
|
@@ -1,3 +1,12 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Simple Calendar</string>
|
<string name="app_name">Simple Calendar</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>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user