generated from GO-SOPT-ANDROID/android-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from GO-SOPT-ANDROID/feature/week4
Feature/week4
- Loading branch information
Showing
33 changed files
with
1,089 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.android.go.sopt | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import org.android.go.sopt.databinding.ItemPagerBinding | ||
|
||
class ViewPagerAdapter( | ||
_itemList: List<Int> = listOf(), | ||
) : RecyclerView.Adapter<ViewPagerAdapter.PagerViewHolder>() { | ||
private var itemList: List<Int> = _itemList | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PagerViewHolder { | ||
val binding = ItemPagerBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
return PagerViewHolder(binding) | ||
} | ||
|
||
class PagerViewHolder( | ||
private val binding: ItemPagerBinding, | ||
) : RecyclerView.ViewHolder(binding.root) { | ||
fun bind(src: Int) { | ||
binding.ivPager.setImageResource(src) | ||
} | ||
} | ||
|
||
override fun onBindViewHolder(holder: PagerViewHolder, position: Int) { | ||
holder.bind(itemList[position]) | ||
} | ||
|
||
override fun getItemCount() = itemList.size | ||
|
||
fun setItemList(itemList: List<Int>) { | ||
this.itemList = itemList | ||
notifyDataSetChanged() | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
app/src/main/java/org/android/go/sopt/myPage/ContextUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.android.go.sopt.myPage | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.view.View | ||
import android.view.inputmethod.InputMethodManager | ||
|
||
fun Context.hideKeyboard(view: View) { | ||
val inputMethodManager = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager | ||
inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) | ||
} |
Oops, something went wrong.