Skip to content
Open
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
22 changes: 14 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion 33

defaultConfig {
applicationId "com.wang.avi.sample"
minSdkVersion 14
targetSdkVersion 23
minSdkVersion 16
targetSdkVersion 33
versionCode 33
versionName "2.1.3"
}
Expand All @@ -17,11 +16,18 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
namespace 'com.wang.avi.sample'
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile project(':library')
implementation project(':library')
implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
}
11 changes: 5 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wang.avi.sample" >
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:theme="@style/AppTheme">
<activity
android:name=".SampleActivity"
android:label="@string/app_name" >
android:exported="true"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".IndicatorActivity"/>
<activity android:name=".IndicatorActivity" />
</application>

</manifest>
11 changes: 5 additions & 6 deletions app/src/main/java/com/wang/avi/sample/IndicatorActivity.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.wang.avi.sample;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;

import com.wang.avi.AVLoadingIndicatorView;
Expand All @@ -11,17 +11,16 @@
* Created by Jack Wang on 2016/8/5.
*/

public class IndicatorActivity extends AppCompatActivity{

public class IndicatorActivity extends AppCompatActivity {
private AVLoadingIndicatorView avi;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_indicator);

String indicator=getIntent().getStringExtra("indicator");
avi= (AVLoadingIndicatorView) findViewById(R.id.avi);
String indicator = getIntent().getStringExtra("indicator");
avi = (AVLoadingIndicatorView) findViewById(R.id.avi);
avi.setIndicator(indicator);
}

Expand Down
30 changes: 14 additions & 16 deletions app/src/main/java/com/wang/avi/sample/MyCustomIndicator.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.graphics.Paint;

import android.animation.ValueAnimator;

import com.wang.avi.Indicator;

import java.util.ArrayList;
Expand All @@ -12,29 +13,26 @@
* Created by Jack Wang on 2016/8/5.
*/

public class MyCustomIndicator extends Indicator{


public static final float SCALE=1.0f;
public class MyCustomIndicator extends Indicator {
public static final float SCALE = 1.0f;

//scale x ,y
private float[] scaleFloats=new float[]{SCALE,
private float[] scaleFloats = new float[]{SCALE,
SCALE,
SCALE,
SCALE,
SCALE};



@Override
public void draw(Canvas canvas, Paint paint) {
float circleSpacing=4;
float radius=(Math.min(getWidth(),getHeight())-circleSpacing*2)/12;
float x = getWidth()/ 2-(radius*2+circleSpacing);
float y=getHeight() / 2;
float circleSpacing = 4;
float radius = (Math.min(getWidth(), getHeight()) - circleSpacing * 2) / 12;
float x = getWidth() / 2 - (radius * 2 + circleSpacing);
float y = getHeight() / 2;
for (int i = 0; i < 4; i++) {
canvas.save();
float translateX=x+(radius*2)*i+circleSpacing*i;
float translateX = x + (radius * 2) * i + circleSpacing * i;
canvas.translate(translateX, y);
canvas.scale(scaleFloats[i], scaleFloats[i]);
canvas.drawCircle(0, 0, radius, paint);
Expand All @@ -44,18 +42,18 @@ public void draw(Canvas canvas, Paint paint) {

@Override
public ArrayList<ValueAnimator> onCreateAnimators() {
ArrayList<ValueAnimator> animators=new ArrayList<>();
int[] delays=new int[]{120,240,360,480};
ArrayList<ValueAnimator> animators = new ArrayList<>();
int[] delays = new int[]{120, 240, 360, 480};
for (int i = 0; i < 4; i++) {
final int index=i;
final int index = i;

ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);
ValueAnimator scaleAnim = ValueAnimator.ofFloat(1, 0.3f, 1);

scaleAnim.setDuration(750);
scaleAnim.setRepeatCount(-1);
scaleAnim.setStartDelay(delays[i]);

addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
addUpdateListener(scaleAnim, new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
scaleFloats[index] = (float) animation.getAnimatedValue();
Expand Down
32 changes: 16 additions & 16 deletions app/src/main/java/com/wang/avi/sample/SampleActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,48 @@

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.wang.avi.AVLoadingIndicatorView;

/**
* Created by Jack Wang on 2016/8/5.
*/

public class SampleActivity extends AppCompatActivity{

public class SampleActivity extends AppCompatActivity {
private RecyclerView mRecycler;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

mRecycler= (RecyclerView) findViewById(R.id.recycler);
mRecycler = (RecyclerView) findViewById(R.id.recycler);

GridLayoutManager layoutManager=new GridLayoutManager(this,4);
GridLayoutManager layoutManager = new GridLayoutManager(this, 4);
mRecycler.setLayoutManager(layoutManager);
mRecycler.setAdapter(new RecyclerView.Adapter<IndicatorHolder>() {
@Override
public IndicatorHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView=getLayoutInflater().inflate(R.layout.item_indicator,parent,false);
View itemView = getLayoutInflater().inflate(R.layout.item_indicator, parent, false);
return new IndicatorHolder(itemView);
}


@Override
public void onBindViewHolder(IndicatorHolder holder, final int position) {
holder.indicatorView.setIndicator(INDICATORS[position]);
holder.itemLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(SampleActivity.this,IndicatorActivity.class);
intent.putExtra("indicator",INDICATORS[position]);
Intent intent = new Intent(SampleActivity.this, IndicatorActivity.class);
intent.putExtra("indicator", INDICATORS[holder.getAbsoluteAdapterPosition()]);
startActivity(intent);
}
});
Expand All @@ -55,21 +56,20 @@ public int getItemCount() {
});
}

final static class IndicatorHolder extends RecyclerView.ViewHolder{
final static class IndicatorHolder extends RecyclerView.ViewHolder {

public AVLoadingIndicatorView indicatorView;
public View itemLayout;

public IndicatorHolder(View itemView) {
super(itemView);
itemLayout= itemView.findViewById(R.id.itemLayout);
indicatorView= (AVLoadingIndicatorView) itemView.findViewById(R.id.indicator);
itemLayout = itemView.findViewById(R.id.itemLayout);
indicatorView = (AVLoadingIndicatorView) itemView.findViewById(R.id.indicator);
}
}



private static final String[] INDICATORS=new String[]{
private static final String[] INDICATORS = new String[]{
"BallPulseIndicator",
"BallGridPulseIndicator",
"BallClipRotateIndicator",
Expand Down
13 changes: 5 additions & 8 deletions app/src/main/res/layout/activity_sample.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFE75764"
>
android:orientation="vertical">

<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="2dp"
android:clipToPadding="false"
android:scrollbars="vertical"
android:orientation="vertical"
android:padding="2dp"
android:scrollbarStyle="insideOverlay"
android:orientation="vertical"/>


android:scrollbars="vertical" />
</LinearLayout>
30 changes: 16 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven { url = 'https://jitpack.io' }
maven { url = 'https://maven.google.com' }
}

dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:7.3.1'

classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

allprojects {
repositories {
maven {
url properties.getProperty("sdk.dir")+"/extras/android/m2repository"
}
mavenLocal()
google()
jcenter()
mavenCentral()
maven { url = 'https://jitpack.io' }
maven { url = 'https://maven.google.com' }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
8 changes: 3 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Oct 16 02:32:07 CST 2015
#Fri Mar 31 13:00:18 PKT 2023
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
zipStoreBase=GRADLE_USER_HOME
Loading