Showing
6 changed files
with
57 additions
and
40 deletions
... | @@ -5,17 +5,17 @@ import android.view.View | ... | @@ -5,17 +5,17 @@ import android.view.View |
5 | import android.view.ViewGroup | 5 | import android.view.ViewGroup |
6 | import android.widget.Toast | 6 | import android.widget.Toast |
7 | import androidx.recyclerview.widget.RecyclerView | 7 | import androidx.recyclerview.widget.RecyclerView |
8 | -import kotlinx.android.synthetic.main.list_item.view.* | 8 | +import kotlinx.android.synthetic.main.item_policyfield.view.* |
9 | 9 | ||
10 | -class RecyclerAdapter(private val items: ArrayList<YoutubeItem>) : | 10 | +class PolicyFieldAdapter(private val items: ArrayList<PolicyFieldItem>) : |
11 | - RecyclerView.Adapter<RecyclerAdapter.ViewHolder>() { | 11 | + RecyclerView.Adapter<PolicyFieldAdapter.ViewHolder>() { |
12 | 12 | ||
13 | override fun getItemCount() = items.size | 13 | override fun getItemCount() = items.size |
14 | 14 | ||
15 | - override fun onBindViewHolder(holder: RecyclerAdapter.ViewHolder, position: Int) { | 15 | + override fun onBindViewHolder(holder: PolicyFieldAdapter.ViewHolder, position: Int) { |
16 | val item = items[position] | 16 | val item = items[position] |
17 | val listener = View.OnClickListener {it -> | 17 | val listener = View.OnClickListener {it -> |
18 | - Toast.makeText(it.context, "Clicked: ${item.title}", Toast.LENGTH_SHORT).show() | 18 | + Toast.makeText(it.context, "Clicked: ${item.policyFieldItemText}", Toast.LENGTH_SHORT).show() |
19 | } | 19 | } |
20 | holder.apply { | 20 | holder.apply { |
21 | bind(listener, item) | 21 | bind(listener, item) |
... | @@ -24,19 +24,19 @@ class RecyclerAdapter(private val items: ArrayList<YoutubeItem>) : | ... | @@ -24,19 +24,19 @@ class RecyclerAdapter(private val items: ArrayList<YoutubeItem>) : |
24 | } | 24 | } |
25 | 25 | ||
26 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): | 26 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): |
27 | - RecyclerAdapter.ViewHolder { | 27 | + PolicyFieldAdapter.ViewHolder { |
28 | val inflatedView = LayoutInflater.from(parent.context) | 28 | val inflatedView = LayoutInflater.from(parent.context) |
29 | - .inflate(R.layout.list_item, parent, false) | 29 | + .inflate(R.layout.item_policyfield, parent, false) |
30 | - return RecyclerAdapter.ViewHolder(inflatedView) | 30 | + return PolicyFieldAdapter.ViewHolder(inflatedView) |
31 | } | 31 | } |
32 | 32 | ||
33 | class ViewHolder(v: View) : RecyclerView.ViewHolder(v) { | 33 | class ViewHolder(v: View) : RecyclerView.ViewHolder(v) { |
34 | 34 | ||
35 | private var view: View = v | 35 | private var view: View = v |
36 | 36 | ||
37 | - fun bind(listener: View.OnClickListener, item: YoutubeItem) { | 37 | + fun bind(listener: View.OnClickListener, item: PolicyFieldItem) { |
38 | - view.thumbnail.setImageDrawable(item.image) | 38 | + view.fieldIcon.setImageDrawable(item.policyFieldItemImage) |
39 | - view.title.text = item.title | 39 | + view.fieldIconText.text = item.policyFieldItemText |
40 | view.setOnClickListener(listener) | 40 | view.setOnClickListener(listener) |
41 | } | 41 | } |
42 | } | 42 | } | ... | ... |
... | @@ -2,6 +2,6 @@ package com.example.vip | ... | @@ -2,6 +2,6 @@ package com.example.vip |
2 | 2 | ||
3 | import android.graphics.drawable.Drawable | 3 | import android.graphics.drawable.Drawable |
4 | 4 | ||
5 | -class YoutubeItem(val image: Drawable, val title: String) { | 5 | +class PolicyFieldItem(val policyFieldItemImage: Drawable, val policyFieldItemText: String) { |
6 | 6 | ||
7 | } | 7 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -11,21 +11,21 @@ class SignInActivity : AppCompatActivity() { | ... | @@ -11,21 +11,21 @@ class SignInActivity : AppCompatActivity() { |
11 | super.onCreate(savedInstanceState) | 11 | super.onCreate(savedInstanceState) |
12 | setContentView(R.layout.activity_signin) | 12 | setContentView(R.layout.activity_signin) |
13 | 13 | ||
14 | - val list = ArrayList<YoutubeItem>() | 14 | + val policyFieldList = ArrayList<PolicyFieldItem>() |
15 | - | 15 | + |
16 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image01)!!, getString(R.string.title01))) | 16 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image01)!!, getString(R.string.title01))) |
17 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image02)!!, getString(R.string.title02))) | 17 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image02)!!, getString(R.string.title02))) |
18 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image03)!!, getString(R.string.title03))) | 18 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image03)!!, getString(R.string.title03))) |
19 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image04)!!, getString(R.string.title04))) | 19 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image04)!!, getString(R.string.title04))) |
20 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image05)!!, getString(R.string.title05))) | 20 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image05)!!, getString(R.string.title05))) |
21 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image06)!!, getString(R.string.title06))) | 21 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image06)!!, getString(R.string.title06))) |
22 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image07)!!, getString(R.string.title07))) | 22 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image07)!!, getString(R.string.title07))) |
23 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image08)!!, getString(R.string.title08))) | 23 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image08)!!, getString(R.string.title08))) |
24 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image09)!!, getString(R.string.title09))) | 24 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image09)!!, getString(R.string.title09))) |
25 | - list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image10)!!, getString(R.string.title10))) | 25 | + policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image10)!!, getString(R.string.title10))) |
26 | - | 26 | + |
27 | - val adapter = RecyclerAdapter(list) | 27 | + val adapter = PolicyFieldAdapter(policyFieldList) |
28 | - recyclerView.adapter = adapter | 28 | + policyFieldRecyclerView.adapter = adapter |
29 | 29 | ||
30 | } | 30 | } |
31 | 31 | ... | ... |
... | @@ -13,14 +13,31 @@ | ... | @@ -13,14 +13,31 @@ |
13 | tools:layout_editor_absoluteX="46dp" | 13 | tools:layout_editor_absoluteX="46dp" |
14 | tools:layout_editor_absoluteY="287dp"> | 14 | tools:layout_editor_absoluteY="287dp"> |
15 | 15 | ||
16 | + <TextView | ||
17 | + android:id="@+id/space_logo_and_search" | ||
18 | + android:layout_width="match_parent" | ||
19 | + android:layout_height="50dp" | ||
20 | + android:text="로고 및 검색창" /> | ||
21 | + | ||
22 | + <TextView | ||
23 | + android:id="@+id/space_rollingBanner" | ||
24 | + android:layout_width="match_parent" | ||
25 | + android:layout_height="200dp" | ||
26 | + android:text="롤링배너창" /> | ||
27 | + | ||
16 | <androidx.recyclerview.widget.RecyclerView | 28 | <androidx.recyclerview.widget.RecyclerView |
17 | - android:id="@+id/recyclerView" | 29 | + android:id="@+id/policyFieldRecyclerView" |
18 | android:layout_width="match_parent" | 30 | android:layout_width="match_parent" |
19 | - android:layout_height="match_parent" | 31 | + android:layout_height="300dp" |
20 | - android:clipToPadding="false" | ||
21 | app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" | 32 | app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" |
22 | app:spanCount="3" | 33 | app:spanCount="3" |
23 | - tools:listitem="@layout/list_item"/> | 34 | + tools:listitem="@layout/item_policyfield" /> |
35 | + | ||
36 | + <TextView | ||
37 | + android:id="@+id/space_snackbar" | ||
38 | + android:layout_width="match_parent" | ||
39 | + android:layout_height="wrap_content" | ||
40 | + android:text="스낵바창" /> | ||
24 | 41 | ||
25 | 42 | ||
26 | </LinearLayout> | 43 | </LinearLayout> | ... | ... |
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | 7 | ||
8 | 8 | ||
9 | <ImageView | 9 | <ImageView |
10 | - android:id="@+id/thumbnail" | 10 | + android:id="@+id/fieldIcon" |
11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
12 | android:layout_height="wrap_content" | 12 | android:layout_height="wrap_content" |
13 | app:layout_constraintLeft_toLeftOf="parent" | 13 | app:layout_constraintLeft_toLeftOf="parent" |
... | @@ -16,11 +16,11 @@ | ... | @@ -16,11 +16,11 @@ |
16 | android:adjustViewBounds="true"/> | 16 | android:adjustViewBounds="true"/> |
17 | 17 | ||
18 | <TextView | 18 | <TextView |
19 | - android:id="@+id/title" | 19 | + android:id="@+id/fieldIconText" |
20 | android:layout_width="wrap_content" | 20 | android:layout_width="wrap_content" |
21 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
22 | android:textSize="20sp" | 22 | android:textSize="20sp" |
23 | - app:layout_constraintTop_toBottomOf="@+id/thumbnail" | 23 | + app:layout_constraintTop_toBottomOf="@+id/fieldIcon" |
24 | app:layout_constraintLeft_toLeftOf="parent" | 24 | app:layout_constraintLeft_toLeftOf="parent" |
25 | app:layout_constraintRight_toRightOf="parent"/> | 25 | app:layout_constraintRight_toRightOf="parent"/> |
26 | 26 | ... | ... |
1 | <resources> | 1 | <resources> |
2 | <string name="app_name">vip</string> | 2 | <string name="app_name">vip</string> |
3 | 3 | ||
4 | - <string name="title01">10 Best Practices for Moving to a Single Activity</string> | 4 | + <string name="title01">교육</string> |
5 | - <string name="title02">Cost of a Pixel Color (Android Dev Summit 18)</string> | 5 | + <string name="title02">고용</string> |
6 | - <string name="title03">Foldables, App Bundles and more from Android Dev Summit 18!</string> | 6 | + <string name="title03">주거</string> |
7 | - <string name="title04">Fun with LiveData (Android Dev Summit 18)</string> | 7 | + <string name="title04">건강</string> |
8 | - <string name="title05">Keynote (Android Dev Summit 18)</string> | 8 | + <string name="title05">서민금융</string> |
9 | - <string name="title06">Modern WebView Best Practices (Android Dev Summit 18)</string> | 9 | + <string name="title06">문화</string> |
10 | <string name="title07">Performance Analysis Using Systrace (Android Dev Summit 18)</string> | 10 | <string name="title07">Performance Analysis Using Systrace (Android Dev Summit 18)</string> |
11 | <string name="title08">Preferential Practices for Preferences (Android Dev Summit 18)</string> | 11 | <string name="title08">Preferential Practices for Preferences (Android Dev Summit 18)</string> |
12 | <string name="title09">That’s a wrap on Android Dev Summit 2018!</string> | 12 | <string name="title09">That’s a wrap on Android Dev Summit 2018!</string> | ... | ... |
-
Please register or login to post a comment