Skip to content

Instantly share code, notes, and snippets.

View thalespupo's full-sized avatar

Thales Pupo Araújo thalespupo

View GitHub Profile
@thalespupo
thalespupo / MyAdapter.kt
Last active November 13, 2020 13:04
MyAdapter KotlinSynthetic
import kotlinx.android.synthetic.main.list_item_example.view.*
class MyAdapter : ListAdapter<String, MyAdapter.MyViewHolder>(DiffCallBack()) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val view =
LayoutInflater.from(parent.context)
.inflate(R.layout.list_item_example, parent, false)
return MyViewHolder(view)
@thalespupo
thalespupo / MainActivity.kt
Last active November 13, 2020 12:46
MainActivity Kotlin Synthetic
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Já podemos utilizar o txtView
// sem necessidade de criar um membro p/ classe
@thalespupo
thalespupo / MainActivity.kt
Last active November 13, 2020 12:30
MainActivity findViewById
class MainActivity : AppCompatActivity() {
private var myTextView: TextView? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
myTextView = findViewById(R.id.txtView)
@thalespupo
thalespupo / ActRobot.kt
Last active May 9, 2019 18:36
AAA + TestingRobot + Kotlin DSL
package com.tapura.podmorecasts
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.action.ViewActions.pressImeActionButton
import android.support.test.espresso.matcher.ViewMatchers.withId
class ActRobot {
fun clickOkInSearchBar() {
onView(withId(android.support.design.R.id.search_src_text)).perform().perform(pressImeActionButton())
}
package com.tapura.podmorecasts.download;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
import java.util.ArrayList;