Commit b06a8f29 by gao.chao

放开web和map

parent e18f1c69
...@@ -8,7 +8,6 @@ android { ...@@ -8,7 +8,6 @@ android {
targetSdkVersion 28 targetSdkVersion 28
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
signingConfigs { signingConfigs {
...@@ -51,11 +50,11 @@ repositories{ ...@@ -51,11 +50,11 @@ repositories{
} }
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
api "com.tencent.bugly:crashreport_upgrade:1.3.4" api "com.tencent.bugly:crashreport_upgrade:1.3.4"
api 'com.tencent.bugly:nativecrashreport:3.6.0.1' api 'com.tencent.bugly:nativecrashreport:3.6.0.1'
// api(name:'fastDevelop-release', ext:'aar') // api(name:'fastDevelop-release', ext:'aar')
api project(':fastDevelop') api project(':fastDevelop')
// api project(':web') api project(':web')
// api project(':map') api project(':map')
} }
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
<activity <activity
android:name=".StartActivity" android:name=".StartActivity"
android:theme="@style/AppThemeLaunch" /> android:theme="@style/AppThemeLaunch" />
<activity android:name=".PlayerActivity" />
<activity android:name=".PlayerActivtiy2" />
<activity android:name=".FunctionActivity" /> <activity android:name=".FunctionActivity" />
<activity android:name=".OnMultiClickActivity" /> <activity android:name=".OnMultiClickActivity" />
<activity android:name=".PermissionActivity" /> <activity android:name=".PermissionActivity" />
......
...@@ -111,6 +111,12 @@ public class FunctionActivity extends BaseActivity { ...@@ -111,6 +111,12 @@ public class FunctionActivity extends BaseActivity {
CallManage.getInstance().handleTarget(bean); CallManage.getInstance().handleTarget(bean);
} }
}); });
findViewById(R.id.b9).setOnClickListener(new OnMultiClickListener() {
@Override
public void onMultiClick(View v) {
gotoActivity(PlayerActivity.class);
}
});
} }
} }
...@@ -7,16 +7,20 @@ import com.gc.call.CallParticipationBean; ...@@ -7,16 +7,20 @@ import com.gc.call.CallParticipationBean;
import com.mayi.fastdevelop.base.BaseApplication; import com.mayi.fastdevelop.base.BaseApplication;
import com.mayi.fastdevelop.comnon.Configure; import com.mayi.fastdevelop.comnon.Configure;
import com.mayi.fastdevelop.comnon.CrashHandler; import com.mayi.fastdevelop.comnon.CrashHandler;
import com.mayi.fastdevelop.map.GoMapLocationCallTarget;
import com.mayi.fastdevelop.map.LocationCallTarget;
import com.mayi.fastdevelop.web.GoWebCallTarget;
import com.mayi.fastdevelop.web.InitWebCallTarget;
public class MyApplication extends BaseApplication { public class MyApplication extends BaseApplication {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
// CallManage.getInstance().addTarget(new LocationCallTarget()); CallManage.getInstance().addTarget(new LocationCallTarget());
// CallManage.getInstance().addTarget(new GoMapLocationCallTarget()); CallManage.getInstance().addTarget(new GoMapLocationCallTarget());
// CallManage.getInstance().addTarget(new GoWebCallTarget()); CallManage.getInstance().addTarget(new GoWebCallTarget());
// CallManage.getInstance().addTarget(new InitWebCallTarget()); CallManage.getInstance().addTarget(new InitWebCallTarget());
CallParticipationBean bean = new CallParticipationBean("web_initWeb"); CallParticipationBean bean = new CallParticipationBean("web_initWeb");
CallManage.getInstance().handleTarget(bean); CallManage.getInstance().handleTarget(bean);
initBugly("cb8018da1b", true); initBugly("cb8018da1b", true);
......
package com.mayi.demo;
import android.os.Bundle;
import android.view.View;
import com.mayi.fastdevelop.base.BaseActivity;
public class PlayerActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player);
findViewById(R.id.bt1).setOnClickListener(this);
findViewById(R.id.bt2).setOnClickListener(this);
findViewById(R.id.bt3).setOnClickListener(this);
findViewById(R.id.bt4).setOnClickListener(this);
findViewById(R.id.bt5).setOnClickListener(this);
findViewById(R.id.bt6).setOnClickListener(this);
}
@Override
protected void onMultiClick(View v) {
if (v.getId() == R.id.bt1) {
gotoActivity(PlayerActivtiy2.class);
}
}
}
package com.mayi.demo;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.view.AppPlayerView;
public class PlayerActivtiy2 extends BaseActivity {
private AppPlayerView appPlayerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);//强制竖屏
setContentView(R.layout.activity_player2);
appPlayerView=findViewById(R.id.player);
}
@Override
protected void onResume() {
super.onResume();
appPlayerView.setUrl("http://player.youku.com/embed/XMzU3MDIzMjkyMA==?_time=6.001",true);
}
@Override
protected void onPause() {
super.onPause();
appPlayerView.releasePlayer();
}
}
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="定位" /> android:text="定位" />
<Button
android:id="@+id/b9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="播放视频/音频\n未完成" />
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/bt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="播放网络视频" />
<Button
android:id="@+id/bt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="播放APP内视频" />
<Button
android:id="@+id/bt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="播放本地视频" />
<Button
android:id="@+id/bt4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="播放网络音频" />
<Button
android:id="@+id/bt5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="播放APP内音频" />
<Button
android:id="@+id/bt6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="播放本地音频" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.mayi.fastdevelop.view.AppPlayerView
android:id="@+id/player"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
...@@ -8,7 +8,6 @@ android { ...@@ -8,7 +8,6 @@ android {
targetSdkVersion 28 targetSdkVersion 28
versionCode 2 versionCode 2
versionName "1.1" versionName "1.1"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk { ndk {
// 设置支持的SO库架构 // 设置支持的SO库架构
abiFilters 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a' abiFilters 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
......
...@@ -4,13 +4,14 @@ import android.app.Dialog; ...@@ -4,13 +4,14 @@ import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.mayi.fastdevelop.util.ToastUtil; import com.mayi.fastdevelop.util.ToastUtil;
import com.mayi.fastdevelop.view.LoadingDialog; import com.mayi.fastdevelop.view.LoadingDialog;
public abstract class BaseActivity extends AppCompatActivity { public abstract class BaseActivity extends AppCompatActivity implements View.OnClickListener {
private Dialog dialog; private Dialog dialog;
...@@ -82,6 +83,26 @@ public abstract class BaseActivity extends AppCompatActivity { ...@@ -82,6 +83,26 @@ public abstract class BaseActivity extends AppCompatActivity {
ToastUtil.show(this, msg); ToastUtil.show(this, msg);
} }
// 两次点击按钮之间的点击间隔不能少于500毫秒
private final int MIN_CLICK_DELAY_TIME = 500;
private long lastClickTime;
private int lastViewId = 0;
@Override
public void onClick(View v) {
if (lastViewId == v.getId() && System.currentTimeMillis() - lastClickTime < MIN_CLICK_DELAY_TIME) {
lastViewId = v.getId();
return;
}
lastViewId = v.getId();
lastClickTime = System.currentTimeMillis();
onMultiClick(v);
}
//防止重复点击
protected void onMultiClick(View v) {
}
@Override @Override
protected void onDestroy() { protected void onDestroy() {
dismssLoadingDialog(); dismssLoadingDialog();
......
...@@ -61,27 +61,22 @@ public class AppPlayerView extends PlayerView implements PlaybackPreparer { ...@@ -61,27 +61,22 @@ public class AppPlayerView extends PlayerView implements PlaybackPreparer {
TransferListener listener = new DefaultBandwidthMeter(); TransferListener listener = new DefaultBandwidthMeter();
DefaultDataSourceFactory upstreamFactory = new DefaultDataSourceFactory(getContext(), listener, DefaultDataSourceFactory upstreamFactory = new DefaultDataSourceFactory(getContext(), listener,
new DefaultHttpDataSourceFactory(getContext().getPackageName(), listener)); new DefaultHttpDataSourceFactory(getContext().getPackageName(), listener));
// 获取缓存文件夹
// File file = CachesUtil.getMediaCacheFile(CachesUtil.VIDEO,this);
// Cache cache = new SimpleCache(file, new NoOpCacheEvictor(), getDatabaseProvider());
DataSink.Factory cacheWriteDataSinkFactory = new CacheDataSinkFactory(getDownloadCache(), Long.MAX_VALUE); DataSink.Factory cacheWriteDataSinkFactory = new CacheDataSinkFactory(getDownloadCache(), Long.MAX_VALUE);
CacheDataSourceFactory dataSourceFactory = new CacheDataSourceFactory(getDownloadCache(), upstreamFactory, new FileDataSourceFactory(), cacheWriteDataSinkFactory, CacheDataSource.FLAG_BLOCK_ON_CACHE | CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR, null); CacheDataSourceFactory dataSourceFactory = new CacheDataSourceFactory(getDownloadCache(), upstreamFactory, new FileDataSourceFactory(), cacheWriteDataSinkFactory, CacheDataSource.FLAG_BLOCK_ON_CACHE | CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR, null);
Uri uri = Uri.parse(url); Uri uri = Uri.parse(url);
MediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(uri); MediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
if (isLooping){ if (isLooping) {
//循环播放 //循环播放
LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource); LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource);
//使用资源准备播放器 //使用资源准备播放器
player.prepare(loopingMediaSource); player.prepare(loopingMediaSource);
}else { } else {
//使用资源准备播放器 //使用资源准备播放器
player.prepare(mediaSource); player.prepare(mediaSource);
} }
} }
protected synchronized Cache getDownloadCache() { protected synchronized Cache getDownloadCache() {
if (downloadCache == null) { if (downloadCache == null) {
File downloadContentDirectory = new File(getDownloadDirectory(), DOWNLOAD_CONTENT_DIRECTORY); File downloadContentDirectory = new File(getDownloadDirectory(), DOWNLOAD_CONTENT_DIRECTORY);
...@@ -90,15 +85,16 @@ public class AppPlayerView extends PlayerView implements PlaybackPreparer { ...@@ -90,15 +85,16 @@ public class AppPlayerView extends PlayerView implements PlaybackPreparer {
return downloadCache; return downloadCache;
} }
private void releasePlayer() { //释放播放器资源
if (downloadCache!=null){ public void releasePlayer() {
if (downloadCache != null) {
downloadCache.release(); downloadCache.release();
} }
if (Util.SDK_INT <= 23) { if (Util.SDK_INT <= 23) {
onPause(); onPause();
releasePlayer(); releasePlayer();
} }
if (player!=null){ if (player != null) {
player.release(); player.release();
} }
} }
......
...@@ -16,13 +16,18 @@ android { ...@@ -16,13 +16,18 @@ android {
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
} }
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar']) api fileTree(dir: 'libs', include: ['*.jar'])
api project(':fastDevelop') api project(':fastDevelop')
//高德地图 //高德地图
api 'com.amap.api:location:latest.integration' api 'com.amap.api:location:4.7.2'
api 'com.amap.api:search:latest.integration' api 'com.amap.api:search:6.9.2'
api 'com.amap.api:3dmap:latest.integration' api 'com.amap.api:3dmap:7.0.0'
} }
...@@ -8,6 +8,11 @@ import com.gc.call.CallImmediatelyHandlerTarget; ...@@ -8,6 +8,11 @@ import com.gc.call.CallImmediatelyHandlerTarget;
import com.gc.call.CallParticipationBean; import com.gc.call.CallParticipationBean;
import com.gc.call.CallReturnBean; import com.gc.call.CallReturnBean;
import com.mayi.fastdevelop.comnon.RequestCode; import com.mayi.fastdevelop.comnon.RequestCode;
import com.mayi.fastdevelop.util.PermissionUtil;
import com.mayi.fastdevelop.util.ToastUtil;
import com.yanzhenjie.permission.Permission;
import java.util.List;
//跳转地图定位页 //跳转地图定位页
public class GoMapLocationCallTarget extends CallImmediatelyHandlerTarget { public class GoMapLocationCallTarget extends CallImmediatelyHandlerTarget {
...@@ -20,12 +25,28 @@ public class GoMapLocationCallTarget extends CallImmediatelyHandlerTarget { ...@@ -20,12 +25,28 @@ public class GoMapLocationCallTarget extends CallImmediatelyHandlerTarget {
public CallReturnBean onHandle(CallParticipationBean bean) { public CallReturnBean onHandle(CallParticipationBean bean) {
Context context = bean.getContext(); Context context = bean.getContext();
if (context != null) { if (context != null) {
Intent intent = new Intent(context, MapLocationActivity.class); PermissionUtil.requestPermission(new PermissionUtil.PermissionCallback() {
if (context instanceof Activity) { @Override
((Activity) context).startActivityForResult(intent, public void onSuccess(List<String> data) {
RequestCode.MAP_LOCATION_ACTIVITY_RESULTCODE); goMapLocationActivity(context);
} }
@Override
public void onFail(List<String> data) {
ToastUtil.show(context,"没有定位权限,无法定位!");
goMapLocationActivity(context);
}
}, Permission.Group.LOCATION);
} }
return null; return null;
} }
private void goMapLocationActivity(Context context) {
Intent intent = new Intent(context, MapLocationActivity.class);
if (context instanceof Activity) {
((Activity) context).startActivityForResult(intent,
RequestCode.MAP_LOCATION_ACTIVITY_RESULTCODE);
}
}
} }
include ':app', ':fastDevelop' include ':app', ':fastDevelop', ':map', ':web'
//, ':web', ':map' \ No newline at end of file
\ No newline at end of file
...@@ -14,9 +14,6 @@ import android.os.Bundle; ...@@ -14,9 +14,6 @@ import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.FileProvider;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
...@@ -24,6 +21,10 @@ import android.view.ViewGroup; ...@@ -24,6 +21,10 @@ import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.FileProvider;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.comnon.Key; import com.mayi.fastdevelop.comnon.Key;
import com.mayi.fastdevelop.comnon.RequestCode; import com.mayi.fastdevelop.comnon.RequestCode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment