Add gradient to the status bar

- Rework some labels
- Gradient orientation changed
This commit is contained in:
Tanguy Herbron 2018-07-21 21:26:58 +02:00
parent 582a155c8b
commit 2df677c947
8 changed files with 26 additions and 11 deletions

View File

@ -1,7 +1,11 @@
package com.herbron.moodl.Activities; package com.herbron.moodl.Activities;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
@ -59,6 +63,8 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setStatusBarGradiant(this);
/**Interface setup**/ /**Interface setup**/
setContentView(R.layout.activity_currency_summary); setContentView(R.layout.activity_currency_summary);
@ -115,6 +121,18 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
setupBalanceSwitch(); 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 @Override
public void onBackPressed() { public void onBackPressed() {
drawerLayout.openDrawer(GravityCompat.START); drawerLayout.openDrawer(GravityCompat.START);

View File

@ -251,7 +251,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
private void generateSplashScreen() 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(); Random random = new Random();

View File

@ -181,7 +181,7 @@ public class RecordTransactionActivity extends AppCompatActivity {
} }
else else
{ {
setTitle(PlaceholderManager.getAddCoinTransactionString(coin, getBaseContext())); setTitle(getString(R.string.new_transaction));
purchaseDate.setText(sdf.format(calendar.getTime())); purchaseDate.setText(sdf.format(calendar.getTime()));
symbolTxtView.setText(symbol); symbolTxtView.setText(symbol);

View File

@ -34,10 +34,6 @@ public class PlaceholderManager {
return formattedString; 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) public static String getEditTransactionString(String coinName, Context context)
{ {
return context.getResources().getString(R.string.edit_transaction, coinName); return context.getResources().getString(R.string.edit_transaction, coinName);

View File

@ -1,7 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient <gradient
android:type="linear" android:type="linear"
android:startColor="@color/colorPrimary" android:startColor="@color/colorPrimaryDark"
android:endColor="@color/colorPrimaryDark" android:endColor="@color/colorPrimary"
android:angle="0"/> android:angle="0"/>
</shape> </shape>

View File

@ -45,7 +45,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize" android:layout_marginTop="?attr/actionBarSize"
android:background="@drawable/gradient_background"> android:background="@drawable/gradient_background"
android:elevation="0dp">
<ListView android:id="@+id/linearLayoutOverview" <ListView android:id="@+id/linearLayoutOverview"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -118,7 +118,7 @@
</string-array> </string-array>
<string name="emitedPlaceholder">Pourcentage de coin émis : %1$s%%</string> <string name="emitedPlaceholder">Pourcentage de coin émis : %1$s%%</string>
<string name="edit_transaction">Edition d\'une transaction de %1$s</string> <string name="edit_transaction">Edition d\'une transaction de %1$s</string>
<string name="add_coin_transaction">Ajouter d\'une transaction de %1$s</string> <string name="new_transaction">Nouvelle transaction</string>
<string name="error_update_data">Erreur lors de l\'actualisation des données</string> <string name="error_update_data">Erreur lors de l\'actualisation des données</string>
<string name="update">Rafraichir</string> <string name="update">Rafraichir</string>
<string name="invalid_keys_hitbtc">Erreur de synchronisation avec HitBTC : Clefs invalides</string> <string name="invalid_keys_hitbtc">Erreur de synchronisation avec HitBTC : Clefs invalides</string>

View File

@ -198,7 +198,7 @@
<string name="fingerprint_dialog_title">Verify your fingerprint to continue</string> <string name="fingerprint_dialog_title">Verify your fingerprint to continue</string>
<string name="edit_transaction">Edit %1$s transaction</string> <string name="edit_transaction">Edit %1$s transaction</string>
<string name="add_coin_transaction">Add %1$s transaction</string> <string name="new_transaction">New transaction</string>
<!--Marketcap placeholders--> <!--Marketcap placeholders-->