Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
This commit is contained in:
@@ -93,6 +93,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-tanlu')
|
||||
implementation project(':modules:mogo-module-search')
|
||||
implementation project(':modules:mogo-module-back')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ 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.BackToMainHomeManager;
|
||||
import com.mogo.module.carchatting.card.CallChatConstant;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
@@ -52,6 +53,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addModule(new MogoModule(MediaConstants.TAG, MediaConstants.MODULE_TYPE));
|
||||
MogoModulePaths.addModule(new MogoModule( FreshNewsConstants.TAG, FreshNewsConstants.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(PushUIConstants.TAG, PushUIConstants.TAG));
|
||||
// BackToMainHomeManager.addMainHomeView();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -108,6 +108,8 @@ ext {
|
||||
//运营位卡片
|
||||
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}",
|
||||
// 长链
|
||||
socketsdk : 'com.zhidao.socketsdk:socketsdk:2.1.0',
|
||||
socketsdkconnsvrprotoco : 'com.zhidao.ptech:connsvr-protoco:0.1.23',
|
||||
|
||||
@@ -54,5 +54,6 @@ MOGO_MODULE_PUSH_VERSION=1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_SEARCH_VERSION=1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_AD_CARD_VERSION=1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_FRESH_NEWS_VERSION=1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_BACK_VERSION=1.0.0-SNAPSHOT
|
||||
|
||||
|
||||
|
||||
1
modules/mogo-module-back/.gitignore
vendored
Normal file
1
modules/mogo-module-back/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
68
modules/mogo-module-back/build.gradle
Normal file
68
modules/mogo-module-back/build.gradle
Normal file
@@ -0,0 +1,68 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
implementation 'androidx.core:core-ktx:1.0.2'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
api project(":foudations:mogo-commons")
|
||||
implementation project(':modules:mogo-module-common')
|
||||
}
|
||||
|
||||
}
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
0
modules/mogo-module-back/consumer-rules.pro
Normal file
0
modules/mogo-module-back/consumer-rules.pro
Normal file
3
modules/mogo-module-back/gradle.properties
Normal file
3
modules/mogo-module-back/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-back
|
||||
VERSION_CODE=1
|
||||
21
modules/mogo-module-back/proguard-rules.pro
vendored
Normal file
21
modules/mogo-module-back/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
6
modules/mogo-module-back/src/main/AndroidManifest.xml
Normal file
6
modules/mogo-module-back/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.back" >
|
||||
<uses-permission android:name="android.permission.ACTION_MANAGE_OVERLAY_PERMISSION" />
|
||||
<uses-permission android:name="android.permission.TYPE_APPLICATION_OVERLAY" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
</manifest>
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.mogo.module.back;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.back.utils.Utils;
|
||||
import com.mogo.module.back.utils.WindowManagerViewHelper;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class BackToMainHomeManager {
|
||||
|
||||
private static View mBackView;
|
||||
public static void addMainHomeView(){
|
||||
Logger.d("BackToMainHomeManager","addMainHomeView");
|
||||
if (mBackView != null)WindowManagerViewHelper.removeView(mBackView);
|
||||
mBackView = LayoutInflater.from(AbsMogoApplication.getApp()).inflate(R.layout.mogo_module_back_home_back_layout, null);
|
||||
final Context context = mBackView.getContext();
|
||||
if ( context == null || context.getApplicationContext() == null ) {
|
||||
return;
|
||||
}
|
||||
WindowManager windowManager = ( WindowManager ) context.getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
if ( windowManager == null ) {
|
||||
return;
|
||||
}
|
||||
mBackView.setOnClickListener(view -> {
|
||||
if (Utils.isActivityExits("com.mogo.launcher","com.mogo.module.main.MainActivity")){
|
||||
ComponentName cn = new ComponentName("com.mogo.launcher", "com.mogo.module.main.MainActivity") ;
|
||||
Intent intent = new Intent() ;
|
||||
intent.setComponent(cn) ;
|
||||
if (!(AbsMogoApplication.getApp().getApplicationContext() instanceof Activity)) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
}
|
||||
AbsMogoApplication.getApp().startActivity(intent);
|
||||
}
|
||||
});
|
||||
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.x = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset(R.dimen.module_back_main_home_icon_left);
|
||||
params.y = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset(R.dimen.module_back_main_home_icon_top);
|
||||
params.gravity = Gravity.LEFT | Gravity.CENTER;
|
||||
params.type = getFitWindowParamsType();
|
||||
params.format = PixelFormat.RGBA_8888;
|
||||
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||
windowManager.addView( mBackView, params );
|
||||
WindowManagerViewHelper.attachMovementEvent(mBackView,params);
|
||||
}
|
||||
|
||||
public static void removeMainHomeView(){
|
||||
WindowManagerViewHelper.removeView(mBackView);
|
||||
}
|
||||
|
||||
private static int getFitWindowParamsType() {
|
||||
int type;
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 ) {
|
||||
// Need request permission.
|
||||
type = WindowManager.LayoutParams.TYPE_PHONE;
|
||||
} else if ( Build.MODEL.equalsIgnoreCase( "MI 5" ) ) {
|
||||
// MI 5 phone not display crawler dot in android 7.0
|
||||
type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
} else {
|
||||
// It's will be dismissed automatically 3s after showing in Android 25.
|
||||
type = WindowManager.LayoutParams.TYPE_TOAST;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.module.back.utils;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
|
||||
public class Utils {
|
||||
public static boolean isActivityExits(String packageName,String classStr){
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(packageName, classStr);
|
||||
ResolveInfo resolveInfo = AbsMogoApplication.getApp().getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if(resolveInfo != null) {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
package com.mogo.module.back.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-04-30
|
||||
* <p>
|
||||
* 向 window manager 添加 view
|
||||
*/
|
||||
public class WindowManagerViewHelper {
|
||||
|
||||
public static void addView( View view ) {
|
||||
|
||||
final Context context = view.getContext();
|
||||
if ( context == null || context.getApplicationContext() == null ) {
|
||||
return;
|
||||
}
|
||||
WindowManager windowManager = ( WindowManager ) context.getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
if ( windowManager == null ) {
|
||||
return;
|
||||
}
|
||||
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.LEFT | Gravity.CENTER;
|
||||
params.type = getFitWindowParamsType();
|
||||
params.format = PixelFormat.RGBA_8888;
|
||||
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||
windowManager.addView( view, params );
|
||||
|
||||
attachMovementEvent( view, params );
|
||||
}
|
||||
|
||||
private static int getFitWindowParamsType() {
|
||||
int type;
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 ) {
|
||||
// Need request permission.
|
||||
type = WindowManager.LayoutParams.TYPE_PHONE;
|
||||
} else if ( Build.MODEL.equalsIgnoreCase( "MI 5" ) ) {
|
||||
// MI 5 phone not display crawler dot in android 7.0
|
||||
type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
} else {
|
||||
// It's will be dismissed automatically 3s after showing in Android 25.
|
||||
type = WindowManager.LayoutParams.TYPE_TOAST;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public static void removeView( View view ) {
|
||||
if ( view == null || view.getContext() == null || view.getContext().getApplicationContext() == null ) {
|
||||
return;
|
||||
}
|
||||
WindowManager windowManager = ( WindowManager ) view.getContext().getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
if ( windowManager == null ) {
|
||||
return;
|
||||
}
|
||||
windowManager.removeViewImmediate( view );
|
||||
DispatchTouchEventWrapper.getInstance().release();
|
||||
|
||||
}
|
||||
|
||||
public static void attachMovementEvent( View view, WindowManager.LayoutParams params ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
view.setOnTouchListener( ( v, event ) -> {
|
||||
DispatchTouchEventWrapper.getInstance()
|
||||
.attach( view, params )
|
||||
.handle( event );
|
||||
return false;
|
||||
} );
|
||||
}
|
||||
|
||||
static class DispatchTouchEventWrapper {
|
||||
|
||||
private WindowViewHandler mWindowViewHandler;
|
||||
|
||||
int mActionDownX = -1;
|
||||
int mActionDownY = -1;
|
||||
|
||||
/**
|
||||
* Flag whether move after touch down.
|
||||
*/
|
||||
boolean mMoveFlag = false;
|
||||
|
||||
private static volatile DispatchTouchEventWrapper INST;
|
||||
|
||||
private DispatchTouchEventWrapper() {
|
||||
}
|
||||
|
||||
public static DispatchTouchEventWrapper getInstance() {
|
||||
if ( INST == null ) {
|
||||
synchronized ( DispatchTouchEventWrapper.class ) {
|
||||
if ( INST == null ) {
|
||||
INST = new DispatchTouchEventWrapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INST;
|
||||
}
|
||||
|
||||
public DispatchTouchEventWrapper attach( View windowView, WindowManager.LayoutParams params ) {
|
||||
if ( mWindowViewHandler == null || mWindowViewHandler.getWindowView() != windowView ) {
|
||||
mWindowViewHandler = new WindowViewHandler.DefaultHandler( windowView, params );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean handle( MotionEvent event ) {
|
||||
switch ( event.getAction() & MotionEvent.ACTION_MASK ) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if ( onActionDown( event ) ) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if ( onActionMove( event ) ) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if ( onActionUp( event ) ) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onActionDown( MotionEvent event ) {
|
||||
mActionDownX = ( ( int ) event.getRawX() );
|
||||
mActionDownY = ( ( int ) event.getRawY() );
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.recordNewPosition();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onActionMove( MotionEvent event ) {
|
||||
|
||||
if ( Math.abs( event.getRawX() - mActionDownX ) >= 20
|
||||
|| Math.abs( event.getRawY() - mActionDownY ) >= 20 ) {
|
||||
mMoveFlag = true;
|
||||
}
|
||||
|
||||
if ( isLastDownValueLegal() ) {
|
||||
moveWindowView( event );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onActionUp( MotionEvent event ) {
|
||||
if ( isClickEventLike() ) {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.performClickLike();
|
||||
}
|
||||
} else {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.moveToEdge();
|
||||
mWindowViewHandler.recordNewPosition();
|
||||
}
|
||||
}
|
||||
mMoveFlag = false;
|
||||
clearLastDownAxisValue();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void clearLastDownAxisValue() {
|
||||
mActionDownX = mActionDownY = -1;
|
||||
}
|
||||
|
||||
private boolean isLastDownValueLegal() {
|
||||
return mActionDownX != -1 && mActionDownY != -1;
|
||||
}
|
||||
|
||||
private void moveWindowView( MotionEvent event ) {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.move( event, mActionDownX, mActionDownY );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate click event just like set {@link View.OnClickListener}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isClickEventLike() {
|
||||
System.out.println( mMoveFlag );
|
||||
return isLastDownValueLegal() && !mMoveFlag;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.release();
|
||||
}
|
||||
mWindowViewHandler = null;
|
||||
mActionDownX = -1;
|
||||
mActionDownY = -1;
|
||||
mMoveFlag = false;
|
||||
INST = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.mogo.module.back.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Created by congtaowang on 2017/6/20.
|
||||
*/
|
||||
|
||||
public interface WindowViewHandler {
|
||||
|
||||
View getWindowView();
|
||||
|
||||
void recordNewPosition();
|
||||
|
||||
void move(MotionEvent event, int downX, int downY);
|
||||
|
||||
void release();
|
||||
|
||||
void moveToEdge();
|
||||
|
||||
void performClickLike();
|
||||
|
||||
class DefaultHandler implements WindowViewHandler {
|
||||
|
||||
protected View mWindowView;
|
||||
|
||||
protected int mWindowViewLeft = -1;
|
||||
protected int mWindowViewTop = -1;
|
||||
|
||||
private WindowManager.LayoutParams mParams;
|
||||
|
||||
public DefaultHandler( View windowView, WindowManager.LayoutParams params ) {
|
||||
this.mWindowView = windowView;
|
||||
mParams = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getWindowView() {
|
||||
return mWindowView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordNewPosition() {
|
||||
mWindowViewLeft = mParams.x;
|
||||
mWindowViewTop = mParams.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move( MotionEvent event, int downX, int downY ) {
|
||||
move( ( ( int ) ( event.getRawX() - downX ) ),
|
||||
( ( int ) ( event.getRawY() - downY ) ) );
|
||||
}
|
||||
|
||||
private void move( int distanceX, int distanceY ) {
|
||||
if ( mWindowView == null ) {
|
||||
return;
|
||||
}
|
||||
mParams.x = mWindowViewLeft + distanceX;
|
||||
mParams.y = mWindowViewTop + distanceY;
|
||||
WindowManager wm = ( ( WindowManager ) mWindowView.getContext().getSystemService( Context.WINDOW_SERVICE ) );
|
||||
|
||||
if ( wm == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mWindowView instanceof WindowViewUIController ) {
|
||||
if ( mParams.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) / 2 ) {
|
||||
( ( WindowViewUIController ) mWindowView ).rightMode();
|
||||
} else {
|
||||
( ( WindowViewUIController ) mWindowView ).leftMode();
|
||||
}
|
||||
}
|
||||
|
||||
wm.updateViewLayout( mWindowView, alignLayoutParamsBoundary( mParams ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToEdge() {
|
||||
if ( mWindowView == null ) {
|
||||
return;
|
||||
}
|
||||
/* WindowManager wm = ( ( WindowManager ) mWindowView.getContext().getSystemService( Context.WINDOW_SERVICE ) );
|
||||
|
||||
if ( mParams.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) / 2 ) {
|
||||
mParams.x = WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) - mWindowView.getMeasuredWidth();
|
||||
} else {
|
||||
mParams.x = 0;
|
||||
}
|
||||
|
||||
wm.updateViewLayout( mWindowView, alignLayoutParamsBoundary( mParams ) );*/
|
||||
}
|
||||
|
||||
protected WindowManager.LayoutParams alignLayoutParamsBoundary( WindowManager.LayoutParams params ) {
|
||||
return params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performClickLike() {
|
||||
if ( mWindowView instanceof WindowViewUIController ) {
|
||||
( ( WindowViewUIController ) mWindowView ).performClickLike();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
mWindowView = null;
|
||||
mWindowViewLeft = -1;
|
||||
mWindowViewTop = -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.module.back.utils;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-05-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public interface WindowViewUIController {
|
||||
|
||||
void leftMode();
|
||||
|
||||
void rightMode();
|
||||
|
||||
void performClickLike();
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/module_back_home_unselected_icon"
|
||||
android:state_pressed="true" />
|
||||
|
||||
<item android:drawable="@drawable/module_back_home_selected_icon"
|
||||
android:state_pressed="false" />
|
||||
|
||||
<item android:drawable="@drawable/module_back_home_unselected_icon" />
|
||||
|
||||
</selector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/module_back_main_home_icon_size"
|
||||
android:layout_height="@dimen/module_back_main_home_icon_size">
|
||||
<ImageView
|
||||
android:layout_width="@dimen/module_back_main_home_icon_size"
|
||||
android:layout_height="@dimen/module_back_main_home_icon_size"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/module_back_home_icon_selector">
|
||||
</ImageView>
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_back_main_home_icon_size">80px</dimen>
|
||||
<dimen name="module_back_main_home_icon_left">0px</dimen>
|
||||
<dimen name="module_back_main_home_icon_top">100px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_back_main_home_icon_size">140px</dimen>
|
||||
<dimen name="module_back_main_home_icon_left">0px</dimen>
|
||||
<dimen name="module_back_main_home_icon_top">190px</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
4
modules/mogo-module-back/src/main/res/values/colors.xml
Normal file
4
modules/mogo-module-back/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
</resources>
|
||||
6
modules/mogo-module-back/src/main/res/values/dimens.xml
Normal file
6
modules/mogo-module-back/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
3
modules/mogo-module-back/src/main/res/values/strings.xml
Normal file
3
modules/mogo-module-back/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">back</string>
|
||||
</resources>
|
||||
4
modules/mogo-module-back/src/main/res/values/styles.xml
Normal file
4
modules/mogo-module-back/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.example.mogo_module_share
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.map.location.IMogoLocationClient
|
||||
import com.mogo.map.marker.IMogoMarkerManager
|
||||
import com.mogo.map.navi.IMogoNavi
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch
|
||||
@@ -59,6 +60,10 @@ object SearchServiceHolder{
|
||||
return mapService.getNavi(context)
|
||||
}
|
||||
|
||||
fun getLocationClient(): IMogoLocationClient {
|
||||
return mapService.getLocationClient(context)
|
||||
}
|
||||
|
||||
fun getMapUIController(): IMogoMapUIController {
|
||||
return mapService.mapUIController
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ public class CategoryPresenter extends Presenter<CategoryView> {
|
||||
public void startSearchLocalPoiByInput(String keyword) {
|
||||
MogoPoiSearchQuery mogoInputtipsQuery = new MogoPoiSearchQuery(keyword, keyword);
|
||||
mogoInputtipsQuery.setPageSize(10);
|
||||
mogoInputtipsQuery.getCity();
|
||||
mogoInputtipsQuery.setLocation(
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().getWindowCenterLocation());
|
||||
IMogoPoiSearch inputtipsSearch =
|
||||
|
||||
@@ -83,7 +83,7 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
SearchServiceHolder.INSTANCE.getMarkerManger().removeMarkers();
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation( false );
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation(false);
|
||||
moveMapToCenter();
|
||||
}
|
||||
|
||||
@@ -116,10 +116,12 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
|
||||
mHistoryAdapter.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager().track("Navigation_History_destination", new HashMap<String,Object>());
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager()
|
||||
.track("Navigation_History_destination", new HashMap<String, Object>());
|
||||
SearchPoi item = (SearchPoi) v.getTag(R.id.tag_item);
|
||||
MogoTip mogoTip = EntityConvertUtils.poi2MogoTip(item);
|
||||
SearchServiceHolder.INSTANCE.push(ChoosePathFragment.Companion.newInstance(mogoTip.getPoint()),
|
||||
SearchServiceHolder.INSTANCE.push(
|
||||
ChoosePathFragment.Companion.newInstance(mogoTip.getPoint()),
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT);
|
||||
}
|
||||
});
|
||||
@@ -128,9 +130,15 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
@Override public void onClick(View v) {
|
||||
MogoTip tag = (MogoTip) v.getTag(R.id.tag_position);
|
||||
SearchPoi searchPoi = EntityConvertUtils.tipToPoi(tag);
|
||||
mSearchPresenter.insert(searchPoi);
|
||||
SearchServiceHolder.INSTANCE.push(ChoosePathFragment.Companion.newInstance(tag.getPoint()),
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT);
|
||||
if (tag.getPoint() == null) {
|
||||
push(CategorySearchFragment.Companion.newInstance(tag.getName()),
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY);
|
||||
} else {
|
||||
mSearchPresenter.insert(searchPoi);
|
||||
SearchServiceHolder.INSTANCE.push(
|
||||
ChoosePathFragment.Companion.newInstance(tag.getPoint()),
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -142,7 +150,8 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
|
||||
findViewById(R.id.tv_navi_setting).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager().track("Navigation_button_setting", new HashMap<String,Object>());
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager()
|
||||
.track("Navigation_button_setting", new HashMap<String, Object>());
|
||||
|
||||
push(new NaviSettingFragment(), MogoModulePaths.PATH_FRAGMENT_SETTING);
|
||||
}
|
||||
@@ -168,7 +177,8 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
|
||||
findViewById(R.id.tv_navi_search).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager().track("Navigation_button_search", new HashMap<String,Object>());
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager()
|
||||
.track("Navigation_button_search", new HashMap<String, Object>());
|
||||
|
||||
mSearchPresenter.startSearchPoiByInput(mSearchBox.getText().toString());
|
||||
}
|
||||
@@ -404,7 +414,7 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation( true );
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation(true);
|
||||
moveMapToRight();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
@@ -100,6 +101,11 @@ public class SearchPresenter extends Presenter< SearchView >
|
||||
public void startSearchPoiByInput( String keyword ) {
|
||||
MogoInputtipsQuery mogoInputtipsQuery = new MogoInputtipsQuery();
|
||||
mogoInputtipsQuery.setKeyword(keyword);
|
||||
|
||||
MogoLocation lastKnowLocation =
|
||||
SearchServiceHolder.INSTANCE.getLocationClient().getLastKnowLocation();
|
||||
mogoInputtipsQuery.setCity(lastKnowLocation.getCityName());
|
||||
mogoInputtipsQuery.setCityLimit(true);
|
||||
IMogoInputtipsSearch inputtipsSearch =
|
||||
mMapService.getInputtipsSearch(getContext(), mogoInputtipsQuery);
|
||||
|
||||
|
||||
@@ -21,6 +21,13 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".receiver.ShareDialogReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.zhidao.sharedialog" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -69,12 +69,14 @@ import com.mogo.module.tanlu.model.TanluModelData;
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
import com.mogo.module.tanlu.model.event.MarkerInfo;
|
||||
import com.mogo.module.tanlu.model.event.PushTypeInfo;
|
||||
import com.mogo.module.tanlu.model.event.SharedialogEvent;
|
||||
import com.mogo.module.tanlu.util.Utils;
|
||||
import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
|
||||
import com.mogo.module.tanlu.view.AutoZoomInImageView;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
@@ -128,6 +130,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
private IMogoMapUIController mMApUIController;
|
||||
private IMogoAnalytics mAnalytics;
|
||||
private IMogoGeoSearch mIMogoGeoSearch;
|
||||
private IMogoFragmentManager mIMogoFragmentManager;
|
||||
|
||||
//声音控制文字
|
||||
private String voiceGetInfoMationTts;
|
||||
@@ -220,6 +223,8 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(getContext());
|
||||
mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(getContext());
|
||||
|
||||
mIMogoFragmentManager = (IMogoFragmentManager) ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation(getContext());
|
||||
|
||||
mIMogoGeoSearch.setGeoSearchListener(new IMogoGeoSearchListener() {
|
||||
@Override
|
||||
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
|
||||
@@ -855,6 +860,18 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
mogoIntentManager.unregisterIntentListener(MogoReceiver.ACTIION_ADAS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享弹框
|
||||
* @param event
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onShareDialog(final SharedialogEvent event) {
|
||||
if (event == null) {
|
||||
return;
|
||||
}
|
||||
ShareControl.getInstance(getActivity()).showDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收到分享对应数据打点
|
||||
*
|
||||
@@ -1099,6 +1116,11 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
inputlon = lon;
|
||||
inputlat = lat;
|
||||
|
||||
Log.d(TAG, "StackSize() = " + mIMogoFragmentManager.getStackSize());
|
||||
if (mIMogoFragmentManager.getStackSize() > 0) {
|
||||
mIMogoFragmentManager.clearAll();
|
||||
}
|
||||
|
||||
Log.d(TAG, "getVoiceControlRoadData lat =" + lat + ">>>lon =" + lon + ">>>cityCode= " + cityCode + " >>>adCode = " + adCode);
|
||||
mTanluModelData.getVoiceControlRoadData(keywords, cityCode, lon, lat, adCode, new VoiceSearchCallback() {
|
||||
@Override
|
||||
@@ -1157,7 +1179,10 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
}
|
||||
Logger.d(TAG, "getVoiceControlRoadData optionList.size() = " + optionList.size());
|
||||
mMarkerManager.addMarkers(TanluConstants.MODEL_NAME, optionList, true);
|
||||
//直接使用当前数据list,作为切换的数据源
|
||||
|
||||
//直接使用当前数据list,作为切换的数据源,切换左侧列表到最新的数据
|
||||
handleMarkerExploreWay(markerExploreWayList.get(0));
|
||||
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(discription)) {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(discription, null);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.module.tanlu.model.event;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 分享弹框事件
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class SharedialogEvent {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.module.tanlu.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.module.tanlu.model.event.SharedialogEvent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-02-09
|
||||
*/
|
||||
public class ShareDialogReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction() == "com.zhidao.sharedialog") {
|
||||
EventBus.getDefault().post(new SharedialogEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ include ':modules:mogo-module-search'
|
||||
include ':modules:mogo-module-tanlu'
|
||||
include ':modules:mogo-module-share'
|
||||
include ':modules:mogo-module-service'
|
||||
include ':modules:mogo-module-back'
|
||||
include ':libraries:map-amap'
|
||||
//include ':libraries:map-baidu'
|
||||
include ':libraries:mogo-map-api'
|
||||
|
||||
Reference in New Issue
Block a user