Skip to content

Commit

Permalink
Merge pull request #2 from agrawalsuneet/dev
Browse files Browse the repository at this point in the history
Merge Dev to master for 0.1 release
  • Loading branch information
agrawalsuneet committed Dec 4, 2017
2 parents cd9028a + c03690d commit b5ffab6
Show file tree
Hide file tree
Showing 78 changed files with 1,675 additions and 291 deletions.
Binary file added .DS_Store
Binary file not shown.
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/workspace.xml

# Keystore files
*.jks

*.DS_Store
Binary file added .gradle/4.1/fileContent/fileContent.lock
Binary file not shown.
Binary file modified .gradle/4.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/4.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/4.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file added .gradle/4.1/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file added .gradle/4.1/javaCompile/jarAnalysis.bin
Binary file not shown.
Binary file added .gradle/4.1/javaCompile/javaCompile.lock
Binary file not shown.
Binary file added .gradle/4.1/javaCompile/taskHistory.bin
Binary file not shown.
Binary file added .gradle/4.1/javaCompile/taskJars.bin
Binary file not shown.
Binary file modified .gradle/4.1/taskHistory/fileSnapshots.bin
Binary file not shown.
Binary file modified .gradle/4.1/taskHistory/taskHistory.bin
Binary file not shown.
Binary file modified .gradle/4.1/taskHistory/taskHistory.lock
Binary file not shown.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/libraries/com_android_support_support_compat_26_0_2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,085 changes: 898 additions & 187 deletions .idea/workspace.xml

Large diffs are not rendered by default.

47 changes: 39 additions & 8 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
.idea/workspace.xml

# Keystore files
*.jks
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation project(':svgloaderspack')
}
Binary file added app/src/.DS_Store
Binary file not shown.
Binary file added app/src/main/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="SVGLoader"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
Expand Down
115 changes: 114 additions & 1 deletion app/src/main/java/com/agrawalsuneet/svgloaders/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,125 @@
package com.agrawalsuneet.svgloaders

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.constraint.ConstraintLayout
import android.support.v7.app.AppCompatActivity
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.Button
import android.widget.Toast
import com.agrawalsuneet.svgloaderspack.loaders.SVGLoader

class MainActivity : AppCompatActivity() {

lateinit var container: ConstraintLayout

lateinit var svgView: SVGLoader

lateinit var playPauseBtn: Button
lateinit var nextSVGBtn: Button

var currentLogoPos = 1

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

playPauseBtn = findViewById(R.id.playpauseBtn)
nextSVGBtn = findViewById(R.id.nextSvgBtn)

container = findViewById(R.id.container)
//addSVGViewProgrammatically()

playPauseBtn.setOnClickListener {
if (svgView.isAnimRunning()) {
playPauseBtn.text = "Play"
playPauseBtn.isEnabled = false
nextSVGBtn.isEnabled = false
svgView.endAnimation()
} else {
svgView.startAnimation()
playPauseBtn.text = "Stop"
nextSVGBtn.isEnabled = false
}
}

//return

svgView = findViewById(R.id.svg_loader)
svgView.listener = (object : SVGLoader.AnimationListener {
override fun onAnimationEnd() {
Toast.makeText(baseContext, "Animation end", Toast.LENGTH_SHORT).show()
playPauseBtn.isEnabled = true
nextSVGBtn.isEnabled = true
}

})

svgView.startAnimation()
playPauseBtn.text = "Stop"
nextSVGBtn.isEnabled = false

nextSVGBtn.setOnClickListener {
when (currentLogoPos) {
1 -> {
svgView.shapesStringArray = resources.getStringArray(R.array.twitter_logo_path)
svgView.fillColorsArray = resources.getIntArray(R.array.twitter_logo_colors)
svgView.validateTraceColors()
svgView.setViewportSize(2000.0f, 1625.36f)
currentLogoPos = 3
}

2 -> {
svgView.shapesStringArray = resources.getStringArray(R.array.github_logo_path)
svgView.fillColorsArray = resources.getIntArray(R.array.github_logo_colors)
svgView.validateTraceColors()
svgView.setViewportSize(512.0f, 512.0f)
currentLogoPos = 3
}

3 -> {
svgView.shapesStringArray = resources.getStringArray(R.array.shotang_logo_path)
svgView.fillColorsArray = resources.getIntArray(R.array.shotang_logo_colors)
svgView.validateTraceColors()
svgView.setViewportSize(500.0f, 500.0f)
currentLogoPos = 4
}

4 -> {
svgView.shapesStringArray = resources.getStringArray(R.array.google_logo_path)
svgView.fillColorsArray = resources.getIntArray(R.array.google_logo_colors)
svgView.validateTraceColors()
svgView.setViewportSize(400.0f, 400.0f)
currentLogoPos = 1
}
}
}
}

private fun addSVGViewProgrammatically() {
svgView = SVGLoader(baseContext, resources.getStringArray(R.array.shotang_logo_path),
resources.getIntArray(R.array.shotang_logo_colors), 512f, 512f)
.apply {
layoutParams = ViewGroup.LayoutParams(800, 800)
markerLength = 50
fillTime = 1000
timePerShape = 2000
interpolator = DecelerateInterpolator()
validateTraceColors()
/*traceResidueColorsArray = resources.getIntArray(R.array.google_logo_colors)
traceColorsArray = resources.getIntArray(R.array.google_logo_colors)*/
}

svgView.listener = (object : SVGLoader.AnimationListener {
override fun onAnimationEnd() {
Toast.makeText(baseContext, "Animation end", Toast.LENGTH_SHORT).show()
playPauseBtn.isEnabled = true
nextSVGBtn.isEnabled = true
}

})
container.addView(svgView)
svgView.startAnimation()
}
}
Binary file added app/src/main/res/.DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_github_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="512"
android:viewportWidth="512">
<path
android:fillColor="#000000"
android:fillType="evenOdd"
android:pathData="M256 70.7c-102.6 0-185.9 83.2-185.9 185.9 0 82.1 53.3 151.8 127.1 176.4 9.3 1.7 12.3-4 12.3-8.9V389.4c-51.7 11.3-62.5-21.9-62.5-21.9 -8.4-21.5-20.6-27.2-20.6-27.2 -16.9-11.5 1.3-11.3 1.3-11.3 18.7 1.3 28.5 19.2 28.5 19.2 16.6 28.4 43.5 20.2 54.1 15.4 1.7-12 6.5-20.2 11.8-24.9 -41.3-4.7-84.7-20.6-84.7-91.9 0-20.3 7.3-36.9 19.2-49.9 -1.9-4.7-8.3-23.6 1.8-49.2 0 0 15.6-5 51.1 19.1 14.8-4.1 30.7-6.2 46.5-6.3 15.8 0.1 31.7 2.1 46.6 6.3 35.5-24 51.1-19.1 51.1-19.1 10.1 25.6 3.8 44.5 1.8 49.2 11.9 13 19.1 29.6 19.1 49.9 0 71.4-43.5 87.1-84.9 91.7 6.7 5.8 12.8 17.1 12.8 34.4 0 24.9 0 44.9 0 51 0 4.9 3 10.7 12.4 8.9 73.8-24.6 127-94.3 127-176.4C441.9 153.9 358.6 70.7 256 70.7z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>
31 changes: 31 additions & 0 deletions app/src/main/res/drawable/ic_google_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="400.0"
android:viewportWidth="400.0">
<path
android:fillColor="#EA4335"
android:fillType="evenOdd"
android:pathData="M142.9,24.2c40.2-13.9,85.3-13.6,125.3,1.1c22.2,8.2,42.5,21,59.9,37.1c-5.8,6.3-12.1,12.2-18.1,18.3 c-11.4,11.4-22.8,22.8-34.2,34.2c-11.3-10.8-25.1-19-40.1-23.6c-17.6-5.3-36.6-6.1-54.6-2.2c-21,4.5-40.5,15.5-55.6,30.9 c-12.2,12.3-21.4,27.5-27,43.9c-20.3-15.8-40.6-31.5-61-47.3C59,73.6,97.6,39.7,142.9,24.2z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
<path
android:fillColor="#FBBC05"
android:fillType="evenOdd"
android:pathData="M21.4,163.2c3.3-16.2,8.7-32,16.2-46.8c20.3,15.8,40.6,31.5,61,47.3c-8,23.3-8,49.2,0,72.4 c-20.3,15.8-40.6,31.6-60.9,47.3C18.9,246.7,13.2,203.6,21.4,163.2z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
<path
android:fillColor="#34A853"
android:fillType="evenOdd"
android:pathData="M37.5,283.5c20.3-15.7,40.6-31.5,60.9-47.3c7.8,22.9,22.8,43.2,42.6,57.1c12.4,8.7,26.6,14.9,41.4,17.9 c14.6,3,29.7,2.6,44.4,0.1c14.6-2.6,28.7-7.9,41-16.2c19.7,15.3,39.4,30.6,59.1,45.9c-21.3,19.7-48,33.1-76.2,39.6 c-31.2,7.1-64.2,7.3-95.2-1c-24.6-6.5-47.7-18.2-67.6-34.1C67,328.9,49.6,307.5,37.5,283.5z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
<path
android:fillColor="#4285F4"
android:fillType="evenOdd"
android:pathData="M203.7,165.1c58.3,0,116.7,0,175,0c5.8,32.7,4.5,66.8-4.7,98.8c-8.5,29.3-24.6,56.5-47.1,77.2 c-19.7-15.3-39.4-30.6-59.1-45.9c19.5-13.1,33.3-34.3,37.2-57.5c-33.8,0-67.6,0-101.4,0C203.7,213.5,203.7,189.3,203.7,165.1z"
android:strokeColor="#00000000"
android:strokeWidth="1" />

</vector>
18 changes: 18 additions & 0 deletions app/src/main/res/drawable/ic_shotang_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="500.0"
android:viewportWidth="500.0">
<path
android:fillColor="#D34E41"
android:fillType="evenOdd"
android:pathData="M390,325C390.7,324.1 390.8,322.3 389.6,320.2C382,307 248,229 257,181C268.8,129.9 421,60 433,43.4C438.7,35.7 438.3,27.4 436,21C433.2,13.4 421.3,10.4 407,13C394,15.4 170.8,108.5 139,127C131.4,131.4 127,141 127,147C127,152.9 129.4,163.3 135,167C169.9,190.2 367,320.2 386.2,325.4C388.2,326 389.5,325.7 390,325Z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
<path
android:fillColor="#72726E"
android:fillType="evenOdd"
android:pathData="M108.6,172.8C107.9,173.7 107.7,175.5 109,177.6C116.6,190.8 250.6,268.8 241.6,316.8C229.8,367.8 77.6,437.8 65.5,454.4C59.9,462.1 60.3,470.4 62.6,476.8C65.3,484.4 77.3,487.4 91.6,484.8C104.5,482.4 327.7,389.3 359.6,370.8C367.2,366.4 371.6,356.8 371.6,350.8C371.6,344.9 369.1,334.5 363.6,330.8C328.7,307.6 131.6,177.6 112.4,172.4C110.4,171.8 109.1,172.1 108.6,172.8Z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_svg.xml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_twitter_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="1625.36"
android:viewportWidth="2000">
<path
android:fillColor="#00ACED"
android:fillType="evenOdd"
android:pathData="m 1999.9999,192.4 c -73.58,32.64 -152.67,54.69 -235.66,64.61 84.7,-50.78 149.77,-131.19 180.41,-227.01 -79.29,47.03 -167.1,81.17 -260.57,99.57 C 1609.3399,49.82 1502.6999,0 1384.6799,0 c -226.6,0 -410.328,183.71 -410.328,410.31 0,32.16 3.628,63.48 10.625,93.51 -341.016,-17.11 -643.368,-180.47 -845.739,-428.72 -35.324,60.6 -55.5583,131.09 -55.5583,206.29 0,142.36 72.4373,267.95 182.5433,341.53 -67.262,-2.13 -130.535,-20.59 -185.8519,-51.32 -0.039,1.71 -0.039,3.42 -0.039,5.16 0,198.803 141.441,364.635 329.145,402.342 -34.426,9.375 -70.676,14.395 -108.098,14.395 -26.441,0 -52.145,-2.578 -77.203,-7.364 52.215,163.008 203.75,281.649 383.304,284.946 -140.429,110.062 -317.351,175.66 -509.5972,175.66 -33.1211,0 -65.7851,-1.949 -97.8828,-5.738 181.586,116.4176 397.27,184.359 628.988,184.359 754.732,0 1167.462,-625.238 1167.462,-1167.47 0,-17.79 -0.41,-35.48 -1.2,-53.08 80.1799,-57.86 149.7399,-130.12 204.7499,-212.41"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>
47 changes: 40 additions & 7 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,50 @@
<android.support.constraint.ConstraintLayout 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"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
<com.agrawalsuneet.svgloaderspack.loaders.SVGLoader
android:id="@+id/svg_loader"
android:layout_width="250dp"
android:layout_height="250dp"
app:layout_constraintBottom_toBottomOf="@+id/linearLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:svgloader_fillColorsArray="@array/google_logo_colors"
app:svgloader_fillTime="2000"
app:svgloader_interpolator="@android:anim/decelerate_interpolator"
app:svgloader_markerLength="10dp"
app:svgloader_shapesStringArray="@array/google_logo_path"
app:svgloader_timePerShape="3000"
app:svgloader_viewportHeight="400"
app:svgloader_viewportWidth="400" />

<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_gravity="bottom"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">

<Button
android:id="@+id/playpauseBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Play/Stop" />

<Button
android:id="@+id/nextSvgBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Next SVG" />
</LinearLayout>


</android.support.constraint.ConstraintLayout>
Loading

0 comments on commit b5ffab6

Please sign in to comment.