From 1e945ec07148d51f0ab0b203212990d2014d32ab Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Fri, 9 Feb 2018 20:47:49 +0100 Subject: [PATCH] Bottombar add button home activity --- app/src/main/AndroidManifest.xml | 14 +- .../Activities/CurrencyDetailsActivity.java | 2 +- .../coinfolio/Activities/HomeActivity.java | 26 +++ .../main/res/color/home_color_bottombar.xml | 5 + .../main/res/drawable/ic_add_white_24dp.xml | 9 + .../res/drawable/ic_pie_chart_black_24dp.xml | 9 + .../res/drawable/ic_view_list_black_24dp.xml | 9 + .../res/layout/activity_currency_details.xml | 4 +- .../res/layout/activity_currency_summary.xml | 162 ++++++++++-------- .../res/layout/content_currency_summary.xml | 3 +- ...{navigation.xml => navigation_details.xml} | 0 app/src/main/res/menu/navigation_home.xml | 27 +++ app/src/main/res/values/strings.xml | 3 + 13 files changed, 190 insertions(+), 83 deletions(-) create mode 100644 app/src/main/res/color/home_color_bottombar.xml create mode 100644 app/src/main/res/drawable/ic_add_white_24dp.xml create mode 100644 app/src/main/res/drawable/ic_pie_chart_black_24dp.xml create mode 100644 app/src/main/res/drawable/ic_view_list_black_24dp.xml rename app/src/main/res/menu/{navigation.xml => navigation_details.xml} (100%) create mode 100644 app/src/main/res/menu/navigation_home.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 85cbf63..150bd0d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,8 +14,8 @@ + android:screenOrientation="portrait" + android:theme="@style/AppTheme.NoActionBar"> @@ -25,15 +25,17 @@ - - + + android:screenOrientation="portrait" /> \ No newline at end of file diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java b/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java index 1cede5e..ad6e6cc 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java @@ -121,7 +121,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity { setTitle(currency.getName()); - BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation); + BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation_details); navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); hasBeenModified = false; diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivity.java b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivity.java index 23a0c2b..1e5edc4 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivity.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivity.java @@ -8,6 +8,8 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.Looper; +import android.support.annotation.NonNull; +import android.support.design.widget.BottomNavigationView; import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; @@ -70,6 +72,26 @@ public class HomeActivity extends AppCompatActivity { private Handler handler; private Runnable updateRunnable; + private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener + = new BottomNavigationView.OnNavigationItemSelectedListener() { + + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + switch (item.getItemId()) { + case R.id.navigation_home: + //viewFlipper.setDisplayedChild(1); + return true; + case R.id.navigation_view_list: + //viewFlipper.setDisplayedChild(1); + return true; + case R.id.navigation_market_cap: + //viewFlipper.setDisplayedChild(2); + return true; + } + return false; + } + }; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -127,6 +149,10 @@ public class HomeActivity extends AppCompatActivity { toolbarSubtitle.setText("US$0.00"); + BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation_home); + navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); + navigation.setSelectedItemId(R.id.navigation_view_list); + //Events setup detailsButton.setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/res/color/home_color_bottombar.xml b/app/src/main/res/color/home_color_bottombar.xml new file mode 100644 index 0000000..b8cae12 --- /dev/null +++ b/app/src/main/res/color/home_color_bottombar.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_add_white_24dp.xml b/app/src/main/res/drawable/ic_add_white_24dp.xml new file mode 100644 index 0000000..685ebcd --- /dev/null +++ b/app/src/main/res/drawable/ic_add_white_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_pie_chart_black_24dp.xml b/app/src/main/res/drawable/ic_pie_chart_black_24dp.xml new file mode 100644 index 0000000..ffcd8f3 --- /dev/null +++ b/app/src/main/res/drawable/ic_pie_chart_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_view_list_black_24dp.xml b/app/src/main/res/drawable/ic_view_list_black_24dp.xml new file mode 100644 index 0000000..78118c1 --- /dev/null +++ b/app/src/main/res/drawable/ic_view_list_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_currency_details.xml b/app/src/main/res/layout/activity_currency_details.xml index 1ada9a2..2729385 100644 --- a/app/src/main/res/layout/activity_currency_details.xml +++ b/app/src/main/res/layout/activity_currency_details.xml @@ -194,7 +194,7 @@ diff --git a/app/src/main/res/layout/activity_currency_summary.xml b/app/src/main/res/layout/activity_currency_summary.xml index 3adbfa4..9c2bf0c 100644 --- a/app/src/main/res/layout/activity_currency_summary.xml +++ b/app/src/main/res/layout/activity_currency_summary.xml @@ -1,5 +1,5 @@ - - + android:layout_height="match_parent"> - + android:theme="@style/AppTheme.AppBarOverlay" + android:background="@drawable/gradient_background"> - + android:layout_height="match_parent" + android:fitsSystemWindows="true" + app:contentScrim="@drawable/gradient_background" + app:layout_scrollFlags="scroll|exitUntilCollapsed" + app:toolbarId="@+id/toolbar"> - - - - - - - + android:layout_gravity="center|bottom" + android:layout_marginBottom="35dp" + android:gravity="center" + android:textSize="20dp" + app:layout_collapseMode="parallax"/> - + - + - + app:layout_collapseMode="pin" + android:orientation="horizontal" + android:gravity="left" + android:layout_margin="10dp"> - + - - + - + - + - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/content_currency_summary.xml b/app/src/main/res/layout/content_currency_summary.xml index df4ee54..257608e 100644 --- a/app/src/main/res/layout/content_currency_summary.xml +++ b/app/src/main/res/layout/content_currency_summary.xml @@ -4,7 +4,8 @@ android:id="@+id/swiperefresh" android:layout_width="match_parent" android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> + app:layout_behavior="@string/appbar_scrolling_view_behavior" + android:layout_marginBottom="56dp"> + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index aed0625..5d9741b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -120,6 +120,8 @@ Charts Infos Transactions + Home + Market Capitalization 1h @@ -138,5 +140,6 @@ (US$%1$s) US$%1$s %1$s%% + MainActivity