- 博客(55)
- 收藏
- 关注
原创 修改头像util类
public class ImageUtil { public static Intent getGalleryIntent(Intent intent) { /**19之后的系统相册的图片都存在于MediaStore数据库中;19之前的系统相册中可能包含不存在与数据库中的图片,所以如果是19之上的系统 * 跳转到19之前的系统相册选择了一张不存在...
2019-01-02 10:53:32
178
原创 动态权限util类
//动态权限依赖 implementation 'com.yanzhenjie:permission:2.0.0-rc4'public class PermissionUtils {public static void permission(final Context context,final PremissionListener listener){AndPerm...
2019-01-02 10:34:34
150
原创 okHtttp拦截器
public class OKHeaderInterceptor implements Interceptor { @Override public Response intercept(Chain chain) throws IOException { Request request = chain.request(); Request.Build...
2019-01-02 10:08:55
177
原创 判断网络是否连接工具类
public class NewThread { //判断网络是否连接 public boolean isNetWork(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECT...
2019-01-02 09:58:01
214
1
原创 LogUtil工具类的封装
public class LogUtil { public static void init(){ PrettyFormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder() .showThreadInfo(false) .methodCoun...
2019-01-02 09:45:18
550
原创 toastUtil工具类的封装
public class ToastUtil { public void Toast(int a) { Toast.makeText(MyApp.context, a + "", Toast.LENGTH_SHORT).show(); } public void Toast(String a) { Toast.makeText(MyAp...
2019-01-02 09:09:24
140
原创 网络判断
1.判断网络状态package com.bw.qgs.shipei;import android.content.Context;import android.net.ConnectivityManager;import android.net.NetworkInfo;public class NewThread {public boolean isNetWork(Context co...
2019-01-02 08:24:58
109
原创 spUtil工具类的封装
工具类的作用是为了让我们更方便的使用,一次封装,多次使用,也是一个合格的工程师必备的代码技术,下面就是sp存值和取值的工具类封装public class SpUtil { private static final String name="login"; private static final int sp_name=Context.MODE_PRIVATE; pri...
2019-01-01 20:44:59
1435
原创 自定义dialog
public class ZpopView extends Dialog { public Context context; public ZpopView(Context context) { super(context); this.context = context; } public ZpopView(Context c...
2018-12-21 08:12:34
105
原创 截取
public class MyAdapter extends RecyclerView.Adapter { private List<User.DataBean> data; private Context context; public MyAdapter(List<User.DataBean> data, Context context) {...
2018-12-21 08:07:57
106
原创 mvp销毁,解决内存泄露
mvp销毁,解决内存泄漏//model层销毁线程public void onDestory() {if (handler != null) {handler.removeCallbacksAndMessages(null);handler = null;}}//presenter层//销毁model层public void onDestory() {if (loginVi...
2018-12-20 19:35:51
409
原创 相机相册回调
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/bt_pic" android:text="选择图片"/>public class MainActivity extends A...
2018-12-20 16:37:39
163
原创 IjkIvRotation视频播放
1.依赖 <uses-permission android:name="android.permission.INTERNET"/>implementation ‘com.dou361.ijkplayer:jjdxm-ijkplayer:1.0.5’代码 private String url = "http://ips.ifeng.com/video19.ifeng.com/...
2018-12-20 14:41:03
98
原创 第三方集成高德地图
1.申请key值https://lbs.amap.com/api/android-sdk/guide/create-project/android-studio-create-project?tdsourcetag=s_pcqq_aiomsg2.导入相关的jar包,build3.jniLibs4.包名5.依赖<uses-permission android:name="andro...
2018-12-20 13:55:37
144
原创 扫描
public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button btn1; private Button btn2; private ImageView image; private EditText edit; @O...
2018-12-20 10:31:30
103
原创 自定义流式布局
public class FlayLinearout extends LinearLayout { private int mWidthPixels; private int mHeightPixels; public FlayLinearout(Context context) { this(context, null); } pub...
2018-12-17 08:09:02
76
原创 retrofit_rxjava
1.bean类public class User { /** * data : {"curPage":1,"datas":[{"apkLink":"","author":" Ruheng","chapterId":390,"chapterName":"Git","collect":fals
2018-12-09 21:06:43
188
原创 拦截器
public class LogUtil { //设置初始化 public static void init(){ //初始化 FormatStrategy formatStrategy=PrettyFormatStrategy.newBuilder() .build(); //添加 L...
2018-12-09 19:26:42
147
原创 bottomtabbar+fragment
bot = findViewById(R.id.bottomtabbar);bot.init(getSupportFragmentManager()).addTabItem(“第一页”,R.drawable.group2,OneFragment.class).addTabItem(“第二页”,R.drawable.interactive2,TwoFragment.class).addTab...
2018-12-07 19:12:36
163
原创 Eventbus传值
原理:eventbus中,传值的页面直接进行传值 ,无论是activity还是fragment都能应用接受值的页面中对eventbus进行绑定和解绑1.依赖implementation ‘org.greenrobot:eventbus:3.0.0’代码如下:这个是接受值的页面public class MainActivity extends AppCompatActivity { ...
2018-12-07 19:10:28
324
原创 反射&&自定义注解
1.person类//设置注解@UserInfo(userName = "张三",userPassword = "123456")public class Person { //公有属性 public String sname; public String password; //私有属性 private int age; public ...
2018-12-02 20:34:49
145
原创 网络请求工具类和mvp的封装
1.okhttp工具public class OkHttpUtil { private static final String METHOD_GET = "GET"; private static OkHttpClient client; private static RequestBody body; public OkHttpUtil() { }...
2018-12-02 20:30:39
849
原创 okhttp工具类
/** * 网络请求工具类 */public class OkHttpUtil { private static Gson gson = new Gson(); private static final String MEDIA_TYPE = "application/json; charset=utf-8"; private static final String...
2018-12-02 19:59:27
407
原创 封装okhttp get请求
public class HttpUtils {private static final String MEHOD_GET = “GET”;private static RequestBody body;private static OkHttpClient client;public static void init(){client = new OkHttpClient.Builde...
2018-12-02 19:55:15
96
原创 注解
@UserInfo(userName = “张三三”,userPasswrod = “123456”)public class Person {public String nikeName = “成龙”;public String name;private String age;private String idNum;public Person() {}public Pers...
2018-12-02 19:09:55
79
原创 bannaer图
1.<依赖> implementation 'cn.bingoogolapple:bga-banner:2.1.7'2.布局<cn.bingoogolapple.bgabanner.BGABanner android:layout_width="match_parent" android:layout_height="200dp" ...
2018-11-27 19:34:41
680
原创 观察者模式
<1 ><2 publisher >public class Publisher { private List<Subscriber> list=new ArrayList<>(); public void attach(Subscriber subscriber){ list.add(subscribe...
2018-11-27 19:32:38
68
原创 fresco自定义缓存
<1添加依赖> compile 'com.facebook.fresco:fresco:0.14.1' compile 'com.facebook.fresco:animated-gif:0.14.1'<2 配置网络权限><uses-permission android:name="android.permission.INTERNET"/>//注册...
2018-11-27 19:13:49
195
1
原创 高斯模糊
<1.布局><?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xm
2018-11-27 19:08:03
84
原创 搜索框
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#00000000" /> <stroke android:colo
2018-11-23 08:24:23
79
原创 圆
1.yuan类public class Yuan extends View { private int mCurrent;//当前进度 private Paint mPaintOut; private Paint mPaintCurrent; private Paint mPaintText; private RectF rectF; priva...
2018-11-23 08:21:34
65
原创 购物车
2.布局文件&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="matc
2018-11-23 08:00:09
110
原创 fragment页面切换
<1.布局文件><?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
2018-11-23 07:46:36
197
原创 自定义圆
public class Yuan extends View {private int mCurrent;//当前进度private Paint mPaintOut;private Paint mPaintCurrent;private Paint mPaintText;private RectF rectF;private int width;private int height;...
2018-11-22 19:51:37
96
原创 分类
<1布局文件>**mainactivity**<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/re.
2018-11-22 13:36:15
73
原创 recyclerview多条目
1.mainactivitypublic class MainActivity extends AppCompatActivity { private ArrayList<RecycleUser.DataBean> list = new ArrayList<>(); private String path = "http://www.xieast.com...
2018-11-19 07:48:02
96
原创 umeng+recyclerview+okhttp
前言:umeng的配置app配置public class App extends Application { @Override public void onCreate() { super.onCreate(); UMConfigure.setLogEnabled(true); UMConfigure.init(this,"5...
2018-11-18 21:55:56
251
原创 第三方Umeng登录
1.一定要注意包名 包名如果出错以后会有大麻烦2.导入相关的jar文件和drawable,layout,values3.创建wxapi包 在这个包下面创建WXEntryActivity 继承 WXCallbackActivity 不需要做其他操作了4.app 中需要配置public class App extends Application { @Override pu...
2018-11-16 21:09:03
194
原创 mvp登录注册+二维码
1.封装工具类URLConnectionpublic class UrlConnction {public void CallBackData(final String url, final CallBack callBack){ new AsyncTask&lt;String,Void,String&gt;(){ @Override protect...
2018-11-12 16:33:18
1126
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人