Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated sdks #20

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# ArcAnimator
A bit updated fork of this:

https://github.com/asyl/ArcAnimator

Usage in gradle file:

https://jitpack.io/#AndroidDeveloperLB/ArcAnimator

----

Original docs from it:

ArcAnimator helps to create arc transition animation: 14+

<img width="270" height="480" src="http://i.imgur.com/DSiQxbg.gif" />|<img width="270" height="480" src="http://i.imgur.com/aLcLrGk.gif" />
Expand Down
15 changes: 10 additions & 5 deletions animator/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
apply plugin: 'com.android.library'

plugins {
id 'com.android.library'
id 'com.github.dcendents.android-maven'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 30

defaultConfig {
minSdkVersion 14
targetSdkVersion 25
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static ArcAnimator createArcAnimator(View clipView, float endX, float end
return new ArcAnimator(arcMetric, clipView);
}

ArcMetric mArcMetric;
WeakReference<View> mTarget;
WeakReference<ValueAnimator> mAnimator;
final ArcMetric mArcMetric;
final WeakReference<View> mTarget;
final WeakReference<ValueAnimator> mAnimator;
float mValue;


Expand All @@ -38,12 +38,7 @@ private ArcAnimator(ArcMetric arcmetric, View target) {
mAnimator = new WeakReference<>(
ValueAnimator.ofFloat(arcmetric.getStartDegree(), arcmetric.getEndDegree())
);
mAnimator.get().addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
setDegree((Float) animation.getAnimatedValue());
}
});
mAnimator.get().addUpdateListener(animation -> setDegree((Float) animation.getAnimatedValue()));
}

void setDegree(float degree) {
Expand All @@ -53,8 +48,8 @@ void setDegree(float degree) {
* Utils.cos(degree);
float y = mArcMetric.getAxisPoint().y - mArcMetric.mRadius
* Utils.sin(degree);
clipView.setX(x - clipView.getWidth() / 2);
clipView.setY(y - clipView.getHeight() / 2);
clipView.setX(x - clipView.getWidth() / 2f);
clipView.setY(y - clipView.getHeight() / 2f);
}

float getDegree() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class ArcDebugView extends View {

private ArcMetric mArcMetric;

private Paint mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);

private static final int BLUE = 0xFF2196F3;
private static final int PURPLE = 0xFF9C27B0;
Expand Down Expand Up @@ -96,4 +96,4 @@ public int dpToPx(int dp) {
DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
return Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

class ArcMetric {

PointF mStartPoint = new PointF();
final PointF mStartPoint = new PointF();

PointF mEndPoint = new PointF();
final PointF mEndPoint = new PointF();

PointF mMidPoint = new PointF();
final PointF mMidPoint = new PointF();

PointF mAxisPoint[] = new PointF[2];
final PointF[] mAxisPoint = new PointF[2];

PointF mZeroPoint = new PointF();
final PointF mZeroPoint = new PointF();

//SEGMENTS. This Segments create virtual triangle except mZeroStartSegment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public static float acos(double value) {
}

public static float centerX(View view) {
return view.getX() + view.getWidth() / 2;
return view.getX() + view.getWidth() / 2f;
}

public static float centerY(View view) {
return view.getY() + view.getHeight() / 2;
return view.getY() + view.getHeight() / 2f;
}

}
21 changes: 12 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = "1.4.30"

repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.android.tools.build:gradle:4.1.3'
// classpath 'com.android.tools.build:gradle:7.0.0-alpha10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
maven {
url "https://jitpack.io"
}
mavenCentral()
maven { url "https://jitpack.io" }
}
}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
# 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
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Jun 06 19:12:50 MSK 2017
#Mon Mar 22 02:21:39 IST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
24 changes: 16 additions & 8 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"

compileSdkVersion 30
defaultConfig {
applicationId "io.codetail.arcsample"
minSdkVersion 14
targetSdkVersion 25
minSdkVersion 15
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
compile project(":animator")
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.github.ozodrukh:CircularReveal:1.0.4@aar'
implementation project(":animator")
implementation 'com.google.android.material:material:1.4.0-alpha01'
// https://github.com/ozodrukh/CircularReveal
implementation('com.github.ozodrukh:CircularReveal:2.0.1@aar') {
transitive = true
}
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.fragment:fragment-ktx:1.3.2'
}
6 changes: 3 additions & 3 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.codetail.arcsample" >
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="io.codetail.arcsample" >

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:theme="@style/AppTheme" tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package io.codetail.arcsample;

import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -11,6 +9,9 @@
import android.widget.EditText;
import android.widget.ImageButton;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import io.codetail.animation.arcanimator.ArcAnimator;
import io.codetail.animation.arcanimator.ArcDebugView;
import io.codetail.animation.arcanimator.Side;
Expand Down Expand Up @@ -44,7 +45,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mParent = (ViewGroup) view;

Expand All @@ -61,7 +62,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
mDefiner.setOnClickListener(mClicker);
}

View.OnClickListener mClicker = new View.OnClickListener() {
final View.OnClickListener mClicker = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (TextUtils.isEmpty(mDegreeEditor.getText().toString()) ||
Expand Down
14 changes: 8 additions & 6 deletions sample/src/main/java/io/codetail/arcsample/ChooseFragment.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package io.codetail.arcsample;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class ChooseFragment extends Fragment {

Button mArcAnimatorDemo;
Expand All @@ -19,24 +21,24 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mArcAnimatorDemo = (Button) view.findViewById(R.id.demo_arcanimation);
mTransitionDemo = (Button) view.findViewById(R.id.demo_transition);
mArcAnimatorDemo.setOnClickListener(mClicker);
mTransitionDemo.setOnClickListener(mClicker);
}

View.OnClickListener mClicker = new View.OnClickListener() {
final View.OnClickListener mClicker = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.demo_arcanimation:
getFragmentManager().beginTransaction().replace(R.id.container, new ArcTestFragment())
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.container, new ArcTestFragment())
.addToBackStack(getClass().getName()).commit();
break;
case R.id.demo_transition:
getFragmentManager().beginTransaction().replace(R.id.container, new TransitionLoopFragment())
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.container, new TransitionLoopFragment())
.addToBackStack(getClass().getName()).commit();
break;
}
Expand Down
38 changes: 0 additions & 38 deletions sample/src/main/java/io/codetail/arcsample/MainActivity.java

This file was deleted.

Loading