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
15 changes: 9 additions & 6 deletions app-catalog/app/build.gradle
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 {
Expand All @@ -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"
}
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions app-catalog/samples/wBasis/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 5 additions & 0 deletions app-catalog/samples/wBasis/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@
android:name=".transition.GridToPagerMainActivity"
android:exported="true"
android:theme="@style/GridToPager_Activity_Theme" />

<activity
android:name=".animation.RevealEffectBasicActivity"
android:exported="true"
android:theme="@style/GridToPager_Activity_Theme" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!--
Copyright 2013 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

http://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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/sample_main_layout">

<ViewAnimator
android:id="@+id/sample_output"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1">

<ScrollView
style="@style/Widget.SampleMessageTile"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
style="@style/Widget.SampleMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/horizontal_page_margin"
android:paddingRight="@dimen/horizontal_page_margin"
android:paddingTop="@dimen/vertical_page_margin"
android:paddingBottom="@dimen/vertical_page_margin"
android:text="@string/reveal_intro_message" />
</ScrollView>

<androidx.fragment.app.FragmentContainerView
android:name="lib.wintmain.wBasis.logger.LogFragment"
android:id="@+id/log_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</ViewAnimator>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />

<FrameLayout
android:id="@+id/sample_content_fragment"
android:layout_weight="2"
android:layout_width="match_parent"
android:layout_height="0px" />

</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2014 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

http://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.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<View
android:id="@+id/circle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="#673AB7"
android:layout_above="@+id/button"
android:layout_marginTop="@dimen/margin_medium"
android:layout_marginRight="@dimen/margin_medium"
android:layout_marginLeft="@dimen/margin_medium"/>
<Button
android:id="@+id/button"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_medium"
android:text="Reveal"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_alignParentBottom="true"
/>

</RelativeLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ 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.
-->

<resources>
<string name="reveal_intro_message">
<![CDATA[


Basic sample to demonstrate the reveal effect.


]]>
</string>
</resources>
Loading
Loading