Loading packages/SettingsLib/res/layout/restricted_icon.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/restricted_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_settings_lock_outline" android:gravity="end|center_vertical" /> No newline at end of file packages/SettingsLib/res/layout/restricted_switch_widget.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/restricted_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_settings_lock_outline" android:gravity="end|center_vertical" /> <!-- Based off frameworks/base/core/res/res/layout/preference_widget_switch.xml --> <Switch xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+android:id/switch_widget" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false" android:clickable="false" android:background="@null" /> </merge> No newline at end of file packages/SettingsLib/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -773,6 +773,11 @@ <!-- Summary for settings preference disabled by administrator [CHAR LIMIT=50] --> <string name="disabled_by_admin_summary_text">Controlled by admin</string> <!-- Summary for switch preference to denote it is switched on [CHAR LIMIT=50] --> <string name="enabled_by_admin">Enabled by administrator</string> <!-- Summary for switch preference to denote it is switched on [CHAR LIMIT=50] --> <string name="disabled_by_admin">Disabled by administrator</string> <!-- Option in navigation drawer that leads to Settings main screen [CHAR LIMIT=30] --> <string name="home">Home</string> Loading packages/SettingsLib/src/com/android/settingslib/RestrictedPreference.java +6 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceManager; import android.support.v7.preference.PreferenceViewHolder; import android.util.AttributeSet; import android.view.View; import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; Loading @@ -36,6 +37,7 @@ public class RestrictedPreference extends Preference { public RestrictedPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); setWidgetLayoutResource(R.layout.restricted_icon); mHelper = new RestrictedPreferenceHelper(context, this, attrs); } Loading @@ -56,6 +58,10 @@ public class RestrictedPreference extends Preference { public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); mHelper.onBindViewHolder(holder); final View restrictedIcon = holder.findViewById(R.id.restricted_icon); if (restrictedIcon != null) { restrictedIcon.setVisibility(isDisabledByAdmin() ? View.VISIBLE : View.GONE); } } @Override Loading packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java +2 −6 Original line number Diff line number Diff line Loading @@ -91,13 +91,9 @@ public class RestrictedPreferenceHelper { * Modify PreferenceViewHolder to add padlock if restriction is disabled. */ public void onBindViewHolder(PreferenceViewHolder holder) { final TextView titleView = (TextView) holder.findViewById(android.R.id.title); if (titleView != null) { RestrictedLockUtils.setTextViewPadlock(mContext, titleView, mDisabledByAdmin); if (mDisabledByAdmin) { holder.itemView.setEnabled(true); } } if (mUseAdminDisabledSummary) { final TextView summaryView = (TextView) holder.findViewById(android.R.id.summary); if (summaryView != null) { Loading Loading
packages/SettingsLib/res/layout/restricted_icon.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/restricted_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_settings_lock_outline" android:gravity="end|center_vertical" /> No newline at end of file
packages/SettingsLib/res/layout/restricted_switch_widget.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/restricted_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_settings_lock_outline" android:gravity="end|center_vertical" /> <!-- Based off frameworks/base/core/res/res/layout/preference_widget_switch.xml --> <Switch xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+android:id/switch_widget" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false" android:clickable="false" android:background="@null" /> </merge> No newline at end of file
packages/SettingsLib/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -773,6 +773,11 @@ <!-- Summary for settings preference disabled by administrator [CHAR LIMIT=50] --> <string name="disabled_by_admin_summary_text">Controlled by admin</string> <!-- Summary for switch preference to denote it is switched on [CHAR LIMIT=50] --> <string name="enabled_by_admin">Enabled by administrator</string> <!-- Summary for switch preference to denote it is switched on [CHAR LIMIT=50] --> <string name="disabled_by_admin">Disabled by administrator</string> <!-- Option in navigation drawer that leads to Settings main screen [CHAR LIMIT=30] --> <string name="home">Home</string> Loading
packages/SettingsLib/src/com/android/settingslib/RestrictedPreference.java +6 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceManager; import android.support.v7.preference.PreferenceViewHolder; import android.util.AttributeSet; import android.view.View; import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; Loading @@ -36,6 +37,7 @@ public class RestrictedPreference extends Preference { public RestrictedPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); setWidgetLayoutResource(R.layout.restricted_icon); mHelper = new RestrictedPreferenceHelper(context, this, attrs); } Loading @@ -56,6 +58,10 @@ public class RestrictedPreference extends Preference { public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); mHelper.onBindViewHolder(holder); final View restrictedIcon = holder.findViewById(R.id.restricted_icon); if (restrictedIcon != null) { restrictedIcon.setVisibility(isDisabledByAdmin() ? View.VISIBLE : View.GONE); } } @Override Loading
packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java +2 −6 Original line number Diff line number Diff line Loading @@ -91,13 +91,9 @@ public class RestrictedPreferenceHelper { * Modify PreferenceViewHolder to add padlock if restriction is disabled. */ public void onBindViewHolder(PreferenceViewHolder holder) { final TextView titleView = (TextView) holder.findViewById(android.R.id.title); if (titleView != null) { RestrictedLockUtils.setTextViewPadlock(mContext, titleView, mDisabledByAdmin); if (mDisabledByAdmin) { holder.itemView.setEnabled(true); } } if (mUseAdminDisabledSummary) { final TextView summaryView = (TextView) holder.findViewById(android.R.id.summary); if (summaryView != null) { Loading