This commit is contained in:
wangcongtao
2020-07-07 14:40:42 +08:00
10 changed files with 35 additions and 22 deletions

2
.idea/misc.xml generated
View File

@@ -4,7 +4,7 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -3,6 +3,7 @@ package com.mogo.utils;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;
@@ -46,4 +47,14 @@ public class AppUtils {
return true;
}
}
public static String getApplicationLabel( Context context, String pkgName ) {
try {
PackageManager pm = context.getPackageManager();
ApplicationInfo appInfo = pm.getApplicationInfo( pkgName, PackageManager.GET_META_DATA );
return pm.getApplicationLabel( appInfo ).toString();
} catch ( Exception e ) {
return null;
}
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.module.apps;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
@@ -9,16 +10,17 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.commons.device.Devices;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.voice.AIAssist;
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.AppInfo;
import com.mogo.module.apps.model.NavigatorApps;
import com.mogo.module.apps.view.OnAiAssistClickListener;
import com.mogo.utils.AppUtils;
import com.mogo.utils.CommonUtils;
import java.util.HashMap;
import java.util.Map;
@@ -58,7 +60,7 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
mAppIndicatorAdapter = new AppIndicatorAdapter( getContext(), NavigatorApps.getApps() );
mAppIndicatorAdapter.setOnItemClickedListener( ( data, position ) -> {
mLauncher.launch( getContext(), data );
trackNavigatorClickEvent( data.getTrackType() );
trackNavigatorClickEvent( data );
} );
mNavigatorAppsList.setAdapter( mAppIndicatorAdapter );
@@ -118,9 +120,18 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
AppsListActivity.start( getActivity() );
}
private void trackNavigatorClickEvent( int type ) {
private void trackNavigatorClickEvent( AppInfo app ) {
final Map< String, Object > properties = new HashMap<>();
properties.put( "type", type );
String appLabel = AppUtils.getApplicationLabel( getContext(), app.getPackageName() );
properties.put( "appname", app.getName() );
if ( !TextUtils.isEmpty( appLabel ) ) {
properties.put( "appname", appLabel );
}
if ( !TextUtils.equals( "全部应用", app.getName() ) ) {
properties.put( "appversion", CommonUtils.getVersionName( getContext(), app.getPackageName() ) );
} else {
properties.put( "appversion", CommonUtils.getVersionName( getContext() ) );
}
AppServiceHandler.getMogoAnalytics().track( "Launcher_APP_Icon", properties );
}

View File

@@ -27,7 +27,7 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
@Override
public void launch( Context context, AppInfo appInfo ) {
switch ( appInfo.getPackageName() ) {
case "com.mogo.launcher.navi.search":
case "com.autonavi.amapauto":
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
try {
LaunchUtils.launchByPkg( context, "com.autonavi.amapauto" );

View File

@@ -13,10 +13,10 @@ import java.util.List;
*/
public class NavigatorApps {
private static AppInfo app = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi, 1 );
private static AppInfo app_ = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi_disable, 1 );
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( "酷我音乐", "cn.kuwo.kwmusiccar", "", 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 );

View File

@@ -5,12 +5,8 @@ import android.view.View;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.device.Devices;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.apps.AppServiceHandler;
import com.mogo.utils.TipToast;
import java.util.HashMap;
import java.util.Map;
public
/**
* @author congtaowang
@@ -32,11 +28,9 @@ class OnAiAssistClickListener implements View.OnClickListener {
public void onClick( View v ) {
if ( Devices.isBind() || !DebugConfig.isActiveAIAssistFlag() ) {
AIAssist.startAssistant( v.getContext() );
trackNavigatorClickEvent( 5 );
} else {
if ( mDebugModeOpen ) {
AIAssist.startAssistant( v.getContext(), 1 );
trackNavigatorClickEvent( 5 );
return;
}
if ( mClickCounter == 0 ) {
@@ -60,10 +54,4 @@ class OnAiAssistClickListener implements View.OnClickListener {
}
}
private void trackNavigatorClickEvent( int type ) {
final Map< String, Object > properties = new HashMap<>();
properties.put( "type", type );
AppServiceHandler.getMogoAnalytics().track( "Launcher_APP_Icon", properties );
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -35,6 +35,9 @@ public class AppOperationIntentHandler implements IntentHandler {
String app = object.optString( "object" );
String operation = object.optString( "operation" );
if ( TextUtils.equals( "打开", operation ) ) {
if ( TextUtils.isEmpty( sAppPackages.get( app ) ) ) {
return;
}
try {
LaunchUtils.launchByPkg( context, sAppPackages.get( app ) );
} catch ( Exception e ) {