-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.3" | ||
|
||
defaultConfig { | ||
applicationId "swipelistview.yjn.com.swiplistview" | ||
minSdkVersion 15 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile project(':swipelistviewlibrary') | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:23.3.0' | ||
compile 'com.jakewharton:butterknife:6.1.0' | ||
|
||
} |
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 F:\ZTEsoft\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 swipelistview.yjn.com.swiplistview; | ||
|
||
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); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="swipelistview.yjn.com.swiplistview" > | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme" > | ||
<activity android:name=".ui.MainActivity" > | ||
<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,89 @@ | ||
package swipelistview.yjn.com.swiplistview.adapter; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.BaseAdapter; | ||
import android.widget.LinearLayout; | ||
import android.widget.TextView; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
import butterknife.ButterKnife; | ||
import butterknife.InjectView; | ||
import swipelistview.yjn.com.swiplistview.R; | ||
import swipelistview.yjn.com.swiplistview.util.StringUtil; | ||
|
||
/** | ||
* Description: | ||
* Author: 0027008122 [[email protected]] | ||
* Time: 2016/3/31 16:29 | ||
* Version: 1.0 | ||
*/ | ||
public class TransferAdapter extends BaseAdapter { | ||
private Context context; | ||
private List<HashMap<String, Object>> data; | ||
|
||
public TransferAdapter(Context context, List<HashMap<String, Object>> data) { | ||
this.context = context; | ||
this.data = data; | ||
} | ||
|
||
@Override | ||
public View getView(int position, View convertView, ViewGroup parent) { | ||
ViewHolder mHolder; | ||
if (convertView == null) { | ||
convertView = LayoutInflater.from(context).inflate(R.layout.transfer_li_item, parent, false); | ||
mHolder = new ViewHolder(convertView); | ||
convertView.setTag(mHolder); | ||
} else { | ||
mHolder = (ViewHolder) convertView.getTag(); | ||
} | ||
|
||
mHolder.happyNum.setText((String) data.get(position).get("happy")); | ||
|
||
if (StringUtil.isEmpty((String) data.get(position).get("quantity"))) { | ||
//如果 quantity 没有值, 就 隐藏quantity这行所属的 LinearLayout | ||
mHolder.transferQuantityLinear.setVisibility(View.GONE); | ||
} else { | ||
mHolder.transferQuantity.setText((String) data.get(position).get("quantity")); | ||
} | ||
|
||
mHolder.transferTotal.setText((String) data.get(position).get("amount")); | ||
|
||
return convertView; | ||
} | ||
|
||
class ViewHolder { | ||
@InjectView(R.id.happy_Num) | ||
TextView happyNum; | ||
@InjectView(R.id.transfer_quantity) | ||
TextView transferQuantity; | ||
@InjectView(R.id.transfer_quantity_linear) | ||
LinearLayout transferQuantityLinear; | ||
@InjectView(R.id.transfer_total) | ||
TextView transferTotal; | ||
|
||
ViewHolder(View view) { | ||
ButterKnife.inject(this, view); | ||
} | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return data.size(); | ||
} | ||
|
||
@Override | ||
public Object getItem(int position) { | ||
return data.get(position); | ||
} | ||
|
||
@Override | ||
public long getItemId(int position) { | ||
return position; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package swipelistview.yjn.com.swiplistview.base; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
|
||
import swipelistview.yjn.com.swiplistview.widget.ToolbarWidget; | ||
|
||
/** | ||
* Created by 0027006362 [[email protected]] | ||
* Date: 2016/3/8 | ||
* Time: 11:04 | ||
*/ | ||
public class BaseActivity extends AppCompatActivity { | ||
|
||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
} | ||
|
||
public void setBackListener(Activity context,ToolbarWidget toolbar) { | ||
final Activity mContext = context; | ||
if(toolbar != null){ | ||
toolbar.setNavBtnClickListener(new ToolbarWidget.ToolbarBtnOnclickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
mContext.onBackPressed(); | ||
} | ||
}); | ||
} | ||
} | ||
} |