Skip to content

Commit

Permalink
2018.6.22
Browse files Browse the repository at this point in the history
  • Loading branch information
tome34 committed Jun 22, 2018
1 parent 5ba556e commit eaa0b77
Show file tree
Hide file tree
Showing 167 changed files with 8,204 additions and 470 deletions.
3 changes: 3 additions & 0 deletions .idea/gradle.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/modules.xml

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

6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ android {


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation rootProject.ext.dependencies["junit"]
androidTestImplementation rootProject.ext.dependencies["runner"]
androidTestImplementation rootProject.ext.dependencies["espresso_core"]

implementation project(':component_data')
implementation project(':component_base')
implementation project(':module_common')

if (!rootProject.ext.isModule) {
implementation project(':module_shop_mall')
implementation project(':module_shop_cart')
implementation project(':module_welfare')
}

//常用控件依赖包
implementation project(':baseLib:alertview')
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ public static MyApplication getInstance() {
public void onCreate() {
super.onCreate();
myApplication = this ;
//RouterConfig.init(this, com.example.tome.component_base.BuildConfig.DEBUG);
// Stetho.initializeWithDefaults(this);
}
}
8 changes: 4 additions & 4 deletions component_base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ dependencies {
api rootProject.ext.dependencies["appcompat_v7"]
api rootProject.ext.dependencies["constraint_layout"]
api rootProject.ext.dependencies["cardview-v7"]
api rootProject.ext.dependencies["recyclerview-v7"]
api rootProject.ext.dependencies["support-v4"]
api rootProject.ext.dependencies["design"]
api rootProject.ext.dependencies["support_annotations"]
testApi rootProject.ext.dependencies["junit"]
androidTestApi rootProject.ext.dependencies["runner"]
androidTestApi rootProject.ext.dependencies["espresso_core"]
Expand Down Expand Up @@ -119,10 +122,7 @@ dependencies {
//安卓调试神器-Stetho
api rootProject.ext.dependencies["stetho"]
api rootProject.ext.dependencies["stetho-okhttp3"]






implementation project(':component_data')
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
onViewCreated();
initTitle();
initView();
if (regEvent){
EventBus.getDefault().register(this);
}
}

/**
Expand All @@ -64,10 +67,6 @@ public void onViewCreated() {
if (mPresenter != null) {
mPresenter.attachView(this);
}
if (regEvent){
EventBus.getDefault().register(this);
}

}

@Subscribe(threadMode = ThreadMode.MAIN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
initTitle();
initView();

if (regEvent){
EventBus.getDefault().register(this);
}
return view ;
}

Expand All @@ -65,9 +68,6 @@ public void onViewCreated() {
if (mPresenter != null) {
mPresenter.attachView(this);
}
if (regEvent){
EventBus.getDefault().register(this);
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public abstract class BaseTabListActivity<P extends AbstractPresenter> extends B
@Override
protected int getLayoutId() {
titleList = tabTitles();
// return R.layout.fragment_tab_list;
return getTabLayoutId();
return R.layout.fragment_tab_list;
// return getTabLayoutId();
}

@Override
Expand Down Expand Up @@ -102,7 +102,7 @@ protected boolean isTabScrollable() {
return false;
}

protected abstract int getTabLayoutId();
// protected abstract int getTabLayoutId();
/**
* tab标题集合
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.tome.module_shop_mall.adapter;
package com.example.tome.component_base.base;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
Expand All @@ -9,14 +9,14 @@

/**
* Created by bruce on 2016/11/1.
* ViewPagerAdapter
* BaseViewPagerAdapter
*/

public class ViewPagerAdapter extends FragmentPagerAdapter {
public class BaseViewPagerAdapter extends FragmentPagerAdapter {

private final List<Fragment> mFragmentList = new ArrayList<>();

public ViewPagerAdapter(FragmentManager manager) {
public BaseViewPagerAdapter(FragmentManager manager) {
super(manager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.app.Activity;

import com.example.tome.component_base.base.BaseMVPActivity;

import java.lang.ref.WeakReference;
import java.util.HashSet;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package com.example.welfare.module_welfare.api;

package com.example.tome.component_base.net.common_callback;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package com.example.tome.component_base.net.file_download;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import okhttp3.ResponseBody;

/**
* 保存文件
*/

//public abstract class FileDownLoadCallback<T> {
public class FileDownLoadCallback {


private static File file;

//可以重写,具体可由子类实现
public void onComplete() {
}
//下载成功的回调
//public abstract void onDownLoadSuccess(T t);
//下载失败回调
// public abstract void onDownLoadFail(Throwable throwable);
//下载进度监听
// public abstract void onProgress(int progress,long total);

/**
* 将文件写入本地
* @param responseBody 请求结果全体
* @param destFileDir 目标文件夹
* @param destFileName 目标文件名
* @return 写入完成的文件
* @throws IOException IO异常
*/
public static File saveFile(ResponseBody responseBody, String destFileDir, String destFileName) {
InputStream is = null;
byte[] buf = new byte[2048];
int len = 0;
FileOutputStream fos = null;
try {
is = responseBody.byteStream();
final long total = responseBody.contentLength();
long sum = 0;

File dir = new File(destFileDir);
if (!dir.exists()) {
dir.mkdirs();
}
file = new File(dir, destFileName);
fos = new FileOutputStream(file);
while ((len = is.read(buf)) != -1) {
sum += len;
fos.write(buf, 0, len);
final long finalSum = sum;
//写入本地的进度条
// onProgress((int) (finalSum * 100 / total),total);
}
fos.flush();

} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is != null) is.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
if (fos != null) fos.close();
} catch (IOException e) {
e.printStackTrace();
}

}
return file;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.app.Activity;

import com.example.tome.component_base.base.BaseMVPActivity;

import java.util.Stack;
import java.util.logging.Logger;

Expand Down Expand Up @@ -58,6 +60,8 @@ public void popCurrentActivity() {
popActivity(currentActivity());
}



/**
* <将Activity入栈>
* <功能详细描述>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

/**
* @author liubp
* 判断是否为空
*/
public class BasicTool {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;
import android.util.Log;

/**
* 密度转换工具
*/
public class DensityUtil {

// 根据手机的分辨率将dp的单位转成px(像素)
Expand Down Expand Up @@ -48,4 +52,30 @@ public static int getWindowHeight(Activity activity){
activity.getWindowManager().getDefaultDisplay().getMetrics(metric);
return metric.heightPixels;
}

/**
* 获取屏幕横向(宽度)分辨率
* @param context
* @return
*/
public static int getResolutionX(Context context){
DisplayMetrics mDisplayMetrics = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(mDisplayMetrics);

int width = mDisplayMetrics.widthPixels;
return width;
}

/**
* 获取屏幕纵向(高度)分辨率
* @param context
* @return
*/
public static int getResolutionY(Context context){
DisplayMetrics mDisplayMetrics = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(mDisplayMetrics);

int height = mDisplayMetrics.heightPixels;
return height;
}
}
Loading

0 comments on commit eaa0b77

Please sign in to comment.