forked from kikoso/Swipeable-Cards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- TextCardModel - TextCardStackAdapter - and TextCardActivity as test
- Loading branch information
wujiawei
committed
Jun 21, 2016
1 parent
943de4e
commit 47fd523
Showing
12 changed files
with
224 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
AndTinder/src/main/java/com/andtinder/model/TextCardModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.andtinder.model; | ||
|
||
/** | ||
* Created by einverne on 16/6/21. | ||
*/ | ||
|
||
public class TextCardModel extends CardModel { | ||
|
||
private String textShow; | ||
|
||
public TextCardModel(String textShow) { | ||
this.textShow = textShow; | ||
} | ||
|
||
public String getTextShow() { | ||
return textShow; | ||
} | ||
|
||
public void setTextShow(String textShow) { | ||
this.textShow = textShow; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
AndTinder/src/main/java/com/andtinder/view/TextCardStackAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.andtinder.view; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.andtinder.R; | ||
import com.andtinder.model.CardModel; | ||
import com.andtinder.model.TextCardModel; | ||
|
||
/** | ||
* Created by einverne on 16/6/21. | ||
*/ | ||
|
||
public class TextCardStackAdapter extends CardStackAdapter { | ||
public TextCardStackAdapter(Context context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
protected View getCardView(int position, CardModel model, View convertView, ViewGroup parent) { | ||
if (convertView == null) { | ||
LayoutInflater inflater = LayoutInflater.from(getContext()); | ||
convertView = inflater.inflate(R.layout.text_card_inner, parent, false); | ||
|
||
assert convertView != null; | ||
} | ||
|
||
((TextView) convertView.findViewById(R.id.tv_main)).setText(((TextCardModel)model).getTextShow()); | ||
|
||
return convertView; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="400dp" | ||
android:layout_height="400dp" | ||
android:background="@android:color/darker_gray" | ||
android:gravity="center_vertical|center_horizontal|center"> | ||
|
||
<TextView | ||
android:id="@+id/tv_main" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentLeft="true" | ||
android:layout_alignParentStart="true" | ||
android:layout_alignParentTop="true" | ||
android:textColor="@android:color/holo_green_dark" | ||
android:textSize="50sp" | ||
android:text="demo" /> | ||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.andtinder.demo"> | ||
|
||
<uses-sdk | ||
android:minSdkVersion="13" | ||
/> | ||
<application android:allowBackup="true" | ||
android:label="@string/app_name" | ||
<uses-sdk android:minSdkVersion="13" /> | ||
|
||
<android:uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<android:uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
<android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name="com.andtinder.demo.MainActivity" | ||
android:label="@string/app_name" > | ||
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=".TextCardActivity"></activity> | ||
</application> | ||
</manifest> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
AndTinderDemo/src/main/java/com/andtinder/demo/TextCardActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.andtinder.demo; | ||
|
||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
|
||
import com.andtinder.model.TextCardModel; | ||
import com.andtinder.view.CardContainer; | ||
import com.andtinder.view.TextCardStackAdapter; | ||
|
||
public class TextCardActivity extends AppCompatActivity { | ||
|
||
private CardContainer mTextCardContainer; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_text_card); | ||
|
||
mTextCardContainer = (CardContainer) findViewById(R.id.textCardContainer); | ||
|
||
TextCardStackAdapter textCardStackAdapter = new TextCardStackAdapter(this); | ||
textCardStackAdapter.add(new TextCardModel("text")); | ||
textCardStackAdapter.add(new TextCardModel("text2")); | ||
textCardStackAdapter.add(new TextCardModel("text3")); | ||
textCardStackAdapter.add(new TextCardModel("text4")); | ||
|
||
mTextCardContainer.setAdapter(textCardStackAdapter); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/activity_text_card" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context="com.andtinder.demo.TextCardActivity"> | ||
|
||
<com.andtinder.view.CardContainer | ||
android:id="@+id/textCardContainer" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:gravity="center"> | ||
|
||
</com.andtinder.view.CardContainer> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<item | ||
android:id="@+id/menu_text_card" | ||
android:title="TextCard" /> | ||
</menu> |
Oops, something went wrong.