Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
flyou committed Feb 17, 2017
1 parent 9d5f80f commit acfe600
Show file tree
Hide file tree
Showing 33 changed files with 1,003 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# AdCountView
an simple CountView for advertisement

![](http://ww4.sinaimg.cn/large/a2f7c645jw1fcti0d34kog204t048myd.gif)

![](http://ww1.sinaimg.cn/large/a2f7c645jw1fcti0iluarg204t048q3y.gif)

![](http://ww1.sinaimg.cn/large/a2f7c645jw1fcti0oal4mg20a60a5td7.gif)

## step 1

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
30 changes: 30 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.flyou.adcountview"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
testCompile 'junit:junit:4.12'
compile project(path: ':library')
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# 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 *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.flyou.adcountview;

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.*;

/**
* Instrumentation 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.flyou.adcountview", appContext.getPackageName());
}
}
20 changes: 20 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.flyou.adcountview">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
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>
85 changes: 85 additions & 0 deletions app/src/main/java/com/flyou/adcountview/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.flyou.adcountview;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

import com.flyou.countview.AdCountView;

public class MainActivity extends AppCompatActivity implements AdCountView.OnStatusChangeListener, View.OnClickListener {


private AdCountView adCountView1;

private AdCountView adcountview2;
private AdCountView adcountview3;



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


adcountview3 = (AdCountView) findViewById(R.id.ad_count_view3);
adcountview2 = (AdCountView) findViewById(R.id.ad_count_view2);
adCountView1 = (AdCountView) findViewById(R.id.ad_count_view1);
init1();
init2();
init3();
init4();
init5();
}

private void init5() {

}

private void init4() {

}

private void init3() {

adcountview3.setbackgroundColor(getResources().getColor(R.color.base_black_30));
adcountview3.setOnClickListener(this);
adcountview3.setOnStatusChangeListener(this);
adcountview3.setOutRingColor(getResources().getColor(R.color.lightseagreen));
adcountview3.setTextClor(getResources().getColor(R.color.base_white_100));
adcountview3.setText("跳过广告");
adcountview3.setTextSize(15);

adcountview3.start();
}

private void init2() {
adcountview2.setbackgroundColor(getResources().getColor(R.color.base_white_80));
adcountview2.setOutRingColor(getResources().getColor(R.color.colorAccent));
adcountview2.setTextClor(getResources().getColor(R.color.base_black_100));
adcountview2.setText("进入应用");
adcountview2.start();
}

private void init1() {

adCountView1.start();
}


@Override
public void onCountViewStart() {
Toast.makeText(this, "动画开始", Toast.LENGTH_SHORT).show();
}

@Override
public void onCountViewStop() {
Toast.makeText(this, "动画结束", Toast.LENGTH_SHORT).show();
}

@Override
public void onClick(View v) {
Toast.makeText(this, "被点击", Toast.LENGTH_SHORT).show();
}
}
34 changes: 34 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/base_black_10"
android:gravity="center"
tools:context="com.flyou.adcountview.MainActivity"
>

<com.flyou.countview.AdCountView

android:id="@+id/ad_count_view1"
android:layout_width="80dp"
android:layout_height="80dp"

/>
<com.flyou.countview.AdCountView
android:layout_marginTop="10dp"
android:id="@+id/ad_count_view2"
android:layout_width="80dp"
android:layout_height="80dp"
/>
<com.flyou.countview.AdCountView
android:layout_marginTop="50dp"
android:id="@+id/ad_count_view3"
android:layout_width="150dp"
android:layout_height="150dp"
/>

</LinearLayout>
Binary file added app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/src/main/res/values-w820dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
58 changes: 58 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="transparent">#00000000</color>

<color name="base_black_100">#000000</color>
<color name="base_black_85">#585858</color>

<color name="base_black_95">#F3000000</color>
<color name="base_black_65">#A6000000</color>
<color name="base_black_50">#80000000</color>
<color name="base_black_30">#4D000000</color>
<color name="base_black_10">#1A000000</color>
<color name="base_white_100">#FFFFFFFF</color>
<color name="base_white_95">#F3FFFFFF</color>
<color name="base_white_80">#CCFFFFFF</color>
<color name="base_white_65">#A6FFFFFF</color>
<color name="base_white_50">#80FFFFFF</color>
<color name="base_white_30">#4DFFFFFF</color>
<color name="base_gray_ed">#ededed</color>
<color name="base_gray_ee">#eeeeee</color>
<color name="base_gray_f7">#f7f7f7</color>
<color name="base_gray_f4">#f4f4f4</color>
<color name="cor_d8d8d8">#d8d8d8</color>

<color name="mediumaquamarine">#66CDAA</color> <!--中绿色 -->
<color name="cornflowerblue">#6495ED</color> <!--菊兰色 -->
<color name="cadetblue">#5F9EA0</color> <!--军兰色 -->
<color name="darkolivegreen">#556B2F</color> <!--暗橄榄绿-->
<color name="indigo">#4B0082</color> <!--靛青色 -->
<color name="mediumturquoise">#48D1CC</color> <!--中绿宝石 -->
<color name="darkslateblue">#483D8B</color> <!--暗灰蓝色 -->
<color name="steelblue">#4682B4</color> <!--钢兰色 -->
<color name="royalblue">#4169E1</color> <!--皇家蓝 -->
<color name="turquoise">#40E0D0</color> <!--青绿色 -->
<color name="mediumseagreen">#3CB371</color> <!--中海蓝 -->
<color name="limegreen">#32CD32</color> <!--橙绿色 -->
<color name="darkslategray">#2F4F4F</color> <!--暗瓦灰色 -->
<color name="darkslategrey">#2F4F4F</color> <!--暗瓦灰色 -->
<color name="seagreen">#2E8B57</color> <!--海绿色 -->
<color name="forestgreen">#228B22</color> <!--森林绿 -->
<color name="lightseagreen">#20B2AA</color> <!--亮海蓝色 -->
<color name="dodgerblue">#1E90FF</color> <!--闪兰色 -->
<color name="midnightblue">#191970</color> <!--中灰兰色 -->
<color name="aqua">#00FFFF</color> <!--浅绿色 -->
<color name="cyan">#00FFFF</color> <!--青色 -->
<color name="springgreen">#00FF7F</color> <!--春绿色 -->
<color name="lime">#00FF00</color> <!--酸橙色 -->
<color name="mediumspringgreen">#00FA9A</color> <!--中春绿色 -->
<color name="darkturquoise">#00CED1</color> <!--暗宝石绿 -->
<color name="deepskyblue">#00BFFF</color> <!--深天蓝色 -->
<color name="darkcyan">#008B8B</color> <!--暗青色 -->
<color name="teal">#008080</color> <!--水鸭色 -->
<color name="green">#008000</color> <!--绿色 -->
<color name="darkgreen">#006400</color> <!--暗绿色 -->
</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">AdCountView</string>
</resources>
11 changes: 11 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>
17 changes: 17 additions & 0 deletions app/src/test/java/com/flyou/adcountview/ExampleUnitTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.flyou.adcountview;

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);
}
}
23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
17 changes: 17 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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.
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
Loading

0 comments on commit acfe600

Please sign in to comment.