Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yang.jianan committed Apr 15, 2016
0 parents commit d5423bf
Show file tree
Hide file tree
Showing 62 changed files with 3,246 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
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
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
29 changes: 29 additions & 0 deletions app/build.gradle
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'

}
17 changes: 17 additions & 0 deletions 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 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);
}
}
20 changes: 20 additions & 0 deletions app/src/main/AndroidManifest.xml
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();
}
});
}
}
}
Loading

0 comments on commit d5423bf

Please sign in to comment.