Repository: armcha/ElasticView
Branch: master
Commit: 7e06b81fe67d
Files: 51
Total size: 51.9 KB
Directory structure:
gitextract_s9jirpp5/
├── .gitignore
├── .idea/
│ ├── codeStyles/
│ │ └── Project.xml
│ ├── encodings.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── README.md
├── app/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── io/
│ │ └── armcha/
│ │ └── sampleapp/
│ │ └── ExampleInstrumentedTest.kt
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── io/
│ │ │ └── armcha/
│ │ │ └── sampleapp/
│ │ │ ├── MainActivity.kt
│ │ │ ├── RecyclerViewActivity.kt
│ │ │ ├── SeekBarChangeListener.kt
│ │ │ ├── SimpleAdapter.kt
│ │ │ └── data/
│ │ │ └── DataSource.kt
│ │ └── res/
│ │ ├── drawable/
│ │ │ └── ic_launcher_background.xml
│ │ ├── drawable-v24/
│ │ │ └── ic_launcher_foreground.xml
│ │ ├── layout/
│ │ │ ├── activity_main.xml
│ │ │ ├── activity_recycler_view.xml
│ │ │ └── item_view.xml
│ │ ├── mipmap-anydpi-v26/
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ └── values/
│ │ ├── attrs_my_view.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test/
│ └── java/
│ └── io/
│ └── armcha/
│ └── sampleapp/
│ └── ExampleUnitTest.kt
├── build.gradle
├── elastic_view/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── kotlin/
│ │ └── io/
│ │ └── armcha/
│ │ └── elasticview/
│ │ ├── CentrePointProvider.kt
│ │ ├── DebugPath.kt
│ │ ├── ElasticView.kt
│ │ ├── FastOutSlowInInterpolator.kt
│ │ └── ShineProvider.kt
│ └── res/
│ ├── drawable/
│ │ └── shine.xml
│ └── values/
│ ├── attrs_elastic_view.xml
│ ├── colors.xml
│ └── strings.xml
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── screens/
│ └── sample.apk
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
================================================
FILE: .idea/codeStyles/Project.xml
================================================
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>
================================================
FILE: .idea/encodings.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
================================================
FILE: .idea/gradle.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/elastic_view" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
================================================
FILE: .idea/misc.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
================================================
FILE: .idea/runConfigurations.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
================================================
FILE: .idea/vcs.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
================================================
FILE: README.md
================================================
# ElasticView

[](https://android-arsenal.com/api?level=21)
[](https://android-arsenal.com/details/1/7274)
Elastic view is a regular **CardView**, which can **flex** from user touches💪
**Kotlin** ❤️

Let's see it in action 💻📲


### Download sample [apk](https://github.com/armcha/ElasticView/raw/master/screens/sample.apk) :arrow_down:
The current minSDK version is API level 21.
### Download
Gradle:
```groovy
implementation 'com.github.armcha:ElasticView:0.2.0'
```
## Setup and usage
You can use it as a regualar CardView.
```xml
<io.armcha.elasticview.ElasticView
android:id="@+id/imageElasticView"
android:layout_width="..."
android:layout_height="..."
app:cardCornerRadius="10dp"
app:cardElevation="5dp">
<ChildView.../>
<!--or without childView-->
</io.armcha.elasticview.ElasticView>
```
## Customization
For now, you can only change flexibility for the view
from code
```kotlin
elasticView.flexibility = 8f
```
or from xml
```xml
<io.armcha.elasticview.ElasticView
android:id="@+id/imageElasticView"
android:layout_width="..."
android:layout_height="..."
app:flexibility="7"
app:cardCornerRadius="10dp"
app:cardElevation="5dp"/>
```
**Note the flexibility must be between [1f..10f] ❗️**
That's all :ok_hand:
### Contact :book:
:arrow_forward: **Email**: chatikyana@gmail.com
:arrow_forward: **Medium**: https://medium.com/@chatikyan
:arrow_forward: **Twitter**: https://twitter.com/ArmanChatikyan
:arrow_forward: **Google+**: https://plus.google.com/+ArmanChatikyan
:arrow_forward: **Website**: https://armcha.github.io/
License
--------
ElasticView
Copyright (c) 2018 Arman Chatikyan (https://github.com/armcha/ElasticView).
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: app/.gitignore
================================================
/build
================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "io.armcha.sampleapp"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation project(':elastic_view')
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
================================================
FILE: app/src/androidTest/java/io/armcha/sampleapp/ExampleInstrumentedTest.kt
================================================
package io.armcha.sampleapp
import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getTargetContext()
assertEquals("io.armcha.sampleapp", appContext.packageName)
}
}
================================================
FILE: app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.armcha.sampleapp">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".RecyclerViewActivity"></activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
================================================
FILE: app/src/main/java/io/armcha/sampleapp/MainActivity.kt
================================================
package io.armcha.sampleapp
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//imageElasticView.flexibility = 8f
imageElasticView.isDebugPathEnabled = true
buttonElasticView.setOnClickListener {
startActivity(Intent(this, RecyclerViewActivity::class.java))
}
seekBar.setOnSeekBarChangeListener(object : SeekBarChangeListener() {
override fun onProgress(progress: Int) {
imageElasticView.flexibility = progress / 10f + 1f
seekBarText.text = "Flexibility is ${imageElasticView.flexibility}f"
}
})
seekBar.progress = 40
}
}
================================================
FILE: app/src/main/java/io/armcha/sampleapp/RecyclerViewActivity.kt
================================================
package io.armcha.sampleapp
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_recycler_view.*
class RecyclerViewActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_recycler_view)
recyclerView setUpWith SimpleAdapter()
}
}
================================================
FILE: app/src/main/java/io/armcha/sampleapp/SeekBarChangeListener.kt
================================================
package io.armcha.sampleapp
import android.widget.SeekBar
/**
*
* Created by Arman Chatikyan on 29 Oct 2018
*
*/
abstract class SeekBarChangeListener : SeekBar.OnSeekBarChangeListener {
abstract fun onProgress(progress: Int)
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
onProgress(progress)
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {
}
override fun onStopTrackingTouch(seekBar: SeekBar?) {
}
}
================================================
FILE: app/src/main/java/io/armcha/sampleapp/SimpleAdapter.kt
================================================
package io.armcha.sampleapp
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.squareup.picasso.Picasso
import io.armcha.sampleapp.data.DataSource
import kotlinx.android.synthetic.main.item_view.view.*
class SimpleAdapter : RecyclerView.Adapter<SimpleAdapter.ViewHolder>() {
private val items = DataSource.items
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_view, parent, false))
}
override fun getItemCount(): Int {
return items.size
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = items[position]
holder.bind(item)
}
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
fun bind(imageUrl: String) {
Picasso.get()
.load(imageUrl)
.into(itemView.imageView)
itemView.nameText.text = "Item for position $adapterPosition"
}
}
}
infix fun RecyclerView.setUpWith(simpleAdapter: SimpleAdapter) {
adapter = simpleAdapter
layoutManager = LinearLayoutManager(context)
}
================================================
FILE: app/src/main/java/io/armcha/sampleapp/data/DataSource.kt
================================================
package io.armcha.sampleapp.data
object DataSource {
val items by lazy {
mutableListOf<String>().apply {
repeat(5) {
add("https://cdn.pixabay.com/photo/2016/05/16/17/59/strawberries-1396330_640.jpg")
add("https://cdn.pixabay.com/photo/2018/02/08/22/27/flower-3140492_640.jpg")
add("https://cdn.pixabay.com/photo/2018/02/07/17/53/poppy-3137588_640.jpg")
add("https://cdn.pixabay.com/photo/2018/02/06/14/07/dance-3134828_640.jpg")
add("https://cdn.pixabay.com/photo/2012/04/26/22/31/substances-43354_640.jpg")
add("https://cdn.pixabay.com/photo/2017/06/06/22/46/mediterranean-cuisine-2378758_640.jpg")
add("https://cdn.pixabay.com/photo/2018/02/01/19/21/easter-3123834_640.jpg")
add("https://cdn.pixabay.com/photo/2017/11/29/09/15/paint-2985569_640.jpg")
add("https://cdn.pixabay.com/photo/2017/11/18/17/09/strawberry-2960533_640.jpg")
add("https://cdn.pixabay.com/photo/2017/11/05/00/46/flower-2919284_640.jpg")
add("https://cdn.pixabay.com/photo/2017/09/25/20/44/peppers-2786684_640.jpg")
add("https://cdn.pixabay.com/photo/2017/09/01/21/53/blue-2705642_640.jpg")
add("https://cdn.pixabay.com/photo/2017/05/31/18/38/sea-2361247_640.jpg")
add("https://cdn.pixabay.com/photo/2018/02/02/22/28/nature-3126513_640.jpg")
add("https://cdn.pixabay.com/photo/2018/01/28/21/14/lens-3114729_640.jpg")
add("https://cdn.pixabay.com/photo/2018/01/27/05/49/woman-3110483_640.jpg")
add("https://cdn.pixabay.com/photo/2018/01/31/16/27/sea-3121435_640.jpg")
add("https://cdn.pixabay.com/photo/2018/01/31/12/16/architecture-3121009_640.jpg")
add("https://cdn.pixabay.com/photo/2018/01/28/14/41/bird-3113835_640.jpg")
add("https://cdn.pixabay.com/photo/2018/01/28/17/48/gallery-3114279_640.jpg")
add("https://cdn.pixabay.com/photo/2017/11/26/19/50/jeans-2979818_640.jpg")
add("https://cdn.pixabay.com/photo/2017/12/15/13/51/polynesia-3021072_640.jpg")
add("https://cdn.pixabay.com/photo/2016/11/13/00/40/girl-1820122_640.jpg")
}
}
}
}
================================================
FILE: app/src/main/res/drawable/ic_launcher_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
================================================
FILE: app/src/main/res/drawable-v24/ic_launcher_foreground.xml
================================================
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
================================================
FILE: app/src/main/res/layout/activity_main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
tools:context=".MainActivity">
<io.armcha.elasticview.ElasticView
android:id="@+id/imageElasticView"
android:layout_width="200dp"
android:layout_height="270dp"
android:layout_marginStart="8dp"
android:layout_marginTop="80dp"
android:layout_marginEnd="8dp"
app:cardCornerRadius="10dp"
app:cardElevation="5dp"
app:flexibility="7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/venom" />
</io.armcha.elasticview.ElasticView>
<TextView
android:id="@+id/seekBarText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:textColor="@android:color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageElasticView" />
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/seekBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:max="90"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/seekBarText" />
<io.armcha.elasticview.ElasticView
android:id="@+id/buttonElasticView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="8dp"
app:cardBackgroundColor="@color/gray"
app:cardCornerRadius="2dp"
app:cardElevation="3dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/seekBar">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:text="Go to recyclerView screen"
android:textAllCaps="true"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textStyle="bold" />
</io.armcha.elasticview.ElasticView>
</androidx.constraintlayout.widget.ConstraintLayout>
================================================
FILE: app/src/main/res/layout/activity_recycler_view.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".RecyclerViewActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:paddingTop="30dp"
android:clipToPadding="false"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
================================================
FILE: app/src/main/res/layout/item_view.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<io.armcha.elasticview.ElasticView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/elasticView"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
app:cardCornerRadius="10dp"
app:cardElevation="5dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView"
android:layout_width="150dp"
android:layout_height="130dp"
android:scaleType="centerCrop"
android:src="@drawable/dark_knight"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/surNameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="20dp"
android:ellipsize="end"
android:lines="1"
android:maxWidth="200dp"
android:textAllCaps="true"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/nameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="20dp"
android:textColor="@color/colorAccent"
android:textSize="13sp"
app:layout_constraintStart_toStartOf="@+id/surNameText"
app:layout_constraintTop_toBottomOf="@+id/surNameText" />
</androidx.constraintlayout.widget.ConstraintLayout>
</io.armcha.elasticview.ElasticView>
================================================
FILE: app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
================================================
FILE: app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
================================================
FILE: app/src/main/res/values/attrs_my_view.xml
================================================
<resources>
<declare-styleable name="ElasticView">
<attr name="exampleString" format="string" />
<attr name="exampleDimension" format="dimension" />
<attr name="exampleColor" format="color" />
<attr name="exampleDrawable" format="color|reference" />
</declare-styleable>
</resources>
================================================
FILE: app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="gray">#D1D1D1</color>
</resources>
================================================
FILE: app/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">SampleApp</string>
</resources>
================================================
FILE: app/src/main/res/values/styles.xml
================================================
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
================================================
FILE: app/src/test/java/io/armcha/sampleapp/ExampleUnitTest.kt
================================================
package io.armcha.sampleapp
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
fun `this is test case for`(){
}
}
================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.0'
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-beta04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "guru.stefma.bintrayrelease:bintrayrelease:1.1.1"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: elastic_view/.gitignore
================================================
/build
================================================
FILE: elastic_view/build.gradle
================================================
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'guru.stefma.bintrayrelease'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
tasks.withType(Javadoc).all { enabled = false }
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap' }
mavenCentral()
}
version = "0.2.0"
group = "com.github.armcha"
publish {
userOrg = 'armcha'
artifactId = 'ElasticView'
desc = 'ElasticView'
website = 'https://github.com/armcha/ElasticView'
}
================================================
FILE: elastic_view/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
================================================
FILE: elastic_view/src/main/AndroidManifest.xml
================================================
<manifest package="io.armcha.elasticview" />
================================================
FILE: elastic_view/src/main/kotlin/io/armcha/elasticview/CentrePointProvider.kt
================================================
package io.armcha.elasticview
import android.view.MotionEvent
import android.view.View
internal abstract class CentrePointProvider(protected val parentView: View) {
private val screenOffDistance = -300f
protected var cx = screenOffDistance
protected var cy = screenOffDistance
init {
parentView.setOnTouchListener { v, event ->
attach(event)
v.onTouchEvent(event)
}
}
private fun attach(event: MotionEvent) {
val (x, y) = if (event.action == MotionEvent.ACTION_MOVE) {
event.x to event.y
} else {
screenOffDistance to screenOffDistance
}
cx = x
cy = y
parentView.invalidate()
}
}
================================================
FILE: elastic_view/src/main/kotlin/io/armcha/elasticview/DebugPath.kt
================================================
package io.armcha.elasticview
import android.graphics.*
import android.view.View
internal class DebugPath(parentView: View) : CentrePointProvider(parentView) {
private val _pathPaint by lazy {
Paint().apply {
style = Paint.Style.STROKE
color = Color.WHITE
strokeWidth = 2f
pathEffect = DashPathEffect(floatArrayOf(20f, 10f), 0f)
}
}
private val _circlePaint by lazy {
Paint().apply {
style = Paint.Style.FILL
color = Color.WHITE
}
}
private val _horizontalPath = Path()
private val _verticalPath = Path()
fun onDispatchDraw(canvas: Canvas?) {
_verticalPath.reset()
_horizontalPath.reset()
_horizontalPath.moveTo(cx, 0f)
_horizontalPath.lineTo(cx, parentView.height.toFloat())
_verticalPath.moveTo(0f, cy)
_verticalPath.lineTo(parentView.width.toFloat(), cy)
canvas?.run {
drawPath(_horizontalPath, _pathPaint)
drawPath(_verticalPath, _pathPaint)
drawCircle(cx, cy, 15f, _circlePaint)
}
}
}
================================================
FILE: elastic_view/src/main/kotlin/io/armcha/elasticview/ElasticView.kt
================================================
package io.armcha.elasticview
import android.content.Context
import android.graphics.Canvas
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.ViewPropertyAnimator
import com.google.android.material.card.MaterialCardView
class ElasticView(context: Context, attrs: AttributeSet? = null) : MaterialCardView(context, attrs) {
private val ANIMATION_DURATION = 200L
private val ANIMATION_DURATION_SHORT = 100L
private var _isAnimating = false
private var _isActionUpPerformed = false
private val _debugPath by lazy {
DebugPath(this)
}
private val _shineProvider by lazy {
ShineProvider(this)
}
//Will be available in next versions
private var isShineEnabled = false
var flexibility = 5f
set(value) {
if (value !in 1f..10f) {
throw IllegalArgumentException("Flexibility must be between [1f..10f].")
}
field = value
}
var isDebugPathEnabled = false
init {
isClickable = true
init(attrs)
}
override fun dispatchTouchEvent(event: MotionEvent): Boolean {
processTouchEvent(event)
return super.dispatchTouchEvent(event)
}
override fun dispatchDraw(canvas: Canvas?) {
super.dispatchDraw(canvas)
if (isDebugPathEnabled)
_debugPath.onDispatchDraw(canvas)
if (isShineEnabled)
_shineProvider.onDispatchDraw(canvas)
}
private fun processTouchEvent(event: MotionEvent) {
val verticalRotation = calculateRotation((event.x * flexibility * 2) / width)
val horizontalRotation = -calculateRotation((event.y * flexibility * 2) / height)
when (event.actionMasked) {
MotionEvent.ACTION_DOWN -> {
animator {
rotationY(verticalRotation)
rotationX(horizontalRotation)
duration = ANIMATION_DURATION_SHORT
withStartAction {
_isActionUpPerformed = false
_isAnimating = true
}
withEndAction {
if (_isActionUpPerformed) {
animateToOriginalPosition()
} else {
_isAnimating = false
}
}
}
}
MotionEvent.ACTION_MOVE -> {
rotationY = verticalRotation
rotationX = horizontalRotation
}
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL, MotionEvent.ACTION_OUTSIDE -> {
_isActionUpPerformed = true
if (!_isAnimating) {
animateToOriginalPosition()
}
}
}
}
private fun init(attrs: AttributeSet?) {
context.obtainStyledAttributes(attrs, R.styleable.ElasticView).apply {
if (hasValue(R.styleable.ElasticView_flexibility)) {
flexibility = getFloat(R.styleable.ElasticView_flexibility, flexibility)
}
recycle()
}
}
private fun animator(body: ViewPropertyAnimator.() -> Unit) {
animate().apply {
interpolator = FastOutSlowInInterpolator()
body()
start()
}
}
private fun animateToOriginalPosition() {
animator {
rotationX(0f)
rotationY(0f)
duration = ANIMATION_DURATION
}
}
private fun calculateRotation(value: Float): Float {
var tempValue = when {
value < 0 -> 1f
value > flexibility * 2 -> flexibility * 2
else -> value
}
tempValue -= flexibility
return tempValue
}
}
================================================
FILE: elastic_view/src/main/kotlin/io/armcha/elasticview/FastOutSlowInInterpolator.kt
================================================
package io.armcha.elasticview
import android.view.animation.Interpolator
internal class FastOutSlowInInterpolator : Interpolator {
private val _values = floatArrayOf(0.0f, 1.0E-4f, 2.0E-4f, 5.0E-4f, 9.0E-4f, 0.0014f,
0.002f, 0.0027f, 0.0036f, 0.0046f, 0.0058f, 0.0071f, 0.0085f, 0.0101f, 0.0118f, 0.0137f,
0.0158f, 0.018f, 0.0205f, 0.0231f, 0.0259f, 0.0289f, 0.0321f, 0.0355f, 0.0391f, 0.043f,
0.0471f, 0.0514f, 0.056f, 0.0608f, 0.066f, 0.0714f, 0.0771f, 0.083f, 0.0893f, 0.0959f,
0.1029f, 0.1101f, 0.1177f, 0.1257f, 0.1339f, 0.1426f, 0.1516f, 0.161f, 0.1707f, 0.1808f,
0.1913f, 0.2021f, 0.2133f, 0.2248f, 0.2366f, 0.2487f, 0.2611f, 0.2738f, 0.2867f, 0.2998f,
0.3131f, 0.3265f, 0.34f, 0.3536f, 0.3673f, 0.381f, 0.3946f, 0.4082f, 0.4217f, 0.4352f,
0.4485f, 0.4616f, 0.4746f, 0.4874f, 0.5f, 0.5124f, 0.5246f, 0.5365f, 0.5482f, 0.5597f,
0.571f, 0.582f, 0.5928f, 0.6033f, 0.6136f, 0.6237f, 0.6335f, 0.6431f, 0.6525f, 0.6616f,
0.6706f, 0.6793f, 0.6878f, 0.6961f, 0.7043f, 0.7122f, 0.7199f, 0.7275f, 0.7349f, 0.7421f,
0.7491f, 0.7559f, 0.7626f, 0.7692f, 0.7756f, 0.7818f, 0.7879f, 0.7938f, 0.7996f, 0.8053f,
0.8108f, 0.8162f, 0.8215f, 0.8266f, 0.8317f, 0.8366f, 0.8414f, 0.8461f, 0.8507f, 0.8551f,
0.8595f, 0.8638f, 0.8679f, 0.872f, 0.876f, 0.8798f, 0.8836f, 0.8873f, 0.8909f, 0.8945f,
0.8979f, 0.9013f, 0.9046f, 0.9078f, 0.9109f, 0.9139f, 0.9169f, 0.9198f, 0.9227f, 0.9254f,
0.9281f, 0.9307f, 0.9333f, 0.9358f, 0.9382f, 0.9406f, 0.9429f, 0.9452f, 0.9474f, 0.9495f,
0.9516f, 0.9536f, 0.9556f, 0.9575f, 0.9594f, 0.9612f, 0.9629f, 0.9646f, 0.9663f, 0.9679f,
0.9695f, 0.971f, 0.9725f, 0.9739f, 0.9753f, 0.9766f, 0.9779f, 0.9791f, 0.9803f, 0.9815f,
0.9826f, 0.9837f, 0.9848f, 0.9858f, 0.9867f, 0.9877f, 0.9885f, 0.9894f, 0.9902f, 0.991f,
0.9917f, 0.9924f, 0.9931f, 0.9937f, 0.9944f, 0.9949f, 0.9955f, 0.996f, 0.9964f, 0.9969f,
0.9973f, 0.9977f, 0.998f, 0.9984f, 0.9986f, 0.9989f, 0.9991f, 0.9993f, 0.9995f, 0.9997f,
0.9998f, 0.9999f, 0.9999f, 1.0f, 1.0f)
private val _stepSize by lazy {
1 / (_values.size - 1f)
}
override fun getInterpolation(input: Float): Float {
return when {
input >= 1.0f -> 1.0f
input <= 0.0f -> 0.0f
else -> {
val position = Math.min((input * (_values.size - 1)).toInt(), _values.size - 2)
val quantized = position * _stepSize
val diff = input - quantized
val weight = diff / _stepSize
_values[position] + weight * (_values[position + 1] - _values[position])
}
}
}
}
================================================
FILE: elastic_view/src/main/kotlin/io/armcha/elasticview/ShineProvider.kt
================================================
package io.armcha.elasticview
import android.graphics.*
import androidx.core.content.ContextCompat
import android.view.View
internal class ShineProvider(parentView: View) : CentrePointProvider(parentView) {
private val _paint by lazy {
Paint().apply {
color = Color.BLACK
style = Paint.Style.FILL
}
}
private val _centreColor by lazy {
ContextCompat.getColor(parentView.context, R.color.startColor)
}
private val _shineRadius by lazy {
parentView.height / 2.5f
}
fun onDispatchDraw(canvas: Canvas?) {
_paint.shader = RadialGradient(cx, cy, _shineRadius, _centreColor,
Color.TRANSPARENT, Shader.TileMode.CLAMP)
canvas?.drawCircle(cx, cy, _shineRadius, _paint)
}
}
================================================
FILE: elastic_view/src/main/res/drawable/shine.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:centerColor="#AAffffff"
android:endColor="#00ffffff"
android:startColor="#00ffffff" />
</shape>
================================================
FILE: elastic_view/src/main/res/values/attrs_elastic_view.xml
================================================
<resources>
<declare-styleable name="ElasticView">
<attr name="flexibility" format="float" />
</declare-styleable>
</resources>
================================================
FILE: elastic_view/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="startColor">#59FFFFFF</color>
<color name="endColor">#23FFFFFF</color>
</resources>
================================================
FILE: elastic_view/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">elastic_view</string>
</resources>
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Tue Oct 23 11:24:05 AMT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
================================================
FILE: gradle.properties
================================================
# 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.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# 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
================================================
FILE: gradlew
================================================
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: settings.gradle
================================================
include ':app', ':elastic_view'
gitextract_s9jirpp5/ ├── .gitignore ├── .idea/ │ ├── codeStyles/ │ │ └── Project.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── README.md ├── app/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ ├── androidTest/ │ │ └── java/ │ │ └── io/ │ │ └── armcha/ │ │ └── sampleapp/ │ │ └── ExampleInstrumentedTest.kt │ ├── main/ │ │ ├── AndroidManifest.xml │ │ ├── java/ │ │ │ └── io/ │ │ │ └── armcha/ │ │ │ └── sampleapp/ │ │ │ ├── MainActivity.kt │ │ │ ├── RecyclerViewActivity.kt │ │ │ ├── SeekBarChangeListener.kt │ │ │ ├── SimpleAdapter.kt │ │ │ └── data/ │ │ │ └── DataSource.kt │ │ └── res/ │ │ ├── drawable/ │ │ │ └── ic_launcher_background.xml │ │ ├── drawable-v24/ │ │ │ └── ic_launcher_foreground.xml │ │ ├── layout/ │ │ │ ├── activity_main.xml │ │ │ ├── activity_recycler_view.xml │ │ │ └── item_view.xml │ │ ├── mipmap-anydpi-v26/ │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ └── values/ │ │ ├── attrs_my_view.xml │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test/ │ └── java/ │ └── io/ │ └── armcha/ │ └── sampleapp/ │ └── ExampleUnitTest.kt ├── build.gradle ├── elastic_view/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── kotlin/ │ │ └── io/ │ │ └── armcha/ │ │ └── elasticview/ │ │ ├── CentrePointProvider.kt │ │ ├── DebugPath.kt │ │ ├── ElasticView.kt │ │ ├── FastOutSlowInInterpolator.kt │ │ └── ShineProvider.kt │ └── res/ │ ├── drawable/ │ │ └── shine.xml │ └── values/ │ ├── attrs_elastic_view.xml │ ├── colors.xml │ └── strings.xml ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── screens/ │ └── sample.apk └── settings.gradle
Condensed preview — 51 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (59K chars).
[
{
"path": ".gitignore",
"chars": 203,
"preview": "*.iml\n.gradle\n/local.properties\n/.idea/caches\n/.idea/libraries\n/.idea/modules.xml\n/.idea/workspace.xml\n/.idea/navEditor."
},
{
"path": ".idea/codeStyles/Project.xml",
"chars": 1775,
"preview": "<component name=\"ProjectCodeStyleConfiguration\">\n <code_scheme name=\"Project\" version=\"173\">\n <Objective-C-extension"
},
{
"path": ".idea/encodings.xml",
"chars": 159,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"Encoding\">\n <file url=\"PROJECT\" chars"
},
{
"path": ".idea/gradle.xml",
"chars": 684,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"GradleSettings\">\n <option name=\"linke"
},
{
"path": ".idea/misc.xml",
"chars": 515,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"CMakeSettings\">\n <configurations>\n "
},
{
"path": ".idea/runConfigurations.xml",
"chars": 564,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"RunConfigurationProducerService\">\n <o"
},
{
"path": ".idea/vcs.xml",
"chars": 180,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"VcsDirectoryMappings\">\n <mapping dire"
},
{
"path": "README.md",
"chars": 2708,
"preview": "# ElasticView\n\n\n[.apply {\n"
},
{
"path": "app/src/main/res/drawable/ic_launcher_background.xml",
"chars": 5606,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:wi"
},
{
"path": "app/src/main/res/drawable-v24/ic_launcher_foreground.xml",
"chars": 1880,
"preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:aapt=\"http://schemas.android.com/aapt\"\n "
},
{
"path": "app/src/main/res/layout/activity_main.xml",
"chars": 3333,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas."
},
{
"path": "app/src/main/res/layout/activity_recycler_view.xml",
"chars": 628,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas."
},
{
"path": "app/src/main/res/layout/item_view.xml",
"chars": 2655,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<io.armcha.elasticview.ElasticView xmlns:android=\"http://schemas.android.com/apk/"
},
{
"path": "app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
"chars": 272,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <b"
},
{
"path": "app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml",
"chars": 272,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <b"
},
{
"path": "app/src/main/res/values/attrs_my_view.xml",
"chars": 324,
"preview": "<resources>\n <declare-styleable name=\"ElasticView\">\n <attr name=\"exampleString\" format=\"string\" />\n <at"
},
{
"path": "app/src/main/res/values/colors.xml",
"chars": 247,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"colorPrimary\">#008577</color>\n <color name=\"color"
},
{
"path": "app/src/main/res/values/strings.xml",
"chars": 72,
"preview": "<resources>\n <string name=\"app_name\">SampleApp</string>\n</resources>\n"
},
{
"path": "app/src/main/res/values/styles.xml",
"chars": 446,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">"
},
{
"path": "app/src/test/java/io/armcha/sampleapp/ExampleUnitTest.kt",
"chars": 388,
"preview": "package io.armcha.sampleapp\n\nimport org.junit.Test\n\nimport org.junit.Assert.*\n\n/**\n * Example local unit test, which wil"
},
{
"path": "build.gradle",
"chars": 714,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n e"
},
{
"path": "elastic_view/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "elastic_view/build.gradle",
"chars": 1196,
"preview": "apply plugin: 'com.android.library'\napply plugin: 'kotlin-android-extensions'\napply plugin: 'kotlin-android'\napply plugi"
},
{
"path": "elastic_view/proguard-rules.pro",
"chars": 751,
"preview": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguar"
},
{
"path": "elastic_view/src/main/AndroidManifest.xml",
"chars": 45,
"preview": "<manifest package=\"io.armcha.elasticview\" />\n"
},
{
"path": "elastic_view/src/main/kotlin/io/armcha/elasticview/CentrePointProvider.kt",
"chars": 724,
"preview": "package io.armcha.elasticview\n\nimport android.view.MotionEvent\nimport android.view.View\n\ninternal abstract class CentreP"
},
{
"path": "elastic_view/src/main/kotlin/io/armcha/elasticview/DebugPath.kt",
"chars": 1131,
"preview": "package io.armcha.elasticview\n\nimport android.graphics.*\nimport android.view.View\n\n\ninternal class DebugPath(parentView:"
},
{
"path": "elastic_view/src/main/kotlin/io/armcha/elasticview/ElasticView.kt",
"chars": 3838,
"preview": "package io.armcha.elasticview\n\nimport android.content.Context\nimport android.graphics.Canvas\nimport android.util.Attribu"
},
{
"path": "elastic_view/src/main/kotlin/io/armcha/elasticview/FastOutSlowInInterpolator.kt",
"chars": 2797,
"preview": "package io.armcha.elasticview\n\nimport android.view.animation.Interpolator\n\ninternal class FastOutSlowInInterpolator : In"
},
{
"path": "elastic_view/src/main/kotlin/io/armcha/elasticview/ShineProvider.kt",
"chars": 787,
"preview": "package io.armcha.elasticview\n\nimport android.graphics.*\nimport androidx.core.content.ContextCompat\nimport android.view."
},
{
"path": "elastic_view/src/main/res/drawable/shine.xml",
"chars": 247,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <gradient\n"
},
{
"path": "elastic_view/src/main/res/values/attrs_elastic_view.xml",
"chars": 144,
"preview": "<resources>\n <declare-styleable name=\"ElasticView\">\n <attr name=\"flexibility\" format=\"float\" />\n </declare-"
},
{
"path": "elastic_view/src/main/res/values/colors.xml",
"chars": 156,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"startColor\">#59FFFFFF</color>\n <color name=\"endCo"
},
{
"path": "elastic_view/src/main/res/values/strings.xml",
"chars": 75,
"preview": "<resources>\n <string name=\"app_name\">elastic_view</string>\n</resources>\n"
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 233,
"preview": "#Tue Oct 23 11:24:05 AMT 2018\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
},
{
"path": "gradle.properties",
"chars": 780,
"preview": "# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will ov"
},
{
"path": "gradlew",
"chars": 5296,
"preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n## Gradle start up"
},
{
"path": "gradlew.bat",
"chars": 2176,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
},
{
"path": "settings.gradle",
"chars": 32,
"preview": "include ':app', ':elastic_view'\n"
}
]
// ... and 2 more files (download for full content)
About this extraction
This page contains the full source code of the armcha/ElasticView GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 51 files (51.9 KB), approximately 16.4k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.