drop_target_bar_horz.xml 背景
<FrameLayout
- android:layout_width="0dp"
- android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:layout_height="90dp"
+ android:layout_marginLeft="-100dp"
+ android:layout_marginRight="-100dp"
+ android:layout_marginTop="-50dp"
+ android:background="#90263B"
android:layout_weight="1" >
<!-- Uninstall target -->
@@ -73,7 +77,7 @@
android:gravity="center"
android:id="@+id/uninstall_target_text"
style="@style/DropTargetButton"
- android:text="@string/uninstall_drop_target_label" />
+ />
packages/apps/Launcher3/src/com/android/launcher3/DropTargetBar.java
动画
- protected static final int DEFAULT_DRAG_FADE_DURATION = 175;
- protected static final int DEFAULT_DRAG_FADE_DURATION = 0;
长按apk时隐藏statueBar
packages/apps/Launcher3/src/com/android/launcher3/ButtonDropTarget.java
public final void onDragEnter(DragObject d) {
@@ -213,6 +223,7 @@ public abstract class ButtonDropTarget extends TextView
mAccessibleDrag = options.isAccessibleDrag;
setOnClickListener(mAccessibleDrag ? this : null);
+ mLauncher.hideStatusBar();
}
@@ -230,6 +241,7 @@ public abstract class ButtonDropTarget extends TextView
@Override
public void onDragEnd() {
+ mLauncher.showStatusBar();
mActive = false;
setOnClickListener(null);
}
packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
super.onCreate(savedInstanceState);
-
+ initStatusBar();
LauncherAppState app = LauncherAppState.getInstance();
// Load configuration-specific DeviceProfile
+ public void hideStatusBar() {
+ int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_FULLSCREEN;
+ uiFlags |= 0x00001000;
+ getWindow().getDecorView().setSystemUiVisibility(uiFlags);
+ }
+
+ public void showStatusBar() {
+ View decorView = getWindow().getDecorView();
+ int uiOptions = decorView.getSystemUiVisibility();
+ uiOptions &= (~View.SYSTEM_UI_FLAG_FULLSCREEN);
+ decorView.setSystemUiVisibility(uiOptions);
+ }
+
+ private void initStatusBar() {
+ View decorView = getWindow().getDecorView();
+ int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
+ decorView.setSystemUiVisibility(uiFlags);
+ }