Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb034eb6 authored by Robin Lee's avatar Robin Lee
Browse files

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
parent 42734c15
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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" />
+2 −0
Original line number Diff line number Diff line
@@ -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>
+0 −1
Original line number Diff line number Diff line
@@ -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;
    }

+7 −10
Original line number Diff line number Diff line
@@ -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()