完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
diff --git a/frameworks/base/core/java/android/provider/Settings.java b/frameworks/base/core/java/android/provider/Settings.java
index ed82d5e..e2febbd 100644 --- a/frameworks/base/core/java/android/provider/Settings.java +++ b/frameworks/base/core/java/android/provider/Settings.java @@ -1592,6 +1592,12 @@ public final class Settings { */ public static final String ; + /** + *hide system bar + * @hide + */ + public static final String ; + /** * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead */ diff --git a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml index 6e712c9..0c9a5d8 100755 --- a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml +++ b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml @@ -19,6 +19,7 @@ + diff --git a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index eb0fad7..a86090f 100755 --- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -1996,7 +1996,8 @@ public class DatabaseHelper extends SQLiteOpenHelper { R.integer.def_hdmi_lcd_timeout); loadBooleanSetting(stmt, Settings.System.SCREENSHOT_BUTTON_SHOW, R.bool.def_screenshot_button_show); - + loadBooleanSetting(stmt, Settings.System.SYSTEMBAR_HIDE, + R.bool.def_systembar_hide); String enableUms= SystemProperties.get("ro.factory.hasUMS","false"); if("true".equals(enableUms))//if has UMS function,flash is primary storage { diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/phone/PhoneStatusBar.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/phone/PhoneStatusBar.java index 59b0057..0c39547 100755 --- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/phone/PhoneStatusBar.java +++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/phone/PhoneStatusBar.java @@ -370,6 +370,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { addNavigationBar(); + + changeBarHideStatus(); // Lastly, call to the icon policy to install/update all the icons. mIconPolicy = new PhoneStatusBarPolicy(mContext); @@ -775,6 +777,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_SCREEN_ON); filter.addAction(ACTION_DEMO); + filter.addAction("com.tchip.changeBarHideStatus"); context.registerReceiver(mBroadcastReceiver, filter); // listen for USER_SETUP_COMPLETE setting (per-user) @@ -1001,6 +1004,16 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { }; private boolean mBarIsAdd = true; + private void changeBarHideStatus() + { + boolean hide_systembar = Settings.System.getInt(mContext.getContentResolver(),Settings.System.SYSTEMBAR_HIDE,0)==1; + + if(hide_systembar) + removeBar(false); + else{ + addBar(); + } + } private void addBarInside(){ if (!mBarIsAdd){ Log.d(TAG,"add Bar"); @@ -1014,7 +1027,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { } } - private void removeBar(){ + private void removeBar(){ + removeBar(true); + } + private void removeBar(boolean needToast){ if (mBarIsAdd){ Log.d(TAG,"remove Bar"); if (mNavigationBarView != null) @@ -1022,6 +1038,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { if (mStatusBarWindow != null) mWindowManager.removeView(mStatusBarWindow); mBarIsAdd = false; + if(needToast) Toast.makeText(mContext, mContext.getResources().getString(R.string.hidebar_msg), 3000).show(); } } @@ -2722,6 +2739,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { } } } + }else if("com.tchip.changeBarHideStatus".equals(action)) + { + changeBarHideStatus(); } } }; diff --git a/packages/apps/Settings/res/values-zh-rCN/strings.xml b/packages/apps/Settings/res/values-zh-rCN/strings.xml index df5ef7f..3cdb045 100755 --- a/packages/apps/Settings/res/values-zh-rCN/strings.xml +++ b/packages/apps/Settings/res/values-zh-rCN/strings.xml @@ -2244,5 +2244,7 @@ - + + + diff --git a/packages/apps/Settings/res/values-zh-rHK/strings.xml b/packages/apps/Settings/res/values-zh-rHK/strings.xml index f862fcc..d2d1990 100644 --- a/packages/apps/Settings/res/values-zh-rHK/strings.xml +++ b/packages/apps/Settings/res/values-zh-rHK/strings.xml @@ -2046,4 +2046,7 @@ + + + diff --git a/packages/apps/Settings/res/values-zh-rTW/strings.xml b/packages/apps/Settings/res/values-zh-rTW/strings.xml index cbf0066..7fdc97b 100644 --- a/packages/apps/Settings/res/values-zh-rTW/strings.xml +++ b/packages/apps/Settings/res/values-zh-rTW/strings.xml @@ -791,6 +791,7 @@ + @@ -2119,4 +2120,5 @@ + diff --git a/packages/apps/Settings/res/values/strings.xml b/packages/apps/Settings/res/values/strings.xml index dc40d05..11027de 100755 --- a/packages/apps/Settings/res/values/strings.xml +++ b/packages/apps/Settings/res/values/strings.xml @@ -5112,4 +5112,8 @@ + + + + diff --git a/packages/apps/Settings/res/xml/display_settings.xml b/packages/apps/Settings/res/xml/display_settings.xml index 577b1a6..e3560b1 100755 --- a/packages/apps/Settings/res/xml/display_settings.xml +++ b/packages/apps/Settings/res/xml/display_settings.xml @@ -24,6 +24,9 @@ android: android:/> + + android: + android:/> android: android: diff --git a/packages/apps/Settings/src/com/android/settings/DisplaySettings.java b/packages/apps/Settings/src/com/android/settings/DisplaySettings.java index 69eb743..f97f550 100755 --- a/packages/apps/Settings/src/com/android/settings/DisplaySettings.java +++ b/packages/apps/Settings/src/com/android/settings/DisplaySettings.java @@ -40,6 +40,7 @@ import android.preference.PreferenceScreen; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.util.Log; +import android.content.Intent; import com.android.settings.R; import com.android.internal.view.RotationPolicy; @@ -56,6 +57,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements /** If there is no setting in the provider, use this. */ private static final int FALLBACK_SCREEN_TIMEOUT_VALUE = 30000; + private static final String KEY_SYSTEMBAR_HIDE = "systembar_hide"; private static final String KEY_SCREEN_TIMEOUT = "screen_timeout"; private static final String KEY_ACCELEROMETER = "accelerometer"; private static final String KEY_FONT_SIZE = "font_size"; @@ -68,6 +70,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements private static final int DLG_GLOBAL_CHANGE_WARNING = 1; + private CheckBoxPreference mSystemBarHide; private CheckBoxPreference mAccelerometer; private WarnedListPreference mFontSizePref; private CheckBoxPreference mNotificationPulse; @@ -122,6 +125,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements addPreferencesFromResource(R.xml.display_settings); + mSystemBarHide = (CheckBoxPreference) findPreference(KEY_SYSTEMBAR_HIDE); mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER); mAccelerometer.setPersistent(false); if (!RotationPolicy.isRotationSupported(getActivity()) @@ -637,6 +641,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements updateAccelerometerRotationCheckbox(); readFontSizePreference(mFontSizePref); updateScreenSaverSummary(); + updateSystemBarHideCheckBox(); } private void updateScreenSaverSummary() { @@ -651,6 +656,11 @@ public class DisplaySettings extends SettingsPreferenceFragment implements mAccelerometer.setChecked(!RotationPolicy.isRotationLocked(getActivity())); } + private void updateSystemBarHideCheckBox(){ + boolean hide_systembar = Settings.System.getInt(getContentResolver(),Settings.System.SYSTEMBAR_HIDE,0)==1; + mSystemBarHide.setChecked(hide_systembar); + + } public void writeFontSizePreference(Object objValue) { try { @@ -671,6 +681,13 @@ public class DisplaySettings extends SettingsPreferenceFragment implements Settings.System.putInt(getContentResolver(), Settings.System.NOTIFICATION_LIGHT_PULSE, value ? 1 : 0); return true; + }else if(preference == mSystemBarHide) + { + + Settings.System.putInt(getContentResolver(), Settings.System.SYSTEMBAR_HIDE, + mSystemBarHide.isChecked() ? 1 : 0); + Intent i = new Intent("com.tchip.changeBarHideStatus"); + getActivity().sendBroadcast(i); } return super.onPreferenceTreeClick(preferenceScreen, preference); } 再补一点自己调查的小知识: firefly的rk3288android5.1系统里面,发现隐藏了状态栏后,在屏幕的下边缘上划,就会又调出状态栏: 贴上源码: private void removeBar(boolean needToast){ Log.d("LOUHN_DEBUG","in removeBar"); if (mBarIsAdd){ Log.d(TAG,"remove Bar"); //$_rockchip_$_modify_$_huangjc begin,add show/hide TitleBar interface for statu***ar if(mContext.getResources().getConfiguration().enableMultiWindow()){ try { mWindowManagerService.changeTitleBar(false); } catch (RemoteException e) { Log.w(TAG, "Error changeTitleBar transition: " + e); } } //$_rockchip_$_modify_$_end if (mNavigationBarView != null){ mWindowManager.removeView(mNavigationBarView); } if (!mContext.getResources(). getConfiguration(). enableMultiWindow()&&mStatusBarWindow != null) mStatusBarWindow.setVisibility(View.GONE); if(signalCluster_win!=null) signalCluster_win=null; if (mNavigationBarView != null) mNavigationBarView = null; if(mNotificationLite != null){ mNotificationLite.closeCenter(); } mBarIsAdd = false; //注意这个变量 if(!isMultiChange) Toast.makeText(mContext, mContext.getResources(). getString(R. string.hidebar_msg) , 1000).show(); } } 在 removeBar()这个方法里面变量mBarIsAdd = false; 上划操作会调用addBarinside()方法,由于mBarIsAdd被设为了false,所以这里就直接执行了addBar的方法,被隐藏的状态栏又出现了如果不想上划出现状态栏,只要把removeBar()方法里面,把mBarIsAdd=false删除就可以了 private void addBarInside(){ Log.d("LOUHN_DEBUG","in addBarInside()"); if (!mBarIsAdd){ //注意这个判断 Log.d(TAG,"add Bar"); Log.d("LOUHN_DEBUG","in addBarInside()222"); try { boolean showNav = mWindowManagerService.hasNavigationBar(); if (DEBUG) Log.v(TAG, "hasNavigationBar=" + showNav); if (showNav) { //haungjc:win bar if(mContext.getResources().getConfiguration().enableMultiWindow()){ //$_rockchip_$_modify_$_huangjc begin,add show/hide TitleBar interfac for statu***ar try { mWindowManagerService.changeTitleBar(true); } catch (RemoteException e) { Log.w(TAG, "Error changeTitleBar transition: " + e); } //$_rockchip_$_modify_$_end mNavigationBarView = (NavigationBarView) View.inflate(mContext, R.layout. navigation_bar_win, null); }else{ mNavigationBarView = (NavigationBarView) View.inflate(mContext, R.layout.navigation_bar, null); } mNavigationBarView.setDisabledFlags(mDisabled); 划后调用addBarInside()方法 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
基于米尔瑞芯微RK3576核心板/开发板的人脸疲劳检测应用方案
1009 浏览 0 评论
1194 浏览 1 评论
956 浏览 1 评论
2212 浏览 1 评论
3533 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 10:23 , Processed in 0.596127 second(s), Total 70, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号