优化卡片滑动性能:探路视频播放、C位事件逻辑;定制化app列表;修改小智动画策略;其他优化;
This commit is contained in:
@@ -4,8 +4,13 @@ import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
|
||||
import com.mogo.module.apps.model.AppEnum;
|
||||
import com.mogo.module.apps.model.AppEnumHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -18,6 +23,7 @@ public class AppFilterImpl implements AppFilter {
|
||||
private final Context mContext;
|
||||
private List< String > mFilterPackages;
|
||||
|
||||
|
||||
public AppFilterImpl( Context context ) {
|
||||
mContext = context;
|
||||
final String[] values = context.getResources().getStringArray( R.array.module_apps_array_filter_packages );
|
||||
@@ -37,6 +43,9 @@ public class AppFilterImpl implements AppFilter {
|
||||
if ( noLaunchIntent( packageInfo ) ) {
|
||||
return true;
|
||||
}
|
||||
if ( !AppEnumHelper.isCustomizedApp( packageInfo.packageName ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,11 @@ public class AppsAdapter extends BaseAdapter {
|
||||
holder = ( ( AppViewHolder ) convertView.getTag() );
|
||||
}
|
||||
AppInfo appInfo = getItem( position );
|
||||
holder.mIcon.setImageDrawable( appInfo.getIcon() );
|
||||
if ( appInfo.getIconResId() <= 0 ) {
|
||||
holder.mIcon.setImageDrawable( appInfo.getIcon() );
|
||||
} else {
|
||||
holder.mIcon.setImageResource( appInfo.getIconResId() );
|
||||
}
|
||||
holder.mName.setText( appInfo.getName() );
|
||||
return holder.mItemView;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -58,6 +59,8 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
private void renderAppsList() {
|
||||
ThreadPoolService.execute( () -> {
|
||||
AppsModel.getInstance( getContext() ).load( appInfoList -> {
|
||||
|
||||
Logger.d( TAG, "apps: %s", appInfoList );
|
||||
UiThreadHandler.post( () -> {
|
||||
if ( mView != null ) {
|
||||
mView.renderApps( appInfoList );
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.mogo.module.apps.model;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-12
|
||||
* <p>
|
||||
* 定制化的 app 列表
|
||||
* <p>
|
||||
* <p>
|
||||
* 自研类:QQ音乐、车聊聊、探路、新鲜事、福利、蘑菇小队、行车记录仪、懒人听书、一键清理、系统升级
|
||||
* 第三方:车机微信助手、爱奇艺、喜马拉雅
|
||||
* 基础类:均衡器、方控学习、蓝牙、FM、车载设置、AUX
|
||||
*/
|
||||
public enum AppEnum {
|
||||
|
||||
//"QQ音乐",
|
||||
QQMusic( "com.pvetec.musics", 0 ),
|
||||
|
||||
//"车聊聊",
|
||||
Im( "com.zhidao.imdemo", 0 ),
|
||||
|
||||
//"探路",
|
||||
RoadCondition( "com.zhidao.roadcondition", 0 ),
|
||||
RoadConditionSlit( "com.zhidao.roadcondition.split", 0 ),
|
||||
|
||||
//"福利",
|
||||
Welfare( "com.zhidaohulian.welfare.car", 0 ),
|
||||
|
||||
//"蘑菇小队",
|
||||
Fleet( "com.zhidao.fleet", 0 ),
|
||||
|
||||
//"行车记录仪",
|
||||
CarCorder( "com.zhidao.carcorder", 0 ),
|
||||
|
||||
//"懒人听书",
|
||||
Lrts( "com.zhidao.lrts", 0 ),
|
||||
|
||||
//"一键清理",
|
||||
CleanMaster( "com.zhidao.cleanmaster", 0 ),
|
||||
|
||||
//"系统升级",
|
||||
Fota( "com.abupdate.fota_demo_iot", 0 ),
|
||||
|
||||
//"微信车机助手",
|
||||
WecahtHelper( "com.zhidao.wechathelper", 0 ),
|
||||
|
||||
//"爱奇艺HD",
|
||||
Qiyi( "com.qiyi.video.pad", 0 ),
|
||||
|
||||
//"喜马拉雅",
|
||||
Ximalaya( "com.ximalaya.ting.android.car", 0 ),
|
||||
|
||||
//"均衡器",
|
||||
Equlizer( "com.zhidao.equalizer", 0 ),
|
||||
|
||||
//"方控学习",
|
||||
SteerProduct( "com.zd.steerproduct", 0 ),
|
||||
|
||||
//"蓝牙音乐",
|
||||
BTMusic( "com.nwd.bt.music", 0 ),
|
||||
|
||||
//"车载设置",
|
||||
CarSettings( "com.zhidao.settings", 0 ),
|
||||
|
||||
//"AUX",
|
||||
AUX( "com.nwd.auxin", 0 ),
|
||||
|
||||
//FM
|
||||
FM( " com.nwd.radio", 0 ),
|
||||
|
||||
// 新鲜事
|
||||
FreshThins( "com.zhidao.fresh.things", 0 ),
|
||||
;
|
||||
|
||||
private String mPkg;
|
||||
private int mIconResId;
|
||||
|
||||
AppEnum( String pkg, int iconResId ) {
|
||||
this.mPkg = pkg;
|
||||
this.mIconResId = iconResId;
|
||||
}
|
||||
|
||||
public String getPkg() {
|
||||
return mPkg;
|
||||
}
|
||||
|
||||
public int getIconResId() {
|
||||
return mIconResId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.mogo.module.apps.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-12
|
||||
* <p>
|
||||
* 定制化的app
|
||||
*/
|
||||
public class AppEnumHelper {
|
||||
|
||||
private static Map< String, AppEnum > sCustomizedApps = new HashMap<>();
|
||||
|
||||
static {
|
||||
AppEnum[] customizedApps = AppEnum.values();
|
||||
for ( AppEnum customizedApp : customizedApps ) {
|
||||
sCustomizedApps.put( customizedApp.getPkg(), customizedApp );
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCustomizedApp( String pkg ) {
|
||||
return sCustomizedApps.containsKey( pkg );
|
||||
}
|
||||
|
||||
public static int getCustomizedAppIconResId( String pkg ) {
|
||||
AppEnum appEnum = sCustomizedApps.get( pkg );
|
||||
if ( appEnum != null ) {
|
||||
return appEnum.getIconResId();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,19 @@ public class AppInfo {
|
||||
private final String mVersionName;
|
||||
private final int mVersionCode;
|
||||
private final Drawable mIcon;
|
||||
private final int mIconResId;
|
||||
|
||||
public AppInfo( String name, String mPackageName, String mVersionName, int versionCode, Drawable icon ) {
|
||||
this.mName = name;
|
||||
public AppInfo( String mName, String mPackageName, String mVersionName, int mVersionCode, Drawable mIcon, int mIconResId ) {
|
||||
this.mName = mName;
|
||||
this.mPackageName = mPackageName;
|
||||
this.mVersionName = mVersionName;
|
||||
this.mVersionCode = versionCode;
|
||||
this.mIcon = icon;
|
||||
this.mVersionCode = mVersionCode;
|
||||
this.mIcon = mIcon;
|
||||
this.mIconResId = mIconResId;
|
||||
}
|
||||
|
||||
public int getIconResId() {
|
||||
return mIconResId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AppsModel {
|
||||
String versionName = packageInfo.versionName;
|
||||
int versionCode = packageInfo.versionCode;
|
||||
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon, AppEnumHelper.getCustomizedAppIconResId( packageName ) );
|
||||
mPagedApps.get( page ).add( appInfo );
|
||||
}
|
||||
if ( callback != null ) {
|
||||
@@ -106,7 +106,7 @@ public class AppsModel {
|
||||
String versionName = packageInfo.versionName;
|
||||
int versionCode = packageInfo.versionCode;
|
||||
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon, AppEnumHelper.getCustomizedAppIconResId( packageName ) );
|
||||
int pageIndex = getPageIndex( packageName, true );
|
||||
if ( !mPagedApps.containsKey( pageIndex ) ) {
|
||||
mPagedApps.put( pageIndex, new ArrayList<>() );
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.module.apps.model;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class CardAppInfo extends AppInfo {
|
||||
|
||||
private String mCardType;
|
||||
|
||||
public CardAppInfo( AppInfo app, String cardType ) {
|
||||
super( app.getName(), app.getPackageName(), app.getVersionName(), app.getVersionCode(), app.getIcon() );
|
||||
this.mCardType = cardType;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user