opt: fit for qqmusic and kuwo music
This commit is contained in:
@@ -10,12 +10,14 @@ import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.apps.adapter.AppIndicatorAdapter;
|
||||
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.AppEnum;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.NavigatorApps;
|
||||
import com.mogo.module.apps.view.OnAiAssistClickListener;
|
||||
@@ -128,7 +130,15 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
properties.put( "appname", appLabel );
|
||||
}
|
||||
if ( !TextUtils.equals( "全部应用", app.getName() ) ) {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext(), app.getPackageName() ) );
|
||||
if ( TextUtils.equals( "com.zhidao.music", app.getPackageName() ) ) {
|
||||
if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), AppEnum.KwMusic.getPkg() ) ) {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext(), AppEnum.KwMusic.getPkg() ) );
|
||||
} else if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), AppEnum.QQMusic.getPkg() ) ) {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext(), AppEnum.QQMusic.getPkg() ) );
|
||||
}
|
||||
} else {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext(), app.getPackageName() ) );
|
||||
}
|
||||
} else {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext() ) );
|
||||
}
|
||||
|
||||
@@ -14,5 +14,7 @@ public interface AppLaunchFilter {
|
||||
|
||||
void launch( Context context, AppInfo appInfo );
|
||||
|
||||
void launch( Context context, String pkg );
|
||||
|
||||
void destroy();
|
||||
}
|
||||
|
||||
@@ -21,15 +21,7 @@ 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." );
|
||||
TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
}
|
||||
launch( context, appInfo.getPackageName() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
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.utils.LaunchUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-09
|
||||
@@ -8,6 +16,8 @@ package com.mogo.module.apps.applaunch;
|
||||
*/
|
||||
public abstract class BaseAppLauncher implements AppLaunchFilter {
|
||||
|
||||
private static final String TAG = "BaseAppLauncher";
|
||||
|
||||
private AppLaunchFilter mNext;
|
||||
|
||||
public AppLaunchFilter getNext() {
|
||||
@@ -17,4 +27,17 @@ public abstract class BaseAppLauncher implements AppLaunchFilter {
|
||||
public void setNext( AppLaunchFilter next ) {
|
||||
this.mNext = next;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch( Context context, String pkg ) {
|
||||
try {
|
||||
if ( LaunchUtils.getLaunchIntentForPackage( context, pkg ) != null ) {
|
||||
AppServiceHandler.getApis().getAdasControllerApi().closeADAS();
|
||||
}
|
||||
LaunchUtils.launchByPkg( context, pkg );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,17 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.AppsListActivity;
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.apps.model.AppEnum;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.common.map.CustomNaviInterrupter;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -32,7 +37,7 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
case "com.autonavi.amapauto":
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
try {
|
||||
LaunchUtils.launchByPkg( context, "com.autonavi.amapauto" );
|
||||
launch( context, AppEnum.AUTO_NAVI.getPkg() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -50,6 +55,23 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
startActivity( context, appInfo, "com.zhidao.bluetooth.ui.MainActivity" );
|
||||
}
|
||||
break;
|
||||
case "com.zhidao.music":
|
||||
if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), AppEnum.KwMusic.getPkg() ) ) {
|
||||
try {
|
||||
launch( context, AppEnum.KwMusic.getPkg() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), AppEnum.QQMusic.getPkg() ) ) {
|
||||
try {
|
||||
launch( context, AppEnum.QQMusic.getPkg() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ( getNext() != null ) {
|
||||
getNext().launch( context, appInfo );
|
||||
|
||||
@@ -16,7 +16,7 @@ public class NavigatorApps {
|
||||
private static AppInfo app = new AppInfo( "高德地图", "com.autonavi.amapauto", "", 0, null, R.drawable.module_apps_ic_navigator_navi, 1 );
|
||||
private static AppInfo app_ = new AppInfo( "高德地图", "com.autonavi.amapauto", "", 0, null, R.drawable.module_apps_ic_navigator_navi_disable, 1 );
|
||||
// private static AppInfo app2 = new AppInfo( "音乐", "com.tencent.wecarflow", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 );
|
||||
private static AppInfo app2 = new AppInfo( "酷我音乐", "cn.kuwo.kwmusiccar", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 );
|
||||
private static AppInfo app2 = new AppInfo( "音乐", "com.zhidao.music", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 );
|
||||
private static AppInfo app3 = new AppInfo( "车聊聊", "com.zhidao.imdemo", "", 0, null, R.drawable.module_apps_ic_navigator_im, 6 );
|
||||
private static AppInfo app4 = new AppInfo( "全部应用", "com.mogo.launcher.applist", "", 0, null, R.drawable.module_apps_ic_navigator_applist, 4 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user