Add about dialog with version information
This commit is contained in:
parent
2f08c762c7
commit
3b5727c78a
2
extern/MicroGUiTools
vendored
2
extern/MicroGUiTools
vendored
|
@ -1 +1 @@
|
|||
Subproject commit d7210d466aec8901f6bd08461134097ce34edad7
|
||||
Subproject commit 6186c987124146d2deb14febcf5cf698829a12d8
|
20
unifiednlp-app/src/main/res/values/bools.xml
Normal file
20
unifiednlp-app/src/main/res/values/bools.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2013-2016 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<bool name="is_unifiednlp_app">true</bool>
|
||||
</resources>
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.microg.nlp.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
|
@ -23,10 +24,12 @@ import android.support.v4.preference.PreferenceFragment;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
||||
import org.microg.nlp.BuildConfig;
|
||||
import org.microg.nlp.R;
|
||||
import org.microg.tools.selfcheck.NlpOsCompatChecks;
|
||||
import org.microg.tools.selfcheck.NlpStatusChecks;
|
||||
import org.microg.tools.selfcheck.SelfCheckGroup;
|
||||
import org.microg.tools.ui.AbstractAboutFragment;
|
||||
import org.microg.tools.ui.AbstractSelfCheckFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -41,13 +44,17 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
.replace(R.id.content_wrapper, new MyPreferenceFragment()).commit();
|
||||
}
|
||||
|
||||
private static boolean isUnifiedNlpAppRelease(Context context) {
|
||||
int resId = context.getResources().getIdentifier("is_unifiednlp_app", "bool", context.getPackageName());
|
||||
return resId != 0 && context.getResources().getBoolean(resId);
|
||||
}
|
||||
|
||||
public static class MyPreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!getContext().getPackageName().equals("com.google.android.gms")
|
||||
|| getResources().getIdentifier("is_gmscore", "bool", "com.google.android.gms") == 0) {
|
||||
if (isUnifiedNlpAppRelease(getContext())) {
|
||||
addPreferencesFromResource(R.xml.nlp_setup_preferences);
|
||||
|
||||
findPreference(getString(R.string.self_check_title))
|
||||
|
@ -64,6 +71,22 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
addPreferencesFromResource(R.xml.nlp_preferences);
|
||||
if (isUnifiedNlpAppRelease(getContext())) {
|
||||
addPreferencesFromResource(R.xml.nlp_about_preferences);
|
||||
|
||||
findPreference(getString(R.string.pref_about_title))
|
||||
.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
getFragmentManager().beginTransaction()
|
||||
.addToBackStack("root")
|
||||
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
|
||||
.replace(R.id.content_wrapper, new MyAboutFragment())
|
||||
.commit();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,4 +98,30 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
checks.add(new NlpStatusChecks());
|
||||
}
|
||||
}
|
||||
|
||||
public static class MyAboutFragment extends AbstractAboutFragment {
|
||||
|
||||
@Override
|
||||
protected String getSummary() {
|
||||
String packageName = getContext().getPackageName();
|
||||
if (packageName.equals("com.google.android.gms")) {
|
||||
return getString(R.string.nlp_version_default);
|
||||
} else if (packageName.equals("com.google.android.location")) {
|
||||
return getString(R.string.nlp_version_legacy);
|
||||
} else if (packageName.equals("org.microg.nlp")) {
|
||||
return getString(R.string.nlp_version_custom);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSelfVersion() {
|
||||
return BuildConfig.VERSION_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void collectLibraries(List<Library> libraries) {
|
||||
libraries.add(new Library("org.microg.nlp.api", "microG UnifiedNlp Api", "Apache License 2.0, Copyright © microG Team"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,4 +52,12 @@
|
|||
<string name="self_check_resolution_nlp_is_providing">No UnifiedNlp location was provided by the system within 10 seconds.</string>
|
||||
<string name="self_check_name_network_enabled">Network-based location enabled:</string>
|
||||
<string name="self_check_resolution_network_enabled">You either disabled network-based location (in system settings) or the system is not supported.</string>
|
||||
|
||||
<string name="prefcat_about">About</string>
|
||||
<string name="pref_about_title">About microG UnifiedNlp</string>
|
||||
<string name="pref_about_summary">Version information and used libraries</string>
|
||||
|
||||
<string name="nlp_version_default">for default systems without GAPPS</string>
|
||||
<string name="nlp_version_legacy">for legacy systems without GAPPS</string>
|
||||
<string name="nlp_version_custom">for custom systems</string>
|
||||
</resources>
|
||||
|
|
26
unifiednlp-base/src/main/res/xml/nlp_about_preferences.xml
Normal file
26
unifiednlp-base/src/main/res/xml/nlp_about_preferences.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2013-2016 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.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory android:title="@string/prefcat_about">
|
||||
<Preference
|
||||
android:key="@string/pref_about_title"
|
||||
android:summary="@string/pref_about_summary"
|
||||
android:title="@string/pref_about_title">
|
||||
</Preference>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
Loading…
Reference in a new issue