From 956d7635aa98487899b57ff4c1fdcde3e93b4142 Mon Sep 17 00:00:00 2001 From: wintmain Date: Sat, 7 Feb 2026 18:10:46 +0800 Subject: [PATCH 1/2] [common][chore]Bump up gradle to ver9 Applying the Compose Compiler Gradle plugin, which is required for Kotlin 2.0+. Also need use 2.0+ kotlin for gradle ver9 --- app-catalog/app/build.gradle | 15 +++++++++------ app-catalog/samples/wNet/build.gradle.kts | 12 +++++++----- build.gradle | 3 ++- gradle/libs.versions.toml | 7 ++++--- gradle/sample-build.gradle | 10 ++++++---- gradle/wrapper/gradle-wrapper.properties | 2 +- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/app-catalog/app/build.gradle b/app-catalog/app/build.gradle index 6c8cc48..0bee008 100644 --- a/app-catalog/app/build.gradle +++ b/app-catalog/app/build.gradle @@ -1,6 +1,6 @@ /* * Copyright 2022 Google LLC - * Copyright 2023-2025 wintmain + * Copyright 2023-2026 wintmain * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ plugins { id 'org.jetbrains.kotlin.android' id 'com.google.devtools.ksp' id 'dagger.hilt.android.plugin' + id 'org.jetbrains.kotlin.plugin.compose' } android { @@ -35,8 +36,8 @@ android { applicationId "com.wintmain.catalog.app" minSdk 26 targetSdk 34 - versionCode 20250601 - versionName 'V20250601' + versionCode 20260207 + versionName 'V20260207' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -59,9 +60,11 @@ android { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } - composeOptions { - kotlinCompilerExtensionVersion libs.versions.composeCompiler.get() - } + + // Compose Compiler plugin replaces composeOptions + // composeOptions { + // kotlinCompilerExtensionVersion libs.versions.composeCompiler.get() + // } lint { checkReleaseBuilds false diff --git a/app-catalog/samples/wNet/build.gradle.kts b/app-catalog/samples/wNet/build.gradle.kts index aa3d867..cc9a5e7 100644 --- a/app-catalog/samples/wNet/build.gradle.kts +++ b/app-catalog/samples/wNet/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2023-2025 wintmain + * Copyright 2023-2026 wintmain * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ plugins { id("org.jetbrains.kotlin.android") id("com.google.devtools.ksp") id("kotlin-kapt") + id("org.jetbrains.kotlin.plugin.compose") } android { @@ -32,6 +33,7 @@ android { buildFeatures { dataBinding = true + compose = true } compileOptions { @@ -42,9 +44,10 @@ android { jvmTarget = "17" } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } + // Compose Compiler plugin replaces composeOptions + // composeOptions { + // kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() + // } } dependencies { @@ -58,7 +61,6 @@ dependencies { implementation(libs.hilt.android) ksp(libs.hilt.compiler) - implementation(libs.androidx.coreExtkt) implementation(libs.compose.foundation.foundation) implementation(libs.compose.ui.ui) implementation(libs.compose.material.material3) diff --git a/build.gradle b/build.gradle index 19754f6..0794cc2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ /* * Copyright 2022 Google LLC - * Copyright 2023 wintmain + * Copyright 2023-2026 wintmain * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,7 @@ buildscript { classpath libs.hilt.plugin classpath libs.google.ksp.plugin classpath libs.kotlin.gradlePlugin + classpath libs.kotlin.compose.compiler.gradlePlugin } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4f88b20..cfb67b4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ # Copyright 2022 Google LLC -# Copyright 2023-2025 wintmain +# Copyright 2023-2026 wintmain # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,12 +25,12 @@ composeCompiler = "1.5.9" documentfile = "1.0.1" glide = "4.11.0" gson = "2.10.1" -kotlin = "1.9.22" +kotlin = "2.0.21" hilt = "2.48.1" kotlinReflect = "2.0.21" kotlinxCoroutines = "1.7.3" kotlinxSerialization = "1.6.3" -ksp = "1.9.22-1.0.17" # Should be updated when kotlin version is updated +ksp = "2.0.21-1.0.25" # Updated to match Kotlin 2.0.21 coreExt = "1.13.1" androidx_activity = "1.9.2" androidx_appcompat = "1.7.0" @@ -61,6 +61,7 @@ hilt-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version hilt-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kotlin-compose-compiler-gradlePlugin = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } androidx-legacy-support-v4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "legacySupportV4" } diff --git a/gradle/sample-build.gradle b/gradle/sample-build.gradle index b0b25fe..8671741 100644 --- a/gradle/sample-build.gradle +++ b/gradle/sample-build.gradle @@ -1,6 +1,6 @@ /* * Copyright 2022 Google LLC - * Copyright 2023-2024 wintmain + * Copyright 2023-2026 wintmain * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: "com.google.devtools.ksp" apply plugin: 'dagger.hilt.android.plugin' +apply plugin: 'org.jetbrains.kotlin.plugin.compose' android { compileSdk 35 @@ -58,9 +59,10 @@ android { compose true } - composeOptions { - kotlinCompilerExtensionVersion libs.versions.composeCompiler.get() - } + // Compose Compiler plugin replaces composeOptions + // composeOptions { + // kotlinCompilerExtensionVersion libs.versions.composeCompiler.get() + // } } dependencies { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 049bce1..edfefb7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Feb 19 19:42:55 CST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 40d51c43ef829643f3f79289bb50bb79cc145b08 Mon Sep 17 00:00:00 2001 From: wintmain Date: Sat, 7 Feb 2026 18:18:40 +0800 Subject: [PATCH 2/2] [wBasis][feat]Add reveal effect sample --- app-catalog/samples/wBasis/build.gradle | 1 + .../wBasis/src/main/AndroidManifest.xml | 5 + .../animation/RevealEffectBasicActivity.java | 101 ++++++++++++++++++ .../animation/RevealEffectBasicFragment.java | 70 ++++++++++++ .../layout/activity_reveal_effect.xml | 64 +++++++++++ .../layout/fragment_reveal_effect.xml | 44 ++++++++ .../src/main/res-animation/values/strings.xml | 27 +++++ 7 files changed, 312 insertions(+) create mode 100644 app-catalog/samples/wBasis/src/main/java/com/wintmain/wBasis/animation/RevealEffectBasicActivity.java create mode 100644 app-catalog/samples/wBasis/src/main/java/com/wintmain/wBasis/animation/RevealEffectBasicFragment.java create mode 100644 app-catalog/samples/wBasis/src/main/res-animation/layout/activity_reveal_effect.xml create mode 100644 app-catalog/samples/wBasis/src/main/res-animation/layout/fragment_reveal_effect.xml create mode 100644 app-catalog/samples/wBasis/src/main/res-animation/values/strings.xml diff --git a/app-catalog/samples/wBasis/build.gradle b/app-catalog/samples/wBasis/build.gradle index b22e42b..fc61165 100644 --- a/app-catalog/samples/wBasis/build.gradle +++ b/app-catalog/samples/wBasis/build.gradle @@ -24,6 +24,7 @@ android { // res 资源目录配置 res.srcDirs( 'src/main/res', + 'src/main/res-animation', 'src/main/res-ext', 'src/main/res-gesture', 'src/main/res-transition', diff --git a/app-catalog/samples/wBasis/src/main/AndroidManifest.xml b/app-catalog/samples/wBasis/src/main/AndroidManifest.xml index 20f1063..ddd4829 100644 --- a/app-catalog/samples/wBasis/src/main/AndroidManifest.xml +++ b/app-catalog/samples/wBasis/src/main/AndroidManifest.xml @@ -391,6 +391,11 @@ android:name=".transition.GridToPagerMainActivity" android:exported="true" android:theme="@style/GridToPager_Activity_Theme" /> + + \ No newline at end of file diff --git a/app-catalog/samples/wBasis/src/main/java/com/wintmain/wBasis/animation/RevealEffectBasicActivity.java b/app-catalog/samples/wBasis/src/main/java/com/wintmain/wBasis/animation/RevealEffectBasicActivity.java new file mode 100644 index 0000000..88667b7 --- /dev/null +++ b/app-catalog/samples/wBasis/src/main/java/com/wintmain/wBasis/animation/RevealEffectBasicActivity.java @@ -0,0 +1,101 @@ +/* + * Copyright 2023-2026 wintmain + * + * 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. + */ + +package com.wintmain.wBasis.animation; + +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.ViewAnimator; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.FragmentTransaction; +import com.google.android.catalog.framework.annotations.Sample; +import com.wintmain.wBasis.R; +import lib.wintmain.wBasis.logger.Log; +import lib.wintmain.wBasis.logger.LogFragment; +import lib.wintmain.wBasis.logger.LogWrapper; +import lib.wintmain.wBasis.logger.MessageOnlyLogFilter; + + +@Sample(name = "RevealEffectBasicActivity", + description = "揭露动画,一种类似于水波纹效果的从一个点向周围扩散或者从四周向一个点集中的动画效果", + tags = {"android-samples", "animation-samples"} +) +public class RevealEffectBasicActivity extends AppCompatActivity { + public static final String TAG = "RevealEffectBasicActivity"; + private boolean isLogShow = false; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_reveal_effect); + + if (savedInstanceState == null) { + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + RevealEffectBasicFragment fragment = new RevealEffectBasicFragment(); + transaction.replace(R.id.sample_content_fragment, fragment); + transaction.commit(); + } + + // Wraps Android's native log framework. + LogWrapper logWrapper = new LogWrapper(); + // Using Log, front-end to the logging chain, emulates android.util.log method signatures. + Log.setLogNode(logWrapper); + + // Filter strips out everything except the message text. + MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter(); + logWrapper.setNext(msgFilter); + + // On screen logging via a fragment with a TextView. + LogFragment logFragment = (LogFragment) getSupportFragmentManager() + .findFragmentById(R.id.log_fragment); + msgFilter.setNext(logFragment.getLogView()); + + Log.i(TAG, "Ready"); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.main, menu); + return true; + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + MenuItem logToggle = menu.findItem(R.id.menu_toggle_log); + logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator); + logToggle.setTitle(isLogShow ? R.string.sample_hide_log : R.string.sample_show_log); + + return super.onPrepareOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == R.id.menu_toggle_log) { + isLogShow = !isLogShow; + ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output); + if (isLogShow) { + output.setDisplayedChild(1); + } else { + output.setDisplayedChild(0); + } + invalidateOptionsMenu(); + return true; + } + return super.onOptionsItemSelected(item); + } +} diff --git a/app-catalog/samples/wBasis/src/main/java/com/wintmain/wBasis/animation/RevealEffectBasicFragment.java b/app-catalog/samples/wBasis/src/main/java/com/wintmain/wBasis/animation/RevealEffectBasicFragment.java new file mode 100644 index 0000000..c800508 --- /dev/null +++ b/app-catalog/samples/wBasis/src/main/java/com/wintmain/wBasis/animation/RevealEffectBasicFragment.java @@ -0,0 +1,70 @@ +/* + * Copyright 2023-2026 wintmain + * + * 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. + */ + +package com.wintmain.wBasis.animation; + +import android.animation.Animator; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewAnimationUtils; +import android.view.ViewGroup; +import android.view.animation.AccelerateDecelerateInterpolator; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import com.wintmain.wBasis.R; +import lib.wintmain.wBasis.logger.Log; + +/** + * This sample shows a view that is revealed when a button is clicked. + */ +public class RevealEffectBasicFragment extends Fragment { + private final static String TAG = "RevealEffectBasicFragment"; + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_reveal_effect, container, false); + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + View circle = view.findViewById(R.id.circle); + View button = view.findViewById(R.id.button); + + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // Create a reveal {@link Animator} that starts clipping the view from + // the top left corner until the whole view is covered. + Animator circularReveal = ViewAnimationUtils.createCircularReveal(circle, 0, 0, 0, + (float) Math.hypot(circle.getWidth(), circle.getHeight())); + circularReveal.setInterpolator(new AccelerateDecelerateInterpolator()); + + // Finally start the animation + circularReveal.start(); + + Log.d(TAG, "Starting Reveal animation"); + } + }); + super.onViewCreated(view, savedInstanceState); + } +} diff --git a/app-catalog/samples/wBasis/src/main/res-animation/layout/activity_reveal_effect.xml b/app-catalog/samples/wBasis/src/main/res-animation/layout/activity_reveal_effect.xml new file mode 100644 index 0000000..73d8a1c --- /dev/null +++ b/app-catalog/samples/wBasis/src/main/res-animation/layout/activity_reveal_effect.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app-catalog/samples/wBasis/src/main/res-animation/layout/fragment_reveal_effect.xml b/app-catalog/samples/wBasis/src/main/res-animation/layout/fragment_reveal_effect.xml new file mode 100644 index 0000000..0bdffdf --- /dev/null +++ b/app-catalog/samples/wBasis/src/main/res-animation/layout/fragment_reveal_effect.xml @@ -0,0 +1,44 @@ + + + + + +