Skip to content

Commit f1f4c09

Browse files
committed
视频sdk组件
1 parent 0656b89 commit f1f4c09

File tree

45 files changed

+559
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+559
-112
lines changed

.idea/caches/build_file_checksums.ser

54 Bytes
Binary file not shown.

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
multiDexEnabled true
1212
javaCompileOptions {
1313
annotationProcessorOptions {
14-
arguments = [ AROUTER_MODULE_NAME : project.getName() ]
14+
arguments = [AROUTER_MODULE_NAME: project.getName()]
1515
}
1616
}
1717

@@ -35,6 +35,7 @@ dependencies {
3535
api rootProject.ext.dependencies["appcompat-v7"]
3636
api rootProject.ext.dependencies["multidex"]
3737
api rootProject.ext.dependencies["arouter"]
38+
3839
if (!isModule) {
3940
implementation project(':module-home')
4041
implementation project(':module-push')

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@
55
<uses-permission android:name="android.permission.INTERNET"/>
66

77
<application
8-
android:name=".MyApp"
8+
android:name=".application.MyApp"
99
android:allowBackup="true"
1010
android:icon="@mipmap/ic_launcher"
1111
android:label="@string/app_name"
1212
android:roundIcon="@mipmap/ic_launcher_round"
1313
android:supportsRtl="true"
1414
android:theme="@style/AppTheme">
15-
<activity android:name=".MainActivity">
15+
<activity android:name=".activity.AndFixActivity">
1616
<intent-filter>
1717
<action android:name="android.intent.action.MAIN"/>
1818

1919
<category android:name="android.intent.category.LAUNCHER"/>
2020
</intent-filter>
2121
</activity>
22-
<activity android:name="com.example.kson.module_im.Main2Activity"/>
22+
<activity android:name="com.example.kson.module_home.Main2Activity"/>
2323
<activity android:name="com.example.kson.module_push.PushActivity"/>
24+
<activity android:name=".activity.MainActivity">
25+
</activity>
2426
</application>
2527

2628
</manifest>

app/src/main/java/com/example/kson/moduledemo/MainActivity.java

Lines changed: 0 additions & 80 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package com.example.kson.moduledemo.activity;
2+
3+
import android.support.v7.app.AppCompatActivity;
4+
import android.os.Bundle;
5+
import android.util.Log;
6+
import android.view.View;
7+
8+
import com.example.kson.lib_core.hotfix.AndFixPatchManager;
9+
import com.example.kson.moduledemo.R;
10+
11+
import java.io.File;
12+
13+
public class AndFixActivity extends AppCompatActivity {
14+
15+
private final String FIELD_END = ".apatch";
16+
private String mPatchDir;
17+
@Override
18+
protected void onCreate(Bundle savedInstanceState) {
19+
super.onCreate(savedInstanceState);
20+
setContentView(R.layout.activity_and_fix);
21+
mPatchDir = getExternalCacheDir().getAbsolutePath()+"/apatch/";
22+
File file = new File(mPatchDir);
23+
if (!file.exists()){
24+
file.mkdirs();
25+
}
26+
}
27+
28+
/**
29+
* 制造bug
30+
* @param view
31+
*/
32+
public void createBug(View view) {
33+
34+
35+
printLog();
36+
}
37+
38+
/**
39+
* 模拟错误
40+
*/
41+
private void printLog() {
42+
String error = null;
43+
Log.e("kson",error);
44+
}
45+
46+
/**
47+
* 修复bug
48+
* @param view
49+
*/
50+
public void fixBug(View view) {
51+
52+
AndFixPatchManager.getmInstance().addPatch(getPatchPath());
53+
}
54+
55+
/**
56+
* 获取patch文件路径
57+
* @return
58+
*/
59+
private String getPatchPath() {
60+
61+
return mPatchDir.concat("im").concat(FIELD_END);
62+
}
63+
}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
package com.example.kson.moduledemo.activity;
2+
3+
import android.util.Log;
4+
import android.view.View;
5+
import android.widget.Button;
6+
7+
import com.example.kson.lib_core.base.mvp.BaseMvpActivity;
8+
import com.example.kson.lib_core.base.mvp.BasePresenter;
9+
import com.example.kson.lib_net.ApiService;
10+
import com.example.kson.moduledemo.R;
11+
import com.example.kson.moduledemo.contract.LoginContract;
12+
import com.example.kson.moduledemo.presenter.LoginPresenter;
13+
14+
import java.io.IOException;
15+
import java.util.HashMap;
16+
import java.util.concurrent.SynchronousQueue;
17+
import java.util.concurrent.ThreadPoolExecutor;
18+
import java.util.concurrent.TimeUnit;
19+
20+
import io.reactivex.observers.TestObserver;
21+
import okhttp3.Call;
22+
import okhttp3.Callback;
23+
import okhttp3.OkHttpClient;
24+
import okhttp3.Request;
25+
import okhttp3.Response;
26+
import okhttp3.ResponseBody;
27+
import okhttp3.internal.Util;
28+
import retrofit2.Retrofit;
29+
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
30+
import retrofit2.converter.gson.GsonConverterFactory;
31+
//import com.example.kson.lib_net.network.RetrofitHelper;
32+
//import com.example.kson.lib_core.constants.Apath;
33+
34+
public class MainActivity extends BaseMvpActivity<LoginContract.ILoginModel, LoginContract.LoginPresenter> implements LoginContract.ILoginView {
35+
36+
@Override
37+
protected void initView() {
38+
Button button = findViewById(R.id.fromg);
39+
button.setOnClickListener(new View.OnClickListener() {
40+
@Override
41+
public void onClick(View view) {
42+
43+
HashMap<String, Object> params = new HashMap<>();
44+
params.put("uid","71");
45+
// params.put("password","222222");
46+
// params.put("phone", "18612991523");
47+
// params.put("nickName", "18612991523");
48+
// params.put("pwd", RsaCoder.encryptByPublicKey("111111"));
49+
//// params.put("phone", "18612991523");
50+
// params.put("plateId", "12");
51+
// params.put("page", "1");
52+
// params.put("count", "5");
53+
//// params.put("pwd", RsaCoder.encryptByPublicKey("111111"));
54+
//
55+
// showToast("121212121212121");
56+
presenter.infoRecommendList(params);
57+
58+
}
59+
});
60+
61+
62+
//
63+
Retrofit retrofit = new Retrofit.Builder()
64+
.addConverterFactory(GsonConverterFactory.create())
65+
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
66+
.build();
67+
//
68+
ApiService apiService = retrofit.create(ApiService.class);
69+
70+
//
71+
retrofit2.Call<ResponseBody> test = apiService.test("");
72+
test.enqueue(new retrofit2.Callback<ResponseBody>() {
73+
@Override
74+
public void onResponse(retrofit2.Call<ResponseBody> call, retrofit2.Response<ResponseBody> response) {
75+
76+
}
77+
78+
@Override
79+
public void onFailure(retrofit2.Call<ResponseBody> call, Throwable t) {
80+
81+
}
82+
});
83+
84+
}
85+
86+
private void okhttp() throws IOException {
87+
OkHttpClient okHttpClient = new OkHttpClient.Builder()
88+
.build();
89+
Request request = new Request.Builder()
90+
.url("https://www.jianshu.com/u/b4e69e85aef6")
91+
.addHeader("user_agent","22222")
92+
.build();
93+
94+
ThreadPoolExecutor executorService = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60, TimeUnit.SECONDS,
95+
new SynchronousQueue<Runnable>(), Util.threadFactory("OkHttp Dispatcher", false));
96+
97+
executorService.allowCoreThreadTimeOut(true);
98+
99+
100+
Call call = okHttpClient.newCall(request);
101+
call.execute();
102+
call.enqueue(new Callback() {
103+
@Override
104+
public void onFailure(Call call, IOException e) {
105+
106+
}
107+
108+
@Override
109+
public void onResponse(Call call, Response response) throws IOException {
110+
111+
}
112+
});
113+
114+
}
115+
116+
@Override
117+
protected int bindLayoutId() {
118+
return R.layout.activity_main;
119+
}
120+
121+
public void home(View view) {
122+
123+
//集成开发模式,可以调用
124+
// startActivity(new Intent(this, PushActivity.class));
125+
126+
}
127+
128+
129+
@Override
130+
public BasePresenter initPresenter() {
131+
return new LoginPresenter();
132+
}
133+
134+
@Override
135+
public void showLoading() {
136+
137+
}
138+
139+
@Override
140+
public void hideLoading() {
141+
142+
}
143+
144+
@Override
145+
public void fail(String msg) {
146+
147+
}
148+
}

app/src/main/java/com/example/kson/moduledemo/MyApp.java renamed to app/src/main/java/com/example/kson/moduledemo/application/MyApp.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
package com.example.kson.moduledemo;
1+
package com.example.kson.moduledemo.application;
22

33
import android.app.Application;
44
import android.content.Context;
55
import android.support.multidex.MultiDex;
66

77
import com.alibaba.android.arouter.launcher.ARouter;
8+
import com.alipay.euler.andfix.AndFixManager;
9+
import com.example.kson.lib_core.hotfix.AndFixPatchManager;
810
import com.example.kson.lib_net.NetApp;
911
import com.example.kson.lib_net.network.http.HttpRequestPresenter;
1012
import com.example.kson.lib_net.network.http.RetrofitHttpRequest;
@@ -28,8 +30,8 @@ public void onCreate() {
2830
ARouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险) }
2931
ARouter.init(this);
3032
NetApp.init(this, Constants.BASE_URL);
31-
HttpRequestPresenter.init(new RetrofitHttpRequest());
32-
// HttpRequestPresenter.init(new RetrofitHttpRequest());
33+
HttpRequestPresenter.init(new RetrofitHttpRequest(true));
34+
AndFixPatchManager.getmInstance().initPatch(this);//初始化andfix
3335
}
3436

3537
@Override
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
xmlns:tools="http://schemas.android.com/tools"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
android:orientation="vertical"
9+
tools:context=".activity.AndFixActivity">
10+
11+
<Button
12+
android:text="制造bug"
13+
android:onClick="createBug"
14+
android:layout_width="match_parent"
15+
android:layout_height="wrap_content"/>
16+
<Button
17+
android:text="修复bug"
18+
android:onClick="fixBug"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content"/>
21+
22+
</LinearLayout>

0 commit comments

Comments
 (0)