mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-02-02 22:17:31 +01:00
Various fixes, proper strings
This commit is contained in:
parent
f0e7d6b1c8
commit
b2f08accd9
@ -21,7 +21,6 @@ import android.content.pm.PackageManager;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.*;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -57,7 +56,7 @@ public abstract class AbstractAboutFragment extends Fragment {
|
|||||||
PackageManager pm = getContext().getPackageManager();
|
PackageManager pm = getContext().getPackageManager();
|
||||||
CharSequence label = pm.getPackageInfo(getContext().getPackageName(), 0).applicationInfo.loadLabel(pm);
|
CharSequence label = pm.getPackageInfo(getContext().getPackageName(), 0).applicationInfo.loadLabel(pm);
|
||||||
if (TextUtils.isEmpty(label)) return getContext().getPackageName();
|
if (TextUtils.isEmpty(label)) return getContext().getPackageName();
|
||||||
return label.toString();
|
return label.toString().trim();
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
// Never happens, self package always exists!
|
// Never happens, self package always exists!
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@ -68,7 +67,7 @@ public abstract class AbstractAboutFragment extends Fragment {
|
|||||||
try {
|
try {
|
||||||
String versionName = (String) Class.forName(packageName + ".BuildConfig").getField("VERSION_NAME").get(null);
|
String versionName = (String) Class.forName(packageName + ".BuildConfig").getField("VERSION_NAME").get(null);
|
||||||
if (TextUtils.isEmpty(versionName)) return "";
|
if (TextUtils.isEmpty(versionName)) return "";
|
||||||
return versionName;
|
return versionName.trim();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -80,10 +79,10 @@ public abstract class AbstractAboutFragment extends Fragment {
|
|||||||
View aboutRoot = inflater.inflate(R.layout.about_root, container, false);
|
View aboutRoot = inflater.inflate(R.layout.about_root, container, false);
|
||||||
((ImageView) aboutRoot.findViewById(android.R.id.icon)).setImageDrawable(getIcon());
|
((ImageView) aboutRoot.findViewById(android.R.id.icon)).setImageDrawable(getIcon());
|
||||||
((TextView) aboutRoot.findViewById(android.R.id.title)).setText(getAppName());
|
((TextView) aboutRoot.findViewById(android.R.id.title)).setText(getAppName());
|
||||||
((TextView) aboutRoot.findViewById(R.id.about_version)).setText("Version " + getLibVersion(getContext().getPackageName()));
|
((TextView) aboutRoot.findViewById(R.id.about_version)).setText(getString(R.string.about_version_str, getLibVersion(getContext().getPackageName())));
|
||||||
|
|
||||||
List<Library> libraries = new ArrayList<Library>();
|
List<Library> libraries = new ArrayList<Library>();
|
||||||
libraries.add(new Library("org.microg.tools.ui", "microG UI Tools", "Apache License 2.0, Copyright (c) microG Team"));
|
libraries.add(new Library(BuildConfig.APPLICATION_ID, getString(R.string.lib_name), getString(R.string.lib_license)));
|
||||||
collectLibraries(libraries);
|
collectLibraries(libraries);
|
||||||
Collections.sort(libraries);
|
Collections.sort(libraries);
|
||||||
((ListView) aboutRoot.findViewById(android.R.id.list)).setAdapter(new LibraryAdapter(getContext(), libraries.toArray(new Library[libraries.size()])));
|
((ListView) aboutRoot.findViewById(android.R.id.list)).setAdapter(new LibraryAdapter(getContext(), libraries.toArray(new Library[libraries.size()])));
|
||||||
@ -100,8 +99,8 @@ public abstract class AbstractAboutFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
View v = super.getView(position, convertView, parent);
|
View v = super.getView(position, convertView, parent);
|
||||||
((TextView) v.findViewById(android.R.id.text1)).setText(getItem(position).name + " " + getLibVersion(getItem(position).packageName));
|
((TextView) v.findViewById(android.R.id.text1)).setText(getString(R.string.about_name_version_str, getItem(position).name, getLibVersion(getItem(position).packageName)));
|
||||||
((TextView) v.findViewById(android.R.id.text2)).setText(getItem(position).copyright);
|
((TextView) v.findViewById(android.R.id.text2)).setText(getItem(position).copyright != null ? getItem(position).copyright : getString(R.string.about_default_license));
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ package org.microg.tools.ui;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -33,10 +34,12 @@ import java.util.List;
|
|||||||
|
|
||||||
import static android.view.View.GONE;
|
import static android.view.View.GONE;
|
||||||
import static android.view.View.INVISIBLE;
|
import static android.view.View.INVISIBLE;
|
||||||
|
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Negative;
|
||||||
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Positive;
|
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Positive;
|
||||||
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Unknown;
|
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Unknown;
|
||||||
|
|
||||||
public abstract class AbstractSelfCheckFragment extends Fragment {
|
public abstract class AbstractSelfCheckFragment extends Fragment {
|
||||||
|
private static final String TAG = "SelfCheck";
|
||||||
|
|
||||||
protected abstract void prepareSelfCheckList(List<SelfCheckGroup> checks);
|
protected abstract void prepareSelfCheckList(List<SelfCheckGroup> checks);
|
||||||
|
|
||||||
@ -52,7 +55,13 @@ public abstract class AbstractSelfCheckFragment extends Fragment {
|
|||||||
View groupView = inflater.inflate(R.layout.self_check_group, root, false);
|
View groupView = inflater.inflate(R.layout.self_check_group, root, false);
|
||||||
((TextView) groupView.findViewById(android.R.id.title)).setText(group.getGroupName(getContext()));
|
((TextView) groupView.findViewById(android.R.id.title)).setText(group.getGroupName(getContext()));
|
||||||
final ViewGroup viewGroup = (ViewGroup) groupView.findViewById(R.id.group_content);
|
final ViewGroup viewGroup = (ViewGroup) groupView.findViewById(R.id.group_content);
|
||||||
group.doChecks(getContext(), new GroupResultCollector(viewGroup));
|
final SelfCheckGroup.ResultCollector collector = new GroupResultCollector(viewGroup);
|
||||||
|
try {
|
||||||
|
group.doChecks(getContext(), collector);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "Failed during check " + group.getGroupName(getContext()), e);
|
||||||
|
collector.addResult("Self-check failed:", Negative, "An exception occurred during self-check. Please report this issue.");
|
||||||
|
}
|
||||||
root.addView(groupView);
|
root.addView(groupView);
|
||||||
}
|
}
|
||||||
return scrollRoot;
|
return scrollRoot;
|
||||||
|
23
microg-ui-tools/src/main/res/values-sr/strings.xml
Normal file
23
microg-ui-tools/src/main/res/values-sr/strings.xml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?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>
|
||||||
|
<string name="prefcat_setup">Поставка</string>
|
||||||
|
|
||||||
|
<string name="self_check_title">микроГ самопровера</string>
|
||||||
|
<string name="self_check_desc">Провера исправности подешавања система за коришћење микроГ услуга.</string>
|
||||||
|
</resources>
|
30
microg-ui-tools/src/main/res/values/strings.xml
Normal file
30
microg-ui-tools/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?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>
|
||||||
|
<string name="lib_name">microG UI Tools</string>
|
||||||
|
<string name="lib_license">Apache License 2.0, Copyright © microG Team</string>
|
||||||
|
|
||||||
|
<string name="about_version_str">Version %1$s</string>
|
||||||
|
<string name="about_name_version_str">%1$s %2$s</string>
|
||||||
|
<string name="about_default_license">All rights reserved.</string>
|
||||||
|
|
||||||
|
<string name="prefcat_setup">Setup</string>
|
||||||
|
|
||||||
|
<string name="self_check_title">Self-Check</string>
|
||||||
|
<string name="self_check_desc">Check if the system is correctly set up to use microG.</string>
|
||||||
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user