导航按钮
This commit is contained in:
@@ -8,6 +8,7 @@ import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
@@ -61,6 +62,7 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
|
||||
private TextView mEnterApp;
|
||||
private TextView mConsult;
|
||||
private View mHandler;
|
||||
private ImageView mHandlerIcon;
|
||||
|
||||
private boolean mLargeStyle = true;
|
||||
|
||||
@@ -116,7 +118,8 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
|
||||
} );
|
||||
mEnterApp = mWindowManagerView.findViewById( R.id.module_widgets_app_entrance );
|
||||
mConsult = mWindowManagerView.findViewById( R.id.module_widgets_app_consult );
|
||||
mHandler = mWindowManagerView.findViewById( R.id.module_widgets_app_handler );
|
||||
mHandler = mWindowManagerView.findViewById( R.id.module_widgets_app_handler_container );
|
||||
mHandlerIcon = mWindowManagerView.findViewById( R.id.module_widgets_app_handler );
|
||||
}
|
||||
try {
|
||||
if ( mWindowManagerView.isShowing() ) {
|
||||
@@ -131,20 +134,31 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
|
||||
}
|
||||
|
||||
private void chooseAction( View root, float xPos, float yPos ) {
|
||||
if ( isInViewArea( mEnterApp, xPos, yPos ) ) {
|
||||
if ( isInViewArea( root, mEnterApp, xPos, yPos ) ) {
|
||||
enterApp( root.getContext() );
|
||||
} else if ( isInViewArea( mHandler, xPos, yPos ) ) {
|
||||
} else if ( isInViewArea( root, mHandler, xPos, yPos ) ) {
|
||||
handleStyle( mHandler.getContext() );
|
||||
} else if ( isInViewArea( mConsult, xPos, yPos ) ) {
|
||||
} else if ( isInViewArea( root, mConsult, xPos, yPos ) ) {
|
||||
consultUser( root.getContext() );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInViewArea( View target, float xPos, float yPos ) {
|
||||
if ( xPos >= target.getLeft()
|
||||
&& xPos <= target.getRight()
|
||||
&& yPos >= target.getTop()
|
||||
&& yPos <= target.getBottom() ) {
|
||||
private boolean isInViewArea( View root, View target, float xPos, float yPos ) {
|
||||
int loc[] = new int[2];
|
||||
root.getLocationOnScreen( loc );
|
||||
int rootX = loc[0];
|
||||
int rootY = loc[1];
|
||||
|
||||
target.getLocationOnScreen( loc );
|
||||
int targetX = loc[0];
|
||||
int targetY = loc[1];
|
||||
int targetWidth = target.getMeasuredWidth();
|
||||
int targetHeight = target.getMeasuredHeight();
|
||||
|
||||
if ( xPos + rootX >= targetX
|
||||
&& xPos + rootX <= targetX + targetWidth
|
||||
&& yPos + rootY >= targetY
|
||||
&& yPos + rootY <= targetY + targetHeight ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -156,7 +170,7 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
|
||||
* @param context
|
||||
*/
|
||||
private void consultUser( Context context ) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", 1 );
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "NAVI_Find_Mogoer", properties );
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageOnResume() ) {
|
||||
@@ -174,10 +188,12 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
|
||||
mEnterApp.setText( R.string.module_widgets_app_entrance_short );
|
||||
mConsult.setText( R.string.module_widgets_app_consult_short );
|
||||
mLargeStyle = false;
|
||||
mHandlerIcon.setImageResource( R.drawable.module_widgets_app_handler_open );
|
||||
} else {
|
||||
mEnterApp.setText( R.string.module_widgets_app_entrance_text );
|
||||
mConsult.setText( R.string.module_widgets_app_entrance_consult );
|
||||
mLargeStyle = true;
|
||||
mHandlerIcon.setImageResource( R.drawable.module_widgets_app_handler_close );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 372 B |
Binary file not shown.
|
After Width: | Height: | Size: 360 B |
Binary file not shown.
|
After Width: | Height: | Size: 372 B |
Binary file not shown.
|
After Width: | Height: | Size: 360 B |
Binary file not shown.
|
After Width: | Height: | Size: 577 B |
Binary file not shown.
|
After Width: | Height: | Size: 564 B |
@@ -2,7 +2,7 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:bottomLeftRadius="@dimen/module_widgets_app_bkg_corner" android:bottomRightRadius="@dimen/module_widgets_app_bkg_corner" android:topLeftRadius="0px" android:topRightRadius="0px" />
|
||||
<corners android:radius="@dimen/module_widgets_app_bkg_corner" />
|
||||
<solid android:color="#3D3F44" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/module_widgets_app_entrance_root"
|
||||
@@ -8,25 +8,24 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_widgets_app_handler_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_widgets_app_handler_bkg">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_widgets_app_handler"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:src="@drawable/ic_1" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_widgets_app_body_bkg">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_widgets_app_handler_container"
|
||||
android:layout_width="@dimen/module_widgets_app_handler_width"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_widgets_app_handler"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_widgets_app_handler_close" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_widgets_app_entrance"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -63,4 +62,4 @@
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -9,4 +9,6 @@
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">27px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
|
||||
<dimen name="module_widgets_app_handler_width">56px</dimen>
|
||||
<dimen name="module_widgets_app_handler_height">40px</dimen>
|
||||
</resources>
|
||||
@@ -9,4 +9,6 @@
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">27px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
|
||||
<dimen name="module_widgets_app_handler_width">56px</dimen>
|
||||
<dimen name="module_widgets_app_handler_height">40px</dimen>
|
||||
</resources>
|
||||
@@ -3,10 +3,12 @@
|
||||
<dimen name="module_widgets_app_entrance_textSize">40px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_padding">30px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">48px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">836px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingTop">37px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">50px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
<dimen name="module_widgets_app_bkg_corner">8px</dimen>
|
||||
<dimen name="module_widgets_app_handler_width">100px</dimen>
|
||||
<dimen name="module_widgets_app_handler_height">85px</dimen>
|
||||
</resources>
|
||||
@@ -3,10 +3,12 @@
|
||||
<dimen name="module_widgets_app_entrance_textSize">40px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_padding">30px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">48px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">836px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingTop">37px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">50px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
<dimen name="module_widgets_app_bkg_corner">8px</dimen>
|
||||
<dimen name="module_widgets_app_handler_width">100px</dimen>
|
||||
<dimen name="module_widgets_app_handler_height">85px</dimen>
|
||||
</resources>
|
||||
@@ -3,10 +3,12 @@
|
||||
<dimen name="module_widgets_app_entrance_textSize">22px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_padding">30px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">48px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">505px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingTop">20px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">27px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
|
||||
<dimen name="module_widgets_app_handler_width">56px</dimen>
|
||||
<dimen name="module_widgets_app_handler_height">40px</dimen>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user