Commit e18f1c69 by gao.chao

web优化升级为androidX,导入 exoplayer

parent 21b5253f
...@@ -4,11 +4,11 @@ android { ...@@ -4,11 +4,11 @@ android {
compileSdkVersion 28 compileSdkVersion 28
defaultConfig { defaultConfig {
applicationId "com.mayi.demo" applicationId "com.mayi.demo"
minSdkVersion 19 minSdkVersion 20
targetSdkVersion 28 targetSdkVersion 28
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" // testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
signingConfigs { signingConfigs {
...@@ -36,6 +36,12 @@ android { ...@@ -36,6 +36,12 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
} }
repositories{ repositories{
...@@ -46,13 +52,10 @@ repositories{ ...@@ -46,13 +52,10 @@ repositories{
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar']) api fileTree(dir: 'libs', include: ['*.jar'])
api 'com.android.support:appcompat-v7:28.0.0'
api 'com.android.support.constraint:constraint-layout:1.1.3'
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')
} }
package com.mayi.demo;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.mayi.demo", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mayi.demo"> package="com.mayi.demo">
<!-- CAMERA动态权限 --> <!-- CAMERA动态权限 -->
...@@ -23,7 +24,9 @@ ...@@ -23,7 +24,9 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"> android:theme="@style/Theme.AppCompat.Light.NoActionBar"
tools:replace="android:appComponentFactory"
android:appComponentFactory="androidx.core.app.CoreComponentFactory">
<meta-data <meta-data
......
package com.mayi.demo; package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.view.PicassoImageLoader; import com.mayi.fastdevelop.view.PicassoImageLoader;
......
package com.mayi.demo; package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseCutPicturesActivity; import com.mayi.fastdevelop.base.BaseCutPicturesActivity;
import com.mayi.fastdevelop.util.BitmapUtil; import com.mayi.fastdevelop.util.BitmapUtil;
......
package com.mayi.demo; package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.bean.AppConfig; import com.mayi.fastdevelop.bean.AppConfig;
import com.mayi.fastdevelop.commonpage.UpdateDownLoadAPKActvity; import com.mayi.fastdevelop.commonpage.UpdateDownLoadAPKActvity;
......
...@@ -3,10 +3,11 @@ package com.mayi.demo; ...@@ -3,10 +3,11 @@ package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;
import com.mayi.fastdevelop.base.BaseFragment; import com.mayi.fastdevelop.base.BaseFragment;
import com.mayi.fastdevelop.base.BaseFragmentActivity; import com.mayi.fastdevelop.base.BaseFragmentActivity;
import com.mayi.fastdevelop.comnon.AppCallback; import com.mayi.fastdevelop.comnon.AppCallback;
......
...@@ -3,10 +3,11 @@ package com.mayi.demo; ...@@ -3,10 +3,11 @@ package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseFragment; import com.mayi.fastdevelop.base.BaseFragment;
import com.mayi.fastdevelop.base.BaseFragmentActivity; import com.mayi.fastdevelop.base.BaseFragmentActivity;
import com.mayi.fastdevelop.comnon.AppCallback; import com.mayi.fastdevelop.comnon.AppCallback;
......
package com.mayi.demo; package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import androidx.annotation.Nullable;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gc.call.CallConstant; import com.gc.call.CallConstant;
import com.gc.call.CallManage; import com.gc.call.CallManage;
......
...@@ -2,9 +2,10 @@ package com.mayi.demo; ...@@ -2,9 +2,10 @@ package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.support.annotation.Nullable;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.view.LoadingPictures; import com.mayi.fastdevelop.view.LoadingPictures;
......
...@@ -2,13 +2,14 @@ package com.mayi.demo; ...@@ -2,13 +2,14 @@ package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.util.DrawableUtils; import com.mayi.fastdevelop.util.DrawableUtils;
...@@ -22,7 +23,7 @@ public class MainActivity extends BaseActivity { ...@@ -22,7 +23,7 @@ public class MainActivity extends BaseActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
RecyclerView listView = findViewById(R.id.list); RecyclerView listView = findViewById(R.id.list);
listView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); listView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
final List<ItemBean> list = new ArrayList<>(); final List<ItemBean> list = new ArrayList<>();
list.add(new ItemBean("常用控件", new View.OnClickListener() { list.add(new ItemBean("常用控件", new View.OnClickListener() {
@Override @Override
......
...@@ -7,20 +7,16 @@ import com.gc.call.CallParticipationBean; ...@@ -7,20 +7,16 @@ 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.InitWebCallTarget;
import com.mayi.fastdevelop.web.GoWebCallTarget;
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);
......
...@@ -2,13 +2,14 @@ package com.mayi.demo; ...@@ -2,13 +2,14 @@ package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseFragment; import com.mayi.fastdevelop.base.BaseFragment;
import com.mayi.fastdevelop.comnon.AppCallback; import com.mayi.fastdevelop.comnon.AppCallback;
import com.mayi.fastdevelop.comnon.Constant; import com.mayi.fastdevelop.comnon.Constant;
......
package com.mayi.demo; package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.view.OnMultiClickListener; import com.mayi.fastdevelop.view.OnMultiClickListener;
......
...@@ -3,9 +3,10 @@ package com.mayi.demo; ...@@ -3,9 +3,10 @@ package com.mayi.demo;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import androidx.annotation.Nullable;
import com.gc.call.CallConstant; import com.gc.call.CallConstant;
import com.gc.call.CallManage; import com.gc.call.CallManage;
import com.gc.call.CallParticipationBean; import com.gc.call.CallParticipationBean;
......
package com.mayi.demo; package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.util.PermissionUtil; import com.mayi.fastdevelop.util.PermissionUtil;
......
package com.mayi.demo; package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.util.BitmapUtil; import com.mayi.fastdevelop.util.BitmapUtil;
import com.mayi.fastdevelop.util.QrUtil; import com.mayi.fastdevelop.util.QrUtil;
......
...@@ -2,14 +2,15 @@ package com.mayi.demo; ...@@ -2,14 +2,15 @@ package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout;
...@@ -32,7 +33,7 @@ public class SmartRefreshLayoutActivity extends BaseActivity { ...@@ -32,7 +33,7 @@ public class SmartRefreshLayoutActivity extends BaseActivity {
handler = new Handler(); handler = new Handler();
final SmartRefreshLayout layout = findViewById(R.id.layout); final SmartRefreshLayout layout = findViewById(R.id.layout);
final RecyclerView list = findViewById(R.id.list); final RecyclerView list = findViewById(R.id.list);
list.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); list.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
list.setAdapter(new MyAdapter()); list.setAdapter(new MyAdapter());
layout.setEnableRefresh(true); layout.setEnableRefresh(true);
......
package com.mayi.demo; package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.util.ToastUtil; import com.mayi.fastdevelop.util.ToastUtil;
import com.mayi.fastdevelop.view.CustomTitleBar; import com.mayi.fastdevelop.view.CustomTitleBar;
......
package com.mayi.demo; package com.mayi.demo;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View; import android.view.View;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.util.DialogUtils; import com.mayi.fastdevelop.util.DialogUtils;
import com.mayi.fastdevelop.util.ToastUtil; import com.mayi.fastdevelop.util.ToastUtil;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
android:layout_height="@dimen/im_dp_40" /> android:layout_height="@dimen/im_dp_40" />
<android.support.v4.view.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager" android:id="@+id/viewpager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list" android:id="@+id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/list" android:id="@+id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
......
...@@ -7,9 +7,7 @@ buildscript { ...@@ -7,9 +7,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }
......
...@@ -4,11 +4,11 @@ android { ...@@ -4,11 +4,11 @@ android {
compileSdkVersion 28 compileSdkVersion 28
defaultConfig { defaultConfig {
minSdkVersion 19 minSdkVersion 20
targetSdkVersion 28 targetSdkVersion 28
versionCode 2 versionCode 2
versionName "1.1" versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" // 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'
...@@ -22,6 +22,11 @@ android { ...@@ -22,6 +22,11 @@ android {
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
} }
dependencies { dependencies {
...@@ -35,10 +40,10 @@ dependencies { ...@@ -35,10 +40,10 @@ dependencies {
api 'com.tencent.bugly:nativecrashreport:3.6.0.1' api 'com.tencent.bugly:nativecrashreport:3.6.0.1'
api 'com.orhanobut:logger:2.2.0' api 'com.orhanobut:logger:2.2.0'
api 'com.alibaba:fastjson:1.2.12' api 'com.alibaba:fastjson:1.2.12'
api 'com.android.support:recyclerview-v7:28.0.0' api 'androidx.recyclerview:recyclerview:1.0.0'
api 'com.android.support:appcompat-v7:28.0.0'
api files('libs/zixing-core-3.2.0.jar') api files('libs/zixing-core-3.2.0.jar')
// api project(':call') // api project(':call')
api 'com.gc:call:1.0.0' api 'com.gc:call:1.0.0'
api 'com.google.android.exoplayer:exoplayer:2.10.5'
} }
package com.mayi.fastdevelop;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.mayi.fastdevelop.test", appContext.getPackageName());
}
}
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<!-- 解决 Android N 7.0 上 报错:android.os.FileUriExposedException --> <!-- 解决 Android N 7.0 上 报错:android.os.FileUriExposedException -->
<provider <provider
android:name="android.support.v4.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.uri" android:authorities="${applicationId}.uri"
android:exported="false" android:exported="false"
android:grantUriPermissions="true" android:grantUriPermissions="true"
......
...@@ -4,7 +4,8 @@ import android.app.Dialog; ...@@ -4,7 +4,8 @@ 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.support.v7.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;
......
...@@ -8,9 +8,10 @@ import android.os.Build; ...@@ -8,9 +8,10 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.support.v4.content.FileProvider;
import androidx.core.content.FileProvider;
import com.mayi.fastdevelop.util.PermissionUtil; import com.mayi.fastdevelop.util.PermissionUtil;
import java.io.File; import java.io.File;
......
...@@ -4,8 +4,9 @@ import android.app.Activity; ...@@ -4,8 +4,9 @@ import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.mayi.fastdevelop.comnon.AppCallback; import com.mayi.fastdevelop.comnon.AppCallback;
import com.mayi.fastdevelop.util.ToastUtil; import com.mayi.fastdevelop.util.ToastUtil;
......
...@@ -3,13 +3,14 @@ package com.mayi.fastdevelop.base; ...@@ -3,13 +3,14 @@ package com.mayi.fastdevelop.base;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.ViewPager;
import com.mayi.fastdevelop.comnon.AppCallback; import com.mayi.fastdevelop.comnon.AppCallback;
import com.mayi.fastdevelop.comnon.Constant; import com.mayi.fastdevelop.comnon.Constant;
import com.mayi.fastdevelop.util.ToastUtil; import com.mayi.fastdevelop.util.ToastUtil;
......
...@@ -2,9 +2,10 @@ package com.mayi.fastdevelop.commonpage; ...@@ -2,9 +2,10 @@ package com.mayi.fastdevelop.commonpage;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.Nullable;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.Nullable;
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.UserManager; import com.mayi.fastdevelop.comnon.UserManager;
......
...@@ -9,7 +9,8 @@ import android.net.Uri; ...@@ -9,7 +9,8 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
import com.mayi.fastdevelop.bean.AppConfig; import com.mayi.fastdevelop.bean.AppConfig;
......
...@@ -4,7 +4,6 @@ import android.os.Bundle; ...@@ -4,7 +4,6 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.Vibrator; import android.os.Vibrator;
import android.support.annotation.Nullable;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback; import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView; import android.view.SurfaceView;
...@@ -12,6 +11,8 @@ import android.view.View; ...@@ -12,6 +11,8 @@ import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.Nullable;
import com.google.zxing.Result; import com.google.zxing.Result;
import com.mayi.fastdevelop.R; import com.mayi.fastdevelop.R;
import com.mayi.fastdevelop.base.BaseActivity; import com.mayi.fastdevelop.base.BaseActivity;
......
...@@ -17,7 +17,6 @@ import android.location.LocationManager; ...@@ -17,7 +17,6 @@ import android.location.LocationManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.support.annotation.FloatRange;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.method.HideReturnsTransformationMethod; import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod; import android.text.method.PasswordTransformationMethod;
...@@ -28,6 +27,8 @@ import android.view.WindowManager; ...@@ -28,6 +27,8 @@ import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import androidx.annotation.FloatRange;
import com.mayi.fastdevelop.R; import com.mayi.fastdevelop.R;
import java.io.File; import java.io.File;
......
package com.mayi.fastdevelop.view;
import android.content.Context;
import android.net.Uri;
import android.util.AttributeSet;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.PlaybackPreparer;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.database.DatabaseProvider;
import com.google.android.exoplayer2.database.ExoDatabaseProvider;
import com.google.android.exoplayer2.source.LoopingMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.upstream.DataSink;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
import com.google.android.exoplayer2.upstream.FileDataSourceFactory;
import com.google.android.exoplayer2.upstream.TransferListener;
import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.exoplayer2.upstream.cache.CacheDataSinkFactory;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
import com.google.android.exoplayer2.upstream.cache.CacheDataSourceFactory;
import com.google.android.exoplayer2.upstream.cache.NoOpCacheEvictor;
import com.google.android.exoplayer2.upstream.cache.SimpleCache;
import com.google.android.exoplayer2.util.Util;
import java.io.File;
public class AppPlayerView extends PlayerView implements PlaybackPreparer {
private static final String DOWNLOAD_CONTENT_DIRECTORY = "downloads";
private SimpleExoPlayer player;
private DatabaseProvider databaseProvider;
private File downloadDirectory;
private Cache downloadCache;
public AppPlayerView(Context context) {
super(context);
}
public AppPlayerView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public AppPlayerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void setUrl(String url, boolean isLooping) {
if (player == null) {
player = ExoPlayerFactory.newSimpleInstance(getContext());
setPlayer(player);
player.setPlayWhenReady(true);
setPlaybackPreparer(this);
}
// 测量播放带宽,如果不需要可以传null
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){
//循环播放
LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource);
//使用资源准备播放器
player.prepare(loopingMediaSource);
}else {
//使用资源准备播放器
player.prepare(mediaSource);
}
}
protected synchronized Cache getDownloadCache() {
if (downloadCache == null) {
File downloadContentDirectory = new File(getDownloadDirectory(), DOWNLOAD_CONTENT_DIRECTORY);
downloadCache = new SimpleCache(downloadContentDirectory, new NoOpCacheEvictor(), getDatabaseProvider());
}
return downloadCache;
}
private void releasePlayer() {
if (downloadCache!=null){
downloadCache.release();
}
if (Util.SDK_INT <= 23) {
onPause();
releasePlayer();
}
if (player!=null){
player.release();
}
}
private File getDownloadDirectory() {
if (downloadDirectory == null) {
downloadDirectory = getContext().getExternalFilesDir(null);
if (downloadDirectory == null) {
downloadDirectory = getContext().getFilesDir();
}
}
return downloadDirectory;
}
private DatabaseProvider getDatabaseProvider() {
if (databaseProvider == null) {
databaseProvider = new ExoDatabaseProvider(getContext());
}
return databaseProvider;
}
@Override
public void preparePlayback() {
player.retry();
}
}
...@@ -2,7 +2,6 @@ package com.mayi.fastdevelop.view; ...@@ -2,7 +2,6 @@ package com.mayi.fastdevelop.view;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.text.Html; import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
...@@ -13,6 +12,8 @@ import android.widget.ImageView; ...@@ -13,6 +12,8 @@ import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.DrawableRes;
import com.mayi.fastdevelop.R; import com.mayi.fastdevelop.R;
import com.mayi.fastdevelop.util.DisplayUtil; import com.mayi.fastdevelop.util.DisplayUtil;
......
...@@ -4,15 +4,16 @@ import android.annotation.SuppressLint; ...@@ -4,15 +4,16 @@ import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.support.annotation.FloatRange;
import android.support.annotation.StyleRes;
import android.support.v7.app.AlertDialog;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import androidx.annotation.FloatRange;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AlertDialog;
import com.mayi.fastdevelop.R; import com.mayi.fastdevelop.R;
......
package com.mayi.fastdevelop.view.dialog; package com.mayi.fastdevelop.view.dialog;
import android.content.Context; import android.content.Context;
import android.support.annotation.StringRes;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.StringRes;
public class DialogViewHolder { public class DialogViewHolder {
private final SparseArray<View> mViews; private final SparseArray<View> mViews;
private View mDialogView; private View mDialogView;
......
...@@ -11,3 +11,6 @@ org.gradle.jvmargs=-Xmx1536m ...@@ -11,3 +11,6 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true # org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true
#Fri Jan 04 11:28:23 GMT+08:00 2019 #Wed Oct 09 13:46:21 CST 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
...@@ -2,17 +2,11 @@ apply plugin: 'com.android.library' ...@@ -2,17 +2,11 @@ apply plugin: 'com.android.library'
android { android {
compileSdkVersion 28 compileSdkVersion 28
defaultConfig { defaultConfig {
minSdkVersion 19 minSdkVersion 20
targetSdkVersion 28 targetSdkVersion 28
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
...@@ -26,7 +20,6 @@ android { ...@@ -26,7 +20,6 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar']) api fileTree(dir: 'libs', include: ['*.jar'])
api 'com.android.support:appcompat-v7:28.0.0'
api project(':fastDevelop') api project(':fastDevelop')
//高德地图 //高德地图
api 'com.amap.api:location:latest.integration' api 'com.amap.api:location:latest.integration'
......
package com.mayi.fastdevelop.map;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.mayi.fastdevelop.map.test", appContext.getPackageName());
}
}
include ':app', ':fastDevelop', ':web', ':map' include ':app', ':fastDevelop'
\ No newline at end of file //, ':web', ':map'
\ No newline at end of file
...@@ -2,17 +2,11 @@ apply plugin: 'com.android.library' ...@@ -2,17 +2,11 @@ apply plugin: 'com.android.library'
android { android {
compileSdkVersion 28 compileSdkVersion 28
defaultConfig { defaultConfig {
minSdkVersion 15 minSdkVersion 20
targetSdkVersion 28 targetSdkVersion 28
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
...@@ -26,10 +20,6 @@ android { ...@@ -26,10 +20,6 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
api project(':fastDevelop') api project(':fastDevelop')
implementation files('libs/tbs_sdk_thirdapp_v3.6.0.1371_43624_sharewithdownload_withoutGame_obfs_20181106_121046.jar')//腾讯X5浏览器 implementation files('libs/tbs_sdk_thirdapp_v3.6.0.1371_43624_sharewithdownload_withoutGame_obfs_20181106_121046.jar')//腾讯X5浏览器
} }
package com.mayi.fastdevelop.web;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.mayi.fastdevelop.web.test", appContext.getPackageName());
}
}
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