Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/wlama/bin/android-studio/plugins/android/resources/proguard-android-optimize.txt

-keep class com.abcomm.MainViewModel { *; }
-keep class com.abcomm.BluetoothService { *; }
-keep interface com.abcomm.CommunicationProvider { *; }
6 changes: 5 additions & 1 deletion app/src/main/java/com/abcomm/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ class MainActivity : AppCompatActivity() {
private val viewModel: MainViewModel by viewModels {
object : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return MainViewModel(BluetoothService()) as T
if (modelClass.isAssignableFrom(MainViewModel::class.java)) {
@Suppress("UNCHECKED_CAST")
return MainViewModel(BluetoothService()) as T
}
throw IllegalArgumentException("Unknown ViewModel class")
}
}
}
Expand Down
Loading