mirror of https://github.com/tasks/tasks
Make main menu popover intercept key events so that menu button can dismiss it
parent
cc25b593b4
commit
cc80afcfef
@ -1,27 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
<com.todoroo.astrid.ui.TouchInterceptingFrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dip">
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dip">
|
||||
|
||||
<include layout="@layout/main_menu_popover_body"/>
|
||||
<include layout="@layout/main_menu_popover_body"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gdi_arrow_up"
|
||||
android:layout_width="27dip"
|
||||
android:layout_height="27dip"
|
||||
android:layout_marginLeft="-10dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginBottom="-8dip"
|
||||
android:src="?attr/asListArrowUp" />
|
||||
<ImageView
|
||||
android:id="@+id/gdi_arrow_up"
|
||||
android:layout_width="27dip"
|
||||
android:layout_height="27dip"
|
||||
android:layout_marginLeft="-10dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginBottom="-8dip"
|
||||
android:src="?attr/asListArrowUp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gdi_arrow_down"
|
||||
android:layout_width="27dip"
|
||||
android:layout_height="27dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginBottom="-8dip"
|
||||
android:layout_below="@android:id/list"/>
|
||||
<ImageView
|
||||
android:id="@+id/gdi_arrow_down"
|
||||
android:layout_width="27dip"
|
||||
android:layout_height="27dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginBottom="-8dip"
|
||||
android:layout_below="@android:id/list"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</com.todoroo.astrid.ui.TouchInterceptingFrameLayout>
|
||||
|
||||
@ -1,27 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
<com.todoroo.astrid.ui.TouchInterceptingFrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dip">
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dip">
|
||||
|
||||
<include layout="@layout/main_menu_popover_body_tablet"/>
|
||||
<include layout="@layout/main_menu_popover_body_tablet"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gdi_arrow_up"
|
||||
android:layout_width="27dip"
|
||||
android:layout_height="27dip"
|
||||
android:layout_marginLeft="-10dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginBottom="-8dip"
|
||||
android:src="@drawable/list_arrow_up_white" />
|
||||
<ImageView
|
||||
android:id="@+id/gdi_arrow_up"
|
||||
android:layout_width="27dip"
|
||||
android:layout_height="27dip"
|
||||
android:layout_marginLeft="-10dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginBottom="-8dip"
|
||||
android:src="@drawable/list_arrow_up_white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gdi_arrow_down"
|
||||
android:layout_width="27dip"
|
||||
android:layout_height="27dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginBottom="-8dip"
|
||||
android:layout_below="@android:id/list"/>
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:id="@+id/gdi_arrow_down"
|
||||
android:layout_width="27dip"
|
||||
android:layout_height="27dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginBottom="-8dip"
|
||||
android:layout_below="@android:id/list"/>
|
||||
</RelativeLayout>
|
||||
</com.todoroo.astrid.ui.TouchInterceptingFrameLayout>
|
||||
@ -0,0 +1,36 @@
|
||||
package com.todoroo.astrid.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
public class TouchInterceptingFrameLayout extends FrameLayout {
|
||||
|
||||
public interface InterceptTouchListener {
|
||||
public boolean didInterceptTouch(KeyEvent event);
|
||||
}
|
||||
|
||||
private InterceptTouchListener mListener;
|
||||
|
||||
public TouchInterceptingFrameLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setBackgroundColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (mListener != null && mListener.didInterceptTouch(event))
|
||||
return true;
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
public InterceptTouchListener getInterceptTouchListener() {
|
||||
return mListener;
|
||||
}
|
||||
|
||||
public void setInterceptTouchListener(InterceptTouchListener mListener) {
|
||||
this.mListener = mListener;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue