summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/FaqFragment.java27
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/FaqViewAdapter.java42
-rwxr-xr-xmain/src/main/res/values/strings.xml3
3 files changed, 52 insertions, 20 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/FaqFragment.java b/main/src/main/java/de/blinkt/openvpn/fragments/FaqFragment.java
index 0bebe98a..13e0c0c2 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/FaqFragment.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/FaqFragment.java
@@ -48,16 +48,21 @@ public class FaqFragment extends Fragment {
return true;
String release = Build.VERSION.RELEASE;
- boolean isAtLeast442 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
- !release.startsWith("4.4.3") && !release.startsWith("4.4.3")
- && !release.startsWith("4.4.4") && !release.startsWith("4.4.5") && !release.startsWith("4.4.6");
+ boolean isOlderThan443 = !release.startsWith("4.4.3") && !release.startsWith("4.4.4") &&
+ !release.startsWith("4.4.5") && !release.startsWith("4.4.6");
- boolean isAtLeast443 = isAtLeast442 && !release.startsWith("4.4.2");
- if (endVersion == -441 && !isAtLeast442)
- return true;
+ boolean isOlderThan442 = isOlderThan443 && !release.startsWith("4.4.2");
- if (endVersion == -442 && !isAtLeast443)
- return true;
+
+ if(Build.VERSION.SDK_INT== Build.VERSION_CODES.KITKAT) {
+ if (endVersion == -441 && isOlderThan442)
+ return true;
+
+ if (endVersion == -442 && isOlderThan443)
+ return true;
+ } else if (endVersion == -441 || endVersion == -442) {
+ return Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT;
+ }
}
@@ -140,10 +145,10 @@ public class FaqFragment extends Fragment {
new FAQEntry(Build.VERSION_CODES.KITKAT, -441, R.string.ab_kitkat_mss_title, R.string.ab_kitkat_mss),
new FAQEntry(Build.VERSION_CODES.ICE_CREAM_SANDWICH, -1, R.string.copying_log_entries, R.string.faq_copying),
- new FAQEntry(Build.VERSION_CODES.KITKAT, -442, R.string.ab_persist_tun),
+ new FAQEntry(Build.VERSION_CODES.KITKAT, -442, R.string.ab_persist_tun_title, R.string.ab_persist_tun),
new FAQEntry(Build.VERSION_CODES.KITKAT, -1, R.string.faq_routing_title, R.string.faq_routing),
- new FAQEntry(Build.VERSION_CODES.KITKAT, Build.VERSION_CODES.KITKAT, R.string.ab_kitkat_reconnect),
- new FAQEntry(Build.VERSION_CODES.KITKAT, Build.VERSION_CODES.KITKAT, R.string.ab_vpn_reachability_44),
+ new FAQEntry(Build.VERSION_CODES.KITKAT, Build.VERSION_CODES.KITKAT, R.string.ab_kitkat_reconnect_title, R.string.ab_kitkat_reconnect),
+ new FAQEntry(Build.VERSION_CODES.KITKAT, Build.VERSION_CODES.KITKAT, R.string.ab_vpn_reachability_44_title, R.string.ab_vpn_reachability_44),
new FAQEntry(Build.VERSION_CODES.ICE_CREAM_SANDWICH, -1, R.string.ab_only_cidr_title, R.string.ab_only_cidr),
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/FaqViewAdapter.java b/main/src/main/java/de/blinkt/openvpn/fragments/FaqViewAdapter.java
index 19421800..c99e073a 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/FaqViewAdapter.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/FaqViewAdapter.java
@@ -6,6 +6,7 @@
package de.blinkt.openvpn.fragments;
import android.content.Context;
+import android.os.AsyncTask;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
@@ -23,23 +24,45 @@ public class FaqViewAdapter extends RecyclerView.Adapter<FaqViewAdapter.FaqViewH
private final FaqFragment.FAQEntry[] mFaqItems;
private final Spanned[] mHtmlEntries;
private final Spanned[] mHtmlEntriesTitle;
-
+ private final Context mContext;
+ private boolean loaded =false;
public FaqViewAdapter(Context context, FaqFragment.FAQEntry[] faqItems) {
mFaqItems = faqItems;
+ mContext = context;
mHtmlEntries = new Spanned[faqItems.length];
mHtmlEntriesTitle = new Spanned[faqItems.length];
+ new FetchStrings().execute(faqItems);
+
+ }
+
+ private class FetchStrings extends AsyncTask<FaqFragment.FAQEntry,Void,Void> {
+
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ loaded=true;
+ notifyDataSetChanged();
+ }
+
+ @Override
+ protected Void doInBackground(FaqFragment.FAQEntry... params) {
+ fetchStrings(params);
+ return null;
+ }
+ }
+
+ private void fetchStrings(FaqFragment.FAQEntry[] faqItems) {
for (int i =0; i < faqItems.length; i++) {
- String versionText = mFaqItems[i].getVersionsString(context);
+ String versionText = mFaqItems[i].getVersionsString(mContext);
String title;
String textColor="";
if (mFaqItems[i].title==-1)
title ="";
else
- title = context.getString(faqItems[i].title);
+ title = mContext.getString(faqItems[i].title);
if (!mFaqItems[i].runningVersion())
@@ -48,22 +71,20 @@ public class FaqViewAdapter extends RecyclerView.Adapter<FaqViewAdapter.FaqViewH
if (versionText != null) {
mHtmlEntriesTitle[i] = (Spanned) TextUtils.concat(Html.fromHtml(textColor + title),
- Html.fromHtml( textColor + "<br><small>" + versionText + "</small>"));
+ Html.fromHtml(textColor + "<br><small>" + versionText + "</small>"));
} else {
mHtmlEntriesTitle[i] = Html.fromHtml(title);
}
- mHtmlEntries[i] = Html.fromHtml(textColor + context.getString(faqItems[i].description));
+ mHtmlEntries[i] = Html.fromHtml(textColor + mContext.getString(faqItems[i].description));
// Add hack R.string.faq_system_dialogs_title -> R.string.faq_system_dialog_xposed
if (faqItems[i].title == R.string.faq_system_dialogs_title)
{
- Spanned xPosedtext = Html.fromHtml(textColor + context.getString(R.string.faq_system_dialog_xposed));
+ Spanned xPosedtext = Html.fromHtml(textColor + mContext.getString(R.string.faq_system_dialog_xposed));
mHtmlEntries[i] = (Spanned) TextUtils.concat(mHtmlEntries[i], xPosedtext);
}
-
}
-
}
public static class FaqViewHolder extends RecyclerView.ViewHolder {
@@ -100,7 +121,10 @@ public class FaqViewAdapter extends RecyclerView.Adapter<FaqViewAdapter.FaqViewH
@Override
public int getItemCount() {
- return mFaqItems.length;
+ if(loaded)
+ return mFaqItems.length;
+ else
+ return 0;
}
diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml
index 973ab46c..fd7936a4 100755
--- a/main/src/main/res/values/strings.xml
+++ b/main/src/main/res/values/strings.xml
@@ -372,5 +372,8 @@
<string name="custom_connection_options_warng">Specify custom connection specific options. Use with care</string>
<string name="custom_connection_options">Custom Options</string>
<string name="remove_connection_entry">Remove connection entry</string>
+ <string name="ab_kitkat_reconnect_title">Random disconnects from mobile network</string>
+ <string name="ab_vpn_reachability_44_title">Remote networks not reachable</string>
+ <string name="ab_persist_tun_title">Persist tun mode</string>
</resources>