Commit 9bb5a9707b9983232c7d19be82620b3f37798db8
1 parent
4ff37557
- change colors
Showing
5 changed files
with
33 additions
and
19 deletions
app/src/main/java/net/devfac/userstory/MainActivity.java
1 | 1 | package net.devfac.userstory; |
2 | 2 | |
3 | -import android.app.ActionBar; | |
4 | -import android.app.Dialog; | |
5 | 3 | import android.content.Intent; |
6 | 4 | import android.os.Bundle; |
7 | 5 | import android.support.design.widget.FloatingActionButton; |
... | ... | @@ -38,14 +36,12 @@ import java.util.List; |
38 | 36 | public class MainActivity extends AppCompatActivity |
39 | 37 | implements NavigationView.OnNavigationItemSelectedListener, View.OnClickListener, StateEventListener { |
40 | 38 | |
41 | -// private Fragment mFragmentBookShelf = new FragmentBookShelf(); | |
42 | -// private Fragment mFragmentLogin = new FragmentLogin(); | |
43 | -// private Fragment mFragmentAddBook = new FragmentAddBook(); | |
44 | - | |
45 | 39 | private ViewPager mViewPagerMain; |
46 | 40 | private ViewPagerAdapter mViewPagerAdapter; |
47 | 41 | private TabLayout mTabLayoutMain; |
48 | 42 | |
43 | + FloatingActionButton mFab; | |
44 | + | |
49 | 45 | @Override |
50 | 46 | protected void onCreate(Bundle savedInstanceState) { |
51 | 47 | super.onCreate(savedInstanceState); |
... | ... | @@ -76,27 +72,41 @@ public class MainActivity extends AppCompatActivity |
76 | 72 | } |
77 | 73 | } |
78 | 74 | void initWidget(){ |
79 | - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | |
75 | + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_main); | |
80 | 76 | setSupportActionBar(toolbar); |
81 | 77 | |
82 | 78 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
83 | 79 | |
84 | 80 | mViewPagerMain = (ViewPager)findViewById(R.id.viewPager_main); |
85 | 81 | setupViewPager(mViewPagerMain); |
82 | + mViewPagerMain.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { | |
83 | + @Override | |
84 | + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |
85 | + } | |
86 | + | |
87 | + @Override | |
88 | + public void onPageSelected(int position) { | |
89 | + if (mViewPagerAdapter.getPosition(Constants.FRAGMENT_TITLE_BOOK_SHELF) == position) { | |
90 | + } | |
91 | + } | |
92 | + | |
93 | + @Override | |
94 | + public void onPageScrollStateChanged(int state) { | |
95 | + | |
96 | + } | |
97 | + }); | |
86 | 98 | |
87 | 99 | mTabLayoutMain = (TabLayout)findViewById(R.id.tablayout_main); |
88 | 100 | mTabLayoutMain.setupWithViewPager(mViewPagerMain); |
89 | 101 | |
90 | - FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | |
91 | - fab.setOnClickListener(new View.OnClickListener() { | |
102 | + mFab = (FloatingActionButton) findViewById(R.id.fab); | |
103 | + mFab.setOnClickListener(new View.OnClickListener() { | |
92 | 104 | @Override |
93 | 105 | public void onClick(View view) { |
94 | 106 | Snackbar.make(view, "ADD BOOKS", Snackbar.LENGTH_LONG) |
95 | 107 | .setAction("Action", null).show(); |
96 | 108 | |
97 | 109 | mViewPagerMain.setCurrentItem(mViewPagerAdapter.getPosition(Constants.FRAGMENT_TITLE_ADD_BOOK)); |
98 | - | |
99 | -// fragmentReplace(Constants.FRAGMENT_SELECT.FRAG_ADD_BOOK); | |
100 | 110 | } |
101 | 111 | }); |
102 | 112 | ... | ... |
app/src/main/res/layout/app_bar_main.xml
... | ... | @@ -9,13 +9,15 @@ |
9 | 9 | <android.support.design.widget.AppBarLayout android:layout_height="wrap_content" |
10 | 10 | android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay"> |
11 | 11 | |
12 | - <android.support.v7.widget.Toolbar android:id="@+id/toolbar" | |
12 | + <android.support.v7.widget.Toolbar android:id="@+id/toolbar_main" | |
13 | 13 | android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" |
14 | - android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> | |
14 | + android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" | |
15 | + app:layout_scrollFlags="scroll|enterAlways"/> | |
15 | 16 | |
16 | 17 | <android.support.design.widget.TabLayout android:id="@+id/tablayout_main" |
17 | 18 | android:layout_width="match_parent" android:layout_height="match_parent" |
18 | - app:tabMode="fixed" app:tabGravity="center"/> | |
19 | + app:tabGravity="center" | |
20 | + app:tabIndicatorColor="@color/tabIndicatorColor"/> | |
19 | 21 | |
20 | 22 | </android.support.design.widget.AppBarLayout> |
21 | 23 | ... | ... |
app/src/main/res/layout/content_main.xml
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | android:layout_width="match_parent" |
15 | 15 | android:layout_height="match_parent" |
16 | 16 | app:layout_behavior="@string/appbar_scrolling_view_behavior"/> |
17 | + | |
17 | 18 | <!--<LinearLayout--> |
18 | 19 | <!--android:id="@+id/fragment_view"--> |
19 | 20 | <!--android:layout_width="fill_parent"--> | ... | ... |
app/src/main/res/menu/login.xml
... | ... | @@ -5,8 +5,8 @@ |
5 | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | 6 | tools:context=".ActivityLogin"> |
7 | 7 | |
8 | - <item android:id="@+id/back" | |
9 | - android:title="NEXT" | |
8 | + <item android:id="@+id/cancel" | |
9 | + android:title="CANCEL" | |
10 | 10 | app:showAsAction="ifRoom"/> |
11 | 11 | |
12 | 12 | </menu> |
13 | 13 | \ No newline at end of file | ... | ... |
app/src/main/res/values/colors.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <resources> |
3 | - <color name="colorPrimary">#9dbb12</color> | |
4 | - <color name="colorPrimaryDark">#748a0c</color> | |
5 | - <color name="colorAccent">#118fa2</color> | |
3 | + <color name="colorPrimary">#0aa4b6</color> | |
4 | + <color name="colorPrimaryDark">#118896</color> | |
5 | + <color name="colorAccent">#b3c208</color> | |
6 | + <color name="tabIndicatorColor">#FFFFFF</color> | |
6 | 7 | </resources> | ... | ... |