Skip to content

Commit

Permalink
同步eclipse版至studio版;提高版本号
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLemon committed Apr 8, 2017
1 parent 01762c7 commit 7a92275
Show file tree
Hide file tree
Showing 154 changed files with 519 additions and 721 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion ZBLibrary(ADT)/ZBLibrary/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<resources>

<string name="app_name">坐标标准库</string>
<string name="app_version">14.2</string>
<string name="app_version">15.0</string>
<string name="share_app">我发现了一款很好用的Android快速开发框架,叫 Android-ZBLibrary ,快去GitHub上看看吧~</string>
<string name="page_return">返回</string>
<string name="remind">提示</string>
Expand Down
2 changes: 1 addition & 1 deletion ZBLibrary(ADT)/ZBLibraryDemoApp/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="zblibrary.demo"
android:versionCode="22"
android:versionCode="23"
android:versionName="@string/app_version" >

<uses-sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private void downloadApp() {
runThread(TAG + "downloadApp", new Runnable() {
@Override
public void run() {
File file = DownloadUtil.downLoadFile(context, "HungryBat", ".apk", Constant.APP_DOWNLOAD_WEBSITE);
File file = DownloadUtil.downLoadFile(context, "ZBLibraryDemo", ".apk", Constant.APP_DOWNLOAD_WEBSITE);
dismissProgressDialog();
DownloadUtil.openFile(context, file);
}
Expand Down
5 changes: 1 addition & 4 deletions ZBLibrary(AndroidStudio)/.idea/misc.xml

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

1 change: 0 additions & 1 deletion ZBLibrary(AndroidStudio)/QRCodeLibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':ZBLibrary')
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<application
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<activity
android:name="zuo.biao.library.ui.SelectPictureActivity"
android:screenOrientation="portrait"
Expand Down Expand Up @@ -81,6 +82,7 @@
android:screenOrientation="portrait"
android:theme="@style/Window"
android:windowSoftInputMode="stateAlwaysHidden" />

</application>

<!-- 复制粘贴到你的工程的AndroidManifest.xml内对应位置 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
Expand Down Expand Up @@ -99,12 +101,14 @@ protected void onCreate(Bundle savedInstanceState) {
inflater = getLayoutInflater();

threadNameList = new ArrayList<String>();

BaseBroadcastReceiver.register(context, receiver, ACTION_EXIT_APP);
}

/**
* activity的默认标题TextView,layout.xml中用@id/tvBaseTitle绑定。子Activity内调用autoSetTitle方法 会优先使用INTENT_TITLE
* 默认标题TextView,layout.xml中用@id/tvBaseTitle绑定。子Activity内调用autoSetTitle方法 会优先使用INTENT_TITLE
* @see #autoSetTitle
* @warn 如果子Activity的layout中没有android:id="@id/tvBaseTitle"的TextView,使用tvBaseTitle前必须在子Activity中赋值
* @warn 如果子Activity的layout中没有android:id="@id/tvBaseTitle"的TextView,使用前必须在子Activity中赋值
*/
@Nullable
protected TextView tvBaseTitle;
Expand Down Expand Up @@ -201,7 +205,7 @@ public <V extends View> V findViewById(int id, OnClickListener l) {
* @must 在UI线程中调用
*/
protected void autoSetTitle() {
autoSetTitle(tvBaseTitle);
tvBaseTitle = autoSetTitle(tvBaseTitle);
}
/**自动把标题设置为上个Activity传入的INTENT_TITLE,建议在子类initView中使用
* @param tvTitle
Expand Down Expand Up @@ -507,6 +511,7 @@ protected void onPause() {
protected void onDestroy() {
Log.d(TAG, "\n onDestroy <<<<<<<<<<<<<<<<<<<<<<<");
dismissProgressDialog();
BaseBroadcastReceiver.unregister(context, receiver);
ThreadManager.getInstance().destroyThread(threadNameList);
if (view != null) {
try {
Expand Down Expand Up @@ -536,6 +541,24 @@ protected void onDestroy() {
Log.d(TAG, "onDestroy >>>>>>>>>>>>>>>>>>>>>>>>\n");
}



private BroadcastReceiver receiver = new BroadcastReceiver() {

public void onReceive(Context context, Intent intent) {
String action = intent == null ? null : intent.getAction();
if (isAlive() == false || StringUtil.isNotEmpty(action, true) == false) {
Log.e(TAG, "receiver.onReceive isAlive() == false" +
" || StringUtil.isNotEmpty(action, true) == false >> return;");
return;
}

if (ACTION_EXIT_APP.equals(action)) {
finish();
}
}
};



//手机返回键和菜单键实现同点击标题栏左右按钮效果<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ public BaseAdapter(Activity context) {
* 传进来的数据列表
*/
public List<T> list;
public List<T> getList() {
return list;
}
/**刷新列表
*/
public synchronized void refresh(List<T> list) {
this.list = list == null ? null : new ArrayList<T>(list);
notifyDataSetChanged();
}

@Override
public int getCount() {
return list == null ? 0 : list.size();
Expand All @@ -90,9 +93,9 @@ public long getItemId(int position) {
return position;
}


//预加载,可不使用 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

protected OnReachViewBorderListener onReachViewBorderListener;
/**设置到达parent的边界的监听
* @param onReachViewBorderListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void onReceive(Context context, Intent intent) {
* @param action
* @return
*/
public static BaseBroadcastReceiver register(Context context, @Nullable BaseBroadcastReceiver receiver, String action) {
public static BroadcastReceiver register(Context context, @Nullable BroadcastReceiver receiver, String action) {
return register(context, receiver, new String[] {action});
}
/**注册广播接收器
Expand All @@ -91,7 +91,7 @@ public static BaseBroadcastReceiver register(Context context, @Nullable BaseBroa
* @param actions
* @return
*/
public static BaseBroadcastReceiver register(Context context, @Nullable BaseBroadcastReceiver receiver, String[] actions) {
public static BroadcastReceiver register(Context context, @Nullable BroadcastReceiver receiver, String[] actions) {
return register(context, receiver, actions == null ? null : Arrays.asList(actions));
}
/**注册广播接收器
Expand All @@ -100,7 +100,7 @@ public static BaseBroadcastReceiver register(Context context, @Nullable BaseBroa
* @param actionList
* @return
*/
public static BaseBroadcastReceiver register(Context context, @Nullable BaseBroadcastReceiver receiver, List<String> actionList) {
public static BroadcastReceiver register(Context context, @Nullable BroadcastReceiver receiver, List<String> actionList) {
IntentFilter filter = new IntentFilter();
for (String action : actionList) {
if (StringUtil.isNotEmpty(action, true)) {
Expand All @@ -115,7 +115,7 @@ public static BaseBroadcastReceiver register(Context context, @Nullable BaseBroa
* @param filter
* @return
*/
public static BaseBroadcastReceiver register(Context context, @Nullable BaseBroadcastReceiver receiver, IntentFilter filter) {
public static BroadcastReceiver register(Context context, @Nullable BroadcastReceiver receiver, IntentFilter filter) {
Log.i(TAG, "register >>>");
if (context == null || filter == null) {
Log.e(TAG, "register context == null || filter == null >> return;");
Expand All @@ -134,7 +134,7 @@ public static BaseBroadcastReceiver register(Context context, @Nullable BaseBroa
* @param receiver
* @return
*/
public static void unregister(Context context, BaseBroadcastReceiver receiver) {
public static void unregister(Context context, BroadcastReceiver receiver) {
Log.i(TAG, "unregister >>>");
if (context == null || receiver == null) {
Log.e(TAG, "unregister context == null || receiver == null >> return;");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

package zuo.biao.library.base;

import android.view.View;
import android.widget.BaseAdapter;

import java.util.List;

import zuo.biao.library.interfaces.AdapterCallBack;
Expand All @@ -23,8 +26,6 @@
import zuo.biao.library.ui.xlistview.XListView;
import zuo.biao.library.ui.xlistview.XListView.IXListViewListener;
import zuo.biao.library.util.Log;
import android.view.View;
import android.widget.BaseAdapter;

/**基础http获取列表的Activity
* @author Lemon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ public abstract class BaseModel implements Serializable {

public long id;

//对子类不起作用
// /**默认构造方法,JSON等解析时必须要有
// */
// public BaseModel() {
// }


public long getId() {
return id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

package zuo.biao.library.base;

import java.util.ArrayList;
import java.util.List;

import zuo.biao.library.util.CommonUtil;
import zuo.biao.library.util.Log;
import android.app.Activity;
Expand Down Expand Up @@ -49,7 +52,7 @@ public BaseView(Activity context, Resources resources) {
/**点击View的事件监听回调,主要是为了activity或fragment间接通过adapter接管baseView的点击事件
* @param <T>
* @param <BV>
* @must 子类重写setOnClickListener方法且view.setOnClickListener(l)事件统一写在这个方法里面。具体见 .DemoView2
* @must 子类重写setOnClickListener方法且view.setOnClickListener(listener)事件统一写在这个方法里面
*/
public interface OnViewClickListener<T, BV extends BaseView<T>> {
/**onClick(v)事件由这个方法接管
Expand All @@ -68,34 +71,41 @@ public interface OnDataChangedListener {

public OnDataChangedListener onDataChangedListener;//数据改变回调监听回调的实例
/**设置数据改变事件监听回调
* @param l
* @param listener
*/
public void setOnDataChangedListener(OnDataChangedListener l) {
onDataChangedListener = l;
public void setOnDataChangedListener(OnDataChangedListener listener) {
onDataChangedListener = listener;
}

public OnTouchListener onTouchListener;//接触View回调监听回调的实例
/**设置接触View事件监听回调
* @param l
* @param listener
*/
public void setOnTouchListener(OnTouchListener l) {
onTouchListener = l;
public void setOnTouchListener(OnTouchListener listener) {
onTouchListener = listener;
}

public OnClickListener onClickListener;//点击View回调监听回调的实例
/**设置点击View事件监听回调
* @param l
* @param listener
*/
public void setOnClickListener(OnClickListener l) {
onClickListener = l;
public void setOnClickListener(OnClickListener listener) {
onClickListener = listener;
if (onClickViewList != null) {
for (View v : onClickViewList) {
if (v != null) {
v.setOnClickListener(listener);
}
}
}
}

public OnLongClickListener onLongClickListener;//长按View回调监听回调的实例
/**设置长按View事件监听回调
* @param l
* @param listener
*/
public void setOnLongClickListener(OnLongClickListener l) {
onLongClickListener = l;
public void setOnLongClickListener(OnLongClickListener listener) {
onLongClickListener = listener;
}


Expand All @@ -105,6 +115,7 @@ public void setOnLongClickListener(OnLongClickListener l) {
*/
protected View convertView = null;

protected List<View> onClickViewList;
/**通过id查找并获取控件,使用时不需要强转
* @param id
* @return
Expand All @@ -115,12 +126,16 @@ public <V extends View> V findViewById(int id) {
}
/**通过id查找并获取控件,并setOnClickListener
* @param id
* @param l
* @param listener
* @return
*/
public <V extends View> V findViewById(int id, OnClickListener l) {
public <V extends View> V findViewById(int id, OnClickListener listener) {
V v = findViewById(id);
v.setOnClickListener(l);
v.setOnClickListener(listener);
if (onClickViewList == null) {
onClickViewList = new ArrayList<View>();
}
onClickViewList.add(v);
return v;
}

Expand Down Expand Up @@ -331,6 +346,7 @@ public void onDestroy() {
onTouchListener = null;
onClickListener = null;
onLongClickListener = null;
onClickViewList = null;

data = null;
position = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public interface FragmentPresenter extends Presenter {
* 该Fragment在Activity添加的所有Fragment中的位置
*/
static final String ARGUMENT_POSITION = "ARGUMENT_POSITION";
static final String ARGUMENT_ID = "ARGUMENT_ID";
static final String ARGUMENT_USER_ID = "ARGUMENT_USER_ID";

static final int RESULT_OK = Activity.RESULT_OK;
static final int RESULT_CANCELED = Activity.RESULT_CANCELED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ public interface Presenter {

static final String INTENT_TITLE = "INTENT_TITLE";
static final String INTENT_ID = "INTENT_ID";
static final String INTENT_TYPE = "INTENT_TYPE";
static final String INTENT_PHONE = "INTENT_PHONE";
static final String INTENT_PASSWORD = "INTENT_PASSWORD";
static final String INTENT_VERIFY = "INTENT_VERIFY";
static final String INTENT_USER_ID = "INTENT_USER_ID";
static final String RESULT_DATA = "RESULT_DATA";
static final String ACTION_EXIT_APP = "ACTION_EXIT_APP";

/**
* UI显示方法(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@
public class Cache<T> {
public static final String TAG = "Cache";

public Cache(Context context, Class<T> clazz, String path) {
this(context, clazz, context.getSharedPreferences(StringUtil.getTrimedString(path), Context.MODE_PRIVATE));
}
@SuppressWarnings("unused")
private Context context;
private Class<T> clazz;
private SharedPreferences sp;
public Cache(Context context, Class<T> clazz, SharedPreferences sp) {
this.context = context;
public Cache(Class<T> clazz, Context context, String name) {
this(clazz, context.getSharedPreferences(name, Context.MODE_PRIVATE));
}
public Cache(Class<T> clazz, SharedPreferences sp) {
this.clazz = clazz;
this.sp = sp;
}
Expand Down
Loading

0 comments on commit 7a92275

Please sign in to comment.