mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Implement about screen
This commit is contained in:
@@ -1,20 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest
|
||||
package="org.isoron.uhabits"
|
||||
<manifest package="org.isoron.uhabits"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="9"
|
||||
android:versionName="1.2.0">
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.VIBRATE"/>
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="18" />
|
||||
|
||||
android:maxSdkVersion="18"/>
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="18" />
|
||||
android:maxSdkVersion="18"/>
|
||||
|
||||
<application
|
||||
android:name="com.activeandroid.app.Application"
|
||||
@@ -23,15 +19,12 @@
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/main_activity_title"
|
||||
android:theme="@style/AppBaseTheme">
|
||||
|
||||
<meta-data
|
||||
android:name="AA_DB_NAME"
|
||||
android:value="uhabits.db"/>
|
||||
|
||||
<meta-data
|
||||
android:name="AA_DB_VERSION"
|
||||
android:value="12"/>
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.backup.api_key"
|
||||
android:value="AEdPqrEAAAAI6aeWncbnMNo8E5GWeZ44dlc5cQ7tCROwFhOtiw"/>
|
||||
@@ -39,15 +32,14 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/main_activity_title">
|
||||
<intent-filter
|
||||
android:label="@string/app_name">
|
||||
<intent-filter android:label="@string/app_name">
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name=".HabitBroadcastReceiver"/>
|
||||
<receiver android:name=".HabitBroadcastReceiver"/>
|
||||
|
||||
<activity
|
||||
android:name=".ShowHabitActivity"
|
||||
@@ -57,7 +49,6 @@
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="org.isoron.uhabits.MainActivity"/>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:label="@string/settings"
|
||||
@@ -78,39 +69,40 @@
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_checkmark_info"/>
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".widgets.HistoryWidgetProvider"
|
||||
android:label="History">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_history_info"/>
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".widgets.ScoreWidgetProvider"
|
||||
android:label="Score">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_score_info"/>
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".widgets.StreakWidgetProvider"
|
||||
android:label="Streaks">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_streak_info"/>
|
||||
@@ -119,13 +111,15 @@
|
||||
<activity
|
||||
android:name=".widgets.HabitPickerDialog"
|
||||
android:theme="@style/Theme.AppCompat.Light.Dialog">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".AboutActivity"
|
||||
android:label="@string/about"
|
||||
android:parentActivityName=".MainActivity">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
93
app/src/main/java/org/isoron/uhabits/AboutActivity.java
Normal file
93
app/src/main/java/org/isoron/uhabits/AboutActivity.java
Normal file
@@ -0,0 +1,93 @@
|
||||
/* Copyright (C) 2016 Alinson Santos Xavier
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.isoron.uhabits;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.isoron.helpers.ColorHelper;
|
||||
|
||||
public class AboutActivity extends Activity implements View.OnClickListener
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.about);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 21)
|
||||
{
|
||||
int color = getResources().getColor(R.color.blue_700);
|
||||
int darkerColor = ColorHelper.mixColors(color, Color.BLACK, 0.75f);
|
||||
getActionBar().setBackgroundDrawable(new ColorDrawable(color));
|
||||
getWindow().setStatusBarColor(darkerColor);
|
||||
}
|
||||
|
||||
TextView tvVersion = (TextView) findViewById(R.id.tvVersion);
|
||||
TextView tvRate = (TextView) findViewById(R.id.tvRate);
|
||||
TextView tvFeedback = (TextView) findViewById(R.id.tvFeedback);
|
||||
TextView tvSource = (TextView) findViewById(R.id.tvSource);
|
||||
|
||||
tvVersion.setText(String.format("%s %s", getResources().getString(R.string.version),
|
||||
BuildConfig.VERSION_NAME));
|
||||
tvRate.setOnClickListener(this);
|
||||
tvFeedback.setOnClickListener(this);
|
||||
tvSource.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
switch (v.getId())
|
||||
{
|
||||
case R.id.tvRate:
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("market://details?id=org.isoron.uhabits"));
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
|
||||
case R.id.tvFeedback:
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_SENDTO);
|
||||
intent.setData(Uri.parse("mailto:isoron+habits@gmail.com?" +
|
||||
"subject=Feedback%20about%20Loop%20Habit%20Tracker"));
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
|
||||
case R.id.tvSource:
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("https://github.com/iSoron/uhabits"));
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,9 +117,18 @@ public class MainActivity extends ReplayableActivity
|
||||
switch (item.getItemId())
|
||||
{
|
||||
case R.id.action_settings:
|
||||
{
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
case R.id.action_about:
|
||||
{
|
||||
Intent intent = new Intent(this, AboutActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
||||
98
app/src/main/res/layout/about.xml
Normal file
98
app/src/main/res/layout/about.xml
Normal file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/windowBackground"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/cardsListStyle">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/cardStyle"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_margin="6dp"
|
||||
android:src="@drawable/intro_icon_1"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
android:layout_margin="6dp"
|
||||
android:textColor="@color/blue_700"
|
||||
android:text="@string/app_name"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvVersion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text=""/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/cardStyle"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
style="@style/cardHeaderStyle"
|
||||
android:text="@string/links"
|
||||
android:textColor="@color/blue_700"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRate"
|
||||
style="@style/aboutClickableItemStyle"
|
||||
android:text="@string/pref_rate_this_app"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFeedback"
|
||||
style="@style/aboutClickableItemStyle"
|
||||
android:text="@string/pref_send_feedback"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSource"
|
||||
style="@style/aboutClickableItemStyle"
|
||||
android:text="@string/pref_view_source_code"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/cardStyle"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
style="@style/cardHeaderStyle"
|
||||
android:text="@string/developers"
|
||||
android:textColor="@color/blue_700"/>
|
||||
|
||||
<TextView
|
||||
style="@style/aboutItemStyle"
|
||||
android:text="Álinson Xavier"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/cardStyle"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
style="@style/cardHeaderStyle"
|
||||
android:text="@string/translators"
|
||||
android:textColor="@color/blue_700"/>
|
||||
|
||||
<TextView
|
||||
style="@style/aboutItemStyle"
|
||||
android:text="Limin Lu (中文)"/>
|
||||
|
||||
<TextView
|
||||
style="@style/aboutItemStyle"
|
||||
android:text="Álinson Xavier (Português)"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -15,4 +15,10 @@
|
||||
android:title="@string/action_settings"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_about"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/about"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_name">Hábitos</string>
|
||||
<string name="app_name">Loop Habit Tracker</string>
|
||||
<string name="action_settings">Configurações</string>
|
||||
<string name="add_habit">Adicionar hábito</string>
|
||||
<string name="archive">Arquivar</string>
|
||||
@@ -102,4 +102,8 @@
|
||||
<string name="any_day">Qualquer dia</string>
|
||||
<string name="select_weekdays">Selecionar dias</string>
|
||||
<string name="export_to_csv">Exportar dados</string>
|
||||
<string name="about">Sobre</string>
|
||||
<string name="developers">Desenvolvedores</string>
|
||||
<string name="translators">Tradutores</string>
|
||||
<string name="version">Versão</string>
|
||||
</resources>
|
||||
@@ -259,7 +259,7 @@
|
||||
<!--<color name="blue_400">#42A5F5</color>-->
|
||||
<!--<color name="blue_500">#2196F3</color>-->
|
||||
<!--<color name="blue_600">#1E88E5</color>-->
|
||||
<!--<color name="blue_700">#1976D2</color>-->
|
||||
<color name="blue_700">#1976D2</color>
|
||||
<!--<color name="blue_800">#1565C0</color>-->
|
||||
<!--<color name="blue_900">#0D47A1</color>-->
|
||||
<!--<color name="blue_A100">#82B1FF</color>-->
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<string name="toast_habit_archived">Habits archived.</string>
|
||||
<string name="toast_habit_unarchived">Habits unarchived.</string>
|
||||
|
||||
<string name="color_swatch_description" translatable="false">Color <xliff:g id="color_index" example="14">%1$d</xliff:g></string>
|
||||
<string name="color_swatch_description_selected" translatable="false">Color <xliff:g id="color_index" example="14">%1$d</xliff:g> selected</string>
|
||||
<string name="color_swatch_description" translatable="false">Color <xliff:g example="14" id="color_index">%1$d</xliff:g></string>
|
||||
<string name="color_swatch_description_selected" translatable="false">Color <xliff:g example="14" id="color_index">%1$d</xliff:g> selected</string>
|
||||
|
||||
<!-- Date and time picker -->
|
||||
<string name="done_label">Done</string>
|
||||
@@ -35,8 +35,8 @@
|
||||
<string name="year_picker_description" translatable="false">Year list</string>
|
||||
<string name="select_day">Select month and day</string>
|
||||
<string name="select_year">Select year</string>
|
||||
<string name="item_is_selected" translatable="false"><xliff:g id="item" example="2013">%1$s</xliff:g> selected</string>
|
||||
<string name="deleted_key" translatable="false"><xliff:g id="key" example="4">%1$s</xliff:g> deleted</string>
|
||||
<string name="item_is_selected" translatable="false"><xliff:g example="2013" id="item">%1$s</xliff:g> selected</string>
|
||||
<string name="deleted_key" translatable="false"><xliff:g example="4" id="key">%1$s</xliff:g> deleted</string>
|
||||
<string name="time_placeholder" translatable="false">--</string>
|
||||
<string name="time_separator" translatable="false">:</string>
|
||||
<string name="radial_numbers_typeface" translatable="false">sans-serif</string>
|
||||
@@ -116,4 +116,9 @@
|
||||
<item>@string/hint_landscape</item>
|
||||
</string-array>
|
||||
|
||||
<string name="about">About</string>
|
||||
<string name="translators">Translators</string>
|
||||
<string name="developers">Developers</string>
|
||||
<string name="version">Version</string>
|
||||
|
||||
</resources>
|
||||
@@ -61,4 +61,18 @@
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
</style>
|
||||
|
||||
<style name="aboutItemStyle">
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:paddingTop">6dp</item>
|
||||
<item name="android:paddingBottom">6dp</item>
|
||||
</style>
|
||||
|
||||
<style name="aboutClickableItemStyle" parent="aboutItemStyle">
|
||||
<item name="android:paddingBottom">12dp</item>
|
||||
<item name="android:paddingTop">12dp</item>
|
||||
<item name="android:background">@drawable/ripple_transparent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -21,36 +21,11 @@
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="pref_key_links"
|
||||
android:title="@string/links">
|
||||
|
||||
<Preference android:title="@string/pref_rate_this_app">
|
||||
<Preference android:title="@string/about">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="market://details?id=org.isoron.uhabits"/>
|
||||
</Preference>
|
||||
|
||||
<Preference android:title="@string/pref_send_feedback">
|
||||
<intent
|
||||
android:action="android.intent.action.SENDTO"
|
||||
android:data="mailto:isoron+habits@gmail.com?subject=Feedback%20about%20Loop%20Habit%20Tracker"/>
|
||||
</Preference>
|
||||
|
||||
<Preference android:title="@string/pref_view_source_code">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="https://github.com/iSoron/uhabits"/>
|
||||
</Preference>
|
||||
|
||||
|
||||
<Preference android:title="@string/pref_view_app_introduction">
|
||||
<intent
|
||||
android:targetClass="org.isoron.uhabits.IntroActivity"
|
||||
android:targetClass="org.isoron.uhabits.AboutActivity"
|
||||
android:targetPackage="org.isoron.uhabits"/>
|
||||
</Preference>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
Reference in New Issue
Block a user