Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

João Gabriel 1jGabriel

🏠
Working from home
View GitHub Profile
View MyAdapter.kt
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.View.OnClickListener
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
class MyAdapter(
private val click: () -> Unit
View MyAdapter.kt
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.View.OnClickListener
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
@1jGabriel
1jGabriel / build.gradle
Created Oct 22, 2020
Paging dependencies
View build.gradle
def paging_version = "3.0.0-alpha07"
implementation "androidx.paging: paging-runtime:$paging_version"
View FragmentB.kt
class FragmentB : Fragment() {
fun onViewCreated(...) {
...
...
view.setOnClickListener {
val uri = Uri.parse("myApp://fragmentD")
findNavController().navigate(uri)
}
}
}
View nav_graph_two_with_deeplink.xml
View app_nav_graph.xml
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nav_main"
app:startDestination="@id/nav_feature_one">
<include app:graph="@navigation/nav_feature_one" />
<include app:graph="@navigation/nav_feature_two" />
<include app:graph="@navigation/nav_feature_three" />
</navigation>
@1jGabriel
1jGabriel / build.gradle
Created Oct 19, 2020
App Module build.gradle
View build.gradle
implementation project(":featureone")
implementation project(":featuretwo")
implementation project(":featurethree")
@1jGabriel
1jGabriel / navgraph_3.xml
Created Oct 19, 2020
Third feature navgraph
View navgraph_3.xml
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_feature_three"
app:startDestination="@id/fragment_e">
<fragment
android:id="@+id/fragment_e"
android:name="io.jgabriel.featurethree.FragmentE">
<action
@1jGabriel
1jGabriel / navgraph.xml
Created Oct 19, 2020
First Feature Navigation graph
View navgraph.xml
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_feature_one"
app:startDestination="@id/fragment_a">
<fragment
android:id="@+id/fragment_a"
android:name="io.jgabriel.featureone.FragmentA">
@1jGabriel
1jGabriel / build.gradle
Created Oct 19, 2020
navigation dependencies
View build.gradle
implementation "androidx.navigation:navigation-fragment-ktx:2.2.2"
implementation "androidx.navigation:navigation-ui-ktx:2.2.2"
You can’t perform that action at this time.