Bottombar add button home activity
This commit is contained in:
parent
ddb618f4fa
commit
1e945ec071
@ -14,8 +14,8 @@
|
||||
<activity
|
||||
android:name=".Activities.HomeActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:screenOrientation="portrait">
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@ -25,15 +25,17 @@
|
||||
<activity
|
||||
android:name=".Activities.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".Activities.CurrencySelectionActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".Activities.RecordTransactionActivity"
|
||||
<activity
|
||||
android:name=".Activities.CurrencySelectionActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activities.RecordTransactionActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activities.CurrencyDetailsActivity"
|
||||
android:label="@string/title_activity_currency_details"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -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;
|
||||
|
@ -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
|
||||
|
5
app/src/main/res/color/home_color_bottombar.xml
Normal file
5
app/src/main/res/color/home_color_bottombar.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:color="@color/colorAccent" />
|
||||
<item android:state_checked="false" android:color="@color/colorPrimary" />
|
||||
</selector>
|
9
app/src/main/res/drawable/ic_add_white_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_add_white_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_pie_chart_black_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_pie_chart_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11,2v20c-5.07,-0.5 -9,-4.79 -9,-10s3.93,-9.5 9,-10zM13.03,2v8.99L22,10.99c-0.47,-4.74 -4.24,-8.52 -8.97,-8.99zM13.03,13.01L13.03,22c4.74,-0.47 8.5,-4.25 8.97,-8.99h-8.97z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_view_list_black_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_view_list_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4,14h4v-4L4,10v4zM4,19h4v-4L4,15v4zM4,9h4L8,5L4,5v4zM9,14h12v-4L9,10v4zM9,19h12v-4L9,15v4zM9,5v4h12L21,5L9,5z"/>
|
||||
</vector>
|
@ -194,7 +194,7 @@
|
||||
</ViewFlipper>
|
||||
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:id="@+id/navigation"
|
||||
android:id="@+id/navigation_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="0dp"
|
||||
@ -203,7 +203,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:menu="@menu/navigation"
|
||||
app:menu="@menu/navigation_details"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
@ -7,92 +7,108 @@
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="com.nauk.coinfolio.Activities.HomeActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/app_bar"
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/app_bar_height"
|
||||
android:fitsSystemWindows="true"
|
||||
android:theme="@style/AppTheme.AppBarOverlay"
|
||||
android:background="@drawable/gradient_background">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:id="@+id/toolbar_layout"
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/app_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="@dimen/app_bar_height"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="@drawable/gradient_background"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||
app:toolbarId="@+id/toolbar">
|
||||
android:theme="@style/AppTheme.AppBarOverlay"
|
||||
android:background="@drawable/gradient_background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbarSubtitle"
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:id="@+id/toolbar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|bottom"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:gravity="center"
|
||||
android:textSize="20dp"
|
||||
app:layout_collapseMode="parallax"/>
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="@drawable/gradient_background"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||
app:toolbarId="@+id/toolbar">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:layout_collapseMode="pin"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
android:background="@drawable/gradient_background">
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_collapseMode="pin"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="left"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/switch_button"
|
||||
android:layout_width="wrap_content"
|
||||
<TextView
|
||||
android:id="@+id/toolbarSubtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quick_button"/>
|
||||
android:layout_gravity="center|bottom"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:gravity="center"
|
||||
android:textSize="20dp"
|
||||
app:layout_collapseMode="parallax"/>
|
||||
|
||||
</LinearLayout>
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:layout_collapseMode="pin"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
android:background="@drawable/gradient_background">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_collapseMode="pin"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="right"
|
||||
android:layout_margin="10dp">
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_settings" />
|
||||
app:layout_collapseMode="pin"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="left"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
</LinearLayout>
|
||||
<ImageButton
|
||||
android:id="@+id/switch_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/quick_button"/>
|
||||
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/content_currency_summary" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_collapseMode="pin"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="right"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:id="@+id/navigation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="?android:attr/windowBackground"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:menu="@menu/navigation"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="bottom"/>
|
||||
<ImageButton
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_settings" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_currency_summary" />
|
||||
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:id="@+id/navigation_home"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="?android:attr/windowBackground"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:menu="@menu/navigation_home"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="bottom" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:src="@drawable/ic_add_white_24dp"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:clickable="true"
|
||||
android:focusable="true"/>
|
||||
|
||||
</FrameLayout>
|
@ -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">
|
||||
|
||||
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
27
app/src/main/res/menu/navigation_home.xml
Normal file
27
app/src/main/res/menu/navigation_home.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_pie_chart_black_24dp"
|
||||
android:title="@string/title_market_cap" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_home"
|
||||
android:icon="@drawable/ic_show_chart_black_24dp"
|
||||
android:title="@string/title_charts" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_view_list"
|
||||
android:icon="@drawable/ic_view_list_black_24dp"
|
||||
android:title="@string/title_home" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_market_cap"
|
||||
android:icon="@drawable/ic_pie_chart_black_24dp"
|
||||
android:title="@string/title_market_cap" />
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_pie_chart_black_24dp"
|
||||
android:title="@string/title_market_cap" />
|
||||
|
||||
</menu>
|
@ -120,6 +120,8 @@
|
||||
<string name="title_charts">Charts</string>
|
||||
<string name="title_infos">Infos</string>
|
||||
<string name="title_transactions">Transactions</string>
|
||||
<string name="title_home">Home</string>
|
||||
<string name="title_market_cap">Market Capitalization</string>
|
||||
|
||||
<!--Chart buttons texts-->
|
||||
<string name="button1h">1h</string>
|
||||
@ -138,5 +140,6 @@
|
||||
<string name="currencyDollarParenthesisPlaceholder">(US$%1$s)</string>
|
||||
<string name="currencyDollarPlaceholder">US$%1$s</string>
|
||||
<string name="currencyPercentagePlaceholder">%1$s%%</string>
|
||||
<string name="title_activity_main">MainActivity</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user