From 2df677c947d3a4f2c29ba876c265d119e63b920a Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Sat, 21 Jul 2018 21:26:58 +0200 Subject: [PATCH] Add gradient to the status bar - Rework some labels - Gradient orientation changed --- .../herbron/moodl/Activities/HomeActivity.java | 18 ++++++++++++++++++ .../HomeActivityFragments/Summary.java | 2 +- .../Activities/RecordTransactionActivity.java | 2 +- .../com/herbron/moodl/PlaceholderManager.java | 4 ---- .../main/res/drawable/gradient_background.xml | 4 ++-- .../layout/fragment_overview_homeactivity.xml | 3 ++- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 8 files changed, 26 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java b/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java index aa82f8d..e484cf0 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java +++ b/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java @@ -1,7 +1,11 @@ package com.herbron.moodl.Activities; +import android.annotation.TargetApi; +import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; +import android.graphics.drawable.Drawable; +import android.os.Build; import android.os.Bundle; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; @@ -59,6 +63,8 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setStatusBarGradiant(this); + /**Interface setup**/ setContentView(R.layout.activity_currency_summary); @@ -115,6 +121,18 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte setupBalanceSwitch(); } + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + public static void setStatusBarGradiant(Activity activity) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = activity.getWindow(); + Drawable background = activity.getResources().getDrawable(R.drawable.gradient_background); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(activity.getResources().getColor(android.R.color.transparent)); + window.setNavigationBarColor(activity.getResources().getColor(android.R.color.transparent)); + window.setBackgroundDrawable(background); + } + } + @Override public void onBackPressed() { drawerLayout.openDrawer(GravityCompat.START); diff --git a/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java b/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java index cf8f721..d7c71c5 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java +++ b/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java @@ -251,7 +251,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface, private void generateSplashScreen() { - loadingDialog = new Dialog(getActivity(), android.R.style.Theme_Black_NoTitleBar_Fullscreen); + loadingDialog = new Dialog(getActivity(), android.R.style.Theme_Black); Random random = new Random(); diff --git a/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java b/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java index 3d2644c..a278e9d 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java +++ b/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java @@ -181,7 +181,7 @@ public class RecordTransactionActivity extends AppCompatActivity { } else { - setTitle(PlaceholderManager.getAddCoinTransactionString(coin, getBaseContext())); + setTitle(getString(R.string.new_transaction)); purchaseDate.setText(sdf.format(calendar.getTime())); symbolTxtView.setText(symbol); diff --git a/app/src/main/java/com/herbron/moodl/PlaceholderManager.java b/app/src/main/java/com/herbron/moodl/PlaceholderManager.java index 9b6edb7..dba42a1 100644 --- a/app/src/main/java/com/herbron/moodl/PlaceholderManager.java +++ b/app/src/main/java/com/herbron/moodl/PlaceholderManager.java @@ -34,10 +34,6 @@ public class PlaceholderManager { return formattedString; } - public static String getAddCoinTransactionString(String coinName, Context context) { - return context.getResources().getString(R.string.add_coin_transaction, coinName); - } - public static String getEditTransactionString(String coinName, Context context) { return context.getResources().getString(R.string.edit_transaction, coinName); diff --git a/app/src/main/res/drawable/gradient_background.xml b/app/src/main/res/drawable/gradient_background.xml index 24074e2..a08a08f 100644 --- a/app/src/main/res/drawable/gradient_background.xml +++ b/app/src/main/res/drawable/gradient_background.xml @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_overview_homeactivity.xml b/app/src/main/res/layout/fragment_overview_homeactivity.xml index 19d6a37..dac2744 100644 --- a/app/src/main/res/layout/fragment_overview_homeactivity.xml +++ b/app/src/main/res/layout/fragment_overview_homeactivity.xml @@ -45,7 +45,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="?attr/actionBarSize" - android:background="@drawable/gradient_background"> + android:background="@drawable/gradient_background" + android:elevation="0dp"> Pourcentage de coin émis : %1$s%% Edition d\'une transaction de %1$s - Ajouter d\'une transaction de %1$s + Nouvelle transaction Erreur lors de l\'actualisation des données Rafraichir Erreur de synchronisation avec HitBTC : Clefs invalides diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 46a46bd..c479a64 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -198,7 +198,7 @@ Verify your fingerprint to continue Edit %1$s transaction - Add %1$s transaction + New transaction