Commit 6023bb12d576fe0a64dc631d3aaf39a7bae6d243
1 parent
9bb5a970
- add Cardview
- add RecyclerView - connection RecyclerViewAdapter with BookShelfCursorAdapter - add Toolbar hide
Showing
17 changed files
with
353 additions
and
50 deletions
app/src/main/AndroidManifest.xml
app/src/main/java/net/devfac/userstory/ActivityLogin.java
... | ... | @@ -5,12 +5,27 @@ import android.support.v7.app.AppCompatActivity; |
5 | 5 | import android.support.v7.widget.Toolbar; |
6 | 6 | import android.view.Menu; |
7 | 7 | import android.view.MenuInflater; |
8 | +import android.view.MenuItem; | |
9 | +import android.view.View; | |
10 | +import android.widget.Button; | |
11 | +import android.widget.EditText; | |
12 | +import android.widget.Toast; | |
13 | + | |
14 | +import net.devfac.userstory.FSM.Action; | |
15 | +import net.devfac.userstory.FSM.StateContext; | |
16 | +import net.devfac.userstory.FSM.StateEventListener; | |
17 | +import net.devfac.userstory.FSM.state.StateLoginRequested; | |
18 | +import net.devfac.userstory.Utils.Logger; | |
19 | +import net.devfac.userstory.Utils.PreferenceUtil; | |
8 | 20 | |
9 | 21 | /** |
10 | 22 | * Created by Onether on 15. 11. 10.. |
11 | 23 | */ |
12 | -public class ActivityLogin extends AppCompatActivity { | |
24 | +public class ActivityLogin extends AppCompatActivity implements View.OnClickListener, StateEventListener { | |
13 | 25 | private Toolbar mToolbarLogin; |
26 | + private EditText mEditId; | |
27 | + private EditText mEditPassword; | |
28 | + private Button mBtnLogin; | |
14 | 29 | |
15 | 30 | @Override |
16 | 31 | protected void onCreate(Bundle savedInstanceState) { |
... | ... | @@ -19,6 +34,24 @@ public class ActivityLogin extends AppCompatActivity { |
19 | 34 | |
20 | 35 | mToolbarLogin = (Toolbar)findViewById(R.id.toolbar_login); |
21 | 36 | setSupportActionBar(mToolbarLogin); |
37 | + | |
38 | + mEditId = (EditText)findViewById(R.id.editId); | |
39 | + mEditPassword = (EditText)findViewById(R.id.editPassword); | |
40 | + mBtnLogin = (Button)findViewById(R.id.btn_login); | |
41 | + | |
42 | + mEditId.setText(PreferenceUtil.getInstance(this).getUserId()); | |
43 | + mEditPassword.setText(PreferenceUtil.getInstance(this).getUserPwd()); | |
44 | + | |
45 | + if( PreferenceUtil.getInstance(this).getIsLoggedInState() ){ | |
46 | + mBtnLogin.setText("LOGOFF"); | |
47 | + } | |
48 | + else{ | |
49 | + mBtnLogin.setText("LOGIN"); | |
50 | + } | |
51 | + | |
52 | + mBtnLogin.setOnClickListener(this); | |
53 | + | |
54 | + StateContext.getInstance(this).setStateEventListener(this); | |
22 | 55 | } |
23 | 56 | |
24 | 57 | @Override |
... | ... | @@ -28,4 +61,66 @@ public class ActivityLogin extends AppCompatActivity { |
28 | 61 | |
29 | 62 | return super.onCreateOptionsMenu(menu); |
30 | 63 | } |
64 | + | |
65 | + @Override | |
66 | + public boolean onOptionsItemSelected(MenuItem item) { | |
67 | + switch( item.getItemId() ){ | |
68 | + case R.id.cancel: | |
69 | + finish(); | |
70 | + break; | |
71 | + } | |
72 | + return super.onOptionsItemSelected(item); | |
73 | + } | |
74 | + | |
75 | + @Override | |
76 | + public void onClick(View v) { | |
77 | + switch( v.getId() ){ | |
78 | + case R.id.btn_login: | |
79 | + if( mBtnLogin.getText().equals("LOGIN")){ | |
80 | + //Log in handling | |
81 | + String userid = mEditId.getText().toString(); | |
82 | + String userpwd = mEditPassword.getText().toString(); | |
83 | + | |
84 | + //TODO: This should be removed before publish | |
85 | + Logger.i("user info saved id : " + userid + "/pwd : " + userpwd); | |
86 | + | |
87 | + PreferenceUtil.getInstance(this).putUserId(userid); | |
88 | + PreferenceUtil.getInstance(this).putUserPwd(userpwd); | |
89 | + | |
90 | +// WebView wv = (WebView)getActivity().findViewById(R.id.webView); | |
91 | +// StateContext.getInstance(getActivity()).setWebView(wv); | |
92 | + StateContext.getInstance(this).processEvent(Action.REQ_LOGIN, null); | |
93 | + } | |
94 | + else if( mBtnLogin.getText().equals("LOGOFF")){ | |
95 | + //Log off handling | |
96 | + } | |
97 | + break; | |
98 | + } | |
99 | + } | |
100 | + | |
101 | + @Override | |
102 | + public void onEntry(Class stateClass, Object input) { | |
103 | + if( stateClass.equals(StateLoginRequested.class)){ | |
104 | + Toast.makeText(this, "๋ก๊ทธ์ธ ์ค์ ๋๋ค...", Toast.LENGTH_LONG).show(); | |
105 | + } | |
106 | + } | |
107 | + | |
108 | + @Override | |
109 | + public void onExit(Class stateClass, Object output, StateContext.STATE_RESULT stateResult) { | |
110 | + if( stateClass.equals(StateLoginRequested.class)){ | |
111 | + switch( stateResult ){ | |
112 | + case LOGIN_FAIL: | |
113 | + PreferenceUtil.getInstance(this).putIsLoggedInState(false); | |
114 | + Toast.makeText(this, "Login Fail. Try login again.", Toast.LENGTH_LONG).show(); | |
115 | + break; | |
116 | + case LOGIN_SUCCESS: | |
117 | + PreferenceUtil.getInstance(this).putIsLoggedInState(true); | |
118 | + Toast.makeText(this, "Login Success", Toast.LENGTH_LONG).show(); | |
119 | + finish(); | |
120 | + break; | |
121 | + } | |
122 | + | |
123 | + } | |
124 | + | |
125 | + } | |
31 | 126 | } | ... | ... |
app/src/main/java/net/devfac/userstory/BookShelfCursorAdapter.java
... | ... | @@ -35,7 +35,7 @@ public class BookShelfCursorAdapter extends CursorAdapter { |
35 | 35 | public void bindView(View view, Context context, Cursor cursor) { |
36 | 36 | TextView shelfRegisteredId = (TextView)view.findViewById(R.id.shelf_list_item_registered_id); |
37 | 37 | ImageView shelfCoverImage = (ImageView)view.findViewById(R.id.shelf_list_item_cover); |
38 | - TextView shelfTitle = (TextView)view.findViewById(R.id.shelf_lis_item_title); | |
38 | + TextView shelfTitle = (TextView)view.findViewById(R.id.shelf_list_item_title); | |
39 | 39 | |
40 | 40 | String registeredId = cursor.getString( cursor.getColumnIndex(Database.BookShelfTable.REGISTERED_ID)); |
41 | 41 | String coverUrlAdress = cursor.getString( cursor.getColumnIndex(Database.BookShelfTable.COVER_URL)); | ... | ... |
app/src/main/java/net/devfac/userstory/FragmentBookShelf.java
... | ... | @@ -2,6 +2,8 @@ package net.devfac.userstory; |
2 | 2 | |
3 | 3 | import android.os.Bundle; |
4 | 4 | import android.support.v4.app.Fragment; |
5 | +import android.support.v7.widget.LinearLayoutManager; | |
6 | +import android.support.v7.widget.RecyclerView; | |
5 | 7 | import android.view.LayoutInflater; |
6 | 8 | import android.view.View; |
7 | 9 | import android.view.ViewGroup; |
... | ... | @@ -15,6 +17,9 @@ import net.devfac.userstory.FSM.StateEventListener; |
15 | 17 | import net.devfac.userstory.FSM.state.StateSync; |
16 | 18 | import net.devfac.userstory.Utils.Logger; |
17 | 19 | |
20 | +import java.util.ArrayList; | |
21 | +import java.util.List; | |
22 | + | |
18 | 23 | /** |
19 | 24 | * Fragment for Book Shelf |
20 | 25 | * Created by Onether on 15. 10. 18.. |
... | ... | @@ -24,21 +29,52 @@ public class FragmentBookShelf extends Fragment implements StateEventListener { |
24 | 29 | private ListView mBookshelf; |
25 | 30 | private WebView wv; |
26 | 31 | |
32 | + public final static String ITEMS_COUNT_KEY = "PartThreeFragment$ItemsCount"; | |
33 | + | |
34 | + public static FragmentBookShelf getInstance(int itemCount){ | |
35 | + FragmentBookShelf fragmentBookShelf = new FragmentBookShelf(); | |
36 | + Bundle bundle = new Bundle(); | |
37 | + bundle.putInt(ITEMS_COUNT_KEY, itemCount); | |
38 | + fragmentBookShelf.setArguments(bundle); | |
39 | + return fragmentBookShelf; | |
40 | + } | |
41 | + | |
27 | 42 | @Override |
28 | 43 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
29 | 44 | Logger.i("onCreateView BookShelf"); |
30 | - View v = inflater.inflate(R.layout.fragment_bookshelf, container, false); | |
45 | +// View v = inflater.inflate(R.layout.fragment_bookshelf, container, false); | |
46 | + RecyclerView recyclerView = (RecyclerView)inflater.inflate(R.layout.recycler_book_shelf, container, false); | |
31 | 47 | |
32 | 48 | mBookShelfCursorAdapter = new BookShelfCursorAdapter( |
33 | 49 | getActivity(), |
34 | 50 | StateContext.getInstance(getActivity()).getDbOpenHelper().getCursor(), true); |
35 | 51 | |
36 | - mBookshelf = (ListView)v.findViewById(R.id.listBookshelf); | |
37 | - mBookshelf.setAdapter(mBookShelfCursorAdapter); | |
52 | +// mBookshelf = (ListView)v.findViewById(R.id.listBookshelf); | |
53 | +// mBookshelf.setAdapter(mBookShelfCursorAdapter); | |
54 | + | |
55 | + setupRecyclerView(recyclerView); | |
38 | 56 | |
39 | 57 | StateContext.getInstance(getActivity()).setStateEventListener(this); |
40 | 58 | |
41 | - return v; | |
59 | +// return v; | |
60 | + return recyclerView; | |
61 | + } | |
62 | + | |
63 | + private void setupRecyclerView(RecyclerView recyclerView) { | |
64 | + recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); | |
65 | +// RecyclerAdapterBookShelfItem recyclerAdapter = new RecyclerAdapterBookShelfItem(createItemList()); | |
66 | + RecyclerAdapterBookShelfItem recyclerAdapter = new RecyclerAdapterBookShelfItem(getActivity(), mBookShelfCursorAdapter); | |
67 | + recyclerView.setAdapter(recyclerAdapter); | |
68 | + } | |
69 | + | |
70 | + private List<String> createItemList() { | |
71 | + List<String> itemList = new ArrayList<>(); | |
72 | + | |
73 | + int itemsCount = 50; | |
74 | + for (int i = 0; i < itemsCount; i++) { | |
75 | + itemList.add("Item " + i); | |
76 | + } | |
77 | + return itemList; | |
42 | 78 | } |
43 | 79 | |
44 | 80 | @Override | ... | ... |
app/src/main/java/net/devfac/userstory/FragmentLogin.java
... | ... | @@ -20,6 +20,7 @@ import net.devfac.userstory.Utils.PreferenceUtil; |
20 | 20 | * Fragment for Login |
21 | 21 | * Created by Onether on 15. 10. 18.. |
22 | 22 | */ |
23 | +@Deprecated | |
23 | 24 | public class FragmentLogin extends Fragment implements View.OnClickListener, StateEventListener { |
24 | 25 | private EditText mEditId; |
25 | 26 | private EditText mEditPassword; | ... | ... |
app/src/main/java/net/devfac/userstory/MainActivity.java
... | ... | @@ -134,6 +134,14 @@ public class MainActivity extends AppCompatActivity |
134 | 134 | drawer.setDrawerListener(toggle); |
135 | 135 | toggle.syncState(); |
136 | 136 | |
137 | + TextView mTextLoginId = (TextView)drawer.findViewById(R.id.text_login_id); | |
138 | + mTextLoginId.setOnClickListener(new View.OnClickListener() { | |
139 | + @Override | |
140 | + public void onClick(View v) { | |
141 | + startActivity(new Intent(MainActivity.this, ActivityLogin.class)); | |
142 | + } | |
143 | + }); | |
144 | + | |
137 | 145 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); |
138 | 146 | navigationView.setNavigationItemSelectedListener(this); |
139 | 147 | |
... | ... | @@ -166,7 +174,7 @@ public class MainActivity extends AppCompatActivity |
166 | 174 | int id = item.getItemId(); |
167 | 175 | |
168 | 176 | //noinspection SimplifiableIfStatement |
169 | - if (id == R.id.action_settings) { | |
177 | + if (id == R.id.action_main_settings) { | |
170 | 178 | return true; |
171 | 179 | } |
172 | 180 | |
... | ... | @@ -189,6 +197,7 @@ public class MainActivity extends AppCompatActivity |
189 | 197 | return true; |
190 | 198 | } |
191 | 199 | |
200 | + | |
192 | 201 | private void setupViewPager(ViewPager viewPager){ |
193 | 202 | mViewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager()); |
194 | 203 | mViewPagerAdapter.addFragment(new FragmentAddBook(), Constants.FRAGMENT_TITLE_ADD_BOOK); | ... | ... |
app/src/main/java/net/devfac/userstory/RecyclerAdapterBookShelfItem.java
0 โ 100644
1 | +package net.devfac.userstory; | |
2 | + | |
3 | +import android.content.Context; | |
4 | +import android.database.Cursor; | |
5 | +import android.support.v7.widget.RecyclerView; | |
6 | +import android.view.LayoutInflater; | |
7 | +import android.view.View; | |
8 | +import android.view.ViewGroup; | |
9 | + | |
10 | +import net.devfac.userstory.FSM.StateContext; | |
11 | + | |
12 | +import java.util.List; | |
13 | + | |
14 | +/** | |
15 | + * Created by Onether on 15. 11. 13.. | |
16 | + */ | |
17 | +public class RecyclerAdapterBookShelfItem extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |
18 | +// private List<String> mItemList; | |
19 | + private BookShelfCursorAdapter mBookShelfCursorAdapter; | |
20 | + private Context mContext; | |
21 | + | |
22 | +// public RecyclerAdapterBookShelfItem(List<String> itemList) { | |
23 | +// mItemList = itemList; | |
24 | +// } | |
25 | + | |
26 | + public RecyclerAdapterBookShelfItem(Context context, BookShelfCursorAdapter bookShelfCursorAdapter) { | |
27 | + mBookShelfCursorAdapter = bookShelfCursorAdapter; | |
28 | + mContext = context; | |
29 | + } | |
30 | + | |
31 | + @Override | |
32 | + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | |
33 | + Context context = parent.getContext(); | |
34 | + View view = LayoutInflater.from(context).inflate(R.layout.recycler_book_shelf_item, parent, false); | |
35 | + return RecyclerBookShelfItemViewHolder.newInstance(view); | |
36 | + } | |
37 | + | |
38 | + @Override | |
39 | + public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { | |
40 | + RecyclerBookShelfItemViewHolder holder = (RecyclerBookShelfItemViewHolder) viewHolder; | |
41 | +// String itemText = mItemList.get(position); | |
42 | +// holder.setItemText(itemText); | |
43 | + | |
44 | + mBookShelfCursorAdapter.getCursor().moveToPosition(position); | |
45 | + mBookShelfCursorAdapter.bindView(holder.itemView, mContext, mBookShelfCursorAdapter.getCursor()); | |
46 | + } | |
47 | + | |
48 | + @Override | |
49 | + public int getItemCount() { | |
50 | +// return mItemList == null ? 0 : mItemList.size(); | |
51 | + return mBookShelfCursorAdapter.getCount(); | |
52 | + } | |
53 | + | |
54 | + public void changeCursor(){ | |
55 | + mBookShelfCursorAdapter.changeCursor(StateContext.getInstance(mContext).getDbOpenHelper().getCursor()); | |
56 | + } | |
57 | +} | ... | ... |
app/src/main/java/net/devfac/userstory/RecyclerBookShelfItemViewHolder.java
0 โ 100644
1 | +package net.devfac.userstory; | |
2 | + | |
3 | +import android.support.v7.widget.RecyclerView; | |
4 | +import android.view.View; | |
5 | +import android.widget.TextView; | |
6 | + | |
7 | +/** | |
8 | + * Created by Onether on 15. 11. 13.. | |
9 | + */ | |
10 | +public class RecyclerBookShelfItemViewHolder extends RecyclerView.ViewHolder { | |
11 | + private final TextView mItemTextView; | |
12 | + | |
13 | + public RecyclerBookShelfItemViewHolder(final View parent, TextView itemTextView) { | |
14 | + super(parent); | |
15 | + mItemTextView = itemTextView; | |
16 | + } | |
17 | + | |
18 | + public static RecyclerBookShelfItemViewHolder newInstance(View parent) { | |
19 | + TextView itemTextView = (TextView) parent.findViewById(R.id.shelf_list_item_title); | |
20 | + return new RecyclerBookShelfItemViewHolder(parent, itemTextView); | |
21 | + } | |
22 | + | |
23 | + public void setItemText(CharSequence text) { | |
24 | + mItemTextView.setText(text); | |
25 | + } | |
26 | +} | ... | ... |
app/src/main/res/layout/app_bar_main.xml
... | ... | @@ -2,11 +2,13 @@ |
2 | 2 | <android.support.design.widget.CoordinatorLayout |
3 | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | - xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" | |
5 | + xmlns:tools="http://schemas.android.com/tools" | |
6 | + android:layout_width="match_parent" | |
6 | 7 | android:layout_height="match_parent" android:fitsSystemWindows="true" |
7 | 8 | tools:context=".MainActivity"> |
8 | 9 | |
9 | 10 | <android.support.design.widget.AppBarLayout android:layout_height="wrap_content" |
11 | + android:id="@+id/appBarLayout" | |
10 | 12 | android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay"> |
11 | 13 | |
12 | 14 | <android.support.v7.widget.Toolbar android:id="@+id/toolbar_main" |
... | ... | @@ -15,13 +17,13 @@ |
15 | 17 | app:layout_scrollFlags="scroll|enterAlways"/> |
16 | 18 | |
17 | 19 | <android.support.design.widget.TabLayout android:id="@+id/tablayout_main" |
18 | - android:layout_width="match_parent" android:layout_height="match_parent" | |
20 | + android:layout_width="match_parent" android:layout_height="wrap_content" | |
19 | 21 | app:tabGravity="center" |
20 | 22 | app:tabIndicatorColor="@color/tabIndicatorColor"/> |
21 | 23 | |
22 | 24 | </android.support.design.widget.AppBarLayout> |
23 | 25 | |
24 | - <include layout="@layout/content_main" /> | |
26 | + <include layout="@layout/content_main"/> | |
25 | 27 | |
26 | 28 | <android.support.design.widget.FloatingActionButton android:id="@+id/fab" |
27 | 29 | android:layout_width="wrap_content" android:layout_height="wrap_content" | ... | ... |
app/src/main/res/layout/bookshelf_list_item.xml
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 | android:layout_height="wrap_content" |
29 | 29 | android:textAppearance="?android:attr/textAppearanceMedium" |
30 | 30 | android:text="Small Text" |
31 | - android:id="@+id/shelf_lis_item_title" | |
31 | + android:id="@+id/shelf_list_item_title" | |
32 | 32 | android:gravity="center" |
33 | 33 | android:layout_gravity="center" |
34 | 34 | android:layout_weight="9" /> | ... | ... |
app/src/main/res/layout/content_main.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | - xmlns:tools="http://schemas.android.com/tools" | |
4 | - xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" | |
5 | - android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" | |
6 | - android:paddingRight="@dimen/activity_horizontal_margin" | |
7 | - android:paddingTop="@dimen/activity_vertical_margin" | |
8 | - android:paddingBottom="@dimen/activity_vertical_margin" | |
9 | - app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:showIn="@layout/app_bar_main" | |
10 | - tools:context=".MainActivity"> | |
2 | +<!--<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"--> | |
3 | + <!--xmlns:tools="http://schemas.android.com/tools"--> | |
4 | + <!--xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"--> | |
5 | + <!--android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"--> | |
6 | + <!--android:paddingRight="@dimen/activity_horizontal_margin"--> | |
7 | + <!--android:paddingTop="@dimen/activity_vertical_margin"--> | |
8 | + <!--android:paddingBottom="@dimen/activity_vertical_margin"--> | |
9 | + <!--tools:showIn="@layout/app_bar_main"--> | |
10 | + <!--tools:context=".MainActivity" app:layout_behavior="@string/appbar_scrolling_view_behavior"--> | |
11 | + <!--android:background="#000000">--> | |
11 | 12 | |
12 | - <android.support.v4.view.ViewPager | |
13 | - android:id="@+id/viewPager_main" | |
14 | - android:layout_width="match_parent" | |
15 | - android:layout_height="match_parent" | |
16 | - app:layout_behavior="@string/appbar_scrolling_view_behavior"/> | |
17 | - | |
18 | - <!--<LinearLayout--> | |
19 | - <!--android:id="@+id/fragment_view"--> | |
20 | - <!--android:layout_width="fill_parent"--> | |
21 | - <!--android:layout_height="fill_parent"--> | |
22 | - <!--android:orientation="horizontal"--> | |
23 | - <!--android:layout_alignParentStart="true"--> | |
24 | - <!--android:layout_below="@+id/listBookshelf">--> | |
25 | - <!--</LinearLayout>--> | |
26 | - | |
27 | - <!--<fragment--> | |
28 | - <!--android:id="@+id/fragment_view"--> | |
29 | - <!--android:orientation="vertical"--> | |
13 | + <!--<android.support.v4.view.ViewPager--> | |
14 | + <!--android:id="@+id/viewPager_main"--> | |
30 | 15 | <!--android:layout_width="match_parent"--> |
31 | 16 | <!--android:layout_height="match_parent"--> |
32 | - <!--android:name="net.devfac.userstory.FragmentBookShelf"--> | |
33 | - <!--tools:layout="@layout/fragment_bookshelf">--> | |
34 | - <!--</fragment>--> | |
17 | + <!--app:layout_behavior="@string/appbar_scrolling_view_behavior"--> | |
18 | + <!--android:nestedScrollingEnabled="false"--> | |
19 | + <!--android:layout_alignParentEnd="false"--> | |
20 | + <!--android:layout_alignParentStart="false" />--> | |
21 | + | |
22 | + <!--<!–<LinearLayout–>--> | |
23 | + <!--<!–android:id="@+id/fragment_view"–>--> | |
24 | + <!--<!–android:layout_width="fill_parent"–>--> | |
25 | + <!--<!–android:layout_height="fill_parent"–>--> | |
26 | + <!--<!–android:orientation="horizontal"–>--> | |
27 | + <!--<!–android:layout_alignParentStart="true"–>--> | |
28 | + <!--<!–android:layout_below="@+id/listBookshelf">–>--> | |
29 | + <!--<!–</LinearLayout>–>--> | |
30 | + | |
31 | + <!--<!–<fragment–>--> | |
32 | + <!--<!–android:id="@+id/fragment_view"–>--> | |
33 | + <!--<!–android:orientation="vertical"–>--> | |
34 | + <!--<!–android:layout_width="match_parent"–>--> | |
35 | + <!--<!–android:layout_height="match_parent"–>--> | |
36 | + <!--<!–android:name="net.devfac.userstory.FragmentBookShelf"–>--> | |
37 | + <!--<!–tools:layout="@layout/fragment_bookshelf">–>--> | |
38 | + <!--<!–</fragment>–>--> | |
39 | + | |
40 | +<!--</RelativeLayout>--> | |
41 | + | |
42 | +<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" | |
43 | + xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" | |
44 | + android:id="@+id/viewPager_main" | |
45 | + android:layout_width="match_parent" | |
46 | + android:layout_height="match_parent" | |
47 | + app:layout_behavior="@string/appbar_scrolling_view_behavior" | |
48 | + tools:showIn="@layout/app_bar_main" /> | |
49 | + | |
35 | 50 | |
36 | -</RelativeLayout> | ... | ... |
app/src/main/res/layout/nav_header_main.xml
... | ... | @@ -19,10 +19,19 @@ |
19 | 19 | android:layout_height="wrap_content" |
20 | 20 | android:weightSum="10"> |
21 | 21 | |
22 | - <TextView android:layout_width="0dp" android:layout_height="wrap_content" | |
23 | - android:text="account@devfac.net" android:id="@+id/text_login_id" | |
22 | + <LinearLayout | |
23 | + android:layout_width="0dp" | |
24 | + android:layout_height="wrap_content" | |
24 | 25 | android:layout_weight="7" |
25 | - android:paddingLeft="10dp" /> | |
26 | + android:layout_gravity="center_vertical"> | |
27 | + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" | |
28 | + android:text="account@devfac.net" android:id="@+id/text_login_id" | |
29 | + | |
30 | + android:paddingLeft="10dp" /> | |
31 | + | |
32 | + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" | |
33 | + android:text="๋"/> | |
34 | + </LinearLayout> | |
26 | 35 | |
27 | 36 | <Button |
28 | 37 | android:layout_width="0dp" | ... | ... |
app/src/main/res/layout/recycler_book_shelf.xml
0 โ 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + android:id="@+id/recycler_book_shelf" | |
4 | + android:layout_width="match_parent" | |
5 | + android:layout_height="match_parent"/> | |
0 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/recycler_book_shelf_item.xml
0 โ 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + xmlns:card_view="http://schemas.android.com/apk/res-auto" | |
4 | + android:layout_width="match_parent" | |
5 | + android:layout_height="wrap_content" | |
6 | + android:layout_gravity="center" | |
7 | + card_view:cardCornerRadius="4dp" | |
8 | + android:layout_margin="8dp" | |
9 | + android:weightSum="10"> | |
10 | + | |
11 | + <LinearLayout | |
12 | + android:orientation="horizontal" android:layout_width="match_parent" | |
13 | + android:layout_height="match_parent" | |
14 | + android:weightSum="10"> | |
15 | + | |
16 | + | |
17 | + <ImageView | |
18 | + android:layout_width="0dp" | |
19 | + android:layout_height="wrap_content" | |
20 | + android:id="@+id/shelf_list_item_cover" | |
21 | + android:layout_gravity="center" | |
22 | + android:layout_weight="1" | |
23 | + android:src="@drawable/abc_btn_check_to_on_mtrl_015" /> | |
24 | + | |
25 | + <TextView | |
26 | + android:layout_width="0dp" | |
27 | + android:layout_height="wrap_content" | |
28 | + android:textAppearance="?android:attr/textAppearanceMedium" | |
29 | + android:text="Small Text" | |
30 | + android:id="@+id/shelf_list_item_registered_id" | |
31 | + android:gravity="center" | |
32 | + android:background="#BBBBBB" | |
33 | + android:layout_gravity="center" | |
34 | + android:visibility="gone" | |
35 | + android:layout_weight="1" /> | |
36 | + | |
37 | + <TextView | |
38 | + android:layout_width="0dp" | |
39 | + android:layout_height="?attr/listPreferredItemHeight" | |
40 | + style="@style/Base.TextAppearance.AppCompat.Body2" | |
41 | + android:textAppearance="?android:attr/textAppearanceMedium" | |
42 | + android:text="Small Text" | |
43 | + android:id="@+id/shelf_list_item_title" | |
44 | + android:gravity="center" | |
45 | + android:layout_gravity="center" | |
46 | + android:layout_weight="9" /> | |
47 | + </LinearLayout> | |
48 | +</android.support.v7.widget.CardView> | |
0 | 49 | \ No newline at end of file | ... | ... |
app/src/main/res/menu/main.xml
1 | 1 | <menu xmlns:android="http://schemas.android.com/apk/res/android" |
2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto" |
3 | 3 | xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"> |
4 | - <item android:id="@+id/action_settings" android:title="@string/action_settings" | |
4 | + <item android:id="@+id/action_main_settings" android:title="@string/action_main_settings" | |
5 | 5 | android:orderInCategory="100" app:showAsAction="never" /> |
6 | + <item android:id="@+id/action_main_about" android:title="@string/action_main_about" | |
7 | + android:orderInCategory="200" app:showAsAction="never" /> | |
6 | 8 | </menu> | ... | ... |
app/src/main/res/values/strings.xml
... | ... | @@ -4,5 +4,6 @@ |
4 | 4 | <string name="navigation_drawer_open">Open navigation drawer</string> |
5 | 5 | <string name="navigation_drawer_close">Close navigation drawer</string> |
6 | 6 | |
7 | - <string name="action_settings">Settings</string> | |
7 | + <string name="action_main_settings">Settings</string> | |
8 | + <string name="action_main_about">About</string> | |
8 | 9 | </resources> | ... | ... |
app/src/main/res/values/styles.xml
... | ... | @@ -6,8 +6,6 @@ |
6 | 6 | <item name="colorPrimary">@color/colorPrimary</item> |
7 | 7 | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> |
8 | 8 | <item name="colorAccent">@color/colorAccent</item> |
9 | - <item name="windowActionBar">false</item> | |
10 | - <item name="windowNoTitle">true</item> | |
11 | 9 | </style> |
12 | 10 | <style name="AppTheme.NoActionBar"> |
13 | 11 | <item name="windowActionBar">false</item> | ... | ... |