Skip to content

Commit ad772a6

Browse files
committed
rename
1 parent 07fe633 commit ad772a6

35 files changed

+2907
-1
lines changed

baselibrary

Lines changed: 0 additions & 1 deletion
This file was deleted.

baselibrarys/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

baselibrarys/build.gradle

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//apply plugin: 'com.android.application'
2+
apply plugin: 'com.android.library'
3+
apply plugin: 'android-apt'
4+
5+
android {
6+
compileSdkVersion 23
7+
buildToolsVersion "23.0.3"
8+
9+
defaultConfig {
10+
minSdkVersion 15
11+
targetSdkVersion 23
12+
versionCode 1
13+
versionName "1.0"
14+
}
15+
buildTypes {
16+
release {
17+
minifyEnabled false
18+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19+
}
20+
}
21+
}
22+
23+
ext {
24+
supportLibVersion = '23.1.1'
25+
}
26+
27+
dependencies {
28+
compile fileTree(dir: 'libs', include: ['*.jar'])
29+
// testCompile 'junit:junit:4.12'
30+
compile "com.android.support:appcompat-v7:${supportLibVersion}"
31+
// compile "com.android.support:support-v4:${supportLibVersion}"
32+
// compile "com.android.support:cardview-v7:${supportLibVersion}"
33+
// compile "com.android.support:design:${supportLibVersion}"
34+
// compile "com.android.support:support-annotations:${supportLibVersion}"
35+
compile 'com.jakewharton:butterknife:8.1.0'
36+
apt 'com.jakewharton:butterknife-compiler:8.1.0'
37+
38+
}

baselibrarys/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
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 E:\android\android_adt_eclipse\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+
#}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.qianmi.baselibrary">
4+
<uses-permission android:name="android.permission.INTERNET"/>
5+
<uses-permission android:name="android.permission.WAKE_LOCK"/>
6+
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/>
7+
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
8+
<uses-permission android:name="android.permission.GET_TASKS"/>
9+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
10+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
11+
<uses-permission android:name="android.permission.CAMERA"/>
12+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
13+
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
14+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
15+
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
16+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
17+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
18+
<uses-permission android:name="android.permission.READ_LOGS"/>
19+
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
20+
<uses-permission android:name="android.permission.VIBRATE"/>
21+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
22+
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
23+
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
24+
<application
25+
android:allowBackup="true"
26+
android:label="@string/app_name"
27+
android:supportsRtl="true">
28+
</application>
29+
30+
</manifest>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.qianmi.baselibrary;
2+
3+
/**
4+
* Created by su on 2016/6/27.
5+
*/
6+
public class AppConfig {
7+
8+
public static final String PointManagerModuleActivity = "com.qianmi.pointmanager.PointActivity";
9+
public static final String OrderManagerModuleActivity = "com.qianmi.small.orderlibrary.OrderActivity";
10+
11+
public static final String ORDER_INTENT_VALUE = "orderIntentValue";
12+
13+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.qianmi.baselibrary;
2+
3+
import android.content.Intent;
4+
import android.content.res.Resources;
5+
import android.support.v7.app.AppCompatActivity;
6+
import android.os.Bundle;
7+
8+
9+
public abstract class BaseActivity extends AppCompatActivity{
10+
11+
@Override
12+
protected void onCreate(Bundle savedInstanceState) {
13+
super.onCreate(savedInstanceState);
14+
}
15+
16+
17+
public Resources getBaseResources(){
18+
return getResources();
19+
}
20+
21+
22+
public Intent getStartActivityIntent(String activityName) {
23+
Intent intent = new Intent();
24+
intent.setClassName(this, activityName);
25+
return intent;
26+
}
27+
}
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
package com.qianmi.baselibrary.adapter;
2+
3+
/**
4+
* Created by su on 2015/11/12.
5+
*/
6+
7+
8+
import android.content.Context;
9+
import android.view.LayoutInflater;
10+
import android.view.View;
11+
import android.view.ViewGroup;
12+
import android.widget.BaseAdapter;
13+
14+
15+
import java.util.List;
16+
17+
/**
18+
* 通用 ViewPagerAdapter
19+
*
20+
* @param <T>
21+
*/
22+
public abstract class CommonAdapter<T> extends BaseAdapter {
23+
24+
private static final int TYPE_SECTION_ITEM = 0;
25+
private static final int TYPE_ITEM = 1;
26+
private int viewTypeCount = 1;
27+
private SectionCallBack mCallBack;
28+
private int mSectionLayoutId;
29+
30+
protected LayoutInflater mInflater;
31+
protected Context mContext;
32+
protected List<T> mDatas;
33+
protected final int mItemLayoutId;
34+
35+
/**
36+
* 初始化通用Adapter
37+
*
38+
* @param context 上下文
39+
* @param mDatas 需要显示的数据集合
40+
* @param itemLayoutId 子布局文件
41+
*/
42+
public CommonAdapter(Context context, List<T> mDatas, int itemLayoutId) {
43+
this.mContext = context;
44+
this.mInflater = LayoutInflater.from(context);
45+
this.mDatas = mDatas;
46+
this.mItemLayoutId = itemLayoutId;
47+
}
48+
49+
public void refresh(List<T> mDatas) {
50+
this.mDatas = mDatas;
51+
notifyDataSetChanged();
52+
}
53+
54+
@Override
55+
public int getCount() {
56+
return mDatas.size();
57+
}
58+
59+
@Override
60+
public T getItem(int position) {
61+
return mDatas.get(position);
62+
}
63+
64+
@Override
65+
public long getItemId(int position) {
66+
return position;
67+
}
68+
69+
@Override
70+
public int getViewTypeCount() {
71+
return viewTypeCount;
72+
}
73+
74+
public void setViewTypeCount(int viewTypeCount) {
75+
this.viewTypeCount = viewTypeCount;
76+
if (this.viewTypeCount > 1 && mCallBack != null) {
77+
mSectionLayoutId = mCallBack.addSectionLayout();
78+
}
79+
}
80+
81+
@Override
82+
public int getItemViewType(int position) {
83+
if (null == mDatas || position < 0 || position > getCount()) {
84+
return TYPE_ITEM;
85+
}
86+
87+
if (mCallBack != null && mCallBack.isSection(position)) {
88+
return TYPE_SECTION_ITEM;
89+
}
90+
return TYPE_ITEM;
91+
}
92+
93+
@Override
94+
public View getView(int position, View convertView, ViewGroup parent) {
95+
96+
int itemViewType = getItemViewType(position);
97+
98+
switch (itemViewType) {
99+
case TYPE_ITEM:
100+
//从ViewHolder中获取控件view,若为空则创建
101+
final ViewHolder viewHolder = getViewHolder(position, convertView, parent);
102+
convert(viewHolder, getItem(position), position);
103+
104+
return viewHolder.getConvertView();
105+
106+
case TYPE_SECTION_ITEM:
107+
View view = mInflater.inflate(mSectionLayoutId, null);
108+
mCallBack.setView(view,position);
109+
return view;
110+
}
111+
return null;
112+
}
113+
114+
/**
115+
* 抽取出getView中间改变的部分
116+
*
117+
* @param helper holder缓存对象
118+
* @param item Bean对象
119+
*/
120+
public abstract void convert(ViewHolder helper, T item, int position);
121+
122+
/**
123+
* 获得ViewHolder中的view
124+
*
125+
* @param position
126+
* @param convertView
127+
* @param parent
128+
* @return
129+
*/
130+
private ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
131+
return ViewHolder.get(mContext, convertView, parent, mItemLayoutId, position);
132+
}
133+
134+
public void addCallBack(SectionCallBack callBack) {
135+
this.mCallBack = callBack;
136+
}
137+
138+
/**
139+
*section回调接口
140+
*/
141+
public interface SectionCallBack {
142+
143+
boolean isSection(int position);
144+
145+
int addSectionLayout();
146+
147+
void setView(View view, int position);
148+
}
149+
}

0 commit comments

Comments
 (0)