-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring UI models module (#2428)
* create audio-ui-model module
- Loading branch information
1 parent
b84e513
commit bde87db
Showing
48 changed files
with
811 additions
and
508 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Signature format: 4.0 | ||
package com.google.android.horologist.audio.ui { | ||
|
||
public final class VolumeUiState { | ||
ctor public VolumeUiState(optional int current, optional int max, optional int min); | ||
method public int component1(); | ||
method public int component2(); | ||
method public int component3(); | ||
method public com.google.android.horologist.audio.ui.VolumeUiState copy(int current, int max, int min); | ||
method public int getCurrent(); | ||
method public int getMax(); | ||
method public int getMin(); | ||
method public boolean isMax(); | ||
method public boolean isMin(); | ||
property public final int current; | ||
property public final boolean isMax; | ||
property public final boolean isMin; | ||
property public final int max; | ||
property public final int min; | ||
} | ||
|
||
@com.google.android.horologist.annotations.ExperimentalHorologistApi public class VolumeViewModel extends androidx.lifecycle.ViewModel { | ||
ctor public VolumeViewModel(com.google.android.horologist.audio.VolumeRepository volumeRepository, com.google.android.horologist.audio.AudioOutputRepository audioOutputRepository, optional kotlin.jvm.functions.Function0<kotlin.Unit> onCleared, android.os.Vibrator vibrator); | ||
method public final void decreaseVolume(); | ||
method public final void decreaseVolumeWithHaptics(); | ||
method public final kotlinx.coroutines.flow.StateFlow<com.google.android.horologist.audio.AudioOutput> getAudioOutput(); | ||
method public final kotlinx.coroutines.flow.Flow<kotlin.Unit> getDisplayIndicatorEvents(); | ||
method public final kotlinx.coroutines.flow.StateFlow<com.google.android.horologist.audio.ui.VolumeUiState> getVolumeUiState(); | ||
method public final void increaseVolume(); | ||
method public final void increaseVolumeWithHaptics(); | ||
method public final void launchOutputSelection(); | ||
method public final void onVolumeChangeByScroll(float pixels); | ||
method public final void setVolume(int volume); | ||
property public final kotlinx.coroutines.flow.StateFlow<com.google.android.horologist.audio.AudioOutput> audioOutput; | ||
property public final kotlinx.coroutines.flow.Flow<kotlin.Unit> displayIndicatorEvents; | ||
property public final kotlinx.coroutines.flow.StateFlow<com.google.android.horologist.audio.ui.VolumeUiState> volumeUiState; | ||
field public static final com.google.android.horologist.audio.ui.VolumeViewModel.Companion Companion; | ||
} | ||
|
||
@com.google.android.horologist.annotations.ExperimentalHorologistApi public static final class VolumeViewModel.Companion { | ||
method public androidx.lifecycle.ViewModelProvider.Factory getFactory(); | ||
property public final androidx.lifecycle.ViewModelProvider.Factory Factory; | ||
} | ||
|
||
} | ||
|
||
package com.google.android.horologist.audio.ui.mapper { | ||
|
||
public final class VolumeUiStateMapper { | ||
method public com.google.android.horologist.audio.ui.VolumeUiState map(com.google.android.horologist.audio.VolumeState volumeState); | ||
field public static final com.google.android.horologist.audio.ui.mapper.VolumeUiStateMapper INSTANCE; | ||
} | ||
|
||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* Copyright 2022 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
plugins { | ||
id("com.android.library") | ||
alias(libs.plugins.dokka) | ||
alias(libs.plugins.metalavaGradle) | ||
kotlin("android") | ||
alias(libs.plugins.roborazzi) | ||
alias(libs.plugins.compose.compiler) | ||
} | ||
|
||
android { | ||
compileSdk = 35 | ||
|
||
defaultConfig { | ||
minSdk = 26 | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
buildFeatures { | ||
buildConfig = false | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_17.majorVersion | ||
freeCompilerArgs = freeCompilerArgs + "-opt-in=com.google.android.horologist.annotations.ExperimentalHorologistApi" | ||
} | ||
|
||
packaging { | ||
resources { | ||
excludes += | ||
listOf( | ||
"/META-INF/AL2.0", | ||
"/META-INF/LGPL2.1", | ||
) | ||
} | ||
} | ||
|
||
testOptions { | ||
unitTests { | ||
isIncludeAndroidResources = true | ||
} | ||
animationsDisabled = true | ||
} | ||
|
||
sourceSets.getByName("main") { | ||
assets.srcDir("src/main/assets") | ||
} | ||
|
||
lint { | ||
disable += listOf("MissingTranslation", "ExtraTranslation") | ||
checkReleaseBuilds = false | ||
textReport = true | ||
} | ||
|
||
namespace = "com.google.android.horologist.audio.ui.model" | ||
} | ||
|
||
project.tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach { | ||
// Workaround for https://youtrack.jetbrains.com/issue/KT-37652 | ||
if (!this.name.endsWith("TestKotlin") && !this.name.startsWith("compileDebug")) { | ||
compilerOptions { | ||
freeCompilerArgs.add("-Xexplicit-api=strict") | ||
} | ||
} | ||
} | ||
|
||
metalava { | ||
sourcePaths.setFrom("src/main") | ||
filename.set("api/current.api") | ||
reportLintsAsErrors.set(true) | ||
} | ||
|
||
dependencies { | ||
api(projects.media.audio) | ||
implementation(libs.androidx.lifecycle.viewmodel.compose) | ||
} | ||
|
||
tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach { | ||
dokkaSourceSets { | ||
configureEach { | ||
moduleName.set("media-audio-ui-model") | ||
} | ||
} | ||
} | ||
|
||
apply(plugin = "com.vanniktech.maven.publish") |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.google.android.horologist.audio.ui.model"> | ||
|
||
<uses-feature android:name="android.hardware.type.watch" /> | ||
<uses-permission android:name="android.permission.VIBRATE" /> | ||
|
||
<uses-sdk android:minSdkVersion="26" tools:ignore="GradleOverrides" /> | ||
</manifest> |
2 changes: 1 addition & 1 deletion
2
...roid/horologist/audio/ui/VolumeUiState.kt → ...roid/horologist/audio/ui/VolumeUiState.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
2 changes: 1 addition & 1 deletion
2
...id/horologist/audio/ui/VolumeViewModel.kt → ...id/horologist/audio/ui/VolumeViewModel.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
File renamed without changes.
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
2 changes: 1 addition & 1 deletion
2
media/audio-ui/src/main/java/com/google/android/horologist/audio/ui/RotaryVolumeControls.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
2 changes: 1 addition & 1 deletion
2
...dio-ui/src/test/kotlin/com/google/android/horologist/audio/ui/RotaryVolumeControlsTest.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
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.