Show "no vpns added" for empty vpn screen

Removed the left-alignment on restricted empty views which was
inherited from Bluetooth settings but inconsistent with normal
settings fragments.

Bug: 22685111
Change-Id: I3a36c47d523392b8925031d4cac2ab3ef681e360
This commit is contained in:
Robin Lee
2016-03-16 12:39:00 +00:00
parent 42734c1551
commit eb034eb65e
4 changed files with 12 additions and 13 deletions

View File

@@ -67,10 +67,11 @@
</FrameLayout>
<TextView android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@*android:dimen/preference_fragment_padding_side"
android:gravity="center"
android:layout_gravity="center"
android:gravity="center_vertical"
android:visibility="gone" />
<include layout="@layout/admin_support_details_empty_view" />

View File

@@ -5195,6 +5195,8 @@
<string name="vpn_menu_delete">Delete profile</string>
<!-- Menu item to select always-on VPN profile. [CHAR LIMIT=40] -->
<string name="vpn_menu_lockdown">Always-on VPN</string>
<!-- Placeholder when VPN settings is open but no VPNs have been created. [CHAR LIMIT=100] -->
<string name="vpn_no_vpns_added">No VPNs added.</string>
<!-- Summary describing the always-on VPN feature. [CHAR LIMIT=NONE] -->
<string name="vpn_lockdown_summary">Select a VPN profile to always remain connected to. Network traffic will only be allowed when connected to this VPN.</string>

View File

@@ -209,7 +209,6 @@ public abstract class RestrictedSettingsFragment extends SettingsPreferenceFragm
protected TextView initEmptyTextView() {
TextView emptyView = (TextView) getActivity().findViewById(android.R.id.empty);
emptyView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
return emptyView;
}

View File

@@ -111,20 +111,15 @@ public class VpnSettings extends RestrictedSettingsFragment implements
}
@Override
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mUserManager = (UserManager) getSystemService(Context.USER_SERVICE);
if (isUiRestricted()) {
mUnavailable = true;
setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
setHasOptionsMenu(false);
return;
}
mConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
setHasOptionsMenu(true);
mUnavailable = isUiRestricted();
setHasOptionsMenu(!mUnavailable);
addPreferencesFromResource(R.xml.vpn_settings2);
}
@@ -186,6 +181,8 @@ public class VpnSettings extends RestrictedSettingsFragment implements
}
getPreferenceScreen().removeAll();
return;
} else {
getEmptyTextView().setText(R.string.vpn_no_vpns_added);
}
final boolean pickLockdown = getActivity()