Skip to content

Commit c58d94c

Browse files
initial commit
0 parents  commit c58d94c

File tree

31 files changed

+641
-0
lines changed

31 files changed

+641
-0
lines changed

.gitignore

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Eclipse
2+
.project
3+
.metadata
4+
tmp/**
5+
tmp/**/*
6+
*.tmp
7+
*.bak
8+
*~.nib
9+
.classpath
10+
.settings/
11+
.loadpath
12+
**/bin/*
13+
**/gen/*
14+
testData
15+
testCache
16+
server.config
17+
18+
# Locally stored "Eclipse launch configurations"
19+
*.launch
20+
21+
# Android
22+
# built application files
23+
*.apk
24+
25+
# Local configuration file (sdk path, etc)
26+
local.properties
27+
28+
# Other
29+
.DS_Store
30+
31+
# Android Studio
32+
.idea
33+
*.iml
34+
*.ipr
35+
*.iws
36+
gen-external-apklibs
37+
38+
# Gradle
39+
.gradle
40+
build

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "23.0.2"
6+
7+
defaultConfig {
8+
applicationId "com.juanpabloprado.cardstacksample"
9+
minSdkVersion 14
10+
targetSdkVersion 23
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
testCompile 'junit:junit:4.12'
25+
compile 'com.android.support:appcompat-v7:23.1.1'
26+
compile 'com.android.support:design:23.1.1'
27+
compile 'com.github.wenchaojiang:AndroidSwipeableCardStack:0.1.1@aar'
28+
}

app/proguard-rules.pro

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in C:\Users\Juan\Android\sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.juanpabloprado.cardstacksample;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
package="com.juanpabloprado.cardstacksample"
4+
xmlns:android="http://schemas.android.com/apk/res/android"
5+
xmlns:tools="http://schemas.android.com/tools">
6+
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:supportsRtl="true"
12+
android:theme="@style/AppTheme"
13+
tools:replace="android:icon">
14+
<activity
15+
android:name=".MainActivity"
16+
android:label="@string/app_name"
17+
android:theme="@style/AppTheme.NoActionBar">
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN" />
20+
21+
<category android:name="android.intent.category.LAUNCHER" />
22+
</intent-filter>
23+
</activity>
24+
</application>
25+
26+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.juanpabloprado.cardstacksample;
2+
3+
import android.content.Context;
4+
import android.view.View;
5+
import android.view.ViewGroup;
6+
import android.widget.ArrayAdapter;
7+
import android.widget.TextView;
8+
9+
public class CardsDataAdapter extends ArrayAdapter<String> {
10+
11+
public CardsDataAdapter(Context context, int resource) {
12+
super(context, resource);
13+
}
14+
15+
@Override
16+
public View getView(int position, final View contentView, ViewGroup parent){
17+
TextView v = (TextView)(contentView.findViewById(R.id.content));
18+
v.setText(getItem(position));
19+
return contentView;
20+
}
21+
22+
}
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.juanpabloprado.cardstacksample;
2+
3+
import android.os.Bundle;
4+
import android.support.v7.app.AppCompatActivity;
5+
import android.support.v7.widget.Toolbar;
6+
import android.view.Menu;
7+
import android.view.MenuItem;
8+
import com.wenchao.cardstack.CardStack;
9+
10+
public class MainActivity extends AppCompatActivity {
11+
private CardStack mCardStack;
12+
private CardsDataAdapter mCardAdapter;
13+
14+
@Override protected void onCreate(Bundle savedInstanceState) {
15+
super.onCreate(savedInstanceState);
16+
setContentView(R.layout.activity_main);
17+
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
18+
setSupportActionBar(toolbar);
19+
20+
mCardStack = (CardStack)findViewById(R.id.cardStackContainer);
21+
22+
//
23+
mCardStack.setContentResource(R.layout.card_content);
24+
mCardStack.setStackMargin(20);
25+
26+
//
27+
mCardAdapter = new CardsDataAdapter(getApplicationContext(),0);
28+
mCardAdapter.add("test1");
29+
mCardAdapter.add("test2");
30+
mCardAdapter.add("test3");
31+
mCardAdapter.add("test4");
32+
mCardAdapter.add("test5");
33+
34+
35+
36+
mCardStack.setAdapter(mCardAdapter);
37+
}
38+
39+
@Override public boolean onCreateOptionsMenu(Menu menu) {
40+
// Inflate the menu; this adds items to the action bar if it is present.
41+
getMenuInflater().inflate(R.menu.menu_main, menu);
42+
return true;
43+
}
44+
45+
@Override public boolean onOptionsItemSelected(MenuItem item) {
46+
// Handle action bar item clicks here. The action bar will
47+
// automatically handle clicks on the Home/Up button, so long
48+
// as you specify a parent activity in AndroidManifest.xml.
49+
int id = item.getItemId();
50+
51+
//noinspection SimplifiableIfStatement
52+
if (id == R.id.action_settings) {
53+
return true;
54+
}
55+
56+
return super.onOptionsItemSelected(item);
57+
}
58+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
android:fitsSystemWindows="true"
8+
tools:context="com.juanpabloprado.cardstacksample.MainActivity">
9+
10+
<android.support.design.widget.AppBarLayout
11+
android:layout_width="match_parent"
12+
android:layout_height="wrap_content"
13+
android:theme="@style/AppTheme.AppBarOverlay">
14+
15+
<android.support.v7.widget.Toolbar
16+
android:id="@+id/toolbar"
17+
android:layout_width="match_parent"
18+
android:layout_height="?attr/actionBarSize"
19+
android:background="?attr/colorPrimary"
20+
app:popupTheme="@style/AppTheme.PopupOverlay" />
21+
22+
</android.support.design.widget.AppBarLayout>
23+
24+
<include layout="@layout/content_main" />
25+
26+
</android.support.design.widget.CoordinatorLayout>
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:orientation="vertical" android:layout_width="match_parent"
5+
android:layout_height="match_parent">
6+
<TextView
7+
android:id="@+id/content"
8+
android:layout_width="wrap_content"
9+
android:layout_height="wrap_content"
10+
/>
11+
12+
</LinearLayout>
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
android:paddingBottom="@dimen/activity_vertical_margin"
8+
android:paddingLeft="@dimen/activity_horizontal_margin"
9+
android:paddingRight="@dimen/activity_horizontal_margin"
10+
android:paddingTop="@dimen/activity_vertical_margin"
11+
app:layout_behavior="@string/appbar_scrolling_view_behavior"
12+
tools:context="com.juanpabloprado.cardstacksample.MainActivity"
13+
tools:showIn="@layout/activity_main">
14+
15+
<com.wenchao.cardstack.CardStack
16+
android:id="@+id/cardStackContainer"
17+
android:layout_width="match_parent"
18+
android:layout_height="match_parent"
19+
android:padding = "20dp"
20+
android:clipChildren="false"
21+
android:clipToPadding="false"
22+
/>
23+
</RelativeLayout>

app/src/main/res/menu/menu_main.xml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:app="http://schemas.android.com/apk/res-auto"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
tools:context="com.juanpabloprado.cardstacksample.MainActivity">
5+
<item
6+
android:id="@+id/action_settings"
7+
android:orderInCategory="100"
8+
android:title="@string/action_settings"
9+
app:showAsAction="never" />
10+
</menu>
3.34 KB
Loading
2.15 KB
Loading
4.73 KB
Loading
7.54 KB
Loading
10.2 KB
Loading
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<resources>>
2+
3+
<style name="AppTheme.NoActionBar">
4+
<item name="windowActionBar">false</item>
5+
<item name="windowNoTitle">true</item>
6+
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
7+
<item name="android:statusBarColor">@android:color/transparent</item>
8+
</style>
9+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<resources>
2+
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
3+
(such as screen margins) for screens with more than 820dp of available width. This
4+
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
5+
<dimen name="activity_horizontal_margin">64dp</dimen>
6+
</resources>

app/src/main/res/values/colors.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#3F51B5</color>
4+
<color name="colorPrimaryDark">#303F9F</color>
5+
<color name="colorAccent">#FF4081</color>
6+
</resources>

app/src/main/res/values/dimens.xml

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

app/src/main/res/values/strings.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<resources>
2+
<string name="app_name">CardStackSample</string>
3+
<string name="action_settings">Settings</string>
4+
</resources>

app/src/main/res/values/styles.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<resources>
2+
3+
<!-- Base application theme. -->
4+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5+
<!-- Customize your theme here. -->
6+
<item name="colorPrimary">@color/colorPrimary</item>
7+
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8+
<item name="colorAccent">@color/colorAccent</item>
9+
</style>
10+
11+
<style name="AppTheme.NoActionBar">
12+
<item name="windowActionBar">false</item>
13+
<item name="windowNoTitle">true</item>
14+
</style>
15+
16+
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
17+
18+
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
19+
20+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.juanpabloprado.cardstacksample;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.*;
6+
7+
/**
8+
* To work on unit tests, switch the Test Artifact in the Build Variants view.
9+
*/
10+
public class ExampleUnitTest {
11+
@Test public void addition_isCorrect() throws Exception {
12+
assertEquals(4, 2 + 2);
13+
}
14+
}

build.gradle

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
jcenter()
6+
}
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:1.5.0'
9+
10+
// NOTE: Do not place your application dependencies here; they belong
11+
// in the individual module build.gradle files
12+
}
13+
}
14+
15+
allprojects {
16+
repositories {
17+
jcenter()
18+
maven { url "https://jitpack.io" }
19+
}
20+
}
21+
22+
task clean(type: Delete) {
23+
delete rootProject.buildDir
24+
}

0 commit comments

Comments
 (0)