Merge branch 'feature/v2.0.0' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into feature/v2.0.0
@@ -10,8 +10,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode generateVersionCode()
|
||||
versionName "${rootProject.ext.android.versionName}.${getMonthAndDay()}"
|
||||
versionCode rootProject.versionCode as int
|
||||
versionName rootProject.versionName
|
||||
applicationId rootProject.ext.android.applicationId
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -153,9 +153,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.guideshowprovider
|
||||
implementation rootProject.ext.dependencies.guideshow
|
||||
implementation rootProject.ext.dependencies.modulemedia
|
||||
implementation rootProject.ext.dependencies.modulefreshnews, {
|
||||
exclude group: 'com.mogo.module', module: 'module-onlinecar'
|
||||
}
|
||||
|
||||
implementation rootProject.ext.dependencies.modulepush, {
|
||||
exclude group: 'com.mogo.module', module: 'module-common'
|
||||
@@ -191,10 +188,25 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
//android.applicationVariants.all { variant ->
|
||||
// variant.outputs.all { //这里修改apk文件名
|
||||
// outputFileName = "Launcher2.0_V${android.defaultConfig.versionName}_${getCurrentDate()}_${variant.name}_${getGitCommit()}.apk"
|
||||
// println outputFileName
|
||||
// }
|
||||
//}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.all { //这里修改apk文件名
|
||||
outputFileName = "Launcher2.0_V${android.defaultConfig.versionName}_${getCurrentDate()}_${variant.name}_${getGitCommit()}.apk"
|
||||
println outputFileName
|
||||
def buildTime = new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08:00"))
|
||||
def flavor = variant.productFlavors.collect { it.name }.join('-')
|
||||
|
||||
variant.outputs.all { output ->
|
||||
outputFileName = [
|
||||
rootProject.applicationName,
|
||||
"v${variant.versionName}",
|
||||
buildTime,
|
||||
flavor.length() > 0 ? "[${flavor}]" : "",
|
||||
variant.buildType.name
|
||||
].findAll { it.length() > 0 }.join('_') << ".apk"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.auto.zhidao.logsdk.CrashSystem;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.launcher.news.FreshNewsConstants;
|
||||
import com.mogo.module.adcard.AdCardConstants;
|
||||
import com.mogo.module.back.BackToLauncherConst;
|
||||
import com.mogo.module.carchatting.card.CallChatConstant;
|
||||
@@ -27,8 +26,6 @@ import com.mogo.utils.logger.Logger;
|
||||
|
||||
import static com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.PATH_AGREEMENT_FRAGMENT;
|
||||
import static com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME;
|
||||
import static com.mogo.module.guide.GuideConstant.PATH_GUIDE_FRAGMENT;
|
||||
import static com.mogo.module.guide.GuideConstant.PATH_GUIDE_MODULE_NAME;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -58,9 +55,8 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addModule(new MogoModule(AdCardConstants.TAG, AdCardConstants.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(MediaConstants.TAG, MediaConstants.MODULE_TYPE));
|
||||
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(TanluConstants.TAG, TanluConstants.MODEL_NAME));
|
||||
// MogoModulePaths.addModule(new MogoModule(TanluConstants.TAG, TanluConstants.MODEL_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(OnLineCarConstants.TAG, OnLineCarConstants.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(FreshNewsConstants.TAG, FreshNewsConstants.MODULE_NAME));
|
||||
|
||||
MogoModulePaths.addModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI));
|
||||
MogoModulePaths.addModule(new MogoModule(PushUIConstants.TAG, PushUIConstants.TAG));
|
||||
|
||||
@@ -6,14 +6,13 @@ ext {
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
versionName : "8.0.6",
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
// androidx
|
||||
androidxappcompat : "androidx.appcompat:appcompat:1.0.2",
|
||||
androidxccorektx : "androidx.core:core-ktx:1.2.0",
|
||||
androidxconstraintlayout : "androidx.constraintlayout:constraintlayout:1.1.3",
|
||||
androidxconstraintlayout : "androidx.constraintlayout:constraintlayout:2.0.0-alpha5",
|
||||
androidxmultidex : "androidx.multidex:multidex:2.0.1",
|
||||
androidxviewpager2 : "androidx.viewpager2:viewpager2:1.0.0",
|
||||
androidxrecyclerview : "androidx.recyclerview:recyclerview:1.1.0",
|
||||
@@ -109,7 +108,6 @@ ext {
|
||||
modulepush : "com.mogo.module:module-push:${MOGO_MODULE_PUSH_VERSION}",
|
||||
//运营位卡片
|
||||
moduleadcard : "com.mogo.module:module-adcard:${MOGO_MODULE_AD_CARD_VERSION}",
|
||||
modulefreshnews : "com.mogo.module:module-freshnews:${MOGO_MODULE_FRESH_NEWS_VERSION}",
|
||||
//统一返回键
|
||||
mogomoduleback : "com.mogo.module:module-back:${MOGO_MODULE_BACK_VERSION}",
|
||||
mogomoduleauth : "com.mogo.module:module-authorize:${MOGO_MODULE_AUTHORIZE_VERSION}",
|
||||
@@ -143,5 +141,7 @@ ext {
|
||||
gpssimulator : "com.mogo.module:module-gps-simulator:${MOGO_MODULE_GPS_SIMULATOR_VERSION}",
|
||||
gpssimulatordebug : "com.mogo.module:module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.0-SNAPSHOT",
|
||||
]
|
||||
}
|
||||
@@ -24,37 +24,37 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
|
||||
USERNAME=xintai
|
||||
PASSWORD=xintai2018
|
||||
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
|
||||
RELEASE=false
|
||||
RELEASE=true
|
||||
# 模块版本
|
||||
## 工程内模块
|
||||
MOGO_COMMONS_VERSION=1.0.3.12
|
||||
MOGO_UTILS_VERSION=1.0.3.12
|
||||
MAP_AMAP_VERSION=1.0.3.12
|
||||
MOGO_MAP_VERSION=1.0.3.12
|
||||
MOGO_MAP_API_VERSION=1.0.3.12
|
||||
MOGO_SERVICE_VERSION=1.0.3.12
|
||||
MOGO_SERVICE_API_VERSION=1.0.3.12
|
||||
MOGO_CONNECTION_VERSION=1.0.3.12
|
||||
MOGO_MODULE_APPS_VERSION=1.0.3.12
|
||||
MOGO_MODULE_NAVI_VERSION=1.0.3.12
|
||||
MOGO_MODULE_SHARE_VERSION=1.0.3.12
|
||||
MOGO_MODULE_COMMON_VERSION=1.0.3.12
|
||||
MOGO_MODULE_MAIN_VERSION=1.0.3.12
|
||||
MOGO_MODULE_MAP_VERSION=1.0.3.12
|
||||
MOGO_MODULE_SERVICE_VERSION=1.0.3.12
|
||||
MOGO_MODULE_EXTENSIONS_VERSION=1.0.3.12
|
||||
MOGO_MODULE_SEARCH_VERSION=1.0.3.12
|
||||
MOGO_MODULE_BACK_VERSION=1.0.3.12
|
||||
MOGO_MODULE_GPS_SIMULATOR_VERSION=1.0.3.12
|
||||
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.0.3.12
|
||||
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.0.3.12
|
||||
MOGO_MODULE_AUTHORIZE_VERSION=1.0.3.12
|
||||
MOGO_MODULE_GUIDE_VERSION=1.0.3.12
|
||||
MOGO_COMMONS_VERSION=1.1.0.7
|
||||
MOGO_UTILS_VERSION=1.1.0.7
|
||||
MAP_AMAP_VERSION=1.1.0.7
|
||||
MOGO_MAP_VERSION=1.1.0.7
|
||||
MOGO_MAP_API_VERSION=1.1.0.7
|
||||
MOGO_SERVICE_VERSION=1.1.0.7
|
||||
MOGO_SERVICE_API_VERSION=1.1.0.7
|
||||
MOGO_CONNECTION_VERSION=1.1.0.7
|
||||
MOGO_MODULE_APPS_VERSION=1.1.0.7
|
||||
MOGO_MODULE_NAVI_VERSION=1.1.0.7
|
||||
MOGO_MODULE_SHARE_VERSION=1.1.0.7
|
||||
MOGO_MODULE_COMMON_VERSION=1.1.0.7
|
||||
MOGO_MODULE_MAIN_VERSION=1.1.0.7
|
||||
MOGO_MODULE_MAP_VERSION=1.1.0.7
|
||||
MOGO_MODULE_SERVICE_VERSION=1.1.0.7
|
||||
MOGO_MODULE_EXTENSIONS_VERSION=1.1.0.7
|
||||
MOGO_MODULE_SEARCH_VERSION=1.1.0.7
|
||||
MOGO_MODULE_BACK_VERSION=1.1.0.7
|
||||
MOGO_MODULE_GPS_SIMULATOR_VERSION=1.1.0.7
|
||||
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.1.0.7
|
||||
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.1.0.7
|
||||
MOGO_MODULE_AUTHORIZE_VERSION=1.1.0.7
|
||||
MOGO_MODULE_GUIDE_VERSION=1.1.0.7
|
||||
|
||||
|
||||
## 工程外部模块
|
||||
# 探路
|
||||
MOGO_MODULE_TANLU_VERSION=1.0.5.6
|
||||
MOGO_MODULE_TANLU_VERSION=1.0.6-SNAPSHOT
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=1.0.4-SNAPSHOT
|
||||
# 车聊聊接口
|
||||
@@ -66,12 +66,16 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT
|
||||
# 在线车辆F
|
||||
MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2
|
||||
# v2x
|
||||
MOGO_MODULE_V2X_VERSION=1.0.6.28
|
||||
MOGO_MODULE_V2X_VERSION=1.0.7
|
||||
# 媒体卡片
|
||||
MOGO_MODULE_MEDIA_VERSION=1.0.4.3
|
||||
# 推送
|
||||
MOGO_MODULE_PUSH_VERSION=1.0.1
|
||||
# 广告资源位
|
||||
MOGO_MODULE_AD_CARD_VERSION=1.0.1
|
||||
# 新鲜事
|
||||
MOGO_MODULE_FRESH_NEWS_VERSION=1.0.3.4
|
||||
|
||||
## 产品库必备配置
|
||||
applicationId=com.mogo.launcer
|
||||
applicationName=Launcer2.0
|
||||
versionCode=80006
|
||||
versionName=8.0.6
|
||||
@@ -17,7 +17,6 @@ import android.view.animation.Interpolator;
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.AMapUtils;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.LocationSource;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
@@ -492,7 +491,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter( MogoLatLng latLng ) {
|
||||
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
|
||||
Logger.d( TAG, "move to center %s", latLng );
|
||||
if ( latLng == null || latLng.lat == 0.0d || latLng.lng == 0.0d ) {
|
||||
Logger.e( TAG, "latlng = null or is illegal" );
|
||||
@@ -502,7 +501,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
loseLockMode();
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
if ( animate ) {
|
||||
mMapView.getMap().animateCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
} else {
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -85,9 +85,9 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng) {
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
if (mClient != null) {
|
||||
mClient.moveToCenter(latLng);
|
||||
mClient.moveToCenter(latLng, animate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,42 +18,42 @@ public interface IMogoMapListener {
|
||||
/**
|
||||
* 地图加载完毕
|
||||
*/
|
||||
void onMapLoaded();
|
||||
default void onMapLoaded(){};
|
||||
|
||||
/**
|
||||
* 地图点击
|
||||
*
|
||||
* @param motionEvent
|
||||
*/
|
||||
void onTouch( MotionEvent motionEvent );
|
||||
default void onTouch( MotionEvent motionEvent ){};
|
||||
|
||||
/**
|
||||
* 地图上的任意poi点击
|
||||
*
|
||||
* @param poi
|
||||
*/
|
||||
void onPOIClick( MogoPoi poi );
|
||||
default void onPOIClick( MogoPoi poi ){};
|
||||
|
||||
/**
|
||||
* 地图点击
|
||||
*
|
||||
* @param latLng
|
||||
*/
|
||||
void onMapClick( MogoLatLng latLng );
|
||||
default void onMapClick( MogoLatLng latLng ){}
|
||||
|
||||
/**
|
||||
* 地图锁定
|
||||
*
|
||||
* @param isLock
|
||||
*/
|
||||
void onLockMap( boolean isLock );
|
||||
default void onLockMap( boolean isLock ){}
|
||||
|
||||
/**
|
||||
* 地图白天黑夜、导航视角切换
|
||||
*
|
||||
* @param ui
|
||||
*/
|
||||
void onMapModeChanged( EnumMapUI ui );
|
||||
default void onMapModeChanged( EnumMapUI ui ){}
|
||||
|
||||
/**
|
||||
* @param latLng 中点的经纬度
|
||||
@@ -61,5 +61,5 @@ public interface IMogoMapListener {
|
||||
* @param tilt 倾斜度
|
||||
* @param bearing 旋转角度
|
||||
*/
|
||||
void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing );
|
||||
default void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ){}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ public interface IMogoAimlessModeListener {
|
||||
/**
|
||||
* 巡航信息发生改变
|
||||
*/
|
||||
void onUpdateTraffic2( MogoTraffic traffic );
|
||||
default void onUpdateTraffic2( MogoTraffic traffic ){}
|
||||
|
||||
/**
|
||||
* 拥堵信息
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
void onUpdateCongestion( MogoCongestionInfo info );
|
||||
default void onUpdateCongestion( MogoCongestionInfo info ){}
|
||||
}
|
||||
|
||||
@@ -96,4 +96,15 @@ public class MogoAoiItem implements Parcelable {
|
||||
return new MogoAoiItem[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoAoiItem{" +
|
||||
"aoiId='" + aoiId + '\'' +
|
||||
", aoiName='" + aoiName + '\'' +
|
||||
", adCode='" + adCode + '\'' +
|
||||
", aoiCenterPoint=" + aoiCenterPoint +
|
||||
", aoiArea=" + aoiArea +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,4 +63,12 @@ public class MogoBusinessArea implements Parcelable {
|
||||
return new MogoBusinessArea[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoBusinessArea{" +
|
||||
"centerPoint=" + centerPoint +
|
||||
", name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,4 +105,16 @@ public class MogoCrossroad implements Parcelable {
|
||||
return new MogoCrossroad[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoCrossroad{" +
|
||||
"distance=" + distance +
|
||||
", direction='" + direction + '\'' +
|
||||
", firstRoadId='" + firstRoadId + '\'' +
|
||||
", firstRoadName='" + firstRoadName + '\'' +
|
||||
", secondRoadId='" + secondRoadId + '\'' +
|
||||
", secondRoadName='" + secondRoadName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,4 +100,20 @@ public class MogoGeocodeAddress {
|
||||
public void setLevel( String level ) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoGeocodeAddress{" +
|
||||
"formatAddress='" + formatAddress + '\'' +
|
||||
", province='" + province + '\'' +
|
||||
", city='" + city + '\'' +
|
||||
", district='" + district + '\'' +
|
||||
", township='" + township + '\'' +
|
||||
", neighborhood='" + neighborhood + '\'' +
|
||||
", building='" + building + '\'' +
|
||||
", adcode='" + adcode + '\'' +
|
||||
", latlng=" + latlng +
|
||||
", level='" + level + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,11 @@ public class MogoGeocodeResult {
|
||||
public void setAddresses( List< MogoGeocodeAddress > addresses ) {
|
||||
this.addresses = addresses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoGeocodeResult{" +
|
||||
"addresses=" + addresses +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,4 +72,13 @@ public class MogoIndoorData implements Parcelable {
|
||||
return new MogoIndoorData[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoIndoorData{" +
|
||||
"poiId='" + poiId + '\'' +
|
||||
", floor=" + floor +
|
||||
", floorName='" + floorName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,4 +61,12 @@ public class MogoPhoto implements Parcelable {
|
||||
return new MogoPhoto[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoPhoto{" +
|
||||
"title='" + title + '\'' +
|
||||
", url='" + url + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,4 +352,38 @@ public class MogoPoiItem implements Parcelable {
|
||||
return new MogoPoiItem[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoPoiItem{" +
|
||||
"businessArea='" + businessArea + '\'' +
|
||||
", adName='" + adName + '\'' +
|
||||
", cityName='" + cityName + '\'' +
|
||||
", provinceName='" + provinceName + '\'' +
|
||||
", typeDes='" + typeDes + '\'' +
|
||||
", tel='" + tel + '\'' +
|
||||
", adCode='" + adCode + '\'' +
|
||||
", poiId='" + poiId + '\'' +
|
||||
", distance=" + distance +
|
||||
", title='" + title + '\'' +
|
||||
", snippet='" + snippet + '\'' +
|
||||
", point=" + point +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", enter=" + enter +
|
||||
", exit=" + exit +
|
||||
", website='" + website + '\'' +
|
||||
", postcode='" + postcode + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", direction='" + direction + '\'' +
|
||||
", indoorMap=" + indoorMap +
|
||||
", provinceCode='" + provinceCode + '\'' +
|
||||
", parkingType='" + parkingType + '\'' +
|
||||
", subPois=" + subPois +
|
||||
", indoorData=" + indoorData +
|
||||
", photos=" + photos +
|
||||
", poiExtension=" + poiExtension +
|
||||
", typeCode='" + typeCode + '\'' +
|
||||
", shopID='" + shopID + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,4 +228,27 @@ public class MogoRegeocodeAddress implements Parcelable {
|
||||
return new MogoRegeocodeAddress[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoRegeocodeAddress{" +
|
||||
"formatAddress='" + formatAddress + '\'' +
|
||||
", province='" + province + '\'' +
|
||||
", city='" + city + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", adCode='" + adCode + '\'' +
|
||||
", district='" + district + '\'' +
|
||||
", township='" + township + '\'' +
|
||||
", neighborhood='" + neighborhood + '\'' +
|
||||
", building='" + building + '\'' +
|
||||
", streetNumber=" + streetNumber +
|
||||
", roads=" + roads +
|
||||
", pois=" + pois +
|
||||
", crossroads=" + crossroads +
|
||||
", businessAreas=" + businessAreas +
|
||||
", aois=" + aois +
|
||||
", towncode='" + towncode + '\'' +
|
||||
", country='" + country + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,11 @@ public class MogoRegeocodeResult implements Parcelable {
|
||||
return new MogoRegeocodeResult[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoRegeocodeResult{" +
|
||||
"regeocodeAddress=" + regeocodeAddress +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,4 +95,15 @@ public class MogoRegeocodeRoad implements Parcelable {
|
||||
return new MogoRegeocodeRoad[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoRegeocodeRoad{" +
|
||||
"id='" + id + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", distance=" + distance +
|
||||
", direction='" + direction + '\'' +
|
||||
", point=" + point +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,4 +95,15 @@ public class MogoStreetNumber implements Parcelable {
|
||||
return new MogoStreetNumber[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoStreetNumber{" +
|
||||
"street='" + street + '\'' +
|
||||
", number='" + number + '\'' +
|
||||
", latLonPoint=" + latLonPoint +
|
||||
", direction='" + direction + '\'' +
|
||||
", distance=" + distance +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,4 +118,17 @@ public class MogoSubPoiItem implements Parcelable {
|
||||
return new MogoSubPoiItem[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoSubPoiItem{" +
|
||||
"poiId='" + poiId + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
", subName='" + subName + '\'' +
|
||||
", distance=" + distance +
|
||||
", point=" + point +
|
||||
", snippet='" + snippet + '\'' +
|
||||
", subTypeDes='" + subTypeDes + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class MogoPoiSearchQuery implements Parcelable {
|
||||
private int pageSize;
|
||||
private boolean isCityLimit;
|
||||
private boolean isSubPois;
|
||||
private boolean isDistanceSort;
|
||||
private boolean isDistanceSort = true;
|
||||
private MogoLatLng location;
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,14 @@ public interface IMogoMapUIController {
|
||||
/**
|
||||
* 将地图移动至当前位置
|
||||
*/
|
||||
void moveToCenter( MogoLatLng latLng );
|
||||
default void moveToCenter( MogoLatLng latLng ){
|
||||
moveToCenter(latLng, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将地图移动至当前位置
|
||||
*/
|
||||
void moveToCenter( MogoLatLng latLng, boolean animate );
|
||||
|
||||
/**
|
||||
* 显示我的位置
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-26
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoInitor {
|
||||
|
||||
public static void init( Context context ) {
|
||||
}
|
||||
}
|
||||
@@ -79,9 +79,9 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng) {
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.moveToCenter(latLng);
|
||||
mDelegate.moveToCenter(latLng, animate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,36 +2,23 @@ package com.mogo.module.apps;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.apps.adapter.AppIndicatorAdapter;
|
||||
import com.mogo.module.apps.adapter.base.RecycleViewHolder;
|
||||
import com.mogo.module.apps.model.NavigatorApp;
|
||||
import com.mogo.module.apps.anim.AnimWrapper;
|
||||
import com.mogo.module.apps.applaunch.AppLauncher;
|
||||
import com.mogo.module.apps.applaunch.BaseAppLauncher;
|
||||
import com.mogo.module.apps.applaunch.InternalFunctionLauncher;
|
||||
import com.mogo.module.apps.model.NavigatorApps;
|
||||
import com.mogo.module.apps.utils.CardScaleTransformer;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardChangedListener;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.yarolegovich.discretescrollview.DiscreteScrollLayoutManager;
|
||||
import com.yarolegovich.discretescrollview.DiscreteScrollView;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -40,27 +27,18 @@ import java.util.Map;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavigatorPresenter>
|
||||
implements AppNavigatorView, DiscreteScrollView.OnItemChangedListener<RecycleViewHolder>,
|
||||
DiscreteScrollView.ScrollStateChangeListener<RecycleViewHolder>,
|
||||
IMogoCardChangedListener {
|
||||
public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavigatorPresenter > implements AppNavigatorView {
|
||||
|
||||
private static final String TAG = "AppNavigatorFragment";
|
||||
private View mApps;
|
||||
|
||||
private IMogoFragmentManager mMogoFragmentManager;
|
||||
List<NavigatorApp> apps;
|
||||
private RecyclerView mNavigatorAppsList;
|
||||
private AppIndicatorAdapter mAppIndicatorAdapter;
|
||||
|
||||
/**
|
||||
* 搜索莫模块
|
||||
*/
|
||||
private IMogoModuleProvider mSearchProvider;
|
||||
private ImageView mAIAssist;
|
||||
private View mAIAssistContainer;
|
||||
private AnimWrapper mAnim = new AnimWrapper();
|
||||
|
||||
private IMogoAnalytics mMogoAnalytics;
|
||||
// private DiscreteScrollView scroller;
|
||||
|
||||
private static int CARD_SIZE = 6;
|
||||
private AppIndicatorAdapter appIndicatorAdapter;
|
||||
private BaseAppLauncher mLauncher;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -70,227 +48,87 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
mMogoFragmentManager = (IMogoFragmentManager) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_FRAGMENT_MANAGER)
|
||||
.navigation();
|
||||
mLauncher = new InternalFunctionLauncher( getActivity() );
|
||||
mLauncher.setNext( new AppLauncher() );
|
||||
|
||||
mApps = findViewById(R.id.module_apps_id_apps);
|
||||
mNavigatorAppsList = findViewById( R.id.module_apps_id_apps_list );
|
||||
mNavigatorAppsList.setLayoutManager( new LinearLayoutManager( getActivity(), RecyclerView.VERTICAL, false ) );
|
||||
mAppIndicatorAdapter = new AppIndicatorAdapter( getContext(), NavigatorApps.getApps() );
|
||||
mAppIndicatorAdapter.setOnItemClickedListener( ( data, position ) -> {
|
||||
mLauncher.launch( getContext(), data );
|
||||
} );
|
||||
mNavigatorAppsList.setAdapter( mAppIndicatorAdapter );
|
||||
|
||||
// scroller = findViewById(R.id.module_apps_id_scroller);
|
||||
//
|
||||
// scroller.setRatio(330 / 523F);
|
||||
// //scroller.setRatio(176/279F);
|
||||
// scroller.setSlideOnFling(true);
|
||||
// scroller.addOnItemChangedListener(this);
|
||||
// scroller.addScrollStateChangeListener(this);
|
||||
// //scroller.setItemTransitionTimeMillis(DiscreteScrollViewOptions.getTransitionTime());
|
||||
// apps = NavigatorApps.getApps();
|
||||
// CARD_SIZE = apps.size();
|
||||
// scroller.setItemTransformer(new CardScaleTransformer.Builder()
|
||||
// .setMinScale(0.84f)
|
||||
// .build());
|
||||
mAIAssistContainer = findViewById( R.id.module_apps_id_ai_assist_container );
|
||||
mAIAssist = findViewById( R.id.module_apps_id_ai_assist );
|
||||
mAnim.initAnim( mAIAssist );
|
||||
mAIAssist.setOnClickListener( view -> {
|
||||
AIAssist.startAssistant( getContext() );
|
||||
AppServiceHandler.getApis().getAnalyticsApi().track( "Launcher_xiaozhi_Click", null );
|
||||
} );
|
||||
mAIAssistContainer.setOnClickListener( view -> {
|
||||
mAIAssist.performClick();
|
||||
} );
|
||||
|
||||
appIndicatorAdapter = new AppIndicatorAdapter(getContext(), apps);
|
||||
|
||||
appIndicatorAdapter.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
NavigatorApp item = (NavigatorApp) v.getTag();
|
||||
AppServiceHandler.getMogoCardManager().switch2(item.mModuleType);
|
||||
AppServiceHandler.getApis().getFragmentManagerApi().addMainFragmentStackTransactionListener( size -> {
|
||||
// 主页 fragment 栈变化的时候,改变动画状态
|
||||
if ( size == 0 ) {
|
||||
mAnim.start();
|
||||
} else {
|
||||
mAnim.stop();
|
||||
}
|
||||
});
|
||||
|
||||
// scroller.setAdapter(appIndicatorAdapter);
|
||||
// scroller.scrollToPosition(Integer.MAX_VALUE / 2 - 1);
|
||||
//mNavigation.setOnClickListener( view -> {
|
||||
// openSearchPanel();
|
||||
// trackNavigatorClickEvent( 1 );
|
||||
//} );
|
||||
//mMediaCenter.setOnClickListener( view -> {
|
||||
// try {
|
||||
// LaunchUtils.launchByPkg( getContext(), AppsConst.APP_PKG_MUSIC );
|
||||
// trackNavigatorClickEvent( 2 );
|
||||
// } catch ( Exception e ) {
|
||||
// TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
// }
|
||||
//} );
|
||||
//mCarSettings.setOnClickListener( view -> {
|
||||
// try {
|
||||
// LaunchUtils.launchByPkg( getContext(), AppsConst.APP_PKG_CAR_SETTINGS );
|
||||
// trackNavigatorClickEvent( 3 );
|
||||
// } catch ( Exception e ) {
|
||||
// TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
// }
|
||||
//} );
|
||||
mApps.setOnClickListener(view -> {
|
||||
openAppsPanel();
|
||||
|
||||
//AppServiceHandler.getMogoCardManager()
|
||||
// .switch2(apps.get((int) (Math.random() * 6)).mModuleType);
|
||||
|
||||
trackNavigatorClickEvent(4);
|
||||
});
|
||||
AppServiceHandler.init(getContext());
|
||||
|
||||
AppServiceHandler.getMogoCardManager().registerCardChangedListener(TAG, this);
|
||||
} );
|
||||
}
|
||||
|
||||
private void scrollToCenter(int index) {
|
||||
@Override
|
||||
public void hideNavigationEntrance() {
|
||||
mAppIndicatorAdapter.setDatas( NavigatorApps.getAppsWithoutNavigation() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNavigationEntrance() {
|
||||
mAppIndicatorAdapter.setDatas( NavigatorApps.getApps() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mAnim.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mAnim.stop();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected AppNavigatorPresenter createPresenter() {
|
||||
return new AppNavigatorPresenter(this);
|
||||
return new AppNavigatorPresenter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mMogoFragmentManager = (IMogoFragmentManager) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_FRAGMENT_MANAGER)
|
||||
.navigation(getContext());
|
||||
mMogoAnalytics = (IMogoAnalytics) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_UTILS_ANALYTICS)
|
||||
.navigation(getContext());
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openAppsPanel() {
|
||||
AppsListActivity.start(getActivity());
|
||||
AppsListActivity.start( getActivity() );
|
||||
}
|
||||
|
||||
private void trackNavigatorClickEvent(int type) {
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", type);
|
||||
mMogoAnalytics.track("Launcher_APP_Icon", properties);
|
||||
private void trackNavigatorClickEvent( int type ) {
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", type );
|
||||
AppServiceHandler.getMogoAnalytics().track( "Launcher_APP_Icon", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (mPresenter != null) {
|
||||
mPresenter.onDestroy(getViewLifecycleOwner());
|
||||
if ( mPresenter != null ) {
|
||||
mPresenter.onDestroy( getViewLifecycleOwner() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentItemChanged(@Nullable RecycleViewHolder viewHolder, int i) {
|
||||
Logger.d(TAG, "onCurrentItemChanged--position--" + i % CARD_SIZE);
|
||||
int currentPosition = (i - 2) % CARD_SIZE;
|
||||
|
||||
//if (!scroller.isComputingLayout()) {
|
||||
// appIndicatorAdapter.setCurrentPos(i);
|
||||
//}
|
||||
//this.currentPosition=currentPosition;
|
||||
AppServiceHandler.getMogoCardManager().switch2(apps.get(i % CARD_SIZE).mModuleType, true);
|
||||
|
||||
//holder.showText();
|
||||
|
||||
//ImageView view = viewHolder.getView(R.id.module_apps_id_app_icon);
|
||||
//view.setImageResource(apps.get(currentPosition).getmIconId());
|
||||
//
|
||||
//TextView tvTitle = viewHolder.getView(R.id.module_apps_id_app_name);
|
||||
//tvTitle.setTextColor(getResources().getColor(R.color.white));
|
||||
|
||||
}
|
||||
|
||||
@Override public void onScrollStart(@NonNull RecycleViewHolder viewHolder, int i) {
|
||||
int currentPosition = i % CARD_SIZE - 2;
|
||||
//
|
||||
//ImageView view = viewHolder.getView(R.id.module_apps_id_app_icon);
|
||||
//
|
||||
//
|
||||
//view.setImageResource(apps.get(currentPosition).mUncheckedIconId);
|
||||
//TextView tvTitle = viewHolder.getView(R.id.module_apps_id_app_name);
|
||||
//tvTitle.setTextColor(getResources().getColor(R.color.white_80));
|
||||
|
||||
}
|
||||
|
||||
@Override public void onScrollEnd(@NonNull RecycleViewHolder viewHolder, int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(float v, int i, int i1, @Nullable RecycleViewHolder viewHolder,
|
||||
@Nullable RecycleViewHolder t1) {
|
||||
|
||||
}
|
||||
|
||||
//private int currentPosition = 0;
|
||||
|
||||
@Override public void onSwitched(int position, String moduleName) {
|
||||
//int index = (position - scroller.getCurrentItem() % CARD_SIZE + 2) % CARD_SIZE;
|
||||
//int i = scroller.getCurrentItem() + index;
|
||||
// DiscreteScrollLayoutManager layoutManager =
|
||||
// (DiscreteScrollLayoutManager) scroller.getLayoutManager();
|
||||
//
|
||||
// int currentPosition = (scroller.getCurrentItem() - 2) % CARD_SIZE;
|
||||
//
|
||||
// int index = position - currentPosition;
|
||||
//
|
||||
// if (index == 0) {
|
||||
// return;
|
||||
// }
|
||||
// if (index <= -3) {
|
||||
// index += CARD_SIZE;
|
||||
// } else if (index >= 3) {
|
||||
// index = index - CARD_SIZE;
|
||||
// }
|
||||
// //RecyclerView 的特性,如果是否在屏幕内
|
||||
// //if (index < 0) {
|
||||
// // index -= 2;
|
||||
// //}
|
||||
//
|
||||
// Logger.d(TAG, "position--"
|
||||
// + position
|
||||
// + "index--"
|
||||
// + index
|
||||
// + "scroll-->"
|
||||
// + scroller.getCurrentItem()
|
||||
// + index);
|
||||
//
|
||||
// //scroller.setPendingScroll(getResources().getDimensionPixelSize(R.dimen.dp_137)*index);
|
||||
// //layoutManager.scrollToPositionWithOffset(scroller.getCurrentItem() + index,0);
|
||||
// //scroller.smoothScrollBy(getResources().getDimensionPixelSize(R.dimen.dp_137)*index,0);
|
||||
//
|
||||
// if (Math.abs(index) == 1) {
|
||||
// scroller.smoothScrollBy(getResources().getDimensionPixelSize(R.dimen.dp_137) * index,
|
||||
// 0, null, 10);
|
||||
// } else {
|
||||
// layoutManager.startSmoothPendingScroll(layoutManager.getCurrentPosition() + index);
|
||||
// }
|
||||
//layoutManager.smoothScrollToPosition(scroller.getCurrentItem() + index);
|
||||
//currentPosition = position;
|
||||
}
|
||||
|
||||
private void printIds(View view) {
|
||||
System.out.println(view.getId());
|
||||
if (view instanceof ViewGroup) {
|
||||
int childCount = ((ViewGroup) view).getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
printIds(((ViewGroup) view).getChildAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void print(View view) {
|
||||
|
||||
ArrayList<View> views = new ArrayList<>();
|
||||
views.add(view);
|
||||
|
||||
while (views.size() > 0) {
|
||||
System.out.println(view.getId());
|
||||
View remove = views.remove(0);
|
||||
|
||||
if (remove instanceof ViewGroup) {
|
||||
|
||||
int childCount = ((ViewGroup) view).getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
views.add(((ViewGroup) view).getChildAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.module.apps.utils.LaunchUtils;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -26,7 +27,9 @@ import org.json.JSONObject;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AppNavigatorPresenter extends Presenter< AppNavigatorView > implements IMogoIntentListener, IMogoVoiceCmdCallBack {
|
||||
public class AppNavigatorPresenter extends Presenter< AppNavigatorView > implements IMogoIntentListener,
|
||||
IMogoVoiceCmdCallBack,
|
||||
IMogoNaviListener2 {
|
||||
|
||||
private static final String TAG = "AppNavigatorPresenter";
|
||||
|
||||
@@ -40,8 +43,9 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
mIntentManager = ( IMogoIntentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_INTENT_MANAGER ).navigation( getContext() );
|
||||
mMogoStatusManager = ( IMogoStatusManager ) ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation( getContext() );
|
||||
mIntentManager = AppServiceHandler.getApis().getIntentManagerApi();
|
||||
mMogoStatusManager = AppServiceHandler.getApis().getStatusManagerApi();
|
||||
AppServiceHandler.getApis().getRegisterCenterApi().registerMogoNaviListener( TAG, this );
|
||||
// 预加载应用列表,空间换时间
|
||||
AppsModel.getInstance( getContext() ).load( null );
|
||||
}
|
||||
@@ -71,6 +75,11 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
|
||||
JSONObject object = new JSONObject( intent.getStringExtra( "data" ) );
|
||||
String app = object.optString( "object" );
|
||||
String operation = object.optString( "operation" );
|
||||
|
||||
if( !AppsConst.OBJECT_ADAS.equals( app ) ){
|
||||
AppServiceHandler.getApis().getAdasControllerApi().closeADAS();
|
||||
}
|
||||
|
||||
if ( AppsConst.OBJECT_ALL_APPS.equals( app ) ) {
|
||||
if ( AppsConst.OPERATION_OPEN.equals( operation ) ) {
|
||||
mView.openAppsPanel();
|
||||
@@ -105,26 +114,6 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
if ( mIntentManager != null ) {
|
||||
@@ -132,4 +121,14 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
|
||||
}
|
||||
super.onDestroy( owner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
mView.hideNavigationEntrance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
mView.showNavigationEntrance();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,8 @@ public interface AppNavigatorView extends IView {
|
||||
* 打开全部应用
|
||||
*/
|
||||
void openAppsPanel();
|
||||
|
||||
void hideNavigationEntrance();
|
||||
|
||||
void showNavigationEntrance();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.mogo.module.apps;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
@@ -27,6 +29,7 @@ import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class AppServiceHandler {
|
||||
|
||||
private static final String TAG = "AppServiceHandler";
|
||||
|
||||
private static IMogoServiceApis mApis;
|
||||
@@ -34,17 +37,18 @@ public class AppServiceHandler {
|
||||
private static IMogoAnalytics mMogoAnalytics;
|
||||
private static IGuideShowProvider mMogoGuideShow;
|
||||
|
||||
|
||||
public static void init( final Context context ) {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context );
|
||||
mMogoCardManager = mApis.getCardManagerApi();
|
||||
mMogoAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoGuideShow = (IGuideShowProvider) ARouter.getInstance().build(GuideShowProviderConstant.GUIDE_SHOW_PROVIDER).navigation(context);
|
||||
mMogoGuideShow = ( IGuideShowProvider ) ARouter.getInstance().build( GuideShowProviderConstant.GUIDE_SHOW_PROVIDER ).navigation( context );
|
||||
|
||||
}
|
||||
|
||||
public static IMogoCardManager getMogoCardManager() {
|
||||
return mMogoCardManager;
|
||||
}
|
||||
|
||||
public static IMogoAnalytics getMogoAnalytics() {
|
||||
return mMogoAnalytics;
|
||||
}
|
||||
@@ -52,4 +56,11 @@ public class AppServiceHandler {
|
||||
public static IGuideShowProvider getMogoGuideShow() {
|
||||
return mMogoGuideShow;
|
||||
}
|
||||
|
||||
public static IMogoServiceApis getApis() {
|
||||
if ( mApis == null ) {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( AbsMogoApplication.getApp() );
|
||||
}
|
||||
return mApis;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public class AppsConst {
|
||||
|
||||
public static final String OBJECT_ALL_APPS = "全部应用";
|
||||
public static final String OBJECT_FAST_SETTINGS = "快捷设置";
|
||||
public static final String OBJECT_ADAS = "辅助驾驶";
|
||||
public static final String OPERATION_OPEN = "打开";
|
||||
public static final String OPERATION_CLOSE = "关闭";
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
|
||||
mExit.setOnClickListener( view -> {
|
||||
if ( getActivity() != null ) {
|
||||
getActivity().finish();
|
||||
getActivity().overridePendingTransition( R.anim.module_apps_anim_enter, R.anim.module_apps_anim_exit);
|
||||
getActivity().overridePendingTransition( 0, R.anim.module_apps_anim_exit);
|
||||
}
|
||||
} );
|
||||
// mAppsList = findViewById( R.id.module_apps_id_apps );
|
||||
|
||||
@@ -74,7 +74,7 @@ public class AppsFragmentProvider implements IMogoModuleProvider {
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
AppServiceHandler.init( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.mogo.module.apps;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
@@ -27,7 +29,12 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent
|
||||
public static void start( Activity context ) {
|
||||
Intent starter = new Intent( context, AppsListActivity.class );
|
||||
context.startActivity( starter );
|
||||
context.overridePendingTransition( R.anim.module_apps_anim_enter, R.anim.module_apps_anim_exit);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
overridePendingTransition( R.anim.module_apps_anim_enter, 0);
|
||||
super.onCreate( savedInstanceState );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.apps.applaunch.AppLaunchFilter;
|
||||
import com.mogo.module.apps.applaunch.AppLauncher;
|
||||
@@ -36,7 +37,7 @@ import java.util.Set;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AppsPresenter extends Presenter<AppsView> {
|
||||
public class AppsPresenter extends Presenter< AppsView > {
|
||||
|
||||
private static final String TAG = "AppsPresenter";
|
||||
|
||||
@@ -48,61 +49,62 @@ public class AppsPresenter extends Presenter<AppsView> {
|
||||
private IMogoCardManager mCardManager;
|
||||
private IMogoStatusManager mMogoStatusManager;
|
||||
|
||||
public AppsPresenter(AppsView view) {
|
||||
super(view);
|
||||
mApis = (IMogoServiceApis)ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation(getContext());
|
||||
public AppsPresenter( AppsView view ) {
|
||||
super( view );
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
mCardManager = mApis.getCardManagerApi();
|
||||
CardAppLauncher cardAppLauncher = new CardAppLauncher(this, mCardManager);
|
||||
GuideShowLauncher guideShowLauncher = new GuideShowLauncher(mApis.getMapServiceApi().getNavi( getContext() ));
|
||||
cardAppLauncher.setNext(guideShowLauncher);
|
||||
guideShowLauncher.setNext(new AppLauncher());
|
||||
CardAppLauncher cardAppLauncher = new CardAppLauncher( this, mCardManager );
|
||||
GuideShowLauncher guideShowLauncher = new GuideShowLauncher( mApis.getMapServiceApi().getNavi( getContext() ) );
|
||||
cardAppLauncher.setNext( guideShowLauncher );
|
||||
guideShowLauncher.setNext( new AppLauncher() );
|
||||
mLauncher = cardAppLauncher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
renderAppsList();
|
||||
AppsListChangedLiveData.getInstance().observeForever(bool -> {
|
||||
if (mView != null) {
|
||||
AppsListChangedLiveData.getInstance().observeForever( bool -> {
|
||||
if ( mView != null ) {
|
||||
renderAppsList();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoStatusManager = mApis.getStatusManagerApi();
|
||||
mMogoStatusManager.setAppListUIShow(TAG, true);
|
||||
mMogoStatusManager.setAppListUIShow( TAG, true );
|
||||
}
|
||||
|
||||
private void renderAppsList() {
|
||||
ThreadPoolService.execute(() -> {
|
||||
AppsModel.getInstance(getContext()).load(appInfoList -> {
|
||||
ThreadPoolService.execute( () -> {
|
||||
AppsModel.getInstance( getContext() ).load( appInfoList -> {
|
||||
|
||||
Logger.d(TAG, "apps: %s", appInfoList);
|
||||
final Map<Integer, List<AppInfo>> result = addOthersEntrances( appInfoList );
|
||||
UiThreadHandler.post(() -> {
|
||||
if (mView != null) {
|
||||
Logger.d( TAG, "apps: %s", appInfoList );
|
||||
final Map< Integer, List< AppInfo > > result = addOthersEntrances( appInfoList );
|
||||
UiThreadHandler.post( () -> {
|
||||
if ( mView != null ) {
|
||||
mView.renderApps( result );
|
||||
}
|
||||
});
|
||||
});
|
||||
} );
|
||||
} );
|
||||
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入口
|
||||
*
|
||||
* @param appInfoMap
|
||||
* @return
|
||||
*/
|
||||
private Map<Integer, List<AppInfo>> addOthersEntrances( Map<Integer, List<AppInfo>> appInfoMap) {
|
||||
Map<Integer, List<AppInfo>> result = new HashMap<>();
|
||||
private Map< Integer, List< AppInfo > > addOthersEntrances( Map< Integer, List< AppInfo > > appInfoMap ) {
|
||||
Map< Integer, List< AppInfo > > result = new HashMap<>();
|
||||
|
||||
if ( appInfoMap != null && !appInfoMap.isEmpty() ) {
|
||||
// val deep copy
|
||||
Set<Integer> keys = appInfoMap.keySet();
|
||||
Set< Integer > keys = appInfoMap.keySet();
|
||||
for ( Integer key : keys ) {
|
||||
List<AppInfo> val = appInfoMap.get( key );
|
||||
List< AppInfo > val = appInfoMap.get( key );
|
||||
try {
|
||||
result.put( key, new ArrayList<>( val ) );
|
||||
} catch ( Exception e ) {
|
||||
@@ -112,16 +114,16 @@ public class AppsPresenter extends Presenter<AppsView> {
|
||||
}
|
||||
|
||||
// 手动添加无法识别到的app
|
||||
List<AppInfo> apps = UnScannedApps.getUnScannedApps();
|
||||
List< AppInfo > apps = UnScannedApps.getUnScannedApps();
|
||||
if ( apps != null && !apps.isEmpty() ) {
|
||||
for ( AppInfo app : apps ) {
|
||||
if ( app == null ) {
|
||||
continue;
|
||||
}
|
||||
Set<Integer> keys = result.keySet();
|
||||
Set< Integer > keys = result.keySet();
|
||||
boolean addFlag = true;
|
||||
for ( Integer key : keys ) {
|
||||
List<AppInfo> val = result.get( key );
|
||||
List< AppInfo > val = result.get( key );
|
||||
// 无法扫描到蓝牙电话app,这里手动添加
|
||||
for ( AppInfo appInfo : val ) {
|
||||
if ( appInfo == null ) {
|
||||
@@ -137,71 +139,77 @@ public class AppsPresenter extends Presenter<AppsView> {
|
||||
}
|
||||
}
|
||||
if ( addFlag ) {
|
||||
growthCapacity(result);
|
||||
result.get(result.size() - 1).add(app);
|
||||
growthCapacity( result );
|
||||
result.get( result.size() - 1 ).add( app );
|
||||
}
|
||||
}
|
||||
}
|
||||
growthCapacity(result);
|
||||
// 添加介绍入口
|
||||
result.get(result.size() - 1).add(new AppInfo(GuideShowLauncher.APP_INFO_NAME_GUIDE_SHOW, getContext().getPackageName(), null, 0, null, R.drawable.module_apps_ic_guide_show));
|
||||
// growthCapacity( result );
|
||||
// // 添加介绍入口
|
||||
// result.get( result.size() - 1 ).add( new AppInfo( GuideShowLauncher.APP_INFO_NAME_GUIDE_SHOW, getContext().getPackageName(), null, 0, null, R.drawable.module_apps_ic_guide_show ) );
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
// 添加测试入口
|
||||
growthCapacity( result );
|
||||
result.get( result.size() - 1 ).add( new AppInfo( "包管理程序", "com.mogo.packages.manager", null, 0, null, -1 ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 扩容
|
||||
*
|
||||
* @param target
|
||||
*/
|
||||
private void growthCapacity( Map<Integer, List<AppInfo>> target ){
|
||||
private void growthCapacity( Map< Integer, List< AppInfo > > target ) {
|
||||
if ( target == null ) {
|
||||
return;
|
||||
}
|
||||
if (target.isEmpty()) {
|
||||
target.put(0, new ArrayList<>());
|
||||
} else if (target.get(target.size() - 1) == null) {
|
||||
target.put(target.size() - 1, new ArrayList<>());
|
||||
} else if (target.get(target.size() - 1).size() == AppsConst.TOTAL_SIZE_EACH_PAGE) {
|
||||
target.put(target.size(), new ArrayList<>());
|
||||
if ( target.isEmpty() ) {
|
||||
target.put( 0, new ArrayList<>() );
|
||||
} else if ( target.get( target.size() - 1 ) == null ) {
|
||||
target.put( target.size() - 1, new ArrayList<>() );
|
||||
} else if ( target.get( target.size() - 1 ).size() == AppsConst.TOTAL_SIZE_EACH_PAGE ) {
|
||||
target.put( target.size(), new ArrayList<>() );
|
||||
}
|
||||
}
|
||||
|
||||
public void launch(AppInfo appInfo) {
|
||||
if (appInfo == null) {
|
||||
public void launch( AppInfo appInfo ) {
|
||||
if ( appInfo == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
trackAppClicked(appInfo);
|
||||
trackAppClicked( appInfo );
|
||||
try {
|
||||
mLauncher.launch(getContext(), appInfo);
|
||||
} catch (Exception e) {
|
||||
mLauncher.launch( getContext(), appInfo );
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void trackAppClicked(AppInfo appInfo) {
|
||||
if (appInfo == null) {
|
||||
private void trackAppClicked( AppInfo appInfo ) {
|
||||
if ( appInfo == null ) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("appname", appInfo.getName());
|
||||
properties.put("packagename", appInfo.getPackageName());
|
||||
properties.put("appversion", appInfo.getVersionName());
|
||||
properties.put("from", 1);
|
||||
mAnalytics.track("appenterfront", properties);
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", appInfo.getName() );
|
||||
properties.put( "packagename", appInfo.getPackageName() );
|
||||
properties.put( "appversion", appInfo.getVersionName() );
|
||||
properties.put( "from", 1 );
|
||||
mAnalytics.track( "appenterfront", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
mMogoStatusManager.setAppListUIShow(TAG, false);
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
mMogoStatusManager.setAppListUIShow( TAG, false );
|
||||
AppsListChangedLiveData.getInstance().release();
|
||||
mView = null;
|
||||
mLauncher.destroy();
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
if (mView != null) {
|
||||
if ( mView != null ) {
|
||||
mView.exit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,62 +1,34 @@
|
||||
package com.mogo.module.apps.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.apps.adapter.base.RecycleBaseAdapter;
|
||||
import com.mogo.module.apps.adapter.base.RecycleViewHolder;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.NavigatorApp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-03-09.
|
||||
*/
|
||||
public class AppIndicatorAdapter extends RecycleBaseAdapter<NavigatorApp> {
|
||||
public class AppIndicatorAdapter extends RecycleBaseAdapter< AppInfo > {
|
||||
|
||||
|
||||
private int currentPos;
|
||||
|
||||
private View.OnClickListener onClickListener;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public AppIndicatorAdapter(Context context, List<NavigatorApp> list
|
||||
) {
|
||||
super(context, list, R.layout.module_apps_item_app_indicator);
|
||||
public AppIndicatorAdapter( Context context, List< AppInfo > list ) {
|
||||
super( context, list, R.layout.module_apps_item_app_indicator );
|
||||
}
|
||||
|
||||
@Override public int getItemCount() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override public void onBindViewHolder(RecycleViewHolder holder, NavigatorApp integer) {
|
||||
ImageView ivIndicator = holder.getView(R.id.module_apps_id_app_icon);
|
||||
ivIndicator.setImageResource(integer.getmIconId());
|
||||
holder.setText(R.id.module_apps_id_app_name,integer.getmName() );
|
||||
|
||||
TextView tvTitle = holder.getView(R.id.module_apps_id_app_name);
|
||||
if (currentPos==holder.getLayoutPosition()) {
|
||||
ivIndicator.setImageResource(integer.getmIconId());
|
||||
tvTitle.setTextColor(ContextCompat.getColor(context,R.color.white));
|
||||
}else {
|
||||
tvTitle.setTextColor(ContextCompat.getColor(context,R.color.white_80));
|
||||
ivIndicator.setImageResource(integer.getmUncheckedIconId());
|
||||
}
|
||||
holder.itemView.setTag(integer);
|
||||
holder.itemView.setOnClickListener(onClickListener);
|
||||
|
||||
}
|
||||
|
||||
public void setOnClickListener(View.OnClickListener onClickListener) {
|
||||
this.onClickListener = onClickListener;
|
||||
}
|
||||
|
||||
public void setCurrentPos(int currentPos){
|
||||
this.currentPos=currentPos;
|
||||
notifyDataSetChanged();
|
||||
@Override
|
||||
public void onBindViewHolder( RecycleViewHolder holder, AppInfo app, int position ) {
|
||||
ImageView ivIndicator = holder.getView( R.id.module_apps_id_app_icon );
|
||||
ivIndicator.setImageResource( app.getIconResId() );
|
||||
holder.itemView.setOnClickListener( view -> {
|
||||
if ( getOnItemClickedListener() != null ) {
|
||||
getOnItemClickedListener().onItemClicked( app, position );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -21,20 +23,19 @@ import java.util.List;
|
||||
* <p>
|
||||
* </p>
|
||||
*/
|
||||
public abstract class RecycleBaseAdapter<T> extends
|
||||
RecyclerView.Adapter<RecycleViewHolder>
|
||||
{
|
||||
public abstract class RecycleBaseAdapter< T > extends
|
||||
RecyclerView.Adapter< RecycleViewHolder > {
|
||||
|
||||
protected Context context;
|
||||
protected List<T> list;
|
||||
protected List< T > list;
|
||||
private int resourceID;
|
||||
private Toast toast;
|
||||
|
||||
protected OnItemClickListener<T> mOnItemClickedListener;
|
||||
|
||||
/**
|
||||
* @param context
|
||||
*/
|
||||
public RecycleBaseAdapter(Context context, List<T> list, int resourceID)
|
||||
{
|
||||
public RecycleBaseAdapter( Context context, List< T > list, int resourceID ) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.list = list;
|
||||
@@ -42,81 +43,75 @@ public abstract class RecycleBaseAdapter<T> extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecycleViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType)
|
||||
{
|
||||
View v = LayoutInflater.from(context).inflate(resourceID, viewGroup,
|
||||
false);
|
||||
public RecycleViewHolder onCreateViewHolder( ViewGroup viewGroup, int viewType ) {
|
||||
View v = LayoutInflater.from( context ).inflate( resourceID, viewGroup,
|
||||
false );
|
||||
|
||||
RecycleViewHolder holder = RecycleViewHolder
|
||||
.get(v);
|
||||
.get( v );
|
||||
|
||||
initHolder(holder);
|
||||
initHolder( holder );
|
||||
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(
|
||||
RecycleViewHolder viewHolder, int position)
|
||||
{
|
||||
onBindViewHolder(viewHolder, list.get(position % list.size()));
|
||||
public void onBindViewHolder( RecycleViewHolder viewHolder, int position ) {
|
||||
onBindViewHolder( viewHolder, list.get( position % list.size()), position );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount()
|
||||
{
|
||||
public int getItemCount() {
|
||||
return list == null ? 0 : list.size();
|
||||
}
|
||||
|
||||
public abstract void onBindViewHolder(
|
||||
RecycleViewHolder holder, T t);
|
||||
public abstract void onBindViewHolder( RecycleViewHolder holder, T t, int position );
|
||||
|
||||
public void initHolder(RecycleViewHolder holder)
|
||||
{
|
||||
public void initHolder( RecycleViewHolder holder ) {
|
||||
|
||||
}
|
||||
public void setDatas(List<T> list)
|
||||
{
|
||||
setDatas(list, false);
|
||||
|
||||
public void setDatas( List< T > list ) {
|
||||
setDatas( list, false );
|
||||
}
|
||||
|
||||
public void setDatas(List<T> list, boolean add)
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
this.list.addAll(list);
|
||||
}
|
||||
else
|
||||
{
|
||||
public void setDatas( List< T > list, boolean add ) {
|
||||
if ( add ) {
|
||||
this.list.addAll( list );
|
||||
} else {
|
||||
this.list = list;
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
public void clear(){
|
||||
if (list != null) {
|
||||
|
||||
public void clear() {
|
||||
if ( list != null ) {
|
||||
list.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
public void messageShow(String mes)
|
||||
{
|
||||
if (toast==null){
|
||||
toast= Toast.makeText(context,mes, Toast.LENGTH_LONG);
|
||||
}
|
||||
else{
|
||||
toast.setText(mes);
|
||||
}
|
||||
toast.show();
|
||||
}
|
||||
|
||||
public T getItem(int position){
|
||||
if (list==null||list.size()==0){
|
||||
public T getItem( int position ) {
|
||||
if ( list == null || list.size() == 0 ) {
|
||||
return null;
|
||||
}
|
||||
return list.get(position);
|
||||
return list.get( position );
|
||||
}
|
||||
|
||||
public List<T> getList() {
|
||||
public List< T > getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public interface OnItemClickListener< T > {
|
||||
void onItemClicked( T data, int position );
|
||||
}
|
||||
|
||||
public RecycleBaseAdapter< T > setOnItemClickedListener( OnItemClickListener< T > onItemClickedListener ) {
|
||||
this.mOnItemClickedListener = onItemClickedListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OnItemClickListener< T > getOnItemClickedListener() {
|
||||
return mOnItemClickedListener;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.extensions.anim;
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.extensions.anim;
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
import com.mogo.module.extensions.R;
|
||||
|
||||
import com.mogo.module.apps.R;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.mogo.module.extensions.anim;
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.extensions.anim;
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -13,7 +13,6 @@ import android.util.AttributeSet;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.extensions.anim;
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.extensions.anim;
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.apps.applaunch;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.utils.LaunchUtils;
|
||||
@@ -21,6 +22,9 @@ public class AppLauncher extends BaseAppLauncher {
|
||||
@Override
|
||||
public void launch( Context context, AppInfo appInfo ) {
|
||||
try {
|
||||
if ( LaunchUtils.getLaunchIntentForPackage( context, appInfo.getPackageName() ) != null ) {
|
||||
AppServiceHandler.getApis().getAdasControllerApi().closeADAS();
|
||||
}
|
||||
LaunchUtils.launchByPkg( context, appInfo.getPackageName() );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
|
||||
@@ -35,13 +35,8 @@ public class CardAppLauncher extends BaseAppLauncher {
|
||||
|
||||
@Override
|
||||
public void launch( Context context, AppInfo appInfo ) {
|
||||
if ( sCardApps.containsKey( appInfo.getPackageName() ) ) {
|
||||
mCardManager.switch2( sCardApps.get( appInfo.getPackageName() ) );
|
||||
mAppsPresenter.exit();
|
||||
} else {
|
||||
if ( getNext() != null ) {
|
||||
getNext().launch( context, appInfo );
|
||||
}
|
||||
if ( getNext() != null ) {
|
||||
getNext().launch( context, appInfo );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
package com.mogo.module.apps.applaunch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
public class GuideShowLauncher extends BaseAppLauncher {
|
||||
|
||||
@@ -25,19 +18,7 @@ public class GuideShowLauncher extends BaseAppLauncher {
|
||||
|
||||
@Override
|
||||
public void launch(Context context, AppInfo appInfo) {
|
||||
if (appInfo != null && APP_INFO_NAME_GUIDE_SHOW.equals(appInfo.getName())) {
|
||||
if ( mNavi != null && !mNavi.isNaviing()) {
|
||||
AppServiceHandler.getMogoGuideShow().playGuideVideo((Activity) context, (s) -> {
|
||||
Logger.d(TAG, s);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
} else {
|
||||
AIAssist.getInstance(context).speakTTSVoice(context.getString(R.string.module_apps_str_guide_warning));
|
||||
processChain(context,appInfo);
|
||||
}
|
||||
} else {
|
||||
processChain(context, appInfo);
|
||||
}
|
||||
processChain(context, appInfo);
|
||||
}
|
||||
|
||||
private void processChain(Context context, AppInfo appInfo) {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mogo.module.apps.applaunch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.AppsListActivity;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-05-14
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
|
||||
private Activity mActivity;
|
||||
|
||||
public InternalFunctionLauncher( Activity activity ) {
|
||||
this.mActivity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch( Context context, AppInfo appInfo ) {
|
||||
switch ( appInfo.getPackageName() ) {
|
||||
case "com.mogo.launcher.navi.search":
|
||||
AppServiceHandler.getApis().getSearchManagerApi().showSearch();
|
||||
break;
|
||||
case "com.mogo.launcher.applist":
|
||||
AppServiceHandler.getApis().getAdasControllerApi().closeADAS();
|
||||
AppsListActivity.start( mActivity );
|
||||
break;
|
||||
default:
|
||||
if ( getNext() != null ) {
|
||||
getNext().launch( context, appInfo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if ( getNext() != null ) {
|
||||
getNext().destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,11 @@ public enum AppEnum {
|
||||
QQMusic( "QQ音乐", "com.pvetec.musics", R.drawable.module_apps_ic_qq_music ),
|
||||
|
||||
//"车聊聊",
|
||||
Im( "车聊聊", "com.zhidao.imdemo", R.drawable.module_apps_ic_im ),
|
||||
// Im( "车聊聊", "com.zhidao.imdemo", R.drawable.module_apps_ic_im ),
|
||||
|
||||
//"探路",
|
||||
RoadCondition( "探路", "com.zhidao.roadcondition", R.drawable.module_apps_ic_road_condition ),
|
||||
RoadConditionSlit( "探路", "com.zhidao.roadcondition.split", R.drawable.module_apps_ic_road_condition ),
|
||||
// RoadCondition( "探路", "com.zhidao.roadcondition", R.drawable.module_apps_ic_road_condition ),
|
||||
// RoadConditionSlit( "探路", "com.zhidao.roadcondition.split", R.drawable.module_apps_ic_road_condition ),
|
||||
|
||||
//"福利",
|
||||
Welfare( "福利", "com.zhidaohulian.welfare.car", R.drawable.module_apps_ic_welfare ),
|
||||
|
||||
@@ -15,44 +15,18 @@ public class NavigatorApp {
|
||||
@DrawableRes
|
||||
public int mUncheckedIconId;
|
||||
public String mName;
|
||||
public String mModuleType;
|
||||
|
||||
public NavigatorApp( int mIconId,int mUncheckedIconId, String mName, String mModuleType ) {
|
||||
public NavigatorApp( int mIconId, int mUncheckedIconId, String mName ) {
|
||||
this.mIconId = mIconId;
|
||||
this.mUncheckedIconId = mUncheckedIconId;
|
||||
this.mName = mName;
|
||||
this.mModuleType = mModuleType;
|
||||
}
|
||||
|
||||
public int getmIconId() {
|
||||
public int getIconId() {
|
||||
return mIconId;
|
||||
}
|
||||
|
||||
public void setmIconId(int mIconId) {
|
||||
this.mIconId = mIconId;
|
||||
}
|
||||
|
||||
public int getmUncheckedIconId() {
|
||||
return mUncheckedIconId;
|
||||
}
|
||||
|
||||
public void setmUncheckedIconId(int mUncheckedIconId) {
|
||||
this.mUncheckedIconId = mUncheckedIconId;
|
||||
}
|
||||
|
||||
public String getmName() {
|
||||
public String getName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public void setmName(String mName) {
|
||||
this.mName = mName;
|
||||
}
|
||||
|
||||
public String getmModuleType() {
|
||||
return mModuleType;
|
||||
}
|
||||
|
||||
public void setmModuleType(String mModuleType) {
|
||||
this.mModuleType = mModuleType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.mogo.module.apps.model;
|
||||
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -16,48 +13,27 @@ import java.util.List;
|
||||
*/
|
||||
public class NavigatorApps {
|
||||
|
||||
public static List< NavigatorApp > getApps() {
|
||||
List< NavigatorApp > apps = new ArrayList<>();
|
||||
apps.add( new NavigatorApp( R.drawable.module_apps_ic_online_car,R.drawable.module_apps_ic_online_car_unchecked, "在线车辆", ModuleNames.CARD_TYPE_USER_DATA ) );
|
||||
apps.add( new NavigatorApp( R.drawable.module_apps_ic_interest, R.drawable.module_apps_ic_interest_unchecked,"新鲜事", ModuleNames.CARD_TYPE_NOVELTY ) );
|
||||
apps.add( new NavigatorApp( R.drawable.module_apps_ic_news,R.drawable.module_apps_ic_news_unchecked, "首页", ModuleNames.CARD_TYPE_BUSINESS_OPERATION ) );
|
||||
apps.add( new NavigatorApp( R.drawable.module_apps_ic_media_center, R.drawable.module_apps_ic_media_center_checked, "媒体中心", ModuleNames.CARD_TYPE_SHARE_MUSIC ) );
|
||||
apps.add( new NavigatorApp( R.drawable.module_apps_ic_chat_icon, R.drawable.module_apps_ic_chat_unchecked,"车聊聊", ModuleNames.CARD_TYPE_CARS_CHATTING ) );
|
||||
apps.add( new NavigatorApp( R.drawable.module_apps_ic_tanlu, R.drawable.module_apps_ic_tanlu_unchecked,"探路", ModuleNames.CARD_TYPE_ROAD_CONDITION ) );
|
||||
return apps;
|
||||
private static AppInfo app = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi );
|
||||
private static AppInfo app_ = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi_disable );
|
||||
private static AppInfo app2 = new AppInfo( "音乐", "com.pvetec.musics", "", 0, null, R.drawable.module_apps_ic_navigator_media );
|
||||
private static AppInfo app3 = new AppInfo( "个人中心", "com.zhidao.auto.personal", "", 0, null, R.drawable.module_apps_ic_navigator_personcenter );
|
||||
private static AppInfo app4 = new AppInfo( "全部应用", "com.mogo.launcher.applist", "", 0, null, R.drawable.module_apps_ic_navigator_applist );
|
||||
|
||||
public static List< AppInfo > getApps() {
|
||||
List< AppInfo > sApps = new ArrayList<>();
|
||||
sApps.add( app );
|
||||
sApps.add( app2 );
|
||||
sApps.add( app3 );
|
||||
sApps.add( app4 );
|
||||
return sApps;
|
||||
}
|
||||
|
||||
// public static List< NavigatorApp > getApps() {
|
||||
// List< NavigatorApp > apps = new ArrayList<>();
|
||||
// List< MogoModule > modules = MogoModulePaths.getModules();
|
||||
// for ( MogoModule module : modules ) {
|
||||
// NavigatorApp app = getApp( module );
|
||||
// if ( app == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// apps.add( app );
|
||||
// }
|
||||
// return apps;
|
||||
// }
|
||||
//
|
||||
// private static NavigatorApp getApp( MogoModule module ) {
|
||||
// if ( module == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// switch ( module.getName() ) {
|
||||
// case ModuleNames.CARD_TYPE_USER_DATA:
|
||||
// return new NavigatorApp( R.drawable.module_apps_ic_online_car, R.drawable.module_apps_ic_online_car_unchecked, "在线车辆", ModuleNames.CARD_TYPE_USER_DATA );
|
||||
// case ModuleNames.CARD_TYPE_NOVELTY:
|
||||
// return new NavigatorApp( R.drawable.module_apps_ic_interest, R.drawable.module_apps_ic_interest_unchecked, "新鲜事", ModuleNames.CARD_TYPE_NOVELTY );
|
||||
// case ModuleNames.CARD_TYPE_BUSINESS_OPERATION:
|
||||
// return new NavigatorApp( R.drawable.module_apps_ic_news, R.drawable.module_apps_ic_news_unchecked, "首页", ModuleNames.CARD_TYPE_BUSINESS_OPERATION );
|
||||
// case ModuleNames.CARD_TYPE_SHARE_MUSIC:
|
||||
// return new NavigatorApp( R.drawable.module_apps_ic_media_center, R.drawable.module_apps_ic_media_center_checked, "媒体中心", ModuleNames.CARD_TYPE_SHARE_MUSIC );
|
||||
// case ModuleNames.CARD_TYPE_CARS_CHATTING:
|
||||
// return new NavigatorApp( R.drawable.module_apps_ic_chat_icon, R.drawable.module_apps_ic_chat_unchecked, "车聊聊", ModuleNames.CARD_TYPE_CARS_CHATTING );
|
||||
// case ModuleNames.CARD_TYPE_ROAD_CONDITION:
|
||||
// return new NavigatorApp( R.drawable.module_apps_ic_tanlu, R.drawable.module_apps_ic_tanlu_unchecked, "探路", ModuleNames.CARD_TYPE_ROAD_CONDITION );
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
public static List< AppInfo > getAppsWithoutNavigation() {
|
||||
List< AppInfo > sApps = new ArrayList<>();
|
||||
sApps.add( app_ );
|
||||
sApps.add( app2 );
|
||||
sApps.add( app3 );
|
||||
sApps.add( app4 );
|
||||
return sApps;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ package com.mogo.module.apps.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
|
||||
public class AppInstallReceiver extends BroadcastReceiver {
|
||||
@@ -14,6 +16,9 @@ public class AppInstallReceiver extends BroadcastReceiver {
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_ADDED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
AppsModel.getInstance( context ).appAdded( packageName );
|
||||
if ( TextUtils.equals( packageName, "com.zhidao.autopilot" ) ) {
|
||||
AppServiceHandler.getApis().getAdasControllerApi().showADAS();
|
||||
}
|
||||
}
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_REMOVED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
@@ -21,6 +26,9 @@ public class AppInstallReceiver extends BroadcastReceiver {
|
||||
}
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_REPLACED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
if ( TextUtils.equals( packageName, "com.zhidao.autopilot" ) ) {
|
||||
AppServiceHandler.getApis().getAdasControllerApi().showADAS();
|
||||
}
|
||||
}
|
||||
if ( intent.getAction().equals( Intent.ACTION_PACKAGE_CHANGED ) ) {
|
||||
String packageName = intent.getData().getSchemeSpecificPart();
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
package com.mogo.module.apps.utils;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.FloatRange;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.apps.model.NavigatorApp;
|
||||
import com.yarolegovich.discretescrollview.transform.DiscreteScrollItemTransformer;
|
||||
import com.yarolegovich.discretescrollview.transform.Pivot;
|
||||
import com.yarolegovich.discretescrollview.transform.ScaleTransformer;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-03-11.
|
||||
*/
|
||||
public class CardScaleTransformer implements DiscreteScrollItemTransformer {
|
||||
|
||||
private Pivot pivotX;
|
||||
private Pivot pivotY;
|
||||
private float minScale;
|
||||
private float maxMinDiff;
|
||||
private static final int CARD_SIZE = 6;
|
||||
|
||||
List<NavigatorApp> apps;
|
||||
|
||||
public CardScaleTransformer() {
|
||||
pivotX = Pivot.X.CENTER.create();
|
||||
pivotY = Pivot.Y.BOTTOM.create();
|
||||
minScale = 0.8f;
|
||||
maxMinDiff = 0.2f;
|
||||
}
|
||||
|
||||
public void setApps(List<NavigatorApp> apps) {
|
||||
this.apps = apps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformItem(View item, RecyclerView.ViewHolder childViewHolder, float position) {
|
||||
|
||||
ImageView ivItem = item.findViewById(R.id.module_apps_id_app_icon);
|
||||
|
||||
TextView tvTitle = item.findViewById(R.id.module_apps_id_app_name);
|
||||
NavigatorApp tag = (NavigatorApp) item.getTag();
|
||||
|
||||
pivotX.setOn(ivItem);
|
||||
pivotY.setOn(ivItem);
|
||||
float closenessToCenter = 1f - Math.abs(position);
|
||||
float scale = minScale + maxMinDiff * closenessToCenter;
|
||||
ivItem.setScaleX(scale);
|
||||
ivItem.setScaleY(scale);
|
||||
|
||||
if (tag != null) {
|
||||
if (scale == 1) {
|
||||
ivItem.setImageResource(tag.getmIconId());
|
||||
tvTitle.setTextColor(ContextCompat.getColor(item.getContext(),R.color.white));
|
||||
} else {
|
||||
ivItem.setImageResource(tag.getmUncheckedIconId());
|
||||
tvTitle.setTextColor(ContextCompat.getColor(item.getContext(),R.color.white_80));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//int currentPosition = (position - 2) % CARD_SIZE;
|
||||
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private CardScaleTransformer transformer;
|
||||
private float maxScale;
|
||||
|
||||
public Builder() {
|
||||
transformer = new CardScaleTransformer();
|
||||
maxScale = 1f;
|
||||
}
|
||||
|
||||
public Builder setMinScale(@FloatRange(from = 0.01) float scale) {
|
||||
transformer.minScale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMaxScale(@FloatRange(from = 0.01) float scale) {
|
||||
maxScale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPivotX(Pivot.X pivotX) {
|
||||
return setPivotX(pivotX.create());
|
||||
}
|
||||
|
||||
public Builder setPivotX(Pivot pivot) {
|
||||
assertAxis(pivot, Pivot.AXIS_X);
|
||||
transformer.pivotX = pivot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPivotY(Pivot.Y pivotY) {
|
||||
return setPivotY(pivotY.create());
|
||||
}
|
||||
|
||||
public Builder setPivotY(Pivot pivot) {
|
||||
assertAxis(pivot, Pivot.AXIS_Y);
|
||||
transformer.pivotY = pivot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CardScaleTransformer build() {
|
||||
transformer.maxMinDiff = maxScale - transformer.minScale;
|
||||
return transformer;
|
||||
}
|
||||
|
||||
private void assertAxis(Pivot pivot, @Pivot.Axis int axis) {
|
||||
if (pivot.getAxis() != axis) {
|
||||
throw new IllegalArgumentException("You passed a Pivot for wrong axis.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,13 @@ public class LaunchUtils {
|
||||
* @param context
|
||||
* @param pkg 包名
|
||||
*/
|
||||
public static void launchByPkg( Context context, String pkg ) throws Exception{
|
||||
Intent intent = context.getPackageManager().getLaunchIntentForPackage( pkg );
|
||||
public static void launchByPkg( Context context, String pkg ) throws Exception {
|
||||
Intent intent = getLaunchIntentForPackage( context, pkg );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
context.startActivity( intent );
|
||||
}
|
||||
|
||||
public static Intent getLaunchIntentForPackage( Context context, String pkg ) {
|
||||
return context.getPackageManager().getLaunchIntentForPackage( pkg );
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |