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 MvvmView extends StatefulWidget { | |
| @override | |
| _MvvmViewState createState() => _MvvmViewState(); | |
| } | |
| class _MvvmViewState extends State<MvvmView> { | |
| @override |
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
| LocationManager(callback: (state) { | |
| print("State ${state.toString()}"); | |
| switch(state.state) { | |
| case LocationEnum.ERROR: | |
| print("error ${state.message}"); | |
| break; | |
| case LocationEnum.LOADING: | |
| // TODO: Handle this case. | |
| break; | |
| case LocationEnum.REQUESTING_LOCATION_SERVICE: |
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 LocationManager { | |
| Location location = new Location(); | |
| bool _serviceEnabled = false; | |
| PermissionStatus? _permissionGranted; | |
| late LocationData _locationData; | |
| Function(LocationState) callback; | |
| LocationManager({required this.callback}); |
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 LocationState { | |
| LocationEnum state; | |
| String? message; | |
| LocationData? location; | |
| LocationState({required this.state, this.message, this.location}); | |
| static LocationState loading({String? message}) { | |
| return LocationState(state: LocationEnum.LOADING, message: message); |
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 MainActivity : AppCompatActivity() { | |
| val camIntentCode = 100 | |
| val imageFile: File by lazy { | |
| File(getExternalFilesDir(null)?.absolutePath + "/${System.currentTimeMillis()}.jpg") | |
| } | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) |
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 MainActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) | |
| WebView.setWebContentsDebuggingEnabled(true) | |
| webview.settings.apply { | |
| javaScriptEnabled = true | |
| } | |
| // wvl implementation | |
| webview.webChromeClient = object : WebViewLogger(application = application) { |
NewerOlder