Bottombar add button home activity
This commit is contained in:
parent
ddb618f4fa
commit
1e945ec071
@ -14,8 +14,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".Activities.HomeActivity"
|
android:name=".Activities.HomeActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:screenOrientation="portrait"
|
||||||
android:screenOrientation="portrait">
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
@ -25,15 +25,17 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".Activities.SettingsActivity"
|
android:name=".Activities.SettingsActivity"
|
||||||
android:label="@string/title_activity_settings"
|
android:label="@string/title_activity_settings"
|
||||||
android:screenOrientation="portrait"/>
|
|
||||||
<activity android:name=".Activities.CurrencySelectionActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity android:name=".Activities.RecordTransactionActivity"
|
<activity
|
||||||
|
android:name=".Activities.CurrencySelectionActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".Activities.RecordTransactionActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".Activities.CurrencyDetailsActivity"
|
android:name=".Activities.CurrencyDetailsActivity"
|
||||||
android:label="@string/title_activity_currency_details"
|
android:label="@string/title_activity_currency_details"
|
||||||
android:screenOrientation="portrait"/>
|
android:screenOrientation="portrait" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -121,7 +121,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
setTitle(currency.getName());
|
setTitle(currency.getName());
|
||||||
|
|
||||||
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
|
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation_details);
|
||||||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||||
|
|
||||||
hasBeenModified = false;
|
hasBeenModified = false;
|
||||||
|
@ -8,6 +8,8 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
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.CollapsingToolbarLayout;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
@ -70,6 +72,26 @@ public class HomeActivity extends AppCompatActivity {
|
|||||||
private Handler handler;
|
private Handler handler;
|
||||||
private Runnable updateRunnable;
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -127,6 +149,10 @@ public class HomeActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
toolbarSubtitle.setText("US$0.00");
|
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
|
//Events setup
|
||||||
detailsButton.setOnClickListener(new View.OnClickListener() {
|
detailsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@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>
|
</ViewFlipper>
|
||||||
|
|
||||||
<android.support.design.widget.BottomNavigationView
|
<android.support.design.widget.BottomNavigationView
|
||||||
android:id="@+id/navigation"
|
android:id="@+id/navigation_details"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
@ -203,7 +203,7 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:menu="@menu/navigation"
|
app:menu="@menu/navigation_details"
|
||||||
android:layout_alignParentBottom="true"/>
|
android:layout_alignParentBottom="true"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -7,6 +7,11 @@
|
|||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
tools:context="com.nauk.coinfolio.Activities.HomeActivity">
|
tools:context="com.nauk.coinfolio.Activities.HomeActivity">
|
||||||
|
|
||||||
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/app_bar"
|
android:id="@+id/app_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -82,7 +87,7 @@
|
|||||||
<include layout="@layout/content_currency_summary" />
|
<include layout="@layout/content_currency_summary" />
|
||||||
|
|
||||||
<android.support.design.widget.BottomNavigationView
|
<android.support.design.widget.BottomNavigationView
|
||||||
android:id="@+id/navigation"
|
android:id="@+id/navigation_home"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
@ -91,8 +96,19 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:menu="@menu/navigation"
|
app:menu="@menu/navigation_home"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_gravity="bottom"/>
|
android:layout_gravity="bottom" />
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</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:id="@+id/swiperefresh"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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"
|
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
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_charts">Charts</string>
|
||||||
<string name="title_infos">Infos</string>
|
<string name="title_infos">Infos</string>
|
||||||
<string name="title_transactions">Transactions</string>
|
<string name="title_transactions">Transactions</string>
|
||||||
|
<string name="title_home">Home</string>
|
||||||
|
<string name="title_market_cap">Market Capitalization</string>
|
||||||
|
|
||||||
<!--Chart buttons texts-->
|
<!--Chart buttons texts-->
|
||||||
<string name="button1h">1h</string>
|
<string name="button1h">1h</string>
|
||||||
@ -138,5 +140,6 @@
|
|||||||
<string name="currencyDollarParenthesisPlaceholder">(US$%1$s)</string>
|
<string name="currencyDollarParenthesisPlaceholder">(US$%1$s)</string>
|
||||||
<string name="currencyDollarPlaceholder">US$%1$s</string>
|
<string name="currencyDollarPlaceholder">US$%1$s</string>
|
||||||
<string name="currencyPercentagePlaceholder">%1$s%%</string>
|
<string name="currencyPercentagePlaceholder">%1$s%%</string>
|
||||||
|
<string name="title_activity_main">MainActivity</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user