mirror of https://github.com/YTVanced/VancedMicroG
synced with microg repo
This commit is contained in:
parent
02910572d7
commit
6cfa89e15b
|
@ -344,11 +344,6 @@
|
|||
android:label="@string/gms_settings_name"
|
||||
android:theme="@style/Theme.AppCompat.DayNight" />
|
||||
|
||||
<activity
|
||||
android:name="org.microg.gms.ui.SelfCheckFragment$AsActivity"
|
||||
android:label="@string/self_check_title"
|
||||
android:theme="@style/Theme.AppCompat.DayNight" />
|
||||
|
||||
<activity
|
||||
android:name="org.microg.gms.ui.AccountSettingsActivity"
|
||||
android:theme="@style/Theme.AppCompat.DayNight">
|
||||
|
@ -361,17 +356,6 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="org.microg.gms.ui.LocationSettingsActivity"
|
||||
android:theme="@style/Theme.AppCompat.DayNight">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.location.settings.LOCATION_HISTORY" />
|
||||
<action android:name="com.google.android.location.settings.LOCATION_REPORTING_SETTINGS" />
|
||||
<action android:name="com.google.android.gms.location.settings.LOCATION_REPORTING_SETTINGS" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Other -->
|
||||
|
||||
|
|
|
@ -29,18 +29,11 @@ public class AboutFragment extends AbstractAboutFragment {
|
|||
|
||||
@Override
|
||||
protected void collectLibraries(List<AbstractAboutFragment.Library> libraries) {
|
||||
if (BuildConfig.FLAVOR.contains("mapbox")) {
|
||||
libraries.add(new AbstractAboutFragment.Library("com.mapbox.mapboxsdk", "Mapbox Maps SDK for Android", "Three-Clause BSD, Mapbox"));
|
||||
} else {
|
||||
libraries.add(new AbstractAboutFragment.Library("org.oscim.android", "V™", "GNU LGPLv3, Hannes Janetzek and devemux86"));
|
||||
}
|
||||
libraries.add(new AbstractAboutFragment.Library("de.hdodenhof.circleimageview", "CircleImageView", "Apache License 2.0, Henning Dodenhof"));
|
||||
libraries.add(new AbstractAboutFragment.Library("su.litvak.chromecast.api.v2", "ChromeCast Java API v2", "Apache License 2.0, Vitaly Litvak"));
|
||||
libraries.add(new AbstractAboutFragment.Library("org.conscrypt", "Conscrypt", "Apache License 2.0, The Android Open Source Project"));
|
||||
libraries.add(new AbstractAboutFragment.Library("org.microg.safeparcel", "SafeParcel", "Apache License 2.0, microG Team"));
|
||||
libraries.add(new AbstractAboutFragment.Library("org.slf4j", "SLF4J", "MIT License, QOS.ch"));
|
||||
libraries.add(new AbstractAboutFragment.Library("org.microg.nlp.service", "UnifiedNlp", "Apache License 2.0, microG Team"));
|
||||
libraries.add(new AbstractAboutFragment.Library("org.microg.wearable", "Wearable", "Apache License 2.0, microG Team"));
|
||||
libraries.add(new AbstractAboutFragment.Library("com.squareup.wire", "Wire Protocol Buffers", "Apache License 2.0, Square Inc."));
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import androidx.annotation.Nullable;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
import org.microg.gms.auth.AuthConstants;
|
||||
import org.microg.gms.auth.AuthManager;
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
import org.microg.gms.gcm.GcmDatabase;
|
||||
import org.microg.gms.gcm.PushRegisterService;
|
||||
|
|
|
@ -28,7 +28,7 @@ import android.view.View;
|
|||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
import org.microg.gms.gcm.GcmPrefs;
|
||||
import org.microg.tools.ui.Condition;
|
||||
|
|
|
@ -20,19 +20,15 @@ import android.content.Intent;
|
|||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
import org.microg.gms.gcm.GcmPrefs;
|
||||
import org.microg.gms.gcm.McsService;
|
||||
import org.microg.gms.gcm.TriggerReceiver;
|
||||
import org.microg.tools.ui.AbstractSettingsActivity;
|
||||
import org.microg.tools.ui.ResourceSettingsFragment;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class GcmAdvancedFragment extends ResourceSettingsFragment {
|
||||
|
||||
private static String[] HEARTBEAT_PREFS = new String[]{GcmPrefs.PREF_NETWORK_MOBILE, GcmPrefs.PREF_NETWORK_ROAMING, GcmPrefs.PREF_NETWORK_WIFI, GcmPrefs.PREF_NETWORK_OTHER};
|
||||
|
@ -45,18 +41,15 @@ public class GcmAdvancedFragment extends ResourceSettingsFragment {
|
|||
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
|
||||
super.onCreatePreferences(savedInstanceState, rootKey);
|
||||
for (String pref : HEARTBEAT_PREFS) {
|
||||
findPreference(pref).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
getPreferenceManager().getSharedPreferences().edit().putString(preference.getKey(), (String) newValue).apply();
|
||||
updateContent();
|
||||
if (newValue.equals("-1") && preference.getKey().equals(McsService.activeNetworkPref)) {
|
||||
McsService.stop(getContext());
|
||||
} else if (!McsService.isConnected()) {
|
||||
getContext().sendBroadcast(new Intent(TriggerReceiver.FORCE_TRY_RECONNECT, null, getContext(), TriggerReceiver.class));
|
||||
}
|
||||
return true;
|
||||
findPreference(pref).setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
getPreferenceManager().getSharedPreferences().edit().putString(preference.getKey(), (String) newValue).apply();
|
||||
updateContent();
|
||||
if (newValue.equals("-1") && preference.getKey().equals(McsService.activeNetworkPref)) {
|
||||
McsService.stop(getContext());
|
||||
} else if (!McsService.isConnected()) {
|
||||
getContext().sendBroadcast(new Intent(TriggerReceiver.FORCE_TRY_RECONNECT, null, getContext(), TriggerReceiver.class));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
updateContent();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.microg.gms.ui;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
import org.microg.tools.ui.AbstractSettingsActivity;
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013-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.app.Activity;
|
||||
|
||||
public class LocationSettingsActivity extends Activity {
|
||||
}
|
|
@ -1,254 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013-2019 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.content.Intent;
|
||||
import android.location.Address;
|
||||
import android.location.Geocoder;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.google.android.gms.common.api.CommonStatusCodes;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.location.places.internal.PlaceImpl;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.LatLngBounds;
|
||||
|
||||
import org.microg.gms.location.LocationConstants;
|
||||
//import org.microg.gms.maps.vtm.BackendMapView;
|
||||
//import org.microg.gms.maps.vtm.GmsMapsTypeHelper;
|
||||
import org.microg.safeparcel.SafeParcelUtil;
|
||||
//import org.oscim.core.MapPosition;
|
||||
//import org.oscim.event.Event;
|
||||
//import org.oscim.map.Map;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
|
||||
import static android.Manifest.permission.ACCESS_FINE_LOCATION;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static org.microg.gms.location.LocationConstants.EXTRA_PRIMARY_COLOR;
|
||||
import static org.microg.gms.location.LocationConstants.EXTRA_PRIMARY_COLOR_DARK;
|
||||
//import static org.microg.gms.maps.vtm.GmsMapsTypeHelper.fromLatLngBounds;
|
||||
|
||||
public class
|
||||
|
||||
|
||||
PlacePickerActivity extends AppCompatActivity /*implements Map.UpdateListener*/ {
|
||||
private static final String TAG = "GmsPlacePicker";
|
||||
|
||||
private PlaceImpl place;
|
||||
// private BackendMapView mapView;
|
||||
private Intent resultIntent;
|
||||
private AtomicBoolean geocoderInProgress = new AtomicBoolean(false);
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
resultIntent = new Intent();
|
||||
place = new PlaceImpl();
|
||||
|
||||
setContentView(R.layout.pick_place);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
|
||||
if (getIntent().hasExtra(EXTRA_PRIMARY_COLOR)) {
|
||||
toolbar.setBackgroundColor(getIntent().getIntExtra(EXTRA_PRIMARY_COLOR, 0));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
getWindow().setStatusBarColor(getIntent().getIntExtra(EXTRA_PRIMARY_COLOR_DARK, 0));
|
||||
((TextView) findViewById(R.id.place_picker_title)).setTextColor(getIntent().getIntExtra(EXTRA_PRIMARY_COLOR_DARK, 0));
|
||||
}
|
||||
|
||||
// mapView = (BackendMapView) findViewById(R.id.map);
|
||||
// mapView.map().getEventLayer().enableRotation(false);
|
||||
// mapView.map().getEventLayer().enableTilt(false);
|
||||
// mapView.map().events.bind(this);
|
||||
|
||||
LatLngBounds latLngBounds = getIntent().getParcelableExtra(LocationConstants.EXTRA_BOUNDS);
|
||||
if (latLngBounds != null) {
|
||||
place.viewport = latLngBounds;
|
||||
// MapPosition mp = new MapPosition();
|
||||
// mp.setByBoundingBox(fromLatLngBounds(latLngBounds), mapView.map().getWidth(), mapView.map().getHeight());
|
||||
// mapView.map().getMapPosition(mp);
|
||||
} else {
|
||||
if (ActivityCompat.checkSelfPermission(PlacePickerActivity.this, ACCESS_FINE_LOCATION) != PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(PlacePickerActivity.this, new String[]{ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}, 0);
|
||||
} else {
|
||||
updateMapFromLocationManager();
|
||||
}
|
||||
}
|
||||
|
||||
findViewById(R.id.place_picker_select).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
resultIntent.putExtra(LocationConstants.EXTRA_STATUS, SafeParcelUtil.asByteArray(new Status(CommonStatusCodes.SUCCESS)));
|
||||
resultIntent.putExtra(LocationConstants.EXTRA_PLACE, SafeParcelUtil.asByteArray(place));
|
||||
resultIntent.putExtra(LocationConstants.EXTRA_FINAL_BOUNDS, SafeParcelUtil.asByteArray(place.viewport));
|
||||
setResult(RESULT_OK, resultIntent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingPermission")
|
||||
private void updateMapFromLocationManager() {
|
||||
LocationManager lm = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||
Location last = null;
|
||||
for (String provider : lm.getAllProviders()) {
|
||||
if (lm.isProviderEnabled(provider)) {
|
||||
Location t = lm.getLastKnownLocation(provider);
|
||||
if (t != null && (last == null || t.getTime() > last.getTime())) {
|
||||
last = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "Set location to " + last);
|
||||
if (last != null) {
|
||||
// mapView.map().setMapPosition(new MapPosition(last.getLatitude(), last.getLongitude(), 4096));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
if (requestCode == 0) {
|
||||
for (int grantResult : grantResults) {
|
||||
if (grantResult != PERMISSION_GRANTED) return;
|
||||
}
|
||||
updateMapFromLocationManager();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.pick_place, menu);
|
||||
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_action_search));
|
||||
// TODO: search
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
// mapView.onPause();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void onMapEvent(Event event, MapPosition position) {
|
||||
// place.viewport = GmsMapsTypeHelper.toLatLngBounds(mapView.map().viewport().getBBox(null, 0));
|
||||
// resultIntent.putExtra(LocationConstants.EXTRA_FINAL_BOUNDS, place.viewport);
|
||||
// place.latLng = GmsMapsTypeHelper.toLatLng(position.getGeoPoint());
|
||||
place.name = "";
|
||||
place.address = "";
|
||||
updateInfoText();
|
||||
if (geocoderInProgress.compareAndSet(false, true)) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
LatLng ll = null;
|
||||
while (ll != place.latLng) {
|
||||
ll = place.latLng;
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
Geocoder geocoder = new Geocoder(PlacePickerActivity.this);
|
||||
List<Address> addresses = geocoder.getFromLocation(place.latLng.latitude, place.latLng.longitude, 1);
|
||||
if (addresses != null && !addresses.isEmpty() && addresses.get(0).getMaxAddressLineIndex() > 0) {
|
||||
Address address = addresses.get(0);
|
||||
StringBuilder sb = new StringBuilder(address.getAddressLine(0));
|
||||
for (int i = 1; i < address.getMaxAddressLineIndex(); ++i) {
|
||||
if (i == 1 && sb.toString().equals(address.getFeatureName())) {
|
||||
sb = new StringBuilder(address.getAddressLine(i));
|
||||
continue;
|
||||
}
|
||||
sb.append(", ").append(address.getAddressLine(i));
|
||||
}
|
||||
if (place.latLng == ll) {
|
||||
place.address = sb.toString();
|
||||
place.name = address.getFeatureName();
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateInfoText();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
Log.w(TAG, ignored);
|
||||
} finally {
|
||||
geocoderInProgress.lazySet(false);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}*/
|
||||
|
||||
private void updateInfoText() {
|
||||
if (TextUtils.isEmpty(place.address)) {
|
||||
((TextView) findViewById(R.id.place_picker_info)).setText(getString(R.string.place_picker_location_lat_lng, place.latLng.latitude, place.latLng.longitude));
|
||||
} else if (TextUtils.isEmpty(place.name)) {
|
||||
((TextView) findViewById(R.id.place_picker_info)).setText(place.address);
|
||||
} else {
|
||||
((TextView) findViewById(R.id.place_picker_info)).setText(Html.fromHtml("<b>" + place.name + "</b>, " + place.address));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* 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 androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
|
||||
import org.microg.tools.ui.AbstractSettingsActivity;
|
||||
import org.microg.tools.ui.RadioButtonPreference;
|
||||
import org.microg.tools.ui.ResourceSettingsFragment;
|
||||
|
||||
import static org.microg.gms.snet.SafetyNetPrefs.PREF_SNET_OFFICIAL;
|
||||
import static org.microg.gms.snet.SafetyNetPrefs.PREF_SNET_SELF_SIGNED;
|
||||
import static org.microg.gms.snet.SafetyNetPrefs.PREF_SNET_THIRD_PARTY;
|
||||
|
||||
public class SafetyNetAdvancedFragment extends ResourceSettingsFragment {
|
||||
|
||||
public SafetyNetAdvancedFragment() {
|
||||
preferencesResource = R.xml.preferences_snet_advanced;
|
||||
}
|
||||
|
||||
private RadioButtonPreference radioOfficial;
|
||||
private RadioButtonPreference radioSelfSigned;
|
||||
private RadioButtonPreference radioThirdParty;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
|
||||
super.onCreatePreferences(savedInstanceState, rootKey);
|
||||
|
||||
radioOfficial = (RadioButtonPreference) findPreference(PREF_SNET_OFFICIAL);
|
||||
radioSelfSigned = (RadioButtonPreference) findPreference(PREF_SNET_SELF_SIGNED);
|
||||
radioThirdParty = (RadioButtonPreference) findPreference(PREF_SNET_THIRD_PARTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(Preference preference) {
|
||||
if (preference == radioOfficial) {
|
||||
radioOfficial.setChecked(true);
|
||||
radioSelfSigned.setChecked(false);
|
||||
radioThirdParty.setChecked(false);
|
||||
return true;
|
||||
} else if (preference == radioSelfSigned) {
|
||||
radioOfficial.setChecked(false);
|
||||
radioSelfSigned.setChecked(true);
|
||||
radioThirdParty.setChecked(false);
|
||||
return true;
|
||||
} else if (preference == radioThirdParty) {
|
||||
radioOfficial.setChecked(false);
|
||||
radioSelfSigned.setChecked(false);
|
||||
radioThirdParty.setChecked(true);
|
||||
return true;
|
||||
}
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
|
||||
public static class AsActivity extends AbstractSettingsActivity {
|
||||
public AsActivity() {
|
||||
showHomeAsUp = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Fragment getFragment() {
|
||||
return new SafetyNetAdvancedFragment();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013-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.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import org.microg.tools.selfcheck.InstalledPackagesChecks;
|
||||
//import org.microg.tools.selfcheck.NlpOsCompatChecks;
|
||||
//import org.microg.tools.selfcheck.NlpStatusChecks;
|
||||
import org.microg.tools.selfcheck.PermissionCheckGroup;
|
||||
import org.microg.tools.selfcheck.RomSpoofSignatureChecks;
|
||||
import org.microg.tools.selfcheck.SelfCheckGroup;
|
||||
import org.microg.tools.selfcheck.SystemChecks;
|
||||
import org.microg.tools.ui.AbstractSelfCheckFragment;
|
||||
import org.microg.tools.ui.AbstractSettingsActivity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
|
||||
import static android.Manifest.permission.GET_ACCOUNTS;
|
||||
import static android.Manifest.permission.READ_PHONE_STATE;
|
||||
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.os.Build.VERSION_CODES.LOLLIPOP_MR1;
|
||||
|
||||
public class SelfCheckFragment extends AbstractSelfCheckFragment {
|
||||
|
||||
@Override
|
||||
protected void prepareSelfCheckList(List<SelfCheckGroup> checks) {
|
||||
checks.add(new RomSpoofSignatureChecks());
|
||||
checks.add(new InstalledPackagesChecks());
|
||||
if (SDK_INT > LOLLIPOP_MR1) {
|
||||
checks.add(new PermissionCheckGroup(ACCESS_COARSE_LOCATION, "android.permission.ACCESS_BACKGROUND_LOCATION", WRITE_EXTERNAL_STORAGE, GET_ACCOUNTS, READ_PHONE_STATE));
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
checks.add(new SystemChecks());
|
||||
}
|
||||
// checks.add(new NlpOsCompatChecks());
|
||||
// checks.add(new NlpStatusChecks());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
reset(LayoutInflater.from(getContext()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == SystemChecks.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
|
||||
reset(LayoutInflater.from(getContext()));
|
||||
else
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
public static class AsActivity extends AbstractSettingsActivity {
|
||||
public AsActivity() {
|
||||
showHomeAsUp = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Fragment getFragment() {
|
||||
return new SelfCheckFragment();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import androidx.navigation.fragment.NavHostFragment;
|
|||
import androidx.navigation.ui.AppBarConfiguration;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity {
|
||||
private AppBarConfiguration appBarConfiguration;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.microg.gms.ui;
|
|||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
//import org.microg.nlp.Preferences;
|
||||
import org.microg.tools.ui.AbstractDashboardActivity;
|
||||
|
|
|
@ -5,12 +5,11 @@ import android.os.Bundle;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
import org.microg.gms.checkin.CheckinPrefs;
|
||||
import org.microg.gms.gcm.GcmDatabase;
|
||||
import org.microg.gms.gcm.GcmPrefs;
|
||||
import org.microg.gms.snet.SafetyNetPrefs;
|
||||
import org.microg.tools.ui.ResourceSettingsFragment;
|
||||
|
||||
public class SettingsFragment extends ResourceSettingsFragment {
|
||||
|
@ -56,37 +55,6 @@ public class SettingsFragment extends ResourceSettingsFragment {
|
|||
return true;
|
||||
});
|
||||
|
||||
if (SafetyNetPrefs.get(getContext()).isEnabled()) {
|
||||
String snet_info = "";
|
||||
|
||||
if (SafetyNetPrefs.get(getContext()).isOfficial()) {
|
||||
snet_info = getString(R.string.pref_snet_status_official_info);
|
||||
} else if (SafetyNetPrefs.get(getContext()).isSelfSigned()) {
|
||||
snet_info = getString(R.string.pref_snet_status_self_signed_info);
|
||||
} else if (SafetyNetPrefs.get(getContext()).isThirdParty()) {
|
||||
snet_info = getString(R.string.pref_snet_status_third_party_info);
|
||||
}
|
||||
|
||||
findPreference(PREF_SNET).setSummary(getString(R.string.service_status_enabled_short));
|
||||
} else {
|
||||
findPreference(PREF_SNET).setSummary(R.string.service_status_disabled_short);
|
||||
}
|
||||
findPreference(PREF_SNET).setOnPreferenceClickListener(preference -> {
|
||||
NavHostFragment.findNavController(SettingsFragment.this).navigate(R.id.openSafetyNetSettings);
|
||||
return true;
|
||||
});
|
||||
|
||||
// Preferences unifiedNlPrefs = new Preferences(getContext());
|
||||
// int backendCount = TextUtils.isEmpty(unifiedNlPrefs.getLocationBackends()) ? 0 :
|
||||
// Preferences.splitBackendString(unifiedNlPrefs.getLocationBackends()).length;
|
||||
// backendCount += TextUtils.isEmpty(unifiedNlPrefs.getGeocoderBackends()) ? 0 :
|
||||
// Preferences.splitBackendString(unifiedNlPrefs.getGeocoderBackends()).length;
|
||||
// findPreference(PREF_UNIFIEDNLP).setSummary(getResources().getQuantityString(R.plurals.pref_unifiednlp_summary, backendCount, backendCount));
|
||||
findPreference(PREF_UNIFIEDNLP).setOnPreferenceClickListener(preference -> {
|
||||
NavHostFragment.findNavController(SettingsFragment.this).navigate(R.id.openUnifiedNlpSettings);
|
||||
return true;
|
||||
});
|
||||
|
||||
boolean checkinEnabled = CheckinPrefs.get(getContext()).isEnabled();
|
||||
findPreference(PREF_CHECKIN).setSummary(checkinEnabled ? R.string.service_status_enabled_short : R.string.service_status_disabled_short);
|
||||
findPreference(PREF_CHECKIN).setOnPreferenceClickListener(preference -> {
|
||||
|
|
|
@ -60,10 +60,6 @@
|
|||
app:popExitAnim="@anim/fragment_close_exit" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/selfcheckFragment"
|
||||
android:name="org.microg.gms.ui.SelfCheckFragment"
|
||||
android:label="@string/self_check_title" />
|
||||
<fragment
|
||||
android:id="@+id/checkinFragment"
|
||||
android:name="org.microg.gms.ui.DeviceRegistrationFragment"
|
||||
|
@ -121,22 +117,6 @@
|
|||
android:id="@+id/gcmAdvancedFragment"
|
||||
android:name="org.microg.gms.ui.GcmAdvancedFragment"
|
||||
android:label="@string/service_name_mcs" />
|
||||
<fragment
|
||||
android:id="@+id/safetyNetFragment"
|
||||
android:name="org.microg.gms.ui.SafetyNetFragment"
|
||||
android:label="@string/service_name_snet">
|
||||
<action
|
||||
android:id="@+id/openSafetyNetAdvancedSettings"
|
||||
app:destination="@id/safetyNetAdvancedFragment"
|
||||
app:enterAnim="@anim/fragment_open_enter"
|
||||
app:exitAnim="@anim/fragment_open_exit"
|
||||
app:popEnterAnim="@anim/fragment_close_enter"
|
||||
app:popExitAnim="@anim/fragment_close_exit" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/safetyNetAdvancedFragment"
|
||||
android:name="org.microg.gms.ui.SafetyNetAdvancedFragment"
|
||||
android:label="@string/service_name_snet" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/googleMoreFragment"
|
||||
|
|
Loading…
Reference in New Issue