Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SwiftyWang committed Feb 7, 2018
0 parents commit 3df9e35
Show file tree
Hide file tree
Showing 62 changed files with 892 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
.DS_Store
/build
/captures
.externalNativeBuild
.idea
1 change: 1 addition & 0 deletions animateplaybutton/.gitignore
@@ -0,0 +1 @@
/build
34 changes: 34 additions & 0 deletions animateplaybutton/build.gradle
@@ -0,0 +1,34 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26



defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
21 changes: 21 additions & 0 deletions animateplaybutton/proguard-rules.pro
@@ -0,0 +1,21 @@
# 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
@@ -0,0 +1,26 @@
package com.swifty.animateplaybutton;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.swifty.animateplaybutton.test", appContext.getPackageName());
}
}
2 changes: 2 additions & 0 deletions animateplaybutton/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
<manifest package="com.swifty.animateplaybutton"
xmlns:android="http://schemas.android.com/apk/res/android"/>
@@ -0,0 +1,39 @@
package com.swifty.animateplaybutton;

import android.content.Context;
import android.support.annotation.DimenRes;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;

/**
* Created by swifty on 7/2/2018.
*/

public class AnimatePlayButton extends FrameLayout {
public AnimatePlayButton(Context context) {
super(context);
initView();
}

public AnimatePlayButton(Context context, AttributeSet attrs) {
super(context, attrs);
initView();
}

public AnimatePlayButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView();
}

private void initView() {
int size = getSize(R.dimen.padding_parent);
setPadding(size, size, size, size);
setBackgroundResource(R.drawable.blue_ring);
inflate(getContext(), R.layout.view_pause_stop, this);
}

private int getSize(@DimenRes int dimenRes) {
return getContext().getResources().getDimensionPixelSize(dimenRes);
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions animateplaybutton/src/main/res/drawable-v21/circle_button_bg.xml
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@android:color/holo_blue_dark">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="@android:color/holo_blue_bright"/>
</shape>
</item>
<item android:id="@android:id/background">
<shape android:shape="oval">
<solid android:color="@android:color/holo_blue_bright"/>
</shape>
</item>
</ripple>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions animateplaybutton/src/main/res/drawable/blue_circle.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@android:color/holo_blue_bright"/>
</shape>
10 changes: 10 additions & 0 deletions animateplaybutton/src/main/res/drawable/blue_ring.xml
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:useLevel="false">
<corners android:radius="@dimen/size_button"/>
<solid android:color="@android:color/transparent"/>
<stroke
android:width="@dimen/width_stroke"
android:color="@android:color/holo_blue_bright"/>
</shape>
5 changes: 5 additions & 0 deletions animateplaybutton/src/main/res/drawable/circle_button_bg.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/drak_blue_circle" android:state_pressed="true"/>
<item android:drawable="@drawable/blue_circle"/>
</selector>
5 changes: 5 additions & 0 deletions animateplaybutton/src/main/res/drawable/drak_blue_circle.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@android:color/holo_blue_dark"/>
</shape>
33 changes: 33 additions & 0 deletions animateplaybutton/src/main/res/layout/view_pause_stop.xml
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

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

<ImageView
android:layout_width="@dimen/size_button"
android:layout_height="@dimen/size_button"
android:background="@drawable/circle_button_bg"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/padding_button"
android:src="@drawable/ic_pause_white_36dp"/>

<ImageView
android:layout_width="@dimen/size_button"
android:layout_height="@dimen/size_button"
android:layout_marginLeft="@dimen/margin_button"
android:layout_marginStart="@dimen/margin_button"
android:background="@drawable/circle_button_bg"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/padding_button"
android:src="@drawable/ic_stop_white_36dp"/>
</LinearLayout>


</merge>
16 changes: 16 additions & 0 deletions animateplaybutton/src/main/res/layout/view_play.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<ImageView
android:layout_width="@dimen/size_button"
android:layout_height="@dimen/size_button"
android:background="@drawable/circle_button_bg"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/padding_button"
android:src="@drawable/ic_play_arrow_white_36dp"/>
</merge>

10 changes: 10 additions & 0 deletions animateplaybutton/src/main/res/values/dimens.xml
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="margin_button">4dp</dimen>
<dimen name="padding_parent">4dp</dimen>
<dimen name="width_stroke">2dp</dimen>

<!--button-style-->
<dimen name="size_button">42dp</dimen>
<dimen name="padding_button">7dp</dimen>
</resources>
3 changes: 3 additions & 0 deletions animateplaybutton/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">AnimatePlayButton</string>
</resources>
@@ -0,0 +1,17 @@
package com.swifty.animateplaybutton;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
1 change: 1 addition & 0 deletions app/.gitignore
@@ -0,0 +1 @@
/build
34 changes: 34 additions & 0 deletions app/build.gradle
@@ -0,0 +1,34 @@
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 26
defaultConfig {
applicationId "com.swifty.animateplaybutton.example"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation project(":animateplaybutton")
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
@@ -0,0 +1,21 @@
# 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
21 changes: 21 additions & 0 deletions app/src/main/AndroidManifest.xml
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.swifty.animateplaybutton.example"
xmlns:android="http://schemas.android.com/apk/res/android">

<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=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

</manifest>
@@ -0,0 +1,12 @@
package com.swifty.animateplaybutton.example

import android.support.v7.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {

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

0 comments on commit 3df9e35

Please sign in to comment.