├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── compiler.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── bett
│ │ └── androidkotlinanimationimagealongpath
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── bett
│ │ │ └── androidkotlinanimationimagealongpath
│ │ │ ├── AnimationView.kt
│ │ │ ├── Constants.kt
│ │ │ ├── MainActivity.kt
│ │ │ ├── MyApplication.kt
│ │ │ ├── PlayerDto.kt
│ │ │ └── PointDto.kt
│ └── res
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── bett
│ └── androidkotlinanimationimagealongpath
│ └── ExampleUnitTest.kt
├── avatar_demo
├── avatar1.png
├── avatar2.png
├── avatar3.png
├── avatar4.png
├── avatar5.png
├── avatar6.png
├── avatar7.png
└── avatar8.png
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | xmlns:android
14 |
15 | ^$
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | xmlns:.*
25 |
26 | ^$
27 |
28 |
29 | BY_NAME
30 |
31 |
32 |
33 |
34 |
35 |
36 | .*:id
37 |
38 | http://schemas.android.com/apk/res/android
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | .*:name
48 |
49 | http://schemas.android.com/apk/res/android
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | name
59 |
60 | ^$
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | style
70 |
71 | ^$
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | .*
81 |
82 | ^$
83 |
84 |
85 | BY_NAME
86 |
87 |
88 |
89 |
90 |
91 |
92 | .*
93 |
94 | http://schemas.android.com/apk/res/android
95 |
96 |
97 | ANDROID_ATTRIBUTE_ORDER
98 |
99 |
100 |
101 |
102 |
103 |
104 | .*
105 |
106 | .*
107 |
108 |
109 | BY_NAME
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 | 1.8
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 | 1.8
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | android {
8 | compileSdkVersion 29
9 | buildToolsVersion "29.0.2"
10 | defaultConfig {
11 | applicationId "com.bett.androidkotlinanimationimagealongpath"
12 | minSdkVersion 23
13 | targetSdkVersion 29
14 | versionCode 1
15 | versionName "1.0"
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility = 1.8
26 | targetCompatibility = 1.8
27 | }
28 | }
29 |
30 | dependencies {
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61'
33 | implementation 'androidx.appcompat:appcompat:1.1.0'
34 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
35 | implementation 'com.facebook.fresco:fresco:2.0.0'
36 | testImplementation 'junit:junit:4.13'
37 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
38 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
39 | }
40 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/bett/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/bett/androidkotlinanimationimagealongpath/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.bett.androidkotlinanimationimagealongpath
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.bett.androidkotlinanimationimagealongpath", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bett/androidkotlinanimationimagealongpath/AnimationView.kt:
--------------------------------------------------------------------------------
1 | package com.bett.androidkotlinanimationimagealongpath
2 |
3 | import android.content.Context
4 | import android.graphics.*
5 | import android.media.ThumbnailUtils
6 | import android.net.Uri
7 | import android.os.Handler
8 | import android.util.AttributeSet
9 | import android.view.MotionEvent
10 | import android.view.View
11 | import android.widget.Toast
12 | import com.facebook.common.executors.CallerThreadExecutor
13 | import com.facebook.common.references.CloseableReference
14 | import com.facebook.datasource.DataSource
15 | import com.facebook.drawee.backends.pipeline.Fresco
16 | import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber
17 | import com.facebook.imagepipeline.image.CloseableImage
18 | import com.facebook.imagepipeline.request.ImageRequestBuilder
19 |
20 |
21 | /**
22 | * Created by bett on 8/25/17.
23 | */
24 |
25 | class AnimationView : View {
26 |
27 | private var step = 0f
28 |
29 | private var xMouseDown = 0f
30 | private var yMouseDown = 0f
31 |
32 | internal var animPath: Path = Path()
33 | internal var pathMeasure: PathMeasure = PathMeasure()
34 | internal var pathLength: Float = 0.toFloat()
35 |
36 | private val PADDING = 80
37 | private val STROKE_WIDTH = 4.0f
38 |
39 | private var deltaX = 0f
40 | private var deltaY = 0f
41 |
42 | private var autoRun = true
43 |
44 | private var paint: Paint? = null
45 | private var paintText: Paint? = null
46 |
47 | private var players: List? = null
48 | private var positions: MutableList? = null
49 |
50 | private val REDUCE_VALUE = 0.1f
51 |
52 | constructor(context: Context) : super(context) {
53 | initAnimationView()
54 | }
55 |
56 | constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
57 | initAnimationView()
58 |
59 | }
60 |
61 | constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
62 | initAnimationView()
63 | }
64 |
65 | private fun initAnimationView() {
66 | paint = Paint()
67 | paint!!.setAntiAlias(true)
68 | paint!!.setDither(true)
69 | paint!!.setFilterBitmap(true)
70 | paint!!.setColor(Color.GRAY)
71 | paint!!.setStrokeWidth(STROKE_WIDTH)
72 | paint!!.setStyle(Paint.Style.STROKE)
73 |
74 | animPath = Path()
75 | players = ArrayList()
76 | positions = ArrayList()
77 | autoRun = true
78 | step = 0f
79 |
80 | paintText = Paint()
81 | paintText!!.setColor(Color.WHITE)
82 | paintText!!.setTextSize(30f)
83 | paintText!!.setTextAlign(Paint.Align.CENTER)
84 | }
85 |
86 | protected override fun onDraw(canvas: Canvas) {
87 |
88 | val width = width.toFloat()
89 | val height = height.toFloat()
90 |
91 | val radius: Float = (width - PADDING * 2) / 2 - STROKE_WIDTH
92 |
93 |
94 | val center_x: Float
95 | val center_y: Float
96 | val oval = RectF()
97 | val ovalBottom = RectF()
98 |
99 |
100 | center_x = width / 2
101 | center_y = PADDING + radius
102 |
103 | oval.set(center_x - radius,
104 | center_y - radius,
105 | center_x + radius,
106 | center_y + radius)
107 |
108 | val centerYBottom = height - radius - PADDING
109 | ovalBottom.set(center_x - radius,
110 | centerYBottom - radius,
111 | center_x + radius,
112 | centerYBottom + radius)
113 |
114 | // -------------------------------------------------------------------------
115 | // ------------- define Path where images move along -----------------------
116 | // -------------------------------------------------------------------------
117 | animPath.reset()
118 | animPath.moveTo(PADDING + STROKE_WIDTH, height - radius - PADDING)
119 | animPath.lineTo(PADDING + STROKE_WIDTH, center_y)
120 | animPath.arcTo(oval, 180f, 180f)
121 | animPath.lineTo(PADDING.toFloat() + STROKE_WIDTH.toFloat() + radius * 2, height - radius - PADDING)
122 | animPath.arcTo(ovalBottom, 360f, 180f)
123 |
124 | pathMeasure = PathMeasure(animPath, false)
125 | pathLength = pathMeasure.length
126 |
127 |
128 | // -------------------------------------------------------------------------
129 | // ------------- Draw path -------------------------------------------------
130 | // -------------------------------------------------------------------------
131 | paint?.let { canvas.drawLine(PADDING + STROKE_WIDTH, center_y, PADDING + STROKE_WIDTH, height - radius - PADDING, it) }
132 | paint?.let { canvas.drawArc(oval, 180f, 180f, false, it) }
133 | paint?.let { canvas.drawArc(ovalBottom, 360f, 180f, false, it) }
134 |
135 | paint?.let { canvas.drawLine(PADDING.toFloat() + STROKE_WIDTH.toFloat() + radius * 2, center_y, PADDING.toFloat() + STROKE_WIDTH.toFloat() + radius * 2, height - radius - PADDING, it) }
136 |
137 | for (i in players!!.indices) {
138 | val player = players!![i]
139 |
140 | // --------------------------------------------
141 | // --------- Draw object ----------------------
142 | // --------------------------------------------
143 | if (player.distance <= pathLength) {
144 | pathMeasure.getPosTan(player.distance, player.pos, player.tan)
145 |
146 | player.matrix.reset()
147 | val degrees = (Math.atan2(player.tan[1].toDouble(), player.tan[0].toDouble()) * 0.0 / Math.PI).toFloat()
148 | player.matrix.postRotate(degrees, player.offsetX, player.offsetY)
149 | player.matrix.postTranslate(player.pos[0] - player.offsetX, player.pos[1] - player.offsetY)
150 |
151 | if (player.bm != null) {
152 | canvas.drawBitmap(player.bm!!, player.matrix, null)
153 | }
154 |
155 | player.distance += step
156 | } else {
157 | player.distance %= pathLength
158 | }
159 |
160 | if (player.distance < 0) {
161 | player.distance = pathLength + player.distance % pathLength
162 | }
163 | }
164 |
165 | if (autoRun) {
166 | reduceDistance()
167 | invalidate()
168 | }
169 | }
170 |
171 | internal var timerHandlerAuto = Handler()
172 | internal var timerRunnableAuto: Runnable = Runnable { reduceDistance() }
173 |
174 | private fun reduceDistance() {
175 | if (0 <= Math.abs(step - REDUCE_VALUE - 0.01f) && Math.abs(step - REDUCE_VALUE) <= REDUCE_VALUE + 0.01f) {
176 | step = 0f
177 | timerHandlerAuto.removeCallbacks(timerRunnableAuto)
178 | autoRun = false
179 | } else {
180 | if (step > 0) {
181 | step -= REDUCE_VALUE
182 | } else {
183 | step += REDUCE_VALUE
184 | }
185 | timerHandlerAuto.postDelayed(timerRunnableAuto, 1000)
186 | }
187 | }
188 |
189 | override fun onTouchEvent(event: MotionEvent): Boolean {
190 |
191 | when (event.action) {
192 | MotionEvent.ACTION_DOWN -> {
193 | xMouseDown = event.x
194 | yMouseDown = event.y
195 | // autoRun = false;
196 | positions!!.clear()
197 |
198 | val point = PointDto()
199 | point.x = event.x
200 | point.y = event.y
201 | positions!!.add(point)
202 |
203 | return true
204 | }
205 | MotionEvent.ACTION_MOVE -> {
206 | val point1 = PointDto()
207 | point1.x = event.x
208 | point1.y = event.y
209 | positions!!.add(point1)
210 | }
211 | MotionEvent.ACTION_UP -> {
212 | autoRun = true
213 |
214 | val x = event.x
215 | val y = event.y
216 |
217 | if (x - xMouseDown == 0f && Math.abs(y - yMouseDown) < 4 || y - yMouseDown == 0f && Math.abs(x - xMouseDown) < 4) {
218 | for (i in players!!.indices) {
219 | val xOfYourBitmap = players!![i].pos[0] - Constants.PLAYER_SIZE / 2
220 | val yOfYourBitmap = players!![i].pos[1] - Constants.PLAYER_SIZE / 2
221 | if (x >= xOfYourBitmap && x < xOfYourBitmap + Constants.PLAYER_SIZE
222 | && y >= yOfYourBitmap && y < yOfYourBitmap + Constants.PLAYER_SIZE) {
223 | autoRun = false
224 | // handle click event
225 | Toast.makeText(context, "Clicked: " + ((i + 1).toString()), Toast.LENGTH_SHORT).show()
226 | break
227 | }
228 | }
229 | }
230 | return false
231 | }
232 | else -> return false
233 | }
234 |
235 | for (i in players!!.indices) {
236 | if (positions!!.size >= 2) {
237 | deltaX = positions!![positions!!.size - 1].x - positions!![positions!!.size - 2].x
238 | deltaY = positions!![positions!!.size - 1].y - positions!![positions!!.size - 2].y
239 |
240 | if (i >= 1) {
241 | val currentDistance = players!![i - 1].distance + Constants.PLAYER_DISTANT
242 | players!![i].distance = currentDistance % pathLength
243 | }
244 | }
245 |
246 | if (players!![i].distance < 0) {
247 | players!![i].distance = pathLength + players!![i].distance % pathLength
248 | }
249 | }
250 |
251 | //----------- drag on right side ----------------------
252 | if (event.x > width / 2) {
253 | deltaY = -deltaY
254 | }
255 | step = -deltaY
256 |
257 | invalidate()
258 | return true
259 | }
260 |
261 | fun setPlayers(players: List) {
262 | this.players = players
263 |
264 | for (i in players.indices) {
265 | val player = players[i]
266 |
267 | // To get image using Fresco
268 | val imageRequest = ImageRequestBuilder
269 | .newBuilderWithSource(Uri.parse(player.image))
270 | .setProgressiveRenderingEnabled(true)
271 | .build()
272 |
273 |
274 | val imagePipeline = Fresco.getImagePipeline()
275 | val dataSource = imagePipeline.fetchDecodedImage(imageRequest, context)
276 | dataSource.subscribe(object : BaseBitmapDataSubscriber() {
277 |
278 | public override fun onNewResultImpl(bitmap: Bitmap?) {
279 | player.bm = getCircleBitmap(bitmap!!)
280 | }
281 |
282 | override fun onFailureImpl(dataSource: DataSource>?) {}
283 |
284 | }, CallerThreadExecutor.getInstance())
285 |
286 | }
287 | invalidate()
288 | }
289 |
290 | fun getCircleBitmap(bm: Bitmap): Bitmap {
291 |
292 | val bitmap = ThumbnailUtils.extractThumbnail(bm, Constants.PLAYER_SIZE.toInt(), Constants.PLAYER_SIZE.toInt())
293 |
294 | val output = Bitmap.createBitmap(bitmap.width, bitmap.height, Bitmap.Config.ARGB_8888)
295 |
296 | val canvas = Canvas(output)
297 |
298 | val color = 0xffff0000.toInt()
299 | val paint = Paint()
300 | val rect = Rect(0, 0, bitmap.width, bitmap.height)
301 | val rectF = RectF(rect)
302 |
303 | paint.isAntiAlias = true
304 | paint.isDither = true
305 | paint.isFilterBitmap = true
306 | canvas.drawARGB(0, 0, 0, 0)
307 | paint.color = color
308 | canvas.drawOval(rectF, paint)
309 |
310 | paint.color = Color.BLUE
311 | paint.style = Paint.Style.STROKE
312 | paint.strokeWidth = 4.toFloat()
313 | paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.SRC_IN)
314 | canvas.drawBitmap(bitmap, rect, rect, paint)
315 |
316 | return output
317 | }
318 | }
319 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bett/androidkotlinanimationimagealongpath/Constants.kt:
--------------------------------------------------------------------------------
1 | package com.bett.androidkotlinanimationimagealongpath
2 |
3 | /**
4 | * Created by bett on 8/25/17.
5 | */
6 | object Constants {
7 | val PLAYER_SIZE = 144f
8 | val PLAYER_DISTANT = 210
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bett/androidkotlinanimationimagealongpath/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.bett.androidkotlinanimationimagealongpath
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 |
6 | class MainActivity : AppCompatActivity() {
7 |
8 | override fun onCreate(savedInstanceState: Bundle?) {
9 | super.onCreate(savedInstanceState)
10 | setContentView(R.layout.activity_main)
11 |
12 | var animationView = findViewById(R.id.animationView)
13 |
14 | val avatars = hashSetOf(
15 | "https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/master/avatar_demo/avatar1.png",
16 | "https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/master/avatar_demo/avatar2.png",
17 | "https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/master/avatar_demo/avatar3.png",
18 | "https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/master/avatar_demo/avatar4.png",
19 | "https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/master/avatar_demo/avatar5.png",
20 | "https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/master/avatar_demo/avatar6.png",
21 | "https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/master/avatar_demo/avatar7.png",
22 | "https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/master/avatar_demo/avatar8.png"
23 | )
24 |
25 | var players = ArrayList()
26 | for (i in 0..7) {
27 | var playerDto = PlayerDto()
28 | playerDto.image = avatars.elementAt(i)
29 | playerDto.distance = Constants.PLAYER_DISTANT * i + Constants.PLAYER_SIZE
30 | playerDto.offsetX = Constants.PLAYER_SIZE / 2
31 | playerDto.offsetY = Constants.PLAYER_SIZE / 2
32 | players.add(playerDto)
33 | }
34 | animationView.setPlayers(players)
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bett/androidkotlinanimationimagealongpath/MyApplication.kt:
--------------------------------------------------------------------------------
1 | package com.bett.androidkotlinanimationimagealongpath
2 |
3 | import android.app.Application
4 | import com.facebook.drawee.backends.pipeline.Fresco
5 |
6 | /**
7 | * Created by bett on 8/25/17.
8 | */
9 | class MyApplication : Application() {
10 | override fun onCreate() {
11 | super.onCreate()
12 | Fresco.initialize(this)
13 | }
14 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/bett/androidkotlinanimationimagealongpath/PlayerDto.kt:
--------------------------------------------------------------------------------
1 | package com.bett.androidkotlinanimationimagealongpath
2 |
3 | import android.graphics.Bitmap
4 | import android.graphics.Matrix
5 |
6 | /**
7 | * Created by bett on 8/25/17.
8 | */
9 |
10 | class PlayerDto {
11 |
12 | var image: String? = ""
13 | var bm: Bitmap? = null
14 | var offsetX: Float = 0.toFloat()
15 | var offsetY: Float = 0.toFloat()
16 | var distance: Float = 0.toFloat()
17 | var pos = FloatArray(2)
18 | var tan = FloatArray(2)
19 | var matrix = Matrix()
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bett/androidkotlinanimationimagealongpath/PointDto.kt:
--------------------------------------------------------------------------------
1 | package com.bett.androidkotlinanimationimagealongpath
2 |
3 | /**
4 | * Created by bett on 8/25/17.
5 | */
6 |
7 | class PointDto {
8 | var x: Float = 0.toFloat()
9 | var y: Float = 0.toFloat()
10 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
17 |
22 |
27 |
32 |
37 |
42 |
47 |
52 |
57 |
62 |
67 |
72 |
77 |
82 |
87 |
92 |
97 |
102 |
107 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidKotlinAnimationImageAlongPath
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/bett/androidkotlinanimationimagealongpath/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.bett.androidkotlinanimationimagealongpath
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/avatar_demo/avatar1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/avatar_demo/avatar1.png
--------------------------------------------------------------------------------
/avatar_demo/avatar2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/avatar_demo/avatar2.png
--------------------------------------------------------------------------------
/avatar_demo/avatar3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/avatar_demo/avatar3.png
--------------------------------------------------------------------------------
/avatar_demo/avatar4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/avatar_demo/avatar4.png
--------------------------------------------------------------------------------
/avatar_demo/avatar5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/avatar_demo/avatar5.png
--------------------------------------------------------------------------------
/avatar_demo/avatar6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/avatar_demo/avatar6.png
--------------------------------------------------------------------------------
/avatar_demo/avatar7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/avatar_demo/avatar7.png
--------------------------------------------------------------------------------
/avatar_demo/avatar8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/avatar_demo/avatar8.png
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.10'
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.6.1'
11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | android.enableJetifier=true
13 | android.useAndroidX=true
14 | org.gradle.jvmargs=-Xmx1536m
15 |
16 | # When configured, Gradle will run in incubating parallel mode.
17 | # This option should only be used with decoupled projects. More details, visit
18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
19 | # org.gradle.parallel=true
20 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/betranthanh/android-kotlin-animation-move-image-along-path/e075346446968b23059bf938d37df562d9e0028d/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Mar 23 23:38:10 WIB 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------