Calculator Overlay

This commit is contained in:
Sergey Solovyev 2012-11-21 12:16:33 +04:00
parent 3dd73efaea
commit 75b60e7390
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</LinearLayout>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:orientation="horizontal"
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:gravity="right">
<Button a:id="@+id/overlay_hide_button"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
style="?cpp_operation_button_style"
a:text="_"/>
<Button a:id="@+id/overlay_close_button"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
style="?cpp_operation_button_style"
a:text="x"/>
</LinearLayout>

View File

@ -4,6 +4,8 @@
a:orientation="vertical" a:orientation="vertical"
style="@style/cpp_widget_main_layout_style"> style="@style/cpp_widget_main_layout_style">
<include layout="@layout/overlay_header"/>
<include layout="@layout/widget_editor" <include layout="@layout/widget_editor"
a:layout_weight="2" a:layout_weight="2"
a:layout_width="match_parent" a:layout_width="match_parent"
@ -31,4 +33,6 @@
a:layout_width="match_parent" a:layout_width="match_parent"
a:layout_height="0dp"/> a:layout_height="0dp"/>
<include layout="@layout/overlay_footer"/>
</LinearLayout> </LinearLayout>

View File

@ -68,6 +68,13 @@ public class CalculatorOverlayService extends Service implements ExternalCalcula
} }
} }
view.findViewById(R.id.overlay_close_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
stopService(new Intent(getApplicationContext(), CalculatorOverlayService.class));
}
});
final WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE); final WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
wm.addView(view, params); wm.addView(view, params);