Skip to content
Open
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
ead600b
Modify link
Trinea Feb 5, 2015
9afa24a
Update README.md
Trinea Feb 5, 2015
6d262da
add side-menu folder
cpacm Feb 6, 2015
a2e5e0d
add .gitignore
cpacm Feb 6, 2015
5dc2084
add nineoldanimations-demo by mr.simple
Feb 7, 2015
5d7c5a1
Merge branch 'master' of github.com:aosp-exchange-group/android-open-…
Feb 7, 2015
0746d52
Update README.md
hehonghui Feb 7, 2015
478cae4
rogary
Rogary Feb 10, 2015
3b47d56
READEME.md
Rogary Feb 11, 2015
a50477f
fix README.md
Rogary Feb 11, 2015
6986bcc
delete error README.md
Rogary Feb 11, 2015
3d1a04b
Merge pull request #1 from Rogary/master
Trinea Feb 11, 2015
26eca9f
add QuickAdapterDemo
Feb 12, 2015
ea29714
androidactive-demo
ouyangxiangshao Feb 13, 2015
f32412a
add apk file
Feb 13, 2015
c6a18c4
Merge branch 'master' of https://github.com/aosp-exchange-group/andro…
Feb 13, 2015
9e0cde9
dl-apk-load complete
FFish Feb 14, 2015
be5db32
add .gitignore
FFish Feb 14, 2015
3cf8c7f
pullToZoomInListviewDemo
Yom9c Feb 16, 2015
d15d17a
Create discrete-seek-bar-demo
wangeason Feb 27, 2015
b580e72
Delete discrete-seek-bar-demo
wangeason Feb 27, 2015
536005f
Create README.md
wangeason Feb 27, 2015
111b5bd
Update README.md
wangeason Feb 27, 2015
362dc0e
Demo
Mar 6, 2015
1cda786
pager-sliding-tab-strip-demo-ayyb1988
Mar 8, 2015
b32fb16
apk
Mar 8, 2015
23a9a4b
.gitignore
Mar 9, 2015
bdac540
pager-sliding-tab-strip-demo-ayyb1988
Mar 9, 2015
dce3c33
Create README.md
ayyb1988 Mar 9, 2015
0291b30
Update README.md
ayyb1988 Mar 9, 2015
836683d
Update README.md
ayyb1988 Mar 9, 2015
0f94032
Update README.md
ayyb1988 Mar 9, 2015
4ef0ca2
Merge pull request #2 from ayyb1988/master
ayyb1988 Mar 9, 2015
37aa832
update
cpacm Mar 9, 2015
1864a5b
add readme
cpacm Mar 9, 2015
c851af0
update readme
cpacm Mar 9, 2015
8a33825
update readme
cpacm Mar 9, 2015
0e272d1
submit sliding-menu-demo
huxian99 Mar 12, 2015
b52e9eb
upload demo gif
huxian99 Mar 23, 2015
3e012fc
complete demo
huxian99 Mar 23, 2015
fa0047a
Demo upload
wangeason Mar 26, 2015
245b2d0
update fresco demo
blackiedm Apr 1, 2015
171d21e
modify comments
wangeason Apr 10, 2015
30c2d7e
Initialize CircularReveal Sample commit!
Apr 15, 2015
e1bf917
Add source commit!
Apr 15, 2015
fe7b7c7
Update README.md commit!
Apr 15, 2015
caad22f
Update README.md commit!
Apr 15, 2015
d3ecfd9
update base-adapter-helper-demo
Apr 17, 2015
d13c786
add retrofit demo
guoGavin Jul 16, 2015
b6e9cd4
change retrofit source
guoGavin Jul 16, 2015
7d73690
add flyrefresh demo
AdrianLCA Jul 24, 2015
de4c942
Merge pull request #4 from skyacer/master
AdrianLCA Jul 24, 2015
e92d7c4
add flyrefresh apk
AdrianLCA Jul 31, 2015
9d5de02
change flyrefresh demo
AdrianLCA Aug 1, 2015
311b417
update fly-refresh demo
AdrianLCA Aug 1, 2015
ac3bb20
update flyrefresh
AdrianLCA Aug 1, 2015
9a6c265
Create volley-demo-Kevin1466
Kevin1466 Aug 27, 2015
f5d8784
能否提交
Aug 27, 2015
2e7a1a5
合肥市的
Aug 27, 2015
c304a3d
改变
Aug 27, 2015
9004e51
file
Aug 27, 2015
6c5fa2e
demo ok
Aug 27, 2015
af8083f
cleaned
Aug 27, 2015
cb0bed2
add folder for android-async-http-demo
yuanhuihui Aug 29, 2015
a2052eb
Merge pull request #5 from yuanhuihui/master
yuanhuihui Aug 29, 2015
219e90f
swipebacklayout demo
Neocomb Oct 1, 2015
f67a589
Create rxjava-demo project; Add create observable demo and unsubscrib…
Oct 10, 2015
d90e68d
add retrofit-demo-xxxzhi
jjjtui Oct 25, 2015
bde16c5
Update README.md
Trinea Oct 27, 2015
84d8de6
Create touchimageview-demo
truistic Oct 27, 2015
329d3f5
Create README.md
truistic Oct 27, 2015
d21400a
Update README.md
truistic Oct 27, 2015
ba22102
update listviewanimations lib
Nov 5, 2015
ba246b8
Update:
Nov 5, 2015
8764a8e
Update README.md
yansha87 Nov 5, 2015
f57ac47
add drag-and-drop feature
Nov 5, 2015
99e1a39
Merge branch 'master' of https://github.com/aosp-exchange-group/andro…
Nov 5, 2015
0d02bc9
Fix some crash bugs
Nov 6, 2015
afecb5e
remove unused file
Nov 11, 2015
911eb73
add android-open-project-demo
Labmem003 Jun 29, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
94 changes: 47 additions & 47 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
# built application files
# *.apk
*.ap_
lint.xml

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# maven
target/

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

# Windows thumbnail db
Thumbs.db

# OSX files
.DS_Store

# Eclipse project files
.classpath
.project
.settings

# Android Studio
.idea
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
build/
.gradle

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Other
.svn

# built application files
# *.apk
*.ap_
lint.xml

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# maven
target/

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

# Windows thumbnail db
Thumbs.db

# OSX files
.DS_Store

# Eclipse project files
.classpath
.project
.settings

# Android Studio
.idea
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
build/
.gradle

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Other
.svn

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -5,11 +5,12 @@ Android 开源项目 Demo

### 添加规范
各项目需要新建一个属于自己的文件夹,用于后续上传该开源库使用示例工程代码
- 该文件夹以`开源库名-demo`命名,全小写,单词间用`-`连接。如果已有该文件夹,则以`开源库名-demo-${GitHub 用户名}`命名,如`event-bus-demo-trinea`
- 该文件夹以`开源库名-demo`命名,全小写,单词间用`-`连接。
如果已有该文件夹,则以`开源库名-demo-${GitHub 用户名}`命名,如`event-bus-demo-trinea`
- 示例工程要求覆盖到该开源项目所有功能,不允许拷贝官方 Demo;
- 若没有自己的 Code Format 文件,使用 [common](https://github.com/android-cn/android-open-project-demo/tree/master/common) 文件夹下 code format,code template 文件;
- Android Studio 用默认的格式化文件,Eclipse 用 [common](common) 文件夹下 code format,code template 文件;
- 文件夹下需要有名为 apk 的子文件夹,用于存放可运行 APK 文件;
- 文件夹下需要有名为 README.md 的介绍文件,其中包含以下内容。
(1). Demo Download
(2). Screenshot 截图可使用 [licecap](http://www.cockos.com/licecap/)
具体可参考:[EventBus Demo ReadMe](https://github.com/android-cn/android-open-project-demo/tree/master/event-bus-demo)
具体可参考:[EventBus Demo ReadMe](event-bus-demo)
6 changes: 6 additions & 0 deletions active-android-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
21 changes: 21 additions & 0 deletions active-android-demo/active-android-demo.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

1 change: 1 addition & 0 deletions active-android-demo/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
93 changes: 93 additions & 0 deletions active-android-demo/app/app.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
<orderEntry type="library" exported="" name="activeandroid-3.1.0-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="library" exported="" />
</component>
</module>

33 changes: 33 additions & 0 deletions active-android-demo/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apply plugin: 'com.android.application'
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}


android {
compileSdkVersion 21
buildToolsVersion "21.1.1"

defaultConfig {
applicationId "ouyang.activeandroid"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.+'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'com.google.code.gson:gson:2.3.1'
compile project(':library')
}
17 changes: 17 additions & 0 deletions active-android-demo/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:\android-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,13 @@
package ouyang.activeandroid;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
40 changes: 40 additions & 0 deletions active-android-demo/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ouyang.activeandroid">

<application
android:name="com.activeandroid.app.Application"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<provider android:authorities="ouyang.activeandroid" android:exported="false" android:name="com.activeandroid.content.ContentProvider" />

<meta-data
android:name="AA_DB_NAME"
android:value="activedeme.db" />
<meta-data
android:name="AA_DB_VERSION"
android:value="5" />

<meta-data
android:name="AA_MODELS"
android:value="ouyang.model.Clazz, ouyang.model.Student" />

<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".FoodCategoryActivity" android:label="套餐分类" />
<activity android:name=".FoodActivity" />
<activity android:name=".UpdateFoodActivity" />
<activity android:name=".FoodCategoryCpActivity" />
<activity android:name=".FoodCpActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package ouyang.activeandroid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;

import com.activeandroid.query.Select;
import com.tjerkw.slideexpandable.library.ActionSlideExpandableListView;

import java.util.List;

import ouyang.adapter.FoodAdapter;
import ouyang.model.Food;

/**
* Created by zuxiang on 2015/2/8.
*/
public class FoodActivity extends Activity {
ActionSlideExpandableListView mListView;
List<Food> mFoods;
FoodAdapter mAdapter;

private long mId;
public static final int FOOD_RESULT = 0 << 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_food);
getActionBar().setDisplayHomeAsUpEnabled(true);

mListView = (ActionSlideExpandableListView) findViewById(R.id.listview);
mId = getIntent().getLongExtra("id", 0L);
mFoods = new Select().from(Food.class).where("cid=?", mId).execute();
mAdapter = new FoodAdapter(this, mFoods, mId);
mListView.setAdapter(mAdapter);
mListView.setItemActionListener(new ActionSlideExpandableListView.OnActionClickListener() {
@Override
public void onClick(View listView, View buttonview, int position) {
Food food = (Food) mAdapter.getItem(position);
if (buttonview.getId() == R.id.btn_update) {
Intent intent = new Intent(FoodActivity.this, UpdateFoodActivity.class);
intent.putExtra("food", food);
startActivityForResult(intent, FOOD_RESULT);
}

if (buttonview.getId() == R.id.btn_delete) {
mAdapter.delete(food.pk_id);
}
}
}, R.id.btn_update, R.id.btn_delete);
}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == FOOD_RESULT) {
mFoods = new Select().from(Food.class).where("cid=?", mId).execute();
mAdapter.replaceAll(mFoods);
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}





Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package ouyang.activeandroid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.activeandroid.ActiveAndroid;
import com.activeandroid.query.Select;

import java.util.ArrayList;
import java.util.List;

import ouyang.adapter.FoodCategoryAdapter;
import ouyang.model.Category;
import ouyang.model.Food;

/**
* Created by zuxiang on 2015/2/8.
*/
public class FoodCategoryActivity extends Activity {
ListView mListView;
FoodCategoryAdapter mAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activeandroid);
getActionBar().setDisplayHomeAsUpEnabled(true);

mListView = (ListView) findViewById(R.id.listview);
List<Category> foodCatogroys = new Select().from(Category.class).execute();
mAdapter = new FoodCategoryAdapter(this, foodCatogroys);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(FoodCategoryActivity.this, FoodActivity.class);
intent.putExtra("id", id);
startActivity(intent);
}
});


}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}






}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package ouyang.activeandroid;

import android.app.Activity;
import android.app.LoaderManager;
import android.content.CursorLoader;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

import com.activeandroid.content.ContentProvider;

import java.util.ArrayList;
import java.util.List;

import ouyang.adapter.FoodAdapter;
import ouyang.adapter.FoodCategoryAdapter;
import ouyang.adapter.FoodCategoryCursorAdapter;
import ouyang.model.Category;

/**
* Created by zuxiang on 2015/2/11.
*/
public class FoodCategoryCpActivity extends Activity implements LoaderManager.LoaderCallbacks<Cursor>{
ListView mListView;
private FoodCategoryCursorAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activeandroid);
getActionBar().setDisplayHomeAsUpEnabled(true);


mListView = (ListView)findViewById(R.id.listview);
mAdapter = new FoodCategoryCursorAdapter(this);
mListView.setAdapter(mAdapter);


getLoaderManager().initLoader(0, null,this);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(FoodCategoryCpActivity.this, FoodCpActivity.class);
intent.putExtra("id", parent.getAdapter().getItemId(position));
startActivity(intent);
}
});
}

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new CursorLoader(this,
ContentProvider.createUri(Category.class, null),
null, null, null, null
);
}

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
mAdapter.swapCursor(data);
}

@Override
public void onLoaderReset(Loader<Cursor> loader) {
mAdapter.swapCursor(null);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package ouyang.activeandroid;

import android.app.Activity;
import android.app.LoaderManager;
import android.content.CursorLoader;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;

import com.activeandroid.content.ContentProvider;
import com.activeandroid.query.Delete;
import com.tjerkw.slideexpandable.library.ActionSlideExpandableListView;

import java.util.List;

import ouyang.adapter.FoodAdapter;
import ouyang.adapter.FoodCategoryCursorAdapter;
import ouyang.adapter.FoodCursorAdapter;
import ouyang.model.Category;
import ouyang.model.Food;

/**
* Created by zuxiang on 2015/2/12.
*/
public class FoodCpActivity extends Activity implements LoaderManager.LoaderCallbacks<Cursor> {
ListView mListView;
List<Food> mFoods;
FoodCursorAdapter mAdapter;

private long mId;
public static final int FOODCP_RESULT = 0 << 1;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activeandroid);
getActionBar().setDisplayHomeAsUpEnabled(true);


mListView = (ListView) findViewById(R.id.listview);
mId = getIntent().getLongExtra("id", 0L);
mAdapter = new FoodCursorAdapter(this);
mListView.setAdapter(mAdapter);
getLoaderManager().initLoader(0, null, this);
}

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new CursorLoader(this,
ContentProvider.createUri(Food.class, null),
null, "cid=?", new String[]{String.valueOf(mId)}, null
);
}

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
mAdapter.swapCursor(data);
}

@Override
public void onLoaderReset(Loader<Cursor> loader) {
mAdapter.swapCursor(null);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package ouyang.activeandroid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

import com.activeandroid.ActiveAndroid;
import com.activeandroid.query.Delete;

import java.util.List;

import ouyang.model.Category;
import ouyang.model.CategoryResult;
import ouyang.model.Food;
import ouyang.model.FoodResult;


public class MainActivity extends Activity{
Button mBtnActive;
Button mBtnActiveContentProvider;

private static final int ACTIVE = 1<<0;
private static final int CONTENTPROVIDER = 1<<1;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(msg.what==ACTIVE) {
startActivity(new Intent(MainActivity.this, FoodCategoryActivity.class));
}
if(msg.what==CONTENTPROVIDER){
startActivity(new Intent(MainActivity.this, FoodCategoryCpActivity.class));
}
}
};

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


mBtnActive = (Button) findViewById(R.id.btn_activesimple);
mBtnActive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
initData();
mHandler.sendEmptyMessage(ACTIVE);
}
}).start();
}
});

mBtnActiveContentProvider= (Button)findViewById(R.id.btn_activecontentprovdier);
mBtnActiveContentProvider.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
initData();
mHandler.sendEmptyMessage(CONTENTPROVIDER);
}
}).start();
}
});

}

private void initData(){
try {
new Delete().from(Category.class).execute();
new Delete().from(Food.class).execute();
ActiveAndroid.beginTransaction();
List<Category> categoryList = CategoryResult.getCategorys(CategoryResult.CATEGORY_JSON);
for (Category category : categoryList) {
category.save();
}
List<Food> foodList1 = FoodResult.getFoods(FoodResult.F1_JSON);
for (Food food : foodList1) {
food.save();
}

List<Food> foodList2 = FoodResult.getFoods(FoodResult.F2_JSON);
for (Food food : foodList2) {
food.save();
}
List<Food> foodList3 = FoodResult.getFoods(FoodResult.F3_JSON);
for (Food food : foodList3) {
food.save();
}
ActiveAndroid.setTransactionSuccessful();
} finally {
ActiveAndroid.endTransaction();
}
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package ouyang.activeandroid;

import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.activeandroid.query.Update;

import ouyang.model.Food;

/**
* Created by zuxiang on 2015/2/11.
*/
public class UpdateFoodActivity extends Activity {
EditText mEtName;
EditText mEtPrice;
Button mBtnUpdate;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_updatefood);
getActionBar().setDisplayHomeAsUpEnabled(true);
mEtName = (EditText) findViewById(R.id.et_name);
mEtPrice = (EditText) findViewById(R.id.et_price);
mBtnUpdate = (Button) findViewById(R.id.btn_update);

final Food food = (Food) getIntent().getSerializableExtra("food");
mEtName.setText(food.name);
mEtPrice.setText(String.valueOf(food.price));
mBtnUpdate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name = mEtName.getText().toString();
String price = mEtPrice.getText().toString();
if (name.equals("") || price.equals("")) {
return;
}
new Update(Food.class).set("Name=?,Price=?", name, price).where("pk_id=?",food.pk_id).execute();
setResult(FoodActivity.FOOD_RESULT);
finish();
}
});

}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package ouyang.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.activeandroid.query.Delete;
import com.activeandroid.query.Select;

import java.util.List;

import ouyang.activeandroid.R;
import ouyang.model.Food;

/**
* Created by zuxiang on 2015/2/8.
*/
public class FoodAdapter extends SimpleBaseAdapter<Food> {
private long cid;

public FoodAdapter(Context context, List<Food> data, long cid) {
super(context, data);
this.cid = cid;
}

@Override
public int getItemResource() {
return R.layout.item_food;
}

@Override
public View getItemView(int position, View convertView, ViewHolder holder) {
Food food = data.get(position);
TextView tvName = holder.getView(R.id.tv_name);
TextView tvPrice = holder.getView(R.id.tv_price);
tvName.setText(food.name);
tvPrice.setText("¥" + food.price);
return convertView;
}

public void delete(int id) {
new Delete().from(Food.class).where("pk_id = ? ", id).execute();
data = new Select().from(Food.class).where("cid=?", cid).execute();
notifyDataSetChanged();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package ouyang.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import java.util.List;

import ouyang.activeandroid.R;
import ouyang.model.Category;

/**
* Created by zuxiang on 2015/2/8.
*/
public class FoodCategoryAdapter extends SimpleBaseAdapter<Category> {

public FoodCategoryAdapter(Context context, List<Category> data) {
super(context, data);
}

@Override
public int getItemResource() {
return R.layout.item_category;
}

@Override
public long getItemId(int position) {
return data.get(position).id;
}

@Override
public View getItemView(int position, View convertView, ViewHolder holder) {
TextView tvName= holder.getView(R.id.tv_name);
tvName.setText(data.get(position).name);
return convertView;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package ouyang.adapter;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

import ouyang.activeandroid.R;
import ouyang.model.Category;

/**
* Created by zuxiang on 2015/2/11.
*/
public class FoodCategoryCursorAdapter extends CursorAdapter {
private Cursor mCursor;

public FoodCategoryCursorAdapter(Context context) {
super(context, null, false);
}


@Override
public Object getItem(int position) {
mCursor.moveToPosition(position);
return Category.getCategory(mCursor);
}

@Override
public long getItemId(int position) {
mCursor.moveToPosition(position);
return Category.getCategory(mCursor).id;
}

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
mCursor = cursor;
LayoutInflater layoutInflater = LayoutInflater.from(context);
return layoutInflater.inflate(R.layout.item_category,null);
}

@Override
public void bindView(View view, Context context, Cursor cursor) {
Category category = Category.getCategory(cursor);
TextView tvName = (TextView)view.findViewById(R.id.tv_name);
tvName.setText(category.name);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package ouyang.adapter;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

import ouyang.activeandroid.R;
import ouyang.model.Category;
import ouyang.model.Food;

/**
* Created by zuxiang on 2015/2/12.
*/
public class FoodCursorAdapter extends CursorAdapter {
private Cursor mCursor;

public FoodCursorAdapter(Context context) {
super(context, null, false);
}

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
mCursor = cursor;
LayoutInflater layoutInflater = LayoutInflater.from(context);
return layoutInflater.inflate(R.layout.item_cpfood, null);
}

@Override
public Object getItem(int position) {
mCursor.moveToPosition(position);
return Food.getFood(mCursor);
}

@Override
public void bindView(View view, Context context, Cursor cursor) {
Food food = Food.getFood(cursor);
TextView tvName = (TextView) view.findViewById(R.id.tv_name);
TextView tvPrice = (TextView) view.findViewById(R.id.tv_price);
tvName.setText(food.name);
tvPrice.setText("¥" + food.price);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package ouyang.adapter;

import android.content.Context;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

/**
* Created by zuxiang on 2015/2/8.
*/
public abstract class SimpleBaseAdapter<T> extends BaseAdapter {

protected Context context;
protected List<T> data;

public SimpleBaseAdapter(Context context, List<T> data) {
this.context = context;
this.data = data == null ? new ArrayList<T>() : new ArrayList<T>(data);
}

@Override
public int getCount() {
return data.size();
}

@Override
public Object getItem(int position) {
if (position >= data.size())
return null;
return data.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

/**
* 该方法需要子类实现,需要返回item布局的resource id
*
* @return
*/
public abstract int getItemResource();

/**
* 使用该getItemView方法替换原来的getView方法,需要子类实现
*
* @param position
* @param convertView
* @param parent
* @param holder
* @return
*/
public abstract View getItemView(int position, View convertView, ViewHolder holder);

@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (null == convertView) {
convertView = View.inflate(context, getItemResource(), null);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
return getItemView(position, convertView, holder);
}

public class ViewHolder {
private SparseArray<View> views = new SparseArray<View>();
private View convertView;

public ViewHolder(View convertView) {
this.convertView = convertView;
}

@SuppressWarnings("unchecked")
public <T extends View> T getView(int resId) {
View v = views.get(resId);
if (null == v) {
v = convertView.findViewById(resId);
views.put(resId, v);
}
return (T) v;
}
}

public void addAll(List<T> elem) {
data.addAll(elem);
notifyDataSetChanged();
}

public void remove(T elem) {
data.remove(elem);
notifyDataSetChanged();
}

public void remove(int index) {
data.remove(index);
notifyDataSetChanged();
}

public void replaceAll(List<T> elem) {
data.clear();
data.addAll(elem);
notifyDataSetChanged();
}
}
36 changes: 36 additions & 0 deletions active-android-demo/app/src/main/java/ouyang/model/Category.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package ouyang.model;

import android.database.Cursor;
import android.provider.BaseColumns;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;

/**
* Created by zuxiang on 2015/2/8.
*/
@Table(name = "categorys")
public class Category extends Model {
@Column(name = "Name")
public String name;
@Column(name="cid")
public int id;

@Column(name=BaseColumns._ID)
public int ID;
public Category(String name) {
this.name = name;
}

public Category(){

}

public static Category getCategory(Cursor cursor){
Category category = new Category();
category.name = cursor.getString(cursor.getColumnIndex("Name"));
category.id = cursor.getInt(cursor.getColumnIndex("cid"));
return category;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ouyang.model;

import com.google.gson.Gson;

import java.util.List;

/**
* Created by zuxiang on 2015/2/9.
*/
public class CategoryResult {
public static final String CATEGORY_JSON = "{\"rows\": [ {\"id\":1, \"name\": \"IT一族\"},{\"id\":2,\"name\": \"高富帅\" },{ \"id\":3,\"name\": \"白富美\" }]}";
public List<Category> rows;

public static List<Category> getCategorys(String json) {
Gson gson = new Gson();
CategoryResult categoryResult = gson.fromJson(json, CategoryResult.class);
return categoryResult.rows;
}
}
46 changes: 46 additions & 0 deletions active-android-demo/app/src/main/java/ouyang/model/Food.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package ouyang.model;

import android.database.Cursor;
import android.provider.BaseColumns;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;

import java.io.Serializable;

/**
* Created by zuxiang on 2015/2/8.
*/
@Table(name = "foods")
public class Food extends Model implements Serializable {
@Column(name = "Name")
public String name;
@Column(name = "Price")
public float price;
@Column(name = BaseColumns._ID)
public int ID;
@Column(name = "pk_id")
public int pk_id;

@Column(name = "cid")
public int cid;

public Food(String foodName, float price) {
this.name = foodName;
this.price = price;
}

public Food() {

}

public static Food getFood(Cursor cursor) {
Food food = new Food();
food.cid = cursor.getInt(cursor.getColumnIndex("cid"));
food.name = cursor.getString(cursor.getColumnIndex("Name"));
food.price = cursor.getFloat(cursor.getColumnIndex("Price"));
food.pk_id = cursor.getInt(cursor.getColumnIndex("pk_id"));
return food;
}
}
21 changes: 21 additions & 0 deletions active-android-demo/app/src/main/java/ouyang/model/FoodResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ouyang.model;

import com.google.gson.Gson;

import java.util.List;

/**
* Created by zuxiang on 2015/2/9.
*/
public class FoodResult {
public static final String F1_JSON = "{\"rows\": [{\"pk_id\":1, \"cid\": 1,\"name\": \"海西青虾\",\"price\": 150.12},{\"pk_id\":2, \"cid\": 1,\"name\": \"海鲜套餐\",\"price\": 102.12}, {\"pk_id\":3,\"cid\": 1,\"name\": \"叉烧鸭肉套餐\",\"price\": 110.12},{\"pk_id\":4,\"cid\": 1,\"name\": \"鲜虾一盘\",\"price\": 10.12},{\"pk_id\":5,\"cid\": 1,\"name\": \"白切鸡套餐\",\"price\": 10.12},{\"pk_id\":6,\"cid\": 1,\"name\": \"红烧酱鸭\", \"price\": 160.12}, {\"pk_id\":7,\"cid\": 1,\"name\": \"叉烧鸭肉套餐\", \"price\": 110.12},{\"pk_id\":8,\"cid\": 1,\"name\": \"珍珠贝套餐\",\"price\": 107.12}]}";
public static final String F2_JSON ="{\"rows\": [{\"cid\":2,\t\"pk_id\":11,\"name\": \"青椒肉丝\", \"price\": 150.12},{\"cid\":2,\"pk_id\":12,\"name\": \"荔枝肉\",\"price\": 102.12}, {\"cid\":2,\"pk_id\":13,\"name\": \"排骨套餐\",\"price\": 110.12},{\"cid\":2,\t\"pk_id\":14, \"name\": \"鸡排套餐\", \"price\": 10.12}, {\"cid\":2,\"pk_id\":15, \"name\": \"鸭腿套餐\",\"price\": 10.12 }, {\"cid\":2,\"pk_id\":16,\"name\": \"鸡翅套餐\",\"price\": 160.12} ]}";
public static final String F3_JSON = "{\"rows\": [{\"cid\": 3,\"pk_id\":20,\"name\": \"兔肉套餐\", \"price\": 130.12},{\"cid\": 3,\"pk_id\":21,\"name\": \"带鱼套餐\", \"price\": 150.12 }, {\"cid\": 3,\"pk_id\":22,\"name\": \"筒骨套餐\",\"price\": 102.12 }, { \"cid\": 3,\"pk_id\":23,\"name\": \"叉烧鸡套餐\",\"price\": 110.12},{ \"name\": \"白切鸡套餐\",\"price\": 10.12}]}";
private List<Food> rows;

public static List<Food> getFoods(String json) {
Gson gson = new Gson();
FoodResult foodResult = gson.fromJson(json, FoodResult.class);
return foodResult.rows;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listview"
android:layout_height="match_parent"
android:layout_width="match_parent"/>

</RelativeLayout>
9 changes: 9 additions & 0 deletions active-android-demo/app/src/main/res/layout/activity_food.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.tjerkw.slideexpandable.library.ActionSlideExpandableListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
23 changes: 23 additions & 0 deletions active-android-demo/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<LinearLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity">

<Button
android:id="@+id/btn_activesimple"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/active_simple" />

<Button
android:id="@+id/btn_activecontentprovdier"
android:layout_width="wrap_content"
android:text="@string/active_contentprovider"
android:layout_height="wrap_content" />
</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_marginTop="20dp"
android:textSize="18sp"
android:layout_width="wrap_content"
android:text="菜名"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/et_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textSize="18sp"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="价格"
android:layout_height="wrap_content" />
<EditText
android:inputType="number"
android:id="@+id/et_price"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:layout_marginTop="20dp"
android:id="@+id/btn_update"
android:text="修改"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:slide="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/item">

<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/text"
android:text="Hello World" android:textSize="40dp"/>

<Button
android:id="@+id/expandable_toggle_button"
android:text="More"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/text"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/text" android:textSize="30dp"/>

</RelativeLayout>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/expandable"
android:background="#000000">

<Button
android:id="@+id/buttonA"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_weight="0.5"
android:text="Action A"
android:textSize="12dip"/>

<Button
android:id="@+id/buttonB"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:text="Action B"
android:textSize="12dip"/>

</LinearLayout>
</LinearLayout>
6 changes: 6 additions & 0 deletions active-android-demo/app/src/main/res/layout/item_category.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:padding="10dp"
android:id="@+id/tv_name"
android:layout_height="match_parent" />
23 changes: 23 additions & 0 deletions active-android-demo/app/src/main/res/layout/item_cpfood.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp" />

<TextView
android:id="@+id/tv_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp" />

</LinearLayout>
57 changes: 57 additions & 0 deletions active-android-demo/app/src/main/res/layout/item_food.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:slide="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp" />

<TextView
android:id="@+id/tv_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp" />

<Button
android:id="@+id/expandable_toggle_button"
android:text="More"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/text"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/text" android:textSize="15dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/expandable"
>
<Button
android:id="@+id/btn_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="0.5"
android:text="UPDATE"
android:textSize="12dip"/>

<Button
android:id="@+id/btn_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="DELETE"
android:textSize="12dip"/>
</LinearLayout>
</LinearLayout>
5 changes: 5 additions & 0 deletions active-android-demo/app/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" android:showAsAction="never" />
</menu>
5 changes: 5 additions & 0 deletions active-android-demo/app/src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light">
</style>
</resources>
6 changes: 6 additions & 0 deletions active-android-demo/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>
5 changes: 5 additions & 0 deletions active-android-demo/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>
10 changes: 10 additions & 0 deletions active-android-demo/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">active-android-demo</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="active_simple">ActiveAndroid 示例</string>
<string name="active_contentprovider">ActiveAndroid use ContentProvider</string>
<string name="active_usecontentprovide">使用 ActiveActivity ContentProvider</string>
</resources>
8 changes: 8 additions & 0 deletions active-android-demo/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

</resources>
20 changes: 20 additions & 0 deletions active-android-demo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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:1.0.0'

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

allprojects {
repositories {
jcenter()
}
}
18 changes: 18 additions & 0 deletions active-android-demo/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# 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
Binary file not shown.
6 changes: 6 additions & 0 deletions active-android-demo/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
164 changes: 164 additions & 0 deletions active-android-demo/gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#!/usr/bin/env bash

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# 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
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# 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\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-

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" ] ; 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"`

# 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

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
90 changes: 90 additions & 0 deletions active-android-demo/gradlew.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@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

@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=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@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 Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_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=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
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
1 change: 1 addition & 0 deletions active-android-demo/library/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
15 changes: 15 additions & 0 deletions active-android-demo/library/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

apply plugin: 'android-library'

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
}
89 changes: 89 additions & 0 deletions active-android-demo/library/library.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":library" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

12 changes: 12 additions & 0 deletions active-android-demo/library/project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-8
android.library=true
12 changes: 12 additions & 0 deletions active-android-demo/library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tjerkw.slideexpandable.library"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8" />

<application />

</manifest>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package com.tjerkw.slideexpandable.library;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;

/**
* A more specific expandable listview in which the expandable area
* consist of some buttons which are context actions for the item itself.
*
* It handles event binding for those buttons and allow for adding
* a listener that will be invoked if one of those buttons are pressed.
*
* @author tjerk
* @date 6/26/12 7:01 PM
*/
public class ActionSlideExpandableListView extends SlideExpandableListView {
private OnActionClickListener listener;
private int[] buttonIds = null;

public ActionSlideExpandableListView(Context context) {
super(context);
}

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

public ActionSlideExpandableListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}

public void setItemActionListener(OnActionClickListener listener, int ... buttonIds) {
this.listener = listener;
this.buttonIds = buttonIds;
}

/**
* Interface for callback to be invoked whenever an action is clicked in
* the expandle area of the list item.
*/
public interface OnActionClickListener {
/**
* Called when an action item is clicked.
*
* @param itemView the view of the list item
* @param clickedView the view clicked
* @param position the position in the listview
*/
public void onClick(View itemView, View clickedView, int position);
}

public void setAdapter(ListAdapter adapter) {
super.setAdapter(new WrapperListAdapterImpl(adapter) {

@Override
public View getView(final int position, View view, ViewGroup viewGroup) {
final View listView = wrapped.getView(position, view, viewGroup);
// add the action listeners
if(buttonIds != null && listView!=null) {
for(int id : buttonIds) {
View buttonView = listView.findViewById(id);
if(buttonView!=null) {
buttonView.findViewById(id).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(listener!=null) {
listener.onClick(listView, view, position);
}
}
});
}
}
}
return listView;
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package com.tjerkw.slideexpandable.library;

import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.widget.LinearLayout;

/**
* Animation that either expands or collapses a view by sliding it down to make it visible.
* Or by sliding it up so it will hide. It will look like it slides behind the view above.
*
* @auther tjerk
* @date 6/9/12 4:58 PM
*/
public class ExpandCollapseAnimation extends Animation {
private View mAnimatedView;
private int mEndHeight;
private int mType;
public final static int COLLAPSE = 1;
public final static int EXPAND = 0;
private LinearLayout.LayoutParams mLayoutParams;

/**
* Initializes expand collapse animation, has two types, collapse (1) and expand (0).
* @param view The view to animate
* @param type The type of animation: 0 will expand from gone and 0 size to visible and layout size defined in xml.
* 1 will collapse view and set to gone
*/
public ExpandCollapseAnimation(View view, int type) {

mAnimatedView = view;
mEndHeight = mAnimatedView.getMeasuredHeight();
mLayoutParams = ((LinearLayout.LayoutParams) view.getLayoutParams());
mType = type;
if(mType == EXPAND) {

mLayoutParams.bottomMargin = -mEndHeight;
} else {

mLayoutParams.bottomMargin = 0;
}
view.setVisibility(View.VISIBLE);
}

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {

super.applyTransformation(interpolatedTime, t);
if (interpolatedTime < 1.0f) {
if(mType == EXPAND) {
mLayoutParams.bottomMargin = -mEndHeight + (int) (mEndHeight * interpolatedTime);
} else {
mLayoutParams.bottomMargin = - (int) (mEndHeight * interpolatedTime);
}
Log.d("ExpandCollapseAnimation", "anim height " + mLayoutParams.bottomMargin);
mAnimatedView.requestLayout();
} else {
if(mType == EXPAND) {
mLayoutParams.bottomMargin = 0;
mAnimatedView.requestLayout();
} else {
mLayoutParams.bottomMargin = -mEndHeight;
mAnimatedView.setVisibility(View.GONE);
mAnimatedView.requestLayout();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.tjerkw.slideexpandable.library;

import android.view.View;
import android.widget.ListAdapter;

/**
* ListAdapter that adds sliding functionality to a list.
* Uses R.id.expandalbe_toggle_button and R.id.expandable id's if no
* ids are given in the contructor.
*
* @author tjerk
* @date 6/13/12 8:04 AM
*/
public class SlideExpandableListAdapter extends AbstractSlideExpandableListAdapter {
private int toggle_button_id;
private int expandable_view_id;

public SlideExpandableListAdapter(ListAdapter wrapped, int toggle_button_id, int expandable_view_id) {
super(wrapped);
this.toggle_button_id = toggle_button_id;
this.expandable_view_id = expandable_view_id;
}

public SlideExpandableListAdapter(ListAdapter wrapped) {
this(wrapped, R.id.expandable_toggle_button, R.id.expandable);
}

@Override
public View getExpandToggleButton(View parent) {
return parent.findViewById(toggle_button_id);
}

@Override
public View getExpandableView(View parent) {
return parent.findViewById(expandable_view_id);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.tjerkw.slideexpandable.library;

import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.content.Context;

/**
* Simple subclass of listview which does nothing more than wrap
* any ListAdapter in a SlideExpandalbeListAdapter
*/
class SlideExpandableListView extends ListView {
private SlideExpandableListAdapter adapter;

public SlideExpandableListView(Context context) {
super(context);
}

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

public SlideExpandableListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}

/**
* Collapses the currently open view.
*
* @return true if a view was collapsed, false if there was no open view.
*/
public boolean collapse() {
if(adapter!=null) {
return adapter.collapseLastOpen();
}
return false;
}

public void setAdapter(ListAdapter adapter) {
this.adapter = new SlideExpandableListAdapter(adapter);
super.setAdapter(this.adapter);
}

public void setAdapter(ListAdapter adapter, int toggle_button_id, int expandable_view_id) {
this.adapter = new SlideExpandableListAdapter(adapter, toggle_button_id, expandable_view_id);
super.setAdapter(this.adapter);
}

/**
* Registers a OnItemClickListener for this listview which will
* expand the item by default. Any other OnItemClickListener will be overriden.
*
* To undo call setOnItemClickListener(null)
*
* Important: This method call setOnItemClickListener, so the value will be reset
*/
public void enableExpandOnItemClick() {
this.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
SlideExpandableListAdapter adapter = (SlideExpandableListAdapter)getAdapter();
adapter.getExpandToggleButton(view).performClick();
}
});
}


@Override
public Parcelable onSaveInstanceState() {
return adapter.onSaveInstanceState(super.onSaveInstanceState());
}

@Override
public void onRestoreInstanceState(Parcelable state) {
if(!(state instanceof AbstractSlideExpandableListAdapter.SavedState)) {
super.onRestoreInstanceState(state);
return;
}

AbstractSlideExpandableListAdapter.SavedState ss = (AbstractSlideExpandableListAdapter.SavedState)state;
super.onRestoreInstanceState(ss.getSuperState());

adapter.onRestoreInstanceState(ss);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package com.tjerkw.slideexpandable.library;

import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.WrapperListAdapter;

/**
* Implementation of a WrapperListAdapter interface
* in which each method delegates to the wrapped adapter.
*
* Extend this class if you only want to change a
* few methods of the wrapped adapter.
*
* The wrapped adapter is available to subclasses as the "wrapped" field.
*
* @author tjerk
* @date 6/9/12 4:41 PM
*/
public abstract class WrapperListAdapterImpl extends BaseAdapter implements WrapperListAdapter {
protected ListAdapter wrapped;

public WrapperListAdapterImpl(ListAdapter wrapped) {
this.wrapped = wrapped;
}

@Override
public ListAdapter getWrappedAdapter() {
return wrapped;
}

@Override
public boolean areAllItemsEnabled() {
return wrapped.areAllItemsEnabled();
}

@Override
public boolean isEnabled(int i) {
return wrapped.isEnabled(i);
}

@Override
public void registerDataSetObserver(DataSetObserver dataSetObserver) {
wrapped.registerDataSetObserver(dataSetObserver);
}

@Override
public void unregisterDataSetObserver(DataSetObserver dataSetObserver) {
wrapped.unregisterDataSetObserver(dataSetObserver);
}

@Override
public int getCount() {
return wrapped.getCount();
}

@Override
public Object getItem(int i) {
return wrapped.getItem(i);
}

@Override
public long getItemId(int i) {
return wrapped.getItemId(i);
}

@Override
public boolean hasStableIds() {
return wrapped.hasStableIds();
}

@Override
public View getView(int position, View view, ViewGroup viewGroup) {
return wrapped.getView(position, view, viewGroup);
}

@Override
public int getItemViewType(int i) {
return wrapped.getItemViewType(i);
}

@Override
public int getViewTypeCount() {
return wrapped.getViewTypeCount();
}

@Override
public boolean isEmpty() {
return wrapped.isEmpty();
}
}
12 changes: 12 additions & 0 deletions active-android-demo/library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<!-- TODO: implement modes
<declare-styleable name="SlideExpandableListView">
<attr name="mode">
<flag name="single" value="0" />
<flag name="multiple" value="1" />
</attr>
</declare-styleable>
-->
</resources>
5 changes: 5 additions & 0 deletions active-android-demo/library/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="expandable_toggle_button" />
<item type="id" name="expandable" />
</resources>
1 change: 1 addition & 0 deletions active-android-demo/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':app', ':library'
7 changes: 7 additions & 0 deletions android-async-http-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Android-async-http Demo
================================
###1. Demo Download
暂无

###2. Screenshot
暂无
29 changes: 29 additions & 0 deletions base-adapter-helper-demo/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.zhy_baseadapterhelper"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />

<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.zhy_baseadapterhelper.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
11 changes: 11 additions & 0 deletions base-adapter-helper-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
base-adapter-helper Demo
====================
###1. Demo Download

[本地下载](apk/base-adapter-helper.apk?raw=true "点击下载到本地")

###2. Screenshot
![Screenshot](apk/base-adapter-helper.gif)

###3. Document
[How to Use ](https://github.com/JoanZapata/base-adapter-helper/blob/master/README.md)
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added base-adapter-helper-demo/libs/picasso-2.2.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -12,4 +12,3 @@

# Project target.
target=android-19
android.library.reference.1=../ListviewAnimationLib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions base-adapter-helper-demo/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<RelativeLayout 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" >

<ListView
android:id="@+id/id_lv_main"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

</RelativeLayout>
73 changes: 73 additions & 0 deletions base-adapter-helper-demo/res/layout/item_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp" >

<ImageView
android:id="@+id/id_icon"
android:layout_width="48dp"
android:layout_marginRight="5dp"
android:layout_height="48dp"
android:scaleType="centerCrop"
android:layout_centerVertical="true"
android:src="@drawable/ic_launcher" />

<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="红色钱包"
android:layout_toRightOf="@id/id_icon"
android:textColor="#444444"
android:textSize="16sp" >
</TextView>

<TextView
android:id="@+id/tv_describe"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_title"
android:layout_marginTop="10dp"
android:layout_toRightOf="@id/id_icon"
android:maxLines="2"
android:minLines="1"
android:text="周三早上丢失了红色钱包,在食堂二楼"
android:textColor="#898989"
android:textSize="16sp" >
</TextView>

<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_describe"
android:layout_marginTop="10dp"
android:layout_toRightOf="@id/id_icon"
android:text="20130240122"
android:textColor="#898989"
android:textSize="12sp" >
</TextView>

<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/tv_describe"
android:layout_marginTop="10dp"
android:background="#5cbe6c"
android:drawableLeft="@drawable/icon_photo"
android:drawablePadding="5dp"
android:paddingBottom="3dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="138024249542"
android:textColor="#ffffff"
android:textSize="12sp" >
</TextView>

</RelativeLayout>
9 changes: 9 additions & 0 deletions base-adapter-helper-demo/res/menu/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings"/>

</menu>
8 changes: 8 additions & 0 deletions base-adapter-helper-demo/res/values-sw600dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<resources>

<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw600dp devices (e.g. 7" tablets) here.
-->

</resources>
9 changes: 9 additions & 0 deletions base-adapter-helper-demo/res/values-sw720dp-land/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<resources>

<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-->
<dimen name="activity_horizontal_margin">128dp</dimen>

</resources>
7 changes: 7 additions & 0 deletions base-adapter-helper-demo/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<resources>

<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>

</resources>
8 changes: 8 additions & 0 deletions base-adapter-helper-demo/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">zhy_baseAdapterHelper</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>

</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.example.zhy_baseadapterhelper;

import java.util.ArrayList;
import java.util.List;

public class Bean
{
private String title;
private String url;
private String desc;
private String phone;
private String time;

public Bean()
{
}

public Bean(String url, String title, String desc, String phone, String time)
{
this.url = url;
this.title = title;
this.desc = desc;
this.phone = phone;
this.time = time;
}

public static List<Bean> beans = new ArrayList<Bean>();
static
{
Bean bean = null;
for (int i = 0; i < Images.imageThumbUrls.length; i++)
{
bean = new Bean(Images.imageThumbUrls[i], "标题 :" + i, "这是一个描述 : "
+ i, "10086" + i, "2014-12-12");
beans.add(bean);
}
}

public String getUrl()
{
return url;
}

public void setUrl(String url)
{
this.url = url;
}

public String getTitle()
{
return title;
}

public void setTitle(String title)
{
this.title = title;
}

public String getDesc()
{
return desc;
}

public void setDesc(String desc)
{
this.desc = desc;
}

public String getPhone()
{
return phone;
}

public void setPhone(String phone)
{
this.phone = phone;
}

public String getTime()
{
return time;
}

public void setTime(String time)
{
this.time = time;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.example.zhy_baseadapterhelper;

public class Images
{

public final static String[] imageThumbUrls = new String[] {
"http://img.my.csdn.net/uploads/201407/26/1406383299_1976.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383291_6518.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383291_8239.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383290_9329.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383290_1042.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383275_3977.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383265_8550.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383264_3954.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383264_4787.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383264_8243.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383248_3693.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383243_5120.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383242_3127.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383242_9576.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383242_1721.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383219_5806.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383214_7794.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383213_4418.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383213_3557.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383210_8779.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383172_4577.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383166_3407.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383166_2224.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383166_7301.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383165_7197.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383150_8410.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383131_3736.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383130_5094.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383130_7393.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383129_8813.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383100_3554.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383093_7894.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383092_2432.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383092_3071.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383091_3119.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383059_6589.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383059_8814.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383059_2237.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383058_4330.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406383038_3602.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382942_3079.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382942_8125.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382942_4881.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382941_4559.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382941_3845.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382924_8955.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382923_2141.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382923_8437.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382922_6166.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382922_4843.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382905_5804.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382904_3362.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382904_2312.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382904_4960.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382900_2418.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382881_4490.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382881_5935.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382880_3865.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382880_4662.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382879_2553.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382862_5375.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382862_1748.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382861_7618.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382861_8606.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382861_8949.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382841_9821.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382840_6603.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382840_2405.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382840_6354.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382839_5779.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382810_7578.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382810_2436.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382809_3883.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382809_6269.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382808_4179.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382790_8326.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382789_7174.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382789_5170.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382789_4118.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382788_9532.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382767_3184.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382767_4772.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382766_4924.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382766_5762.jpg",
"http://img.my.csdn.net/uploads/201407/26/1406382765_7341.jpg" };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.example.zhy_baseadapterhelper;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ListView;
import android.widget.Toast;

import com.joanzapata.android.BaseAdapterHelper;
import com.joanzapata.android.QuickAdapter;

public class MainActivity extends Activity
{

private ListView mListView;
private QuickAdapter<Bean> mAdapter;

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

mListView = (ListView) findViewById(R.id.id_lv_main);

// 设置适配器

mListView.setAdapter(mAdapter = new QuickAdapter<Bean>(
MainActivity.this, R.layout.item_list, Bean.beans)
{

@Override
protected void convert(BaseAdapterHelper helper, final Bean item)
{
helper.setText(R.id.tv_title, item.getTitle());
helper.setText(R.id.tv_describe, item.getDesc());
helper.setText(R.id.tv_phone, item.getPhone());
helper.setText(R.id.tv_time, item.getTime());
helper.setImageUrl(R.id.id_icon, item.getUrl());

helper.setOnClickListener(R.id.id_icon, new OnClickListener()
{
@Override
public void onClick(View v)
{
Toast.makeText(MainActivity.this,
"I am icon in " + item.getTitle(),
Toast.LENGTH_SHORT).show();
}
});

}
});

}


}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
/**
* Copyright 2013 Joan Zapata
*
* 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.
*/
package com.joanzapata.android;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.ProgressBar;

import java.util.ArrayList;
import java.util.List;

/**
* Abstraction class of a BaseAdapter in which you only need
* to provide the convert() implementation.<br/>
* Using the provided BaseAdapterHelper, your code is minimalist.
* @param <T> The type of the items in the list.
*/
public abstract class BaseQuickAdapter<T, H extends BaseAdapterHelper> extends BaseAdapter {

protected static final String TAG = BaseQuickAdapter.class.getSimpleName();

protected final Context context;

protected final int layoutResId;

protected final List<T> data;

protected boolean displayIndeterminateProgress = false;

/**
* Create a QuickAdapter.
* @param context The context.
* @param layoutResId The layout resource id of each item.
*/
public BaseQuickAdapter(Context context, int layoutResId) {
this(context, layoutResId, null);
}

/**
* Same as QuickAdapter#QuickAdapter(Context,int) but with
* some initialization data.
* @param context The context.
* @param layoutResId The layout resource id of each item.
* @param data A new list is created out of this one to avoid mutable list
*/
public BaseQuickAdapter(Context context, int layoutResId, List<T> data) {
this.data = data == null ? new ArrayList<T>() : new ArrayList<T>(data);
this.context = context;
this.layoutResId = layoutResId;
}

@Override
public int getCount() {
int extra = displayIndeterminateProgress ? 1 : 0;
return data.size() + extra;
}

@Override
public T getItem(int position) {
if (position >= data.size()) return null;
return data.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public int getViewTypeCount() {
return 2;
}

@Override
public int getItemViewType(int position) {
return position >= data.size() ? 1 : 0;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (getItemViewType(position) == 0) {
final H helper = getAdapterHelper(position, convertView, parent);
T item = getItem(position);
helper.setAssociatedObject(item);
convert(helper, item);
return helper.getView();
}

return createIndeterminateProgressView(convertView, parent);
}

private View createIndeterminateProgressView(View convertView, ViewGroup parent) {
if (convertView == null) {
FrameLayout container = new FrameLayout(context);
container.setForegroundGravity(Gravity.CENTER);
ProgressBar progress = new ProgressBar(context);
container.addView(progress);
convertView = container;
}
return convertView;
}

@Override
public boolean isEnabled(int position) {
return position < data.size();
}

public void add(T elem) {
data.add(elem);
notifyDataSetChanged();
}

public void addAll(List<T> elem) {
data.addAll(elem);
notifyDataSetChanged();
}

public void set(T oldElem, T newElem) {
set(data.indexOf(oldElem), newElem);
}

public void set(int index, T elem) {
data.set(index, elem);
notifyDataSetChanged();
}

public void remove(T elem) {
data.remove(elem);
notifyDataSetChanged();
}

public void remove(int index) {
data.remove(index);
notifyDataSetChanged();
}

public void replaceAll(List<T> elem) {
data.clear();
data.addAll(elem);
notifyDataSetChanged();
}

public boolean contains(T elem) {
return data.contains(elem);
}

/** Clear data list */
public void clear() {
data.clear();
notifyDataSetChanged();
}

public void showIndeterminateProgress(boolean display) {
if (display == displayIndeterminateProgress) return;
displayIndeterminateProgress = display;
notifyDataSetChanged();
}

/**
* Implement this method and use the helper to adapt the view to the given item.
* @param helper A fully initialized helper.
* @param item The item that needs to be displayed.
*/
protected abstract void convert(H helper, T item);

/**
* You can override this method to use a custom BaseAdapterHelper in order to fit your needs
* @param position The position of the item within the adapter's data set of the item whose view we want.
* @param convertView The old view to reuse, if possible. Note: You should check that this view
* is non-null and of an appropriate type before using. If it is not possible to convert
* this view to display the correct data, this method can create a new view.
* Heterogeneous lists can specify their number of view types, so that this View is
* always of the right type (see {@link #getViewTypeCount()} and
* {@link #getItemViewType(int)}).
* @param parent The parent that this view will eventually be attached to
* @return An instance of BaseAdapterHelper
*/
protected abstract H getAdapterHelper(int position, View convertView, ViewGroup parent);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* Copyright 2013 Joan Zapata
*
* 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.
*/
package com.joanzapata.android;

import android.content.Context;

import java.util.List;

/**
* Same as QuickAdapter, but adds an "itemChanged" boolean in the
* convert() method params, which allows you to know if you are
* adapting the new view to the same item or not, and therefore
* make a difference between dataset changed / dataset invalidated.
* <p/>
* Abstraction class of a BaseAdapter in which you only need
* to provide the convert() implementation.<br/>
* Using the provided BaseAdapterHelper, your code is minimalist.
* @param <T> The type of the items in the list.
*/
public abstract class EnhancedQuickAdapter<T> extends QuickAdapter<T> {

/**
* Create a QuickAdapter.
* @param context The context.
* @param layoutResId The layout resource id of each item.
*/
public EnhancedQuickAdapter(Context context, int layoutResId) {
super(context, layoutResId);
}

/**
* Same as QuickAdapter#QuickAdapter(Context,int) but with
* some initialization data.
* @param context The context.
* @param layoutResId The layout resource id of each item.
* @param data A new list is created out of this one to avoid mutable list
*/
public EnhancedQuickAdapter(Context context, int layoutResId, List<T> data) {
super(context, layoutResId, data);
}

@Override
protected final void convert(BaseAdapterHelper helper, T item) {
boolean itemChanged = helper.associatedObject == null || !helper.associatedObject.equals(item);
helper.associatedObject = item;
convert(helper, item, itemChanged);
}

/**
* @param helper The helper to use to adapt the view.
* @param item The item you should adapt the view to.
* @param itemChanged Whether or not the helper was bound to another object before.
*/
protected abstract void convert(BaseAdapterHelper helper, T item, boolean itemChanged);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Copyright 2013 Joan Zapata
*
* 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.
*/
package com.joanzapata.android;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import static com.joanzapata.android.BaseAdapterHelper.get;

/**
* Abstraction class of a BaseAdapter in which you only need
* to provide the convert() implementation.<br/>
* Using the provided BaseAdapterHelper, your code is minimalist.
* @param <T> The type of the items in the list.
*/
public abstract class QuickAdapter<T> extends BaseQuickAdapter<T, BaseAdapterHelper> {

/**
* Create a QuickAdapter.
* @param context The context.
* @param layoutResId The layout resource id of each item.
*/
public QuickAdapter(Context context, int layoutResId) {
super(context, layoutResId);
}

/**
* Same as QuickAdapter#QuickAdapter(Context,int) but with
* some initialization data.
* @param context The context.
* @param layoutResId The layout resource id of each item.
* @param data A new list is created out of this one to avoid mutable list
*/
public QuickAdapter(Context context, int layoutResId, List<T> data) {
super(context, layoutResId, data);
}

protected BaseAdapterHelper getAdapterHelper(int position, View convertView, ViewGroup parent) {
return get(context, convertView, parent, layoutResId, position);
}

}
6 changes: 6 additions & 0 deletions calendar-list-view-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
21 changes: 21 additions & 0 deletions calendar-list-view-demo/CalendarListView-Demo.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6 changes: 6 additions & 0 deletions calendar-list-view-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
calendar-list-view-demo
============
### 1.Demo Download
[本地下载](apk/calendar-list-view-demo.apk?raw=true "点击下载到本地")
###2. Screenshot
![Screenshot](apk/calendar-list-view-demo.gif)
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions calendar-list-view-demo/apk/manifest-merger-release-report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
-- Merging decision tree log ---
manifest
ADDED from AndroidManifest.xml:2:1
package
ADDED from AndroidManifest.xml:3:5
INJECTED from AndroidManifest.xml:0:0
INJECTED from AndroidManifest.xml:0:0
android:versionName
INJECTED from AndroidManifest.xml:0:0
INJECTED from AndroidManifest.xml:0:0
xmlns:android
ADDED from AndroidManifest.xml:2:11
android:versionCode
INJECTED from AndroidManifest.xml:0:0
INJECTED from AndroidManifest.xml:0:0
application
ADDED from AndroidManifest.xml:5:5
MERGED from calendar-list-view-demo:library:unspecified:12:5
MERGED from com.android.support:appcompat-v7:21.0.0:16:5
MERGED from com.android.support:support-v4:21.0.0:16:5
MERGED from com.android.support:recyclerview-v7:21.0.0:17:5
MERGED from com.android.support:support-v4:21.0.0:16:5
android:label
ADDED from AndroidManifest.xml:8:9
android:allowBackup
ADDED from AndroidManifest.xml:6:9
android:icon
ADDED from AndroidManifest.xml:7:9
android:theme
ADDED from AndroidManifest.xml:9:9
activity#com.rogary.calendarlistviewdemo.CalandarDemoActivity
ADDED from AndroidManifest.xml:10:9
android:label
ADDED from AndroidManifest.xml:12:13
android:name
ADDED from AndroidManifest.xml:11:13
intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER
ADDED from AndroidManifest.xml:13:13
action#android.intent.action.MAIN
ADDED from AndroidManifest.xml:14:17
android:name
ADDED from AndroidManifest.xml:14:25
category#android.intent.category.LAUNCHER
ADDED from AndroidManifest.xml:16:17
android:name
ADDED from AndroidManifest.xml:16:27
uses-sdk
INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested
MERGED from calendar-list-view-demo:library:unspecified:8:5
MERGED from com.android.support:appcompat-v7:21.0.0:15:5
MERGED from com.android.support:support-v4:21.0.0:15:5
MERGED from com.android.support:recyclerview-v7:21.0.0:15:5
MERGED from com.android.support:support-v4:21.0.0:15:5
android:targetSdkVersion
INJECTED from AndroidManifest.xml:0:0
INJECTED from AndroidManifest.xml:0:0
android:minSdkVersion
INJECTED from AndroidManifest.xml:0:0
INJECTED from AndroidManifest.xml:0:0
activity#android.support.v7.widget.TestActivity
ADDED from com.android.support:recyclerview-v7:21.0.0:18:9
android:label
ADDED from com.android.support:recyclerview-v7:21.0.0:18:19
android:name
ADDED from com.android.support:recyclerview-v7:21.0.0:18:60
1 change: 1 addition & 0 deletions calendar-list-view-demo/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
90 changes: 90 additions & 0 deletions calendar-list-view-demo/app/app.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
<orderEntry type="module" module-name="library" exported="" />
</component>
</module>

25 changes: 25 additions & 0 deletions calendar-list-view-demo/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.rogary.calendarlistviewdemo"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library')
}
17 changes: 17 additions & 0 deletions calendar-list-view-demo/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 E:\adt-bundle-windows-x86_64-20140702\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,13 @@
package com.rogary.calendarlistviewdemo;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase< Application > {
public ApplicationTest () {
super ( Application.class );
}
}
21 changes: 21 additions & 0 deletions calendar-list-view-demo/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rogary.calendarlistviewdemo" >

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".CalandarDemoActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.rogary.calendarlistviewdemo;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.andexert.calendarlistview.library.DatePickerController;
import com.andexert.calendarlistview.library.DayPickerView;
import com.andexert.calendarlistview.library.SimpleMonthAdapter;


public class CalandarDemoActivity extends Activity implements DatePickerController {

private TextView selectedDaysText; //显示已选择的范围
private DayPickerView dayPickerView; //日期选择View
private TextView selectedText; //显示点击的日期

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


private void initView () {
selectedText = ( TextView ) findViewById ( R.id.activity_text );
selectedDaysText = ( TextView ) findViewById ( R.id.activity_selectd_text );
dayPickerView = ( DayPickerView ) findViewById ( R.id.activity_daypicker );
dayPickerView.setController ( this );
}

@Override
public int getMaxYear () {
return 2017;
}

@Override
public void onDayOfMonthSelected ( int year, int month, int day ) {
selectedText.setText ( getResources ().getString ( R.string.selected ) + year + getResources ().getString ( R.string.year ) + month + getResources ().getString ( R.string.month ) + day + getResources ().getString ( R.string.day ) );
selectedDaysText.setText("");
}

@Override
public void onDateRangeSelected ( SimpleMonthAdapter.SelectedDays< SimpleMonthAdapter.CalendarDay > selectedDays ) {
selectedDaysText.setText ( getResources ().getString ( R.string.selected ) + selectedDays.getFirst ().toString () + " --> " + selectedDays.getLast ().toString () );
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:calendar="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".CalandarDemoActivity">
<TextView
android:id="@+id/activity_selectd_text"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_alignParentBottom="true"></TextView>
<TextView
android:id="@+id/activity_text"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_above="@+id/activity_selectd_text"></TextView>

<com.andexert.calendarlistview.library.DayPickerView
android:id="@+id/activity_daypicker"
android:layout_width="match_parent"
android:layout_height="match_parent"
calendar:drawRoundRect="true"
android:layout_above="@+id/activity_text"/>


</RelativeLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".CalandarDemoActivity">
<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
android:showAsAction="never"/>
</menu>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light">
</style>
</resources>
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>
5 changes: 5 additions & 0 deletions calendar-list-view-demo/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>
8 changes: 8 additions & 0 deletions calendar-list-view-demo/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">CalendarListViewDemo</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>

</resources>
8 changes: 8 additions & 0 deletions calendar-list-view-demo/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

</resources>
19 changes: 19 additions & 0 deletions calendar-list-view-demo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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:1.0.0'

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

allprojects {
repositories {
jcenter()
}
}
21 changes: 21 additions & 0 deletions calendar-list-view-demo/calendar-list-view-demo.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

18 changes: 18 additions & 0 deletions calendar-list-view-demo/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# 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
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
164 changes: 164 additions & 0 deletions calendar-list-view-demo/gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#!/usr/bin/env bash

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# 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
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# 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\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-

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" ] ; 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"`

# 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

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
90 changes: 90 additions & 0 deletions calendar-list-view-demo/gradlew.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@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

@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=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@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 Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_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=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
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
39 changes: 39 additions & 0 deletions calendar-list-view-demo/library/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#Android generated
bin
gen

#Eclipse
.project
.classpath
.settings

#IntelliJ IDEA
.idea
*.iml
*.ipr
*.iws
out

#Gradle
.gradle
build

#Maven
target
release.properties
pom.xml.*
project.properties

#Ant
build.xml
local.properties
gradle.properties
proguard.cfg

#OSX
.DS_Store/

# Crashlytics
com_crashlytics_export_strings.xml
crashlytics-build.properties
crashlytics.properties
21 changes: 21 additions & 0 deletions calendar-list-view-demo/library/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Robin Chutaux

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
26 changes: 26 additions & 0 deletions calendar-list-view-demo/library/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"

defaultConfig {
//applicationId "com.andexert.calendarlistview.library"
minSdkVersion 10
targetSdkVersion 21
versionCode 9
versionName "1.2.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
}
17 changes: 17 additions & 0 deletions calendar-list-view-demo/library/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 C:/Users/robin.chutaux/Documents/adt/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 *;
#}
6 changes: 6 additions & 0 deletions calendar-list-view-demo/library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<manifest
package="com.andexert.calendarlistview.library">

<application />

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/***********************************************************************************
* The MIT License (MIT)
* Copyright (c) 2014 Robin Chutaux
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
***********************************************************************************/
package com.andexert.calendarlistview.library;

import java.util.Calendar;


public class CalendarUtils
{
public static int getDaysInMonth(int month, int year) {
switch (month) {
case Calendar.JANUARY:
case Calendar.MARCH:
case Calendar.MAY:
case Calendar.JULY:
case Calendar.AUGUST:
case Calendar.OCTOBER:
case Calendar.DECEMBER:
return 31;
case Calendar.APRIL:
case Calendar.JUNE:
case Calendar.SEPTEMBER:
case Calendar.NOVEMBER:
return 30;
case Calendar.FEBRUARY:
return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 28 : 29;
default:
throw new IllegalArgumentException("Invalid Month");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/***********************************************************************************
* The MIT License (MIT)
* Copyright (c) 2014 Robin Chutaux
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
***********************************************************************************/
package com.andexert.calendarlistview.library;

public interface DatePickerController {
public abstract int getMaxYear();

public abstract void onDayOfMonthSelected(int year, int month, int day);

public abstract void onDateRangeSelected(final SimpleMonthAdapter.SelectedDays<SimpleMonthAdapter.CalendarDay> selectedDays);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/***********************************************************************************
* The MIT License (MIT)
* Copyright (c) 2014 Robin Chutaux
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
***********************************************************************************/
package com.andexert.calendarlistview.library;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;

public class DayPickerView extends RecyclerView
{
protected Context mContext;
protected SimpleMonthAdapter mAdapter;
private DatePickerController mController;
protected int mCurrentScrollState = 0;
protected long mPreviousScrollPosition;
protected int mPreviousScrollState = 0;
private TypedArray typedArray;
private OnScrollListener onScrollListener;

public DayPickerView(Context context)
{
this(context, null);
}

public DayPickerView(Context context, AttributeSet attrs)
{
this(context, attrs, 0);
}

public DayPickerView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
if (!isInEditMode())
{
typedArray = context.obtainStyledAttributes(attrs, R.styleable.DayPickerView);
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
init(context);
}
}

public void setController(DatePickerController mController)
{
this.mController = mController;
setUpAdapter();
setAdapter(mAdapter);
}


public void init(Context paramContext) {
setLayoutManager(new LinearLayoutManager(paramContext));
mContext = paramContext;
setUpListView();

onScrollListener = new OnScrollListener()
{
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy)
{
super.onScrolled(recyclerView, dx, dy);
final SimpleMonthView child = (SimpleMonthView) recyclerView.getChildAt(0);
if (child == null) {
return;
}

mPreviousScrollPosition = dy;
mPreviousScrollState = mCurrentScrollState;
}
};
}


protected void setUpAdapter() {
if (mAdapter == null) {
mAdapter = new SimpleMonthAdapter(getContext(), mController, typedArray);
}
mAdapter.notifyDataSetChanged();
}

protected void setUpListView() {
setVerticalScrollBarEnabled(false);
setOnScrollListener(onScrollListener);
setFadingEdgeLength(0);
}

public SimpleMonthAdapter.SelectedDays<SimpleMonthAdapter.CalendarDay> getSelectedDays()
{
return mAdapter.getSelectedDays();
}

protected DatePickerController getController()
{
return mController;
}

protected TypedArray getTypedArray()
{
return typedArray;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
/***********************************************************************************
* The MIT License (MIT)
* Copyright (c) 2014 Robin Chutaux
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
***********************************************************************************/
package com.andexert.calendarlistview.library;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.AbsListView;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;

public class SimpleMonthAdapter extends RecyclerView.Adapter<SimpleMonthAdapter.ViewHolder> implements SimpleMonthView.OnDayClickListener {
protected static final int MONTHS_IN_YEAR = 12;
private final TypedArray typedArray;
private final Context mContext;
private final DatePickerController mController;
private final Calendar calendar;
private final SelectedDays<CalendarDay> selectedDays;
private final Integer firstMonth;
private final Integer lastMonth;

public SimpleMonthAdapter(Context context, DatePickerController datePickerController, TypedArray typedArray) {
this.typedArray = typedArray;
calendar = Calendar.getInstance();
firstMonth = typedArray.getInt(R.styleable.DayPickerView_firstMonth, calendar.get(Calendar.MONTH));
lastMonth = typedArray.getInt(R.styleable.DayPickerView_lastMonth, (calendar.get(Calendar.MONTH) - 1) % MONTHS_IN_YEAR);
selectedDays = new SelectedDays<>();
mContext = context;
mController = datePickerController;
init();
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i)
{
final SimpleMonthView simpleMonthView = new SimpleMonthView(mContext, typedArray);
return new ViewHolder(simpleMonthView, this);
}

@Override
public void onBindViewHolder(ViewHolder viewHolder, int position)
{
final SimpleMonthView v = viewHolder.simpleMonthView;
final HashMap<String, Integer> drawingParams = new HashMap<String, Integer>();
int month;
int year;

month = (firstMonth + (position % MONTHS_IN_YEAR)) % MONTHS_IN_YEAR;
year = position / MONTHS_IN_YEAR + calendar.get(Calendar.YEAR) + ((firstMonth + (position % MONTHS_IN_YEAR)) / MONTHS_IN_YEAR);

int selectedFirstDay = -1;
int selectedLastDay = -1;
int selectedFirstMonth = -1;
int selectedLastMonth = -1;
int selectedFirstYear = -1;
int selectedLastYear = -1;

if (selectedDays.getFirst() != null)
{
selectedFirstDay = selectedDays.getFirst().day;
selectedFirstMonth = selectedDays.getFirst().month;
selectedFirstYear = selectedDays.getFirst().year;
}

if (selectedDays.getLast() != null)
{
selectedLastDay = selectedDays.getLast().day;
selectedLastMonth = selectedDays.getLast().month;
selectedLastYear = selectedDays.getLast().year;
}

v.reuse();

drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_BEGIN_YEAR, selectedFirstYear);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_LAST_YEAR, selectedLastYear);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_BEGIN_MONTH, selectedFirstMonth);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_LAST_MONTH, selectedLastMonth);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_BEGIN_DAY, selectedFirstDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_LAST_DAY, selectedLastDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, calendar.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
}

public long getItemId(int position) {
return position;
}

@Override
public int getItemCount()
{
int itemCount = (((mController.getMaxYear() - calendar.get(Calendar.YEAR)) + 1) * MONTHS_IN_YEAR);

if (firstMonth != -1)
itemCount -= firstMonth;

if (lastMonth != -1)
itemCount -= (MONTHS_IN_YEAR - lastMonth) - 1;

return itemCount;
}

public static class ViewHolder extends RecyclerView.ViewHolder
{
final SimpleMonthView simpleMonthView;

public ViewHolder(View itemView, SimpleMonthView.OnDayClickListener onDayClickListener)
{
super(itemView);
simpleMonthView = (SimpleMonthView) itemView;
simpleMonthView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
simpleMonthView.setClickable(true);
simpleMonthView.setOnDayClickListener(onDayClickListener);
}
}

protected void init() {
if (typedArray.getBoolean(R.styleable.DayPickerView_currentDaySelected, false))
onDayTapped(new CalendarDay(System.currentTimeMillis()));
}

public void onDayClick(SimpleMonthView simpleMonthView, CalendarDay calendarDay) {
if (calendarDay != null) {
onDayTapped(calendarDay);
}
}

protected void onDayTapped(CalendarDay calendarDay) {
mController.onDayOfMonthSelected(calendarDay.year, calendarDay.month, calendarDay.day);
setSelectedDay(calendarDay);
}

public void setSelectedDay(CalendarDay calendarDay) {
if (selectedDays.getFirst() != null && selectedDays.getLast() == null)
{
selectedDays.setLast(calendarDay);

if (selectedDays.getFirst().month < calendarDay.month)
{
for (int i = 0; i < selectedDays.getFirst().month - calendarDay.month - 1; ++i)
mController.onDayOfMonthSelected(selectedDays.getFirst().year, selectedDays.getFirst().month + i, selectedDays.getFirst().day);
}

mController.onDateRangeSelected(selectedDays);
}
else if (selectedDays.getLast() != null)
{
selectedDays.setFirst(calendarDay);
selectedDays.setLast(null);
}
else
selectedDays.setFirst(calendarDay);

notifyDataSetChanged();
}

public static class CalendarDay implements Serializable
{
private static final long serialVersionUID = -5456695978688356202L;
private Calendar calendar;

int day;
int month;
int year;

public CalendarDay() {
setTime(System.currentTimeMillis());
}

public CalendarDay(int year, int month, int day) {
setDay(year, month, day);
}

public CalendarDay(long timeInMillis) {
setTime(timeInMillis);
}

public CalendarDay(Calendar calendar) {
year = calendar.get(Calendar.YEAR);
month = calendar.get(Calendar.MONTH);
day = calendar.get(Calendar.DAY_OF_MONTH);
}

private void setTime(long timeInMillis) {
if (calendar == null) {
calendar = Calendar.getInstance();
}
calendar.setTimeInMillis(timeInMillis);
month = this.calendar.get(Calendar.MONTH);
year = this.calendar.get(Calendar.YEAR);
day = this.calendar.get(Calendar.DAY_OF_MONTH);
}

public void set(CalendarDay calendarDay) {
year = calendarDay.year;
month = calendarDay.month;
day = calendarDay.day;
}

public void setDay(int year, int month, int day) {
this.year = year;
this.month = month;
this.day = day;
}

public Date getDate()
{
if (calendar == null) {
calendar = Calendar.getInstance();
}
calendar.set(year, month, day);
return calendar.getTime();
}

@Override
public String toString()
{
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("{ year: ");
stringBuilder.append(year);
stringBuilder.append(", month: ");
stringBuilder.append(month);
stringBuilder.append(", day: ");
stringBuilder.append(day);
stringBuilder.append(" }");

return stringBuilder.toString();
}
}

public SelectedDays<CalendarDay> getSelectedDays()
{
return selectedDays;
}

public static class SelectedDays<K> implements Serializable
{
private static final long serialVersionUID = 3942549765282708376L;
private K first;
private K last;

public K getFirst()
{
return first;
}

public void setFirst(K first)
{
this.first = first;
}

public K getLast()
{
return last;
}

public void setLast(K last)
{
this.last = last;
}
}
}

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions calendar-list-view-demo/library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="DayPickerView">
<attr name="colorCurrentDay" format="color"/>
<attr name="colorSelectedDayBackground" format="color"/>
<attr name="colorSelectedDayText" format="color"/>
<attr name="colorPreviousDay" format="color"/>
<attr name="colorNormalDay" format="color" />
<attr name="colorMonthName" format="color" />
<attr name="colorDayName" format="color" />
<attr name="textSizeDay" format="dimension"/>
<attr name="textSizeMonth" format="dimension" />
<attr name="textSizeDayName" format="dimension" />
<attr name="headerMonthHeight" format="dimension" />
<attr name="selectedDayRadius" format="dimension" />
<attr name="calendarHeight" format="dimension" />
<attr name="enablePreviousDay" format="boolean" />
<attr name="currentDaySelected" format="boolean" />
<attr name="drawRoundRect" format="boolean" />
<attr name="firstMonth" format="enum">
<enum name="january" value="0" />
<enum name="february" value="1" />
<enum name="march" value="2" />
<enum name="april" value="3" />
<enum name="may" value="4" />
<enum name="june" value="5" />
<enum name="july" value="6" />
<enum name="august" value="7" />
<enum name="september" value="8" />
<enum name="october" value="9" />
<enum name="november" value="10" />
<enum name="december" value="11" />
</attr>
<attr name="lastMonth" format="enum">
<enum name="january" value="0" />
<enum name="february" value="1" />
<enum name="march" value="2" />
<enum name="april" value="3" />
<enum name="may" value="4" />
<enum name="june" value="5" />
<enum name="july" value="6" />
<enum name="august" value="7" />
<enum name="september" value="8" />
<enum name="october" value="9" />
<enum name="november" value="10" />
<enum name="december" value="11" />
</attr>
</declare-styleable>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<color name="normal_day">#ff999999</color>
<color name="selected_day_background">#E75F49</color>
<color name="selected_day_text">#fff2f2f2</color>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="text_size_day">16sp</dimen>
<dimen name="text_size_month">16sp</dimen>
<dimen name="text_size_day_name">10sp</dimen>
<dimen name="header_month_height">50dip</dimen>
<dimen name="selected_day_radius">16dip</dimen>
<dimen name="calendar_height">270dip</dimen>
</resources>
11 changes: 11 additions & 0 deletions calendar-list-view-demo/library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<resources>
<string name="app_name">CalendarListview</string>


<string name="sans_serif" translatable="false">sans-serif</string>

<string name="selected">您选择了:</string>
<string name="year">年</string>
<string name="month">月</string>
<string name="day">日</string>
</resources>
1 change: 1 addition & 0 deletions calendar-list-view-demo/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':app' ,'library'
6 changes: 6 additions & 0 deletions circular-reveal-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
115 changes: 115 additions & 0 deletions circular-reveal-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
CircularReveal
==============

Lollipop ViewAnimationUtils.createCircularReveal for everyone 2.3+

<img src="https://github.com/aosp-exchange-group/android-open-project-demo/blob/master/circular-reveal-demo/source/Sample.gif" />

Sample
======
<a href="https://github.com/ozodrukh/CircularReveal/releases"> Sample & .aar file </a>

Note
====

depends from Jake Wharton's NineOldsAndroid, or use my modifed version (included auto cancel)

Using
======

Use regular `RevealFrameLayout` & `RevealLinearLayout` don't worry, only target will be clipped :)

```xml
<io.codetail.widget.RevealFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- Put more views here if you want, it's stock frame layout from Lollipop :) -->

<android.support.v7.widget.CardView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/awesome_card"
style="@style/CardView"
app:cardBackgroundColor="@color/material_deep_teal_500"
app:cardElevation="2dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_gravity="center_horizontal"
/>

</io.codetail.widget.RevealFrameLayout>
```

```java

View myView = findView(R.id.awesome_card);

// get the center for the clipping circle
int cx = (myView.getLeft() + myView.getRight()) / 2;
int cy = (myView.getTop() + myView.getBottom()) / 2;

// get the final radius for the clipping circle
int finalRadius = Math.max(myView.getWidth(), myView.getHeight());

SupportAnimator animator =
ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(1500);
animator.start();

```

How to add dependency
=====================

This library is not released in Maven Central, but instead you can use [JitPack](https://www.jitpack.io/)

add remote maven url

```groovy
repositories {
maven {
url "https://jitpack.io"
}
}
```

then add a library dependency

```groovy
dependencies {
compile 'com.github.ozodrukh:CircularReveal:(latest-release)@aar'
}
```

License
--------

The MIT License (MIT)

Copyright (c) 2014 Abdullaev Ozodrukh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
I
Binary file added circular-reveal-demo/apk/Sample-1.0.apk
Binary file not shown.
24 changes: 24 additions & 0 deletions circular-reveal-demo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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:1.1.0'

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

allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven{
url 'http://oss.svmeng.com:8081/nexus/content/repositories/releases'
}
}
}
1 change: 1 addition & 0 deletions circular-reveal-demo/circualreveal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
16 changes: 16 additions & 0 deletions circular-reveal-demo/circualreveal/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"


defaultConfig {
minSdkVersion 10
targetSdkVersion 21
}
}

dependencies {
compile 'com.nineoldandroids:library:2.4.0'
}
92 changes: 92 additions & 0 deletions circular-reveal-demo/circualreveal/circualreveal.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="circular-reveal-demo" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":circualreveal" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
</component>
</module>

3 changes: 3 additions & 0 deletions circular-reveal-demo/circualreveal/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_NAME=com.ozodrukh
POM_ARTIFACT_ID=circularreveal
POM_PACKAGING=aar
114 changes: 114 additions & 0 deletions circular-reveal-demo/circualreveal/gradle_mvn_push.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* Copyright 2013 Chris Banes
*
* 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.
*/

apply plugin: 'maven'
apply plugin: 'signing'

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}

def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}

artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
}
17 changes: 17 additions & 0 deletions circular-reveal-demo/circualreveal/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 /Users/Ozodrukh/Documents/Android/android-sdk-macosx/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,5 @@
<manifest package="io.codetail.view">

<application />

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
package io.codetail.animation;

import android.annotation.TargetApi;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;

import com.nineoldandroids.animation.Animator;

import java.lang.ref.WeakReference;

import static io.codetail.animation.ViewAnimationUtils.SimpleAnimationListener;

/**
* @hide
*/
public interface RevealAnimator{

public void setClipOutlines(boolean clip);

public void setCenter(float cx, float cy);

public void setTarget(View target);

public void setRevealRadius(float value);

public float getRevealRadius();

public void invalidate(Rect bounds);

static class RevealFinishedGingerbread extends SimpleAnimationListener {
WeakReference<RevealAnimator> mReference;
volatile Rect mInvalidateBounds;

RevealFinishedGingerbread(RevealAnimator target, Rect bounds) {
mReference = new WeakReference<>(target);
mInvalidateBounds = bounds;
}

@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);

RevealAnimator target = mReference.get();

if(target == null){
return;
}

target.setClipOutlines(false);
target.setCenter(0, 0);
target.setTarget(null);
target.invalidate(mInvalidateBounds);
}
}

static class RevealFinishedIceCreamSandwich extends SimpleAnimationListener {
WeakReference<RevealAnimator> mReference;
volatile Rect mInvalidateBounds;

int mLayerType;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
RevealFinishedIceCreamSandwich(RevealAnimator target, Rect bounds) {
mReference = new WeakReference<>(target);
mInvalidateBounds = bounds;

mLayerType = ((View) target).getLayerType();
}

@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
((View) mReference.get()).setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
((View) mReference.get()).setLayerType(mLayerType, null);

RevealAnimator target = mReference.get();

if(target == null){
return;
}

target.setClipOutlines(false);
target.setCenter(0, 0);
target.setTarget(null);
target.invalidate(mInvalidateBounds);
}
}

static class RevealFinishedJellyBeanMr1 extends SimpleAnimationListener {
WeakReference<RevealAnimator> mReference;
volatile Rect mInvalidateBounds;

int mLayerType;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
RevealFinishedJellyBeanMr1(RevealAnimator target, Rect bounds) {
mReference = new WeakReference<>(target);
mInvalidateBounds = bounds;

mLayerType = ((View) target).getLayerType();
}

@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
((View) mReference.get()).setLayerType(View.LAYER_TYPE_HARDWARE, null);
}

@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
((View) mReference.get()).setLayerType(mLayerType, null);

RevealAnimator target = mReference.get();

if(target == null){
return;
}

target.setClipOutlines(false);
target.setCenter(0, 0);
target.setTarget(null);
target.invalidate(mInvalidateBounds);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package io.codetail.animation;

import android.view.animation.Interpolator;

public abstract class SupportAnimator {

/**
* @return true if using native android animation framework, otherwise is
* nineoldandroids
*/
public abstract boolean isNativeAnimator();

/**
* @return depends from {@link android.os.Build.VERSION} if sdk version
* {@link android.os.Build.VERSION_CODES#LOLLIPOP} and greater will return
* {@link android.animation.Animator} otherwise {@link com.nineoldandroids.animation.Animator}
*/
public abstract Object get();

/**
* Starts this animation. If the animation has a nonzero startDelay, the animation will start
* running after that delay elapses. A non-delayed animation will have its initial
* value(s) set immediately, followed by calls to
* {@link android.animation.Animator.AnimatorListener#onAnimationStart(android.animation.Animator)}
* for any listeners of this animator.
*
* <p>The animation started by calling this method will be run on the thread that called
* this method. This thread should have a Looper on it (a runtime exception will be thrown if
* this is not the case). Also, if the animation will animate
* properties of objects in the view hierarchy, then the calling thread should be the UI
* thread for that view hierarchy.</p>
*
*/
public abstract void start();

/**
* Sets the duration of the animation.
*
* @param duration The length of the animation, in milliseconds.
*/
public abstract void setDuration(int duration);

/**
* The time interpolator used in calculating the elapsed fraction of the
* animation. The interpolator determines whether the animation runs with
* linear or non-linear motion, such as acceleration and deceleration. The
* default value is {@link android.view.animation.AccelerateDecelerateInterpolator}.
*
* @param value the interpolator to be used by this animation
*/
public abstract void setInterpolator(Interpolator value);


/**
* Adds a listener to the set of listeners that are sent events through the life of an
* animation, such as start, repeat, and end.
*
* @param listener the listener to be added to the current set of listeners for this animation.
*/
public abstract void addListener(AnimatorListener listener);


/**
* Returns whether this Animator is currently running (having been started and gone past any
* initial startDelay period and not yet ended).
*
* @return Whether the Animator is running.
*/
public abstract boolean isRunning();


/**
* <p>An animation listener receives notifications from an animation.
* Notifications indicate animation related events, such as the end or the
* repetition of the animation.</p>
*/
public static interface AnimatorListener {
/**
* <p>Notifies the start of the animation.</p>
*/
void onAnimationStart();

/**
* <p>Notifies the end of the animation. This callback is not invoked
* for animations with repeat count set to INFINITE.</p>
*/
void onAnimationEnd();

/**
* <p>Notifies the cancellation of the animation. This callback is not invoked
* for animations with repeat count set to INFINITE.</p>
*/
void onAnimationCancel();

/**
* <p>Notifies the repetition of the animation.</p>
*/
void onAnimationRepeat();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package io.codetail.animation;

import android.animation.Animator;
import android.annotation.TargetApi;
import android.os.Build;
import android.view.animation.Interpolator;

import java.lang.ref.WeakReference;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
final class SupportAnimatorLollipop extends SupportAnimator{

WeakReference<Animator> mNativeAnimator;

SupportAnimatorLollipop(Animator animator) {
mNativeAnimator = new WeakReference<Animator>(animator);
}

@Override
public boolean isNativeAnimator() {
return true;
}

@Override
public Object get() {
return mNativeAnimator;
}


@Override
public void start() {
Animator a = mNativeAnimator.get();
if(a != null) {
a.start();
}
}

@Override
public void setDuration(int duration) {
Animator a = mNativeAnimator.get();
if(a != null) {
a.setDuration(duration);
}
}

@Override
public void setInterpolator(Interpolator value) {
Animator a = mNativeAnimator.get();
if(a != null) {
a.setInterpolator(value);
}
}

@Override
public void addListener(final AnimatorListener listener) {
Animator a = mNativeAnimator.get();
if(a == null) {
return;
}

if(listener == null){
a.addListener(null);
return;
}

a.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
listener.onAnimationStart();
}

@Override
public void onAnimationEnd(Animator animation) {
listener.onAnimationEnd();
}

@Override
public void onAnimationCancel(Animator animation) {
listener.onAnimationCancel();
}

@Override
public void onAnimationRepeat(Animator animation) {
listener.onAnimationRepeat();
}
});
}

@Override
public boolean isRunning() {
Animator a = mNativeAnimator.get();
return a != null && a.isRunning();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package io.codetail.animation;

import android.view.animation.Interpolator;

import com.nineoldandroids.animation.Animator;

import java.lang.ref.WeakReference;

final class SupportAnimatorPreL extends SupportAnimator {

WeakReference<Animator> mSupportFramework;

SupportAnimatorPreL(Animator animator) {
mSupportFramework = new WeakReference<Animator>(animator);
}

@Override
public boolean isNativeAnimator() {
return false;
}

@Override
public Object get() {
return mSupportFramework.get();
}

@Override
public void start() {
Animator a = mSupportFramework.get();
if(a != null) {
a.start();
}
}

@Override
public void setDuration(int duration) {
Animator a = mSupportFramework.get();
if(a != null) {
a.setDuration(duration);
}
}

@Override
public void setInterpolator(Interpolator value) {
Animator a = mSupportFramework.get();
if(a != null) {
a.setInterpolator(value);
}
}

@Override
public void addListener(final AnimatorListener listener) {
Animator a = mSupportFramework.get();
if(a == null) {
return;
}

if(listener == null){
a.addListener(null);
return;
}

a.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
listener.onAnimationStart();
}

@Override
public void onAnimationEnd(Animator animation) {
listener.onAnimationEnd();
}

@Override
public void onAnimationCancel(Animator animation) {
listener.onAnimationCancel();
}

@Override
public void onAnimationRepeat(Animator animation) {
listener.onAnimationRepeat();
}
});
}

@Override
public boolean isRunning() {
Animator a = mSupportFramework.get();
return a != null && a.isRunning();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
package io.codetail.animation;

import android.annotation.TargetApi;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;

import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.view.ViewHelper;
import com.nineoldandroids.view.ViewPropertyAnimator;

import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.LOLLIPOP;

public class ViewAnimationUtils {

private final static boolean LOLLIPOP_PLUS = SDK_INT >= LOLLIPOP;

public static final int SCALE_UP_DURATION = 500;

/**
* Returns an Animator which can animate a clipping circle.
* <p>
* Any shadow cast by the View will respect the circular clip from this animator.
* <p>
* Only a single non-rectangular clip can be applied on a View at any time.
* Views clipped by a circular reveal animation take priority over
* {@link android.view.View#setClipToOutline(boolean) View Outline clipping}.
* <p>
* Note that the animation returned here is a one-shot animation. It cannot
* be re-used, and once started it cannot be paused or resumed.
*
* @param view The View will be clipped to the animating circle.
* @param centerX The x coordinate of the center of the animating circle.
* @param centerY The y coordinate of the center of the animating circle.
* @param startRadius The starting radius of the animating circle.
* @param endRadius The ending radius of the animating circle.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static SupportAnimator createCircularReveal(View view,
int centerX, int centerY,
float startRadius, float endRadius) {

if(LOLLIPOP_PLUS){
return new SupportAnimatorLollipop(android.view.ViewAnimationUtils
.createCircularReveal(view, centerX, centerY, startRadius, endRadius));
}

if(!(view.getParent() instanceof RevealAnimator)){
throw new IllegalArgumentException("View must be inside RevealFrameLayout or RevealLinearLayout.");
}

RevealAnimator revealLayout = (RevealAnimator) view.getParent();
revealLayout.setTarget(view);
revealLayout.setCenter(centerX, centerY);

Rect bounds = new Rect();
view.getHitRect(bounds);

ObjectAnimator reveal = ObjectAnimator.ofFloat(revealLayout, "revealRadius", startRadius, endRadius);
reveal.addListener(getRevealFinishListener(revealLayout, bounds));

return new SupportAnimatorPreL(reveal);
}


static Animator.AnimatorListener getRevealFinishListener(RevealAnimator target, Rect bounds){
if(SDK_INT >= 17){
return new RevealAnimator.RevealFinishedJellyBeanMr1(target, bounds);
}else if(SDK_INT >= 14){
return new RevealAnimator.RevealFinishedIceCreamSandwich(target, bounds);
}else {
return new RevealAnimator.RevealFinishedGingerbread(target, bounds);
}
}


/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param fromY initial Y position of view
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, fromY);

ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();

}

/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, view.getHeight() / 3);

ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();

}

/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param duration aniamtion duration
*/
public static void liftingFromBottom(View view, float baseRotation, int duration){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, view.getHeight() / 3);

ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.rotationX(0)
.translationY(0)
.start();

}

public static class SimpleAnimationListener implements Animator.AnimatorListener{

@Override
public void onAnimationStart(Animator animation) {

}

@Override
public void onAnimationEnd(Animator animation) {

}

@Override
public void onAnimationCancel(Animator animation) {

}

@Override
public void onAnimationRepeat(Animator animation) {

}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package io.codetail.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;

import io.codetail.animation.RevealAnimator;

public class RevealFrameLayout extends FrameLayout implements RevealAnimator{

Path mRevealPath;

boolean mClipOutlines;

float mCenterX;
float mCenterY;
float mRadius;

View mTarget;

public RevealFrameLayout(Context context) {
this(context, null);
}

public RevealFrameLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}

public RevealFrameLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mRevealPath = new Path();
}

/**
* Animation target
*
* @hide
*/
@Override
public void setTarget(View view){
mTarget = view;
}

/**
* Epicenter of animation circle reveal
*
* @hide
*/
@Override
public void setCenter(float centerX, float centerY){
mCenterX = centerX;
mCenterY = centerY;
}

/**
* Flag that animation is enabled
*
* @hide
*/
@Override
public void setClipOutlines(boolean clip){
mClipOutlines = clip;
}

/**
* Circle radius size
*
* @hide
*/
@Override
public void setRevealRadius(float radius){
mRadius = radius;
invalidate();
}

/**
* Circle radius size
*
* @hide
*/
@Override
public float getRevealRadius(){
return mRadius;
}


@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
if(!mClipOutlines && child != mTarget)
return super.drawChild(canvas, child, drawingTime);

final int state = canvas.save();

mRevealPath.reset();
mRevealPath.addCircle(mCenterX, mCenterY, mRadius, Path.Direction.CW);

canvas.clipPath(mRevealPath);

boolean isInvalided = super.drawChild(canvas, child, drawingTime);

canvas.restoreToCount(state);

return isInvalided;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package io.codetail.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;

import io.codetail.animation.RevealAnimator;

public class RevealLinearLayout extends LinearLayout implements RevealAnimator{

Path mRevealPath;

boolean mClipOutlines;

float mCenterX;
float mCenterY;
float mRadius;

View mTarget;

public RevealLinearLayout(Context context) {
this(context, null);
}

public RevealLinearLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}

public RevealLinearLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs);
mRevealPath = new Path();
}

/**
* @hide
*/
@Override
public void setTarget(View view){
mTarget = view;
}

/**
* @hide
*/
@Override
public void setCenter(float centerX, float centerY){
mCenterX = centerX;
mCenterY = centerY;
}

/**
* @hide
*/
@Override
public void setClipOutlines(boolean clip){
mClipOutlines = clip;
}

/**
* @hide
*/
@Override
public void setRevealRadius(float radius){
mRadius = radius;
invalidate();
}

/**
* @hide
*/
@Override
public float getRevealRadius(){
return mRadius;
}


@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
if (!mClipOutlines && child != mTarget)
return super.drawChild(canvas, child, drawingTime);

final int state = canvas.save();

mRevealPath.reset();
mRevealPath.addCircle(mCenterX, mCenterY, mRadius, Path.Direction.CW);

canvas.clipPath(mRevealPath);

boolean isInvalided = super.drawChild(canvas, child, drawingTime);

canvas.restoreToCount(state);

return isInvalided;
}
}
19 changes: 19 additions & 0 deletions circular-reveal-demo/circular-reveal-demo.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

18 changes: 18 additions & 0 deletions circular-reveal-demo/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# 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
Binary file not shown.
6 changes: 6 additions & 0 deletions circular-reveal-demo/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
164 changes: 164 additions & 0 deletions circular-reveal-demo/gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#!/usr/bin/env bash

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# 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
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# 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\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-

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" ] ; 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"`

# 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

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
90 changes: 90 additions & 0 deletions circular-reveal-demo/gradlew.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@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

@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=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@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 Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_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=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
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
1 change: 1 addition & 0 deletions circular-reveal-demo/sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Loading