From 642e2af23e444a802e953f92ffeaa3624c3e4bdc Mon Sep 17 00:00:00 2001 From: "serage.betelmal" Date: Sat, 15 Apr 2017 19:05:25 +0100 Subject: [PATCH 1/3] Adding an about activity to the App --- app/build.gradle | 1 + app/src/main/AndroidManifest.xml | 40 +++++++++----- .../keylesspalace/tusky/AboutActivity.java | 25 +++++++++ .../com/keylesspalace/tusky/MainActivity.java | 6 ++- app/src/main/res/layout/activity_about.xml | 54 +++++++++++++++++++ app/src/main/res/values/strings.xml | 3 ++ app/src/main/res/values/styles.xml | 43 ++++++++++----- 7 files changed, 147 insertions(+), 25 deletions(-) create mode 100644 app/src/main/java/com/keylesspalace/tusky/AboutActivity.java create mode 100644 app/src/main/res/layout/activity_about.xml diff --git a/app/build.gradle b/app/build.gradle index ebacc223..1e3de3e1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -50,6 +50,7 @@ dependencies { compile 'com.jakewharton:butterknife:8.4.0' compile 'com.google.firebase:firebase-messaging:10.0.1' compile 'com.google.firebase:firebase-crash:10.0.1' + compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7' testCompile 'junit:junit:4.12' annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 62955811..7bbe6485 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,10 @@ android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> - + + @@ -41,55 +44,68 @@ android:windowSoftInputMode="stateVisible|adjustResize"> + + + + + + - + + - + - + - - + - + + android:permission="android.permission.BIND_QUICK_SETTINGS_TILE" + tools:targetApi="24"> - + - + + \ No newline at end of file diff --git a/app/src/main/java/com/keylesspalace/tusky/AboutActivity.java b/app/src/main/java/com/keylesspalace/tusky/AboutActivity.java new file mode 100644 index 00000000..bbbf02cf --- /dev/null +++ b/app/src/main/java/com/keylesspalace/tusky/AboutActivity.java @@ -0,0 +1,25 @@ +package com.keylesspalace.tusky; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.widget.TextView; + +public class AboutActivity extends AppCompatActivity { + private TextView mVersionTextView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_about); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + mVersionTextView = (TextView) findViewById(R.id.textView); + String versionName = BuildConfig.VERSION_NAME; + + mVersionTextView. + setText(getString(R.string.about_application_version)+ versionName); + } + +} diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java index 43415269..effc48d0 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java @@ -266,7 +266,8 @@ public class MainActivity extends BaseActivity { new PrimaryDrawerItem().withIdentifier(2).withName(getString(R.string.action_view_blocks)).withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_block), new DividerDrawerItem(), new SecondaryDrawerItem().withIdentifier(3).withName(getString(R.string.action_view_preferences)).withSelectable(false), - new SecondaryDrawerItem().withIdentifier(4).withName(getString(R.string.action_logout)).withSelectable(false) + new SecondaryDrawerItem().withIdentifier(4).withName(getString(R.string.about_title_activity)).withSelectable(false), + new SecondaryDrawerItem().withIdentifier(5).withName(getString(R.string.action_logout)).withSelectable(false) ) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override @@ -290,6 +291,9 @@ public class MainActivity extends BaseActivity { Intent intent = new Intent(MainActivity.this, PreferencesActivity.class); startActivity(intent); } else if (drawerItemIdentifier == 4) { + Intent intent = new Intent(MainActivity.this, AboutActivity.class); + startActivity(intent); + } else if (drawerItemIdentifier == 5) { logout(); } } diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml new file mode 100644 index 00000000..e395a86a --- /dev/null +++ b/app/src/main/res/layout/activity_about.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7d053474..0ef915e5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -141,4 +141,7 @@ Locked Account + About + App version: + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a6454085..e0a59373 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -30,7 +30,8 @@ @color/text_color_secondary_dark @color/text_color_tertiary_dark @color/text_color_primary_inverse_dark - @color/text_color_secondary_inverse_dark + @color/text_color_secondary_inverse_dark + @color/text_color_tertiary_inverse_dark @color/text_color_primary_dark @@ -53,11 +54,15 @@ @drawable/tab_page_margin_dark @color/account_header_background_dark @color/toolbar_icon_dark - @color/account_toolbar_icon_collapsed_dark - @style/AppTheme.Account.ToolbarPopupTheme.Dark + + @color/account_toolbar_icon_collapsed_dark + + @style/AppTheme.Account.ToolbarPopupTheme.Dark + @color/toolbar_icon_dark @color/compose_media_button_dark - @color/compose_media_button_disabled_dark + @color/compose_media_button_disabled_dark + @color/color_accent_dark @drawable/border_background_dark @color/image_button_dark @@ -116,8 +121,10 @@ @color/text_color_secondary_light @color/text_color_tertiary_light @color/text_color_primary_inverse_light - @color/text_color_secondary_inverse_light - @color/text_color_tertiary_inverse_light + @color/text_color_secondary_inverse_light + + @color/text_color_tertiary_inverse_light + @color/text_color_primary_light @style/AppTheme.BottomSheetDialog.Light @@ -132,18 +139,25 @@ @drawable/favourite_active_light @drawable/favourite_inactive_light @drawable/toggle_small_light - @color/sensitive_media_warning_background_light + + @color/sensitive_media_warning_background_light + @drawable/media_preview_unloaded_light @drawable/status_divider_light @color/color_accent_light @drawable/tab_page_margin_light @color/account_header_background_light - @color/toolbar_icon_dark - @color/account_toolbar_icon_collapsed_light - @style/AppTheme.Account.ToolbarPopupTheme.Light + @color/toolbar_icon_dark + + + @color/account_toolbar_icon_collapsed_light + + @style/AppTheme.Account.ToolbarPopupTheme.Light + @color/toolbar_icon_light @color/compose_media_button_light - @color/compose_media_button_disabled_light + @color/compose_media_button_disabled_light + @color/compose_mention_light @drawable/border_background_light @color/image_button_light @@ -159,7 +173,8 @@ @color/color_primary_dark_light @color/color_primary_light @color/text_color_primary_light - @color/text_color_primary_dark + @color/text_color_primary_dark + @color/toolbar_background_light @color/text_color_secondary_light @@ -187,4 +202,8 @@ true + -