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
data class SampleModel ( | |
val id: Int, | |
val name: String | |
) |
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
class SampleAdapter(val mListener: SampleAdapterListener): RecyclerView.Adapter<SampleAdapter.ViewHolder>() { | |
interface SampleAdapterListener { | |
fun onClickCard(position: Int) | |
fun onClickDelete(position: Int) | |
} | |
private val mUI = SampleAdapterUI() | |
private var mSampleModelList = listOf<SampleModel>() |
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
class SampleActivity : BaseActivity(), SampleAdapter.SampleAdapterListener { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
val ui = SampleActivityUI() | |
ui.setContentView(this) | |
// テストデータ | |
val sampleModelList = arrayListOf<SampleModel>() |
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
class SampleActivityUI : AnkoComponent<SampleActivity> { | |
lateinit var mRecyclerView: RecyclerView | |
override fun createView(ui: AnkoContext<SampleActivity>) = with(ui) { | |
verticalLayout { | |
mRecyclerView = recyclerView { | |
layoutManager = LinearLayoutManager(ctx, LinearLayoutManager.VERTICAL, false) | |
}.lparams(width = matchParent) { | |
topMargin = dip(5) |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="thank_you">Thank you</string> | |
</resources> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="thank_you">ありがとう</string> | |
</resources> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="thank_you">Gracias</string> | |
</resources> |
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
class SampleDBHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, DB_SAMPLE, null, DB_VERSION) { | |
companion object { | |
const val DB_SAMPLE = "db_sample" | |
const val DB_VERSION = 1 | |
const val TABLE_SAMPLE = "table_sample" | |
const val CULM_ID = "id" | |
const val CULM_TEXT = "text" |
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
data class SampleModel ( | |
val id: Int, | |
val text: String, | |
val number: Int | |
) |
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
class SampleManager(ctx: Context) { | |
private val mDB = SampleDBHelper.getInstance(ctx) | |
fun getSampleModelList(): List<SampleModel> { | |
lateinit var sampleModelList: List<SampleModel> | |
mDB.use { | |
sampleModelList = select(SampleDBHelper.TABLE_SAMPLE).parseList(classParser()) | |
} | |
return sampleModelList |
OlderNewer