frameworks/base
Révision | 99685b3b393ad8980ebb18867f27dae4e5974e1e (tree) |
---|---|
l'heure | 2009-11-11 18:16:55 |
Auteur | Swan_Wang <swandle@gmai...> |
Commiter | Chih-Wei Huang |
Add a tip dialog for the Home/Menu/Back touch features.
@@ -18,6 +18,9 @@ package com.android.server.status; | ||
18 | 18 | |
19 | 19 | import android.app.StatusBarManager; |
20 | 20 | import android.content.Context; |
21 | +import android.content.BroadcastReceiver; | |
22 | +import android.content.IntentFilter; | |
23 | +import android.content.Intent; | |
21 | 24 | import android.os.Binder; |
22 | 25 | import android.os.Handler; |
23 | 26 | import android.os.IBinder; |
@@ -43,11 +46,28 @@ public class TouchFeature { | ||
43 | 46 | private Context mContext; |
44 | 47 | private StatusBarService mService; |
45 | 48 | private final Display mDisplay; |
49 | + private BootReceiver mBootReceiver; | |
50 | + private IntentFilter mIntentFilter; | |
51 | + | |
52 | + private class BootReceiver extends BroadcastReceiver { | |
53 | + @Override | |
54 | + public void onReceive(Context context, Intent intent) { | |
55 | + if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { | |
56 | + Toast.makeText(context, | |
57 | + "Click the right corner of the status bar to enable or disable\nHome/Menu/Back touch features", | |
58 | + Toast.LENGTH_LONG).show(); | |
59 | + return; | |
60 | + } | |
61 | + } | |
62 | + } | |
46 | 63 | |
47 | 64 | protected TouchFeature(Context context){ |
48 | 65 | mContext = context; |
49 | 66 | mToken = new Binder(); |
50 | 67 | mHandler = new Handler(); |
68 | + mIntentFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED); | |
69 | + mBootReceiver = new BootReceiver(); | |
70 | + mContext.registerReceiver(mBootReceiver, mIntentFilter); | |
51 | 71 | mDisplay = ((WindowManager)context.getSystemService( |
52 | 72 | Context.WINDOW_SERVICE)).getDefaultDisplay(); |
53 | 73 | mScreenWidth = mDisplay.getWidth(); |
@@ -55,9 +75,9 @@ public class TouchFeature { | ||
55 | 75 | |
56 | 76 | // ================================================================================ |
57 | 77 | // Add to do key "menu" "home" "back" function |
58 | - // Touch the right corner of the screen on the statusBar to enable/disable the function | |
59 | - // Menu: Click/Touch the statusBar | |
60 | - // Home: Touch the statusBar from left to right | |
78 | + // Touch the right corner of the statusBar to enable/disable the function | |
79 | + // Home: Click/Touch the statusBar | |
80 | + // Menu: Touch the statusBar from left to right | |
61 | 81 | // Back: Touch the statusBar from right to left |
62 | 82 | // ================================================================================ |
63 | 83 | protected void adjust(StatusBarService service, MotionEvent event){ |