-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Moved setup code to a more standard MVVM type structure using Koin …
…and ViewModels, with Flow and LiveData - Switched setup to use View Binding instead of Synthetics as is recommended nowadays - Rewrote Accessibility, Foreground and core Columbus service code to hopefully be more stable and reliable with no duplications. Both Accessibility and Foreground services are now used solely to keep the code running, and executing actions / powering gates (accessibility) - Removed unused tensorflow jni lib & xposed_init left over from pre-alpha days - Began splitting out Extensions into seperate classe
- Loading branch information
1 parent
7e31a5b
commit 313c9c3
Showing
99 changed files
with
2,505 additions
and
1,968 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Binary file not shown.
This file contains 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
Binary file not shown.
This file was deleted.
Oops, something went wrong.
59 changes: 53 additions & 6 deletions
59
app/src/main/java/com/kieronquinn/app/taptap/TapTapApplication.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,71 @@ | ||
package com.kieronquinn.app.taptap | ||
|
||
import android.app.Application | ||
import androidx.lifecycle.MutableLiveData | ||
import com.kieronquinn.app.taptap.services.TapAccessibilityService | ||
import com.kieronquinn.app.taptap.services.TapGestureAccessibilityService | ||
import android.content.Context | ||
import com.google.android.systemui.columbus.ColumbusContentObserver | ||
import com.google.android.systemui.columbus.ContentResolverWrapper | ||
import com.google.android.systemui.columbus.PowerManagerWrapper | ||
import com.google.android.systemui.columbus.sensors.GestureSensor | ||
import com.google.android.systemui.columbus.sensors.config.Adjustment | ||
import com.google.android.systemui.columbus.sensors.config.GestureConfiguration | ||
import com.kieronquinn.app.taptap.core.TapGestureSensorImpl | ||
import com.kieronquinn.app.taptap.core.TapColumbusService | ||
import com.kieronquinn.app.taptap.core.TapServiceContainer | ||
import com.kieronquinn.app.taptap.core.TapSharedPreferences | ||
import com.kieronquinn.app.taptap.utils.AppIconRequestHandler | ||
import com.kieronquinn.app.taptap.utils.activityManagerNative | ||
import com.kieronquinn.app.taptap.v2.ui.screens.modal.ModalNoGyroscopeViewModel | ||
import com.kieronquinn.app.taptap.v2.ui.screens.setup.accessibility.SetupAccessibilityViewModel | ||
import com.kieronquinn.app.taptap.v2.ui.screens.setup.battery.SetupBatteryViewModel | ||
import com.kieronquinn.app.taptap.v2.ui.screens.setup.configuration.SetupConfigurationViewModel | ||
import com.kieronquinn.app.taptap.v2.ui.screens.setup.configuration.preference.SetupConfigurationPreferenceViewModel | ||
import com.kieronquinn.app.taptap.v2.ui.screens.setup.landing.SetupLandingViewModel | ||
import com.kieronquinn.app.taptap.v2.ui.screens.setup.foss.SetupFossInfoViewModel | ||
import com.squareup.picasso.Picasso | ||
import org.koin.android.ext.android.inject | ||
import org.koin.android.ext.koin.androidContext | ||
import org.koin.android.viewmodel.dsl.viewModel | ||
import org.koin.core.context.startKoin | ||
import org.koin.dsl.module | ||
|
||
class TapTapApplication : Application() { | ||
|
||
var accessibilityService: MutableLiveData<TapAccessibilityService?> = MutableLiveData(null) | ||
var gestureAccessibilityService: MutableLiveData<TapGestureAccessibilityService?> = MutableLiveData(null) | ||
|
||
var disableWake = false | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
Picasso.setSingletonInstance(Picasso.Builder(this) | ||
.addRequestHandler(AppIconRequestHandler(this)) | ||
.build()) | ||
startKoin { | ||
androidContext(this@TapTapApplication) | ||
val modules = module { | ||
//Tap Service Dependencies | ||
single { TapSharedPreferences(get()) } | ||
single<GestureSensor> { TapGestureSensorImpl(get(), get(), createGestureConfiguration(get(), activityManagerNative)) } | ||
single { PowerManagerWrapper(get()) } | ||
//Tap Service | ||
single { TapColumbusService(get(), get(), get(), get()) } | ||
single { TapServiceContainer() } | ||
//Setup flow | ||
viewModel { SetupLandingViewModel(get()) } | ||
viewModel { SetupConfigurationViewModel(get()) } | ||
viewModel { SetupConfigurationPreferenceViewModel(get()) } | ||
viewModel { SetupFossInfoViewModel() } | ||
viewModel { SetupAccessibilityViewModel() } | ||
viewModel { SetupBatteryViewModel(get()) } | ||
//No gyroscope modal | ||
viewModel { ModalNoGyroscopeViewModel() } | ||
} | ||
modules(modules) | ||
} | ||
} | ||
|
||
private fun createGestureConfiguration(context: Context, activityManager: Any): GestureConfiguration { | ||
val contentResolverWrapper = ContentResolverWrapper(context) | ||
val factory = ColumbusContentObserver.Factory::class.java.constructors.first() | ||
.newInstance(contentResolverWrapper, activityManager) as ColumbusContentObserver.Factory | ||
return GestureConfiguration(context, emptySet<Adjustment>(), factory) | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
Oops, something went wrong.