Skip to content

Commit

Permalink
Merge pull request #30 from agrawalsuneet/dev
Browse files Browse the repository at this point in the history
Merge Dev to master for 1.4 release
  • Loading branch information
agrawalsuneet authored Apr 27, 2019
2 parents c166ffb + 39f9222 commit 3cd22ca
Show file tree
Hide file tree
Showing 8 changed files with 437 additions and 40 deletions.
79 changes: 61 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ latest version : [ ![Download](https://api.bintray.com/packages/agrawalsuneet/an

![lazyloader](https://user-images.githubusercontent.com/12999622/36225792-b7044432-11c3-11e8-8e22-5bbdcafa2312.gif) ![tashieloader](https://user-images.githubusercontent.com/12999622/36225793-b71f694c-11c3-11e8-9a81-8414bafb26c5.gif)

![slidingloader](https://user-images.githubusercontent.com/12999622/34130222-f58ba220-e43e-11e7-8f60-4971918fecde.gif) ![RotatingCircularDotsLoader](https://user-images.githubusercontent.com/12999622/34453427-d9aa8294-ed4c-11e7-8b1d-fe98d0c2c3dc.gif)
![slidingloader](https://user-images.githubusercontent.com/12999622/34130222-f58ba220-e43e-11e7-8f60-4971918fecde.gif) ![bounceloader](https://user-images.githubusercontent.com/12999622/56847870-1d5b9080-68ff-11e9-952f-b0414771d580.gif)

![trailingcirculardotsloader](https://user-images.githubusercontent.com/12999622/39367184-f3bb706a-4a2d-11e8-9120-5027bbef2861.gif) ![zeeloader](https://user-images.githubusercontent.com/12999622/44630261-8ba41980-a952-11e8-9ba5-45f4cafb473b.gif)

![allianceloader](https://user-images.githubusercontent.com/12999622/44946787-d1e9f480-adfa-11e8-82ff-23e5f19a656b.gif) ![lightsloader](https://user-images.githubusercontent.com/12999622/50548389-bb9d5980-0c71-11e9-8803-f25d1175ced0.gif)

![pullinloader](https://user-images.githubusercontent.com/12999622/52536021-80676d80-2d7b-11e9-9b06-8135d6d15dbb.gif) ![lineardotsloader](https://user-images.githubusercontent.com/12999622/35482391-54665328-042c-11e8-954b-93a92ebe2b0c.gif)

![circulardotsloader](https://user-images.githubusercontent.com/12999622/36224573-f274b956-11bf-11e8-8f97-e4c031959465.gif)
![circulardotsloader](https://user-images.githubusercontent.com/12999622/36224573-f274b956-11bf-11e8-8f97-e4c031959465.gif) ![RotatingCircularDotsLoader](https://user-images.githubusercontent.com/12999622/34453427-d9aa8294-ed4c-11e7-8b1d-fe98d0c2c3dc.gif)

Check all other loaders [here](https://agrawalsuneet.github.io/agrawalsuneet/opensourcecontribution/)

## How To use
include below dependency in build.gradle of application and compile it
```
implementation 'com.agrawalsuneet.androidlibs:dotsloader:1.3'
implementation 'com.agrawalsuneet.androidlibs:dotsloader:1.4'
```


Expand Down Expand Up @@ -168,39 +168,46 @@ SlidingLoader sliding = new SlidingLoader(this, 40, 10,
containerLL.addView(sliding);
```

### RotatingCircularDotsLoader
### BounceLoader
##### Through XML
```
<com.agrawalsuneet.dotsloader.loaders.RotatingCircularDotsLoader
<com.agrawalsuneet.dotsloader.loaders.BounceLoader
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:rotatingcircular_animDur="3000"
app:rotatingcircular_bigCircleRadius="42dp"
app:rotatingcircular_dotsColor="@color/blue_selected"
app:rotatingcircular_dotsRadius="14dp" />
app:bounce_animDuration="1200"
app:bounce_ballColor="@color/blue_selected"
app:bounce_ballRadius="22dp"
app:bounce_shadowColor="@color/black"
app:bounce_showShadow="true" />
```

##### Through Code

* Kotlin
```
val loader = RotatingCircularDotsLoader(this,
20, 60, ContextCompat.getColor(this, R.color.red))
val bounceLoader = BounceLoader(context = this,
ballRadius = 60,
ballColor = ContextCompat.getColor(this, R.color.red),
showShadow = true,
shadowColor = ContextCompat.getColor(this, R.color.black))
.apply {
animDuration = 3000
animDuration = 1000
}
containerLL.addView(loader)
containerLL.addView(bounceLoader)
```

* Java
```
RotatingCircularDotsLoader loader = new RotatingCircularDotsLoader(this,
20, 60, ContextCompat.getColor(this, R.color.red));
loader.setAnimDuration(3000);
BounceLoader bounceLoader = new BounceLoader(this,
60,
ContextCompat.getColor(this, R.color.red),
true,
ContextCompat.getColor(this, R.color.black));
containerLL.addView(loader);
bounceLoader.setAnimDuration(1000);
containerLL.addView(bounceLoader);
```

### TrailingCircularDotsLoader
Expand Down Expand Up @@ -558,6 +565,42 @@ CircularDotsLoader loader = new CircularDotsLoader(this);
loader.setSecondShadowColor(ContextCompat.getColor(this, R.color.blue_delfault));
```


### RotatingCircularDotsLoader
##### Through XML
```
<com.agrawalsuneet.dotsloader.loaders.RotatingCircularDotsLoader
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:rotatingcircular_animDur="3000"
app:rotatingcircular_bigCircleRadius="42dp"
app:rotatingcircular_dotsColor="@color/blue_selected"
app:rotatingcircular_dotsRadius="14dp" />
```

##### Through Code

* Kotlin
```
val loader = RotatingCircularDotsLoader(this,
20, 60, ContextCompat.getColor(this, R.color.red))
.apply {
animDuration = 3000
}
containerLL.addView(loader)
```

* Java
```
RotatingCircularDotsLoader loader = new RotatingCircularDotsLoader(this,
20, 60, ContextCompat.getColor(this, R.color.red));
loader.setAnimDuration(3000);
containerLL.addView(loader);
```

> For avoiding overlapping in CircularDotsLoader, set BigCircleLoader nearly four times of dotsRadius.
> If the showRunningShadow is true and no firstShadowColor and secondShadowColor provided, it'll take 0.7f and 0.5f alpha of selectedColor
Expand Down
18 changes: 16 additions & 2 deletions app/src/main/java/com/agrawalsuneet/loaders/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main_pullin)
setContentView(R.layout.main_bounce)

supportActionBar?.title = "PullInLoader"
supportActionBar?.title = "BounceLoader"

containerLL = findViewById(R.id.container) as LinearLayout

Expand All @@ -36,6 +36,20 @@ class MainActivity : AppCompatActivity() {
//initLightsLoader()

//initPullInLoader()
//initBounceLoader()
}

private fun initBounceLoader() {
val bounceLoader = BounceLoader(context = this,
ballRadius = 60,
ballColor = ContextCompat.getColor(this, R.color.red),
showShadow = true,
shadowColor = ContextCompat.getColor(this, R.color.black))
.apply {
animDuration = 1000
}

containerLL.addView(bounceLoader)
}

private fun initPullInLoader() {
Expand Down
21 changes: 10 additions & 11 deletions app/src/main/java/com/agrawalsuneet/loaders/MainActivityJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.widget.LinearLayout;

import com.agrawalsuneet.dotsloader.loaders.AllianceLoader;
import com.agrawalsuneet.dotsloader.loaders.BounceLoader;
import com.agrawalsuneet.dotsloader.loaders.LightsLoader;
import com.agrawalsuneet.dotsloader.loaders.PullInLoader;
import com.agrawalsuneet.dotsloader.loaders.RotatingCircularDotsLoader;
Expand Down Expand Up @@ -46,7 +47,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
tashie.setAnimDuration(500);
tashie.setAnimDelay(100);
tashie.setInterpolator(new LinearInterpolator());

containerLL.addView(tashie);

//sliding loader
Expand All @@ -56,14 +56,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
ContextCompat.getColor(this, R.color.green));
sliding.setAnimDuration(1000);
sliding.setDistanceToMove(12);

containerLL.addView(sliding);

//RotatingCircularDotsLoader
RotatingCircularDotsLoader loader = new RotatingCircularDotsLoader(this,
20, 60, ContextCompat.getColor(this, R.color.red));
loader.setAnimDuration(3000);

containerLL.addView(loader);


Expand All @@ -76,7 +74,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5);
trailingCircularDotsLoader.setAnimDuration(1200);
trailingCircularDotsLoader.setAnimDelay(200);

containerLL.addView(trailingCircularDotsLoader);


Expand All @@ -89,10 +86,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
ContextCompat.getColor(this, R.color.red));

zeeLoader.setAnimDuration(200);

containerLL.addView(zeeLoader);


AllianceLoader allianceLoader = new AllianceLoader(
this,
40,
Expand All @@ -104,28 +99,32 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
ContextCompat.getColor(this, R.color.green));

allianceLoader.setAnimDuration(500);

containerLL.addView(allianceLoader);

LightsLoader lightsLoader = new LightsLoader(
this, 5,
30, 10,
ContextCompat.getColor(this, R.color.red));


containerLL.addView(lightsLoader);

PullInLoader pullInLoader = new PullInLoader(this,
20, 100, ContextCompat.getColor(this, R.color.red));
pullInLoader.setAnimDuration(2000);

containerLL.addView(pullInLoader);

PullInLoader pullInLoader2 = new PullInLoader(this,
30, 160, getResources().getIntArray(R.array.vibgyorg));
pullInLoader.setAnimDuration(2000);

containerLL.addView(pullInLoader2);

BounceLoader bounceLoader = new BounceLoader(this,
60,
ContextCompat.getColor(this, R.color.red),
true,
ContextCompat.getColor(this, R.color.black));

bounceLoader.setAnimDuration(1000);
containerLL.addView(bounceLoader);
}

}
70 changes: 70 additions & 0 deletions app/src/main/res/layout/main_bounce.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center"
android:orientation="vertical"
tools:context="com.agrawalsuneet.loaders.MainActivity">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="horizontal">

<com.agrawalsuneet.dotsloader.loaders.BounceLoader
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:bounce_animDuration="1000"
app:bounce_ballColor="@color/red"
app:bounce_ballRadius="16dp"
app:bounce_showShadow="false" />

<com.agrawalsuneet.dotsloader.loaders.BounceLoader
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:bounce_animDuration="1000"
app:bounce_ballColor="@color/amber"
app:bounce_ballRadius="16dp"
app:bounce_showShadow="false" />

<com.agrawalsuneet.dotsloader.loaders.BounceLoader
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:bounce_animDuration="1000"
app:bounce_ballColor="@color/green"
app:bounce_ballRadius="16dp"
app:bounce_showShadow="false" />


</LinearLayout>

<com.agrawalsuneet.dotsloader.loaders.BounceLoader
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:bounce_animDuration="1200"
app:bounce_ballColor="@color/blue_selected"
app:bounce_ballRadius="22dp"
app:bounce_shadowColor="@color/black"
app:bounce_showShadow="true" />


<com.agrawalsuneet.dotsloader.loaders.BounceLoader
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:bounce_animDuration="800"
app:bounce_ballColor="@color/violet"
app:bounce_ballRadius="18dp"
app:bounce_shadowColor="@color/black"
app:bounce_showShadow="true" />-->

</LinearLayout>
6 changes: 3 additions & 3 deletions dotsloader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ buildscript {
ext {
PUBLISH_GROUP_ID = 'com.agrawalsuneet.androidlibs'
PUBLISH_ARTIFACT_ID = 'dotsloader'
PUBLISH_VERSION = '1.3'
PUBLISH_VERSION = '1.4'
}

configurations {
Expand All @@ -29,8 +29,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 13
versionName "1.3"
versionCode 14
versionName "1.4"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ class CircleView : View {
var circleColor: Int = 0
var drawOnlyStroke: Boolean = false

private var xyCordinates: Float = 0.0f
var isAntiAlias: Boolean = true

private var xyCordinates: Float = 0.0f
private val paint: Paint = Paint()

constructor(context: Context, circleRadius: Int, circleColor: Int) : super(context) {
constructor(context: Context, circleRadius: Int, circleColor: Int, isAntiAlias: Boolean = true) : super(context) {
this.circleRadius = circleRadius
this.circleColor = circleColor
this.isAntiAlias = isAntiAlias

initValues()
}
Expand Down Expand Up @@ -75,12 +77,11 @@ class CircleView : View {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)

val widthHeight = (2 * (circleRadius)) + strokeWidth

setMeasuredDimension(widthHeight, widthHeight)
}

private fun initValues() {
paint.isAntiAlias = true
paint.isAntiAlias = isAntiAlias

if (drawOnlyStroke) {
paint.style = Paint.Style.STROKE
Expand All @@ -100,6 +101,4 @@ class CircleView : View {
super.onDraw(canvas)
canvas.drawCircle(xyCordinates, xyCordinates, circleRadius.toFloat(), paint)
}


}
Loading

0 comments on commit 3cd22ca

Please sign in to comment.