This file contains hidden or 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
//Migration to AndroidX Room Plugin on Convention Plugins | |
import org.gradle.android.workarounds.room.RoomExtension | |
class AndroidRoomConventionPlugin : Plugin<Project> { | |
override fun apply(project: Project) { | |
with(project) { | |
//To do | |
} | |
} |
This file contains hidden or 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
@Composable | |
fun Main(list: List<String>) { | |
var items by remember { mutableStateOf(list) } | |
LazyColumn { | |
items(items) { item -> | |
RowView(item) { str -> | |
val pos = items.indexOf(str) | |
Log.v(TAG, "pos $pos") | |
if(pos!= -1) { |
This file contains hidden or 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
build.gradle (app) | |
dependencies { | |
implementation 'androidx.core:core-ktx:1.8.0' | |
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0') | |
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' | |
implementation 'androidx.activity:activity-compose:1.5.1' | |
implementation platform('androidx.compose:compose-bom:2022.10.00') | |
implementation 'androidx.compose.ui:ui' |
This file contains hidden or 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
-keep class com.app.demo.model.* { *; } | |
-keep class com.app.demo.remote.SomeResponse { <fields>; } | |
-keep class com.app.demo.SomeEntity { *; } | |
-keep interface com.app.demo.SomeInterface { *; } | |
-keepclassmembers class com.app.demo.SomeClass { | |
public static ** Companion; | |
} |
This file contains hidden or 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
fun <T: ViewModel> T.createFactory() : ViewModelProvider.Factory { | |
val viewModel = this | |
@Suppress("UNCHECKED_CAST") | |
return object :ViewModelProvider.Factory{ | |
override fun <T : ViewModel?> create(modelClass: Class<T>): T = viewModel as T | |
} | |
} |
This file contains hidden or 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
override suspend fun notesByUser( | |
userId: String | |
): OperationResult<List<Note>> { | |
return try { | |
val response = serviceApi.notesByUser(userId) | |
val statusCode = response.code() | |
//200 300 400 | |
if (response.isSuccessful) { //200 | |
val body: NotesResponse? = response.body() | |
OperationResult.Success(body?.data?.map { |
This file contains hidden or 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
Error : | |
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath: | |
/Users/xx/.gradle/caches/transforms-2/files-2.1/5ddeaae6ee15f19826b9dd5f1cf7b0a4/jetified-kotlin-stdlib-jdk7-1.3.72.jar (version 1.3) | |
/Users/xx/.gradle/caches/transforms-2/files-2.1/3951109aac4671bfe341f4dc43e131ef/jetified-kotlin-stdlib-1.4.32.jar (version 1.4) | |
/Users/xx/.gradle/caches/transforms-2/files-2.1/1d67f6842b59bd1bd3d06c3bca4e4ac4/jetified-kotlin-stdlib-common-1.4.32.jar (version 1.4) | |
Inspect dependencies : | |
./gradlew :module:dependencies |
This file contains hidden or 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
//view | |
private val itemTouchHelper = | |
ItemTouchHelper(object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | |
override fun onMove( | |
recyclerView: RecyclerView, | |
viewHolder: RecyclerView.ViewHolder, | |
target: RecyclerView.ViewHolder | |
): Boolean = false | |
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
This file contains hidden or 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
//https://square.github.io/retrofit/ | |
@FormUrlEncoded | |
@POST("endpoint/") | |
Call<LoginResponse> login(@Field("codigo_empresa") String username); | |
String username = user.getText().toString().trim(); | |
Log.v("CONSOLE",username); | |
Call< LoginResponse > loginResponseCall = ApiClient.getUserService ( ).login ( username ); |
This file contains hidden or 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 LogInFragment : Fragment() { | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
//TODO events | |
binding.buttonLogIn.setOnClickListener { | |
if(validForm()) { | |
showMessage() | |
} |
NewerOlder