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

Verified Commit d2b2ee53 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Even more UI improovements

parent 509ccdf2
Loading
Loading
Loading
Loading
Compare 43a18f90 to 632ab779
Original line number Diff line number Diff line
Subproject commit 43a18f90c13c1e7198c23295bb9beb5869030a3b
Subproject commit 632ab7790355f58033b3296d811b88831bea8a07
+16 −1
Original line number Diff line number Diff line
@@ -411,13 +411,18 @@
            android:label="@string/pref_about_title"
            android:theme="@style/Theme.AppCompat.Settings"/>

        <activity
            android:name="org.microg.gms.ui.CheckinFragment$AsActivity"
            android:label="@string/service_name_checkin"
            android:theme="@style/Theme.AppCompat.Settings"/>

        <activity
            android:name="org.microg.gms.ui.GcmFragment$AsActivity"
            android:label="@string/service_name_mcs"
            android:theme="@style/Theme.AppCompat.Settings"/>

        <activity
            android:name="org.microg.gms.ui.GcmFragment$AdvancedAsActivity"
            android:name="org.microg.gms.ui.GcmAdvancedFragment$AsActivity"
            android:label="@string/service_name_mcs"
            android:theme="@style/Theme.AppCompat.Settings"/>

@@ -426,11 +431,21 @@
            android:label="@string/service_name_mcs"
            android:theme="@style/Theme.AppCompat.Settings"/>

        <activity
            android:name="org.microg.gms.ui.GoogleMoreFragment$AsActivity"
            android:label="@string/gms_settings_name"
            android:theme="@style/Theme.AppCompat.Settings"/>

        <activity
            android:name="org.microg.gms.ui.SafetyNetFragment$AsActivity"
            android:label="@string/service_name_snet"
            android:theme="@style/Theme.AppCompat.Settings"/>

        <activity
            android:name="org.microg.gms.ui.SafetyNetAdvancedFragment$AsActivity"
            android:label="@string/service_name_snet"
            android:theme="@style/Theme.AppCompat.Settings"/>

        <activity
            android:name="org.microg.gms.ui.SelfCheckFragment$AsActivity"
            android:label="@string/self_check_title"
+17 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ public class SafetyNetPrefs implements SharedPreferences.OnSharedPreferenceChang
    public static final String PREF_SNET_OFFICIAL = "snet_official";
    public static final String PREF_SNET_THIRD_PARTY = "snet_third_party";
    public static final String PREF_SNET_CUSTOM_URL = "snet_custom_url";
    public static final String PREF_SNET_SELF_SIGNED = "snet_self_signed";

    private static SafetyNetPrefs INSTANCE;

@@ -40,6 +41,7 @@ public class SafetyNetPrefs implements SharedPreferences.OnSharedPreferenceChang

    private boolean disabled;
    private boolean official;
    private boolean selfSigned;
    private boolean thirdParty;
    private String customUrl;

@@ -55,7 +57,8 @@ public class SafetyNetPrefs implements SharedPreferences.OnSharedPreferenceChang

    public void update() {
        disabled = defaultPreferences.getBoolean(PREF_SNET_DISABLED, true);
        official = defaultPreferences.getBoolean(PREF_SNET_OFFICIAL, false);
        official = defaultPreferences.getBoolean(PREF_SNET_OFFICIAL, true);
        selfSigned = defaultPreferences.getBoolean(PREF_SNET_SELF_SIGNED, false);
        thirdParty = defaultPreferences.getBoolean(PREF_SNET_THIRD_PARTY, false);
        customUrl = defaultPreferences.getString(PREF_SNET_CUSTOM_URL, null);
    }
@@ -66,7 +69,19 @@ public class SafetyNetPrefs implements SharedPreferences.OnSharedPreferenceChang
    }

    public boolean isEnabled() {
        return !disabled && (official || thirdParty);
        return !disabled && (official || selfSigned || thirdParty);
    }

    public void setEnabled(boolean enabled) {
        defaultPreferences.edit().putBoolean(PREF_SNET_DISABLED, !enabled).apply();
        if (enabled && !isEnabled()) {
            official = true;
            defaultPreferences.edit().putBoolean(PREF_SNET_OFFICIAL, true).apply();
        }
    }

    public boolean isSelfSigned() {
        return selfSigned;
    }

    public boolean isOfficial() {
+59 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 microG Project Team
 *
 * 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.
 */

package org.microg.gms.ui;

import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;

import com.google.android.gms.R;

import org.microg.tools.ui.AbstractSettingsActivity;
import org.microg.tools.ui.SwitchBarResourceSettingsFragment;

import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;

public class CheckinFragment extends SwitchBarResourceSettingsFragment {

    public CheckinFragment() {
        preferencesResource = R.xml.preferences_checkin;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        switchBar.setChecked(PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean(PREF_ENABLE_CHECKIN, false));
    }

    @Override
    public void onSwitchBarChanged(boolean isChecked) {
        PreferenceManager.getDefaultSharedPreferences(getContext()).edit().putBoolean(PREF_ENABLE_CHECKIN, isChecked).apply();
    }


    public static class AsActivity extends AbstractSettingsActivity {
        public AsActivity() {
            showHomeAsUp = true;
        }

        @Override
        protected Fragment getFragment() {
            return new CheckinFragment();
        }
    }
}
+42 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 microG Project Team
 *
 * 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.
 */

package org.microg.gms.ui;

import android.support.v4.app.Fragment;

import com.google.android.gms.R;

import org.microg.tools.ui.AbstractSettingsActivity;
import org.microg.tools.ui.ResourceSettingsFragment;

public class GcmAdvancedFragment extends ResourceSettingsFragment {

    public GcmAdvancedFragment() {
        preferencesResource = R.xml.preferences_gcm_advanced;
    }

    public static class AsActivity extends AbstractSettingsActivity {
        public AsActivity() {
            showHomeAsUp = true;
        }

        @Override
        protected Fragment getFragment() {
            return new GcmAdvancedFragment();
        }
    }
}
Loading