Commit b06a8f29 by gao.chao

放开web和map

parent e18f1c69
......@@ -8,7 +8,6 @@ android {
targetSdkVersion 28
versionCode 1
versionName "1.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
......@@ -51,11 +50,11 @@ repositories{
}
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:nativecrashreport:3.6.0.1'
// api(name:'fastDevelop-release', ext:'aar')
api project(':fastDevelop')
// api project(':web')
// api project(':map')
api project(':web')
api project(':map')
}
......@@ -44,6 +44,8 @@
<activity
android:name=".StartActivity"
android:theme="@style/AppThemeLaunch" />
<activity android:name=".PlayerActivity" />
<activity android:name=".PlayerActivtiy2" />
<activity android:name=".FunctionActivity" />
<activity android:name=".OnMultiClickActivity" />
<activity android:name=".PermissionActivity" />
......
......@@ -111,6 +111,12 @@ public class FunctionActivity extends BaseActivity {
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;
import com.mayi.fastdevelop.base.BaseApplication;
import com.mayi.fastdevelop.comnon.Configure;
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 {
@Override
public void onCreate() {
super.onCreate();
// CallManage.getInstance().addTarget(new LocationCallTarget());
// CallManage.getInstance().addTarget(new GoMapLocationCallTarget());
// CallManage.getInstance().addTarget(new GoWebCallTarget());
// CallManage.getInstance().addTarget(new InitWebCallTarget());
CallManage.getInstance().addTarget(new LocationCallTarget());
CallManage.getInstance().addTarget(new GoMapLocationCallTarget());
CallManage.getInstance().addTarget(new GoWebCallTarget());
CallManage.getInstance().addTarget(new InitWebCallTarget());
CallParticipationBean bean = new CallParticipationBean("web_initWeb");
CallManage.getInstance().handleTarget(bean);
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 @@
android:layout_height="wrap_content"
android:text="定位" />
<Button
android:id="@+id/b9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="播放视频/音频\n未完成" />
</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 {
targetSdkVersion 28
versionCode 2
versionName "1.1"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
// 设置支持的SO库架构
abiFilters 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
......
......@@ -4,13 +4,14 @@ import android.app.Dialog;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.mayi.fastdevelop.util.ToastUtil;
import com.mayi.fastdevelop.view.LoadingDialog;
public abstract class BaseActivity extends AppCompatActivity {
public abstract class BaseActivity extends AppCompatActivity implements View.OnClickListener {
private Dialog dialog;
......@@ -82,6 +83,26 @@ public abstract class BaseActivity extends AppCompatActivity {
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
protected void onDestroy() {
dismssLoadingDialog();
......
......@@ -61,27 +61,22 @@ public class AppPlayerView extends PlayerView implements PlaybackPreparer {
TransferListener listener = new DefaultBandwidthMeter();
DefaultDataSourceFactory upstreamFactory = new DefaultDataSourceFactory(getContext(), 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);
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);
MediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
if (isLooping){
if (isLooping) {
//循环播放
LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource);
//使用资源准备播放器
player.prepare(loopingMediaSource);
}else {
} else {
//使用资源准备播放器
player.prepare(mediaSource);
}
}
protected synchronized Cache getDownloadCache() {
if (downloadCache == null) {
File downloadContentDirectory = new File(getDownloadDirectory(), DOWNLOAD_CONTENT_DIRECTORY);
......@@ -90,15 +85,16 @@ public class AppPlayerView extends PlayerView implements PlaybackPreparer {
return downloadCache;
}
private void releasePlayer() {
if (downloadCache!=null){
//释放播放器资源
public void releasePlayer() {
if (downloadCache != null) {
downloadCache.release();
}
if (Util.SDK_INT <= 23) {
onPause();
releasePlayer();
}
if (player!=null){
if (player != null) {
player.release();
}
}
......
......@@ -16,13 +16,18 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api project(':fastDevelop')
//高德地图
api 'com.amap.api:location:latest.integration'
api 'com.amap.api:search:latest.integration'
api 'com.amap.api:3dmap:latest.integration'
api 'com.amap.api:location:4.7.2'
api 'com.amap.api:search:6.9.2'
api 'com.amap.api:3dmap:7.0.0'
}
......@@ -8,6 +8,11 @@ import com.gc.call.CallImmediatelyHandlerTarget;
import com.gc.call.CallParticipationBean;
import com.gc.call.CallReturnBean;
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 {
......@@ -20,12 +25,28 @@ public class GoMapLocationCallTarget extends CallImmediatelyHandlerTarget {
public CallReturnBean onHandle(CallParticipationBean bean) {
Context context = bean.getContext();
if (context != null) {
PermissionUtil.requestPermission(new PermissionUtil.PermissionCallback() {
@Override
public void onSuccess(List<String> data) {
goMapLocationActivity(context);
}
@Override
public void onFail(List<String> data) {
ToastUtil.show(context,"没有定位权限,无法定位!");
goMapLocationActivity(context);
}
}, Permission.Group.LOCATION);
}
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);
}
}
return null;
}
}
include ':app', ':fastDevelop'
//, ':web', ':map'
\ No newline at end of file
include ':app', ':fastDevelop', ':map', ':web'
\ No newline at end of file
......@@ -14,9 +14,6 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
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.view.KeyEvent;
import android.view.View;
......@@ -24,6 +21,10 @@ import android.view.ViewGroup;
import android.view.ViewParent;
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.comnon.Key;
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