Skip to content

Commit 1222cc7

Browse files
author
luobl
committed
first commit
0 parents  commit 1222cc7

29 files changed

+633
-0
lines changed

.classpath

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
8+
<classpathentry kind="output" path="bin/classes"/>
9+
</classpath>

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
gen/
2+
bin/
3+
.setting/
4+

.project

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>CardView</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>

AndroidManifest.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.chiemy.cardview"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<uses-sdk
8+
android:minSdkVersion="14"
9+
android:targetSdkVersion="19" />
10+
11+
<application
12+
android:allowBackup="true"
13+
android:icon="@drawable/ic_launcher"
14+
android:label="@string/app_name"
15+
android:theme="@style/AppTheme" >
16+
<activity
17+
android:name=".MainActivity"
18+
android:label="@string/app_name" >
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
</activity>
25+
</application>
26+
27+
</manifest>

ic_launcher-web.png

50.2 KB
Loading

libs/android-support-v4.jar

741 KB
Binary file not shown.

libs/nineoldandroids-2.4.0.jar

108 KB
Binary file not shown.

proguard-project.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To enable ProGuard in your project, edit project.properties
2+
# to define the proguard.config property as described in that file.
3+
#
4+
# Add project specific ProGuard rules here.
5+
# By default, the flags in this file are appended to flags specified
6+
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7+
# You can edit the include path and order by changing the ProGuard
8+
# include property in project.properties.
9+
#
10+
# For more details, see
11+
# http://developer.android.com/guide/developing/tools/proguard.html
12+
13+
# Add any project specific keep options here:
14+
15+
# If your project uses WebView with JS, uncomment the following
16+
# and specify the fully qualified class name to the JavaScript interface
17+
# class:
18+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19+
# public *;
20+
#}

project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=android-19

res/drawable-hdpi/card_bg.9.png

212 Bytes
Loading

res/drawable-hdpi/ic_launcher.png

7.48 KB
Loading

res/drawable-mdpi/ic_launcher.png

3.69 KB
Loading

res/drawable-xhdpi/ic_launcher.png

12.2 KB
Loading

res/drawable-xxhdpi/ic_launcher.png

24.2 KB
Loading

res/layout/activity_main.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
tools:context="com.chiemy.cardview.MainActivity" >
6+
7+
<com.chiemy.cardview.view.CardView
8+
android:id="@+id/cardView1"
9+
android:layout_width="match_parent"
10+
android:layout_height="match_parent"
11+
android:padding="10dp"
12+
>
13+
</com.chiemy.cardview.view.CardView>
14+
15+
</RelativeLayout>

res/layout/item_layout.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
>
6+
7+
<TextView
8+
android:id="@+id/textView1"
9+
android:layout_width="match_parent"
10+
android:layout_height="wrap_content"
11+
android:gravity="center"
12+
android:padding="20dp"
13+
android:text="TextView" />
14+
15+
<Button
16+
android:id="@+id/button1"
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:layout_below="@+id/textView1"
20+
android:text="Button" />
21+
22+
</RelativeLayout>

res/menu/main.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
tools:context="com.chiemy.cardview.MainActivity" >
4+
5+
<item
6+
android:id="@+id/action_settings"
7+
android:orderInCategory="100"
8+
android:showAsAction="never"
9+
android:title="@string/action_settings"/>
10+
11+
</menu>

res/values-v11/styles.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme for API 11+. This theme completely replaces
5+
AppBaseTheme from res/values/styles.xml on API 11+ devices.
6+
-->
7+
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
8+
<!-- API 11 theme customizations can go here. -->
9+
</style>
10+
11+
</resources>

res/values-v14/styles.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme for API 14+. This theme completely replaces
5+
AppBaseTheme from BOTH res/values/styles.xml and
6+
res/values-v11/styles.xml on API 14+ devices.
7+
-->
8+
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
9+
<!-- API 14 theme customizations can go here. -->
10+
</style>
11+
12+
</resources>

res/values-w820dp/dimens.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<resources>
2+
3+
<!--
4+
Example customization of dimensions originally defined in res/values/dimens.xml
5+
(such as screen margins) for screens with more than 820dp of available width. This
6+
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
7+
-->
8+
<dimen name="activity_horizontal_margin">64dp</dimen>
9+
10+
</resources>

res/values/carcontainer_attrs.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<declare-styleable name="CardContainer">
4+
<attr name="android:gravity"/>
5+
<attr name="orientation" format="enum">
6+
<enum name="ordered" value="0"/>
7+
<enum name="disordered" value="1"/>
8+
</attr>
9+
</declare-styleable>
10+
</resources>

res/values/color.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="card_bg">#EBEBEB</color>
4+
<color name="card_outline">#D0D0CE</color>
5+
</resources>

res/values/dimens.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<resources>
2+
3+
<!-- Default screen margins, per the Android Design guidelines. -->
4+
<dimen name="activity_horizontal_margin">16dp</dimen>
5+
<dimen name="activity_vertical_margin">16dp</dimen>
6+
7+
</resources>

res/values/strings.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<string name="app_name">CardView</string>
5+
<string name="hello_world">Hello world!</string>
6+
<string name="action_settings">Settings</string>
7+
8+
</resources>

res/values/styles.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme, dependent on API level. This theme is replaced
5+
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
6+
-->
7+
<style name="AppBaseTheme" parent="android:Theme.Light">
8+
<!--
9+
Theme customizations available in newer API levels can go in
10+
res/values-vXX/styles.xml, while customizations related to
11+
backward-compatibility can go here.
12+
-->
13+
</style>
14+
15+
<!-- Application theme. -->
16+
<style name="AppTheme" parent="AppBaseTheme">
17+
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
18+
</style>
19+
20+
</resources>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package com.chiemy.cardview;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import android.app.Activity;
7+
import android.content.Context;
8+
import android.os.Bundle;
9+
import android.view.LayoutInflater;
10+
import android.view.View;
11+
import android.view.ViewGroup;
12+
import android.widget.TextView;
13+
import android.widget.Toast;
14+
15+
import com.chiemy.cardview.view.CardStackAdapter;
16+
import com.chiemy.cardview.view.CardView;
17+
import com.chiemy.cardview.view.CardView.OnCardClickListener;
18+
19+
public class MainActivity extends Activity {
20+
private List<String> list;
21+
@Override
22+
protected void onCreate(Bundle savedInstanceState) {
23+
super.onCreate(savedInstanceState);
24+
setContentView(R.layout.activity_main);
25+
CardView cardView = (CardView) findViewById(R.id.cardView1);
26+
cardView.setOnCardClickListener(new OnCardClickListener() {
27+
@Override
28+
public void onCardClick(View view, int position) {
29+
Toast.makeText(MainActivity.this, position + "", Toast.LENGTH_SHORT).show();
30+
}
31+
});
32+
MyCardAdapter adapter = new MyCardAdapter(this);
33+
adapter.addAll(initData());
34+
cardView.setAdapter(adapter);
35+
}
36+
37+
private List<String> initData() {
38+
List<String> list = new ArrayList<String>();
39+
list.add("a");
40+
list.add("b");
41+
list.add("c");
42+
list.add("d");
43+
list.add("e");
44+
list.add("f");
45+
list.add("g");
46+
return list;
47+
}
48+
49+
public class MyCardAdapter extends CardStackAdapter<String>{
50+
51+
public MyCardAdapter(Context context) {
52+
super(context);
53+
}
54+
55+
@Override
56+
protected View getCardView(int position,
57+
View convertView, ViewGroup parent) {
58+
TextView tv = null;
59+
if(convertView == null) {
60+
LayoutInflater inflater = LayoutInflater.from(MainActivity.this);
61+
convertView = inflater.inflate(R.layout.item_layout, parent, false);
62+
}
63+
tv = (TextView) convertView.findViewById(R.id.textView1);
64+
tv.setText(getItem(position).toString());
65+
return convertView;
66+
}
67+
}
68+
69+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.chiemy.cardview.view;
2+
3+
import android.widget.BaseAdapter;
4+
5+
public abstract class BaseCardStackAdapter extends BaseAdapter {
6+
7+
}

0 commit comments

Comments
 (0)