From 6cf7c9426e1cea9c29523bff40ef9a7b7c40a961 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 2 Nov 2015 13:22:58 +0100 Subject: [PATCH] Added first use / action completed message, real status icons --- .../eu/faircode/netguard/ActivityMain.java | 44 +++++++++++++----- app/src/main/res/layout/about.xml | 4 +- app/src/main/res/layout/action.xml | 2 +- app/src/main/res/layout/first.xml | 45 +++++++++++++++++++ app/src/main/res/values-ar/strings.xml | 6 +++ app/src/main/res/values-de/strings.xml | 6 +++ app/src/main/res/values-fr/strings.xml | 6 +++ app/src/main/res/values-it/strings.xml | 6 +++ app/src/main/res/values-ko/strings.xml | 6 +++ app/src/main/res/values-nl/strings.xml | 6 +++ app/src/main/res/values-ro/strings.xml | 6 +++ app/src/main/res/values-sk/strings.xml | 6 +++ app/src/main/res/values-zh-rCN/strings.xml | 6 +++ app/src/main/res/values/strings.xml | 6 +++ 14 files changed, 141 insertions(+), 14 deletions(-) create mode 100644 app/src/main/res/layout/first.xml diff --git a/app/src/main/java/eu/faircode/netguard/ActivityMain.java b/app/src/main/java/eu/faircode/netguard/ActivityMain.java index 4955724f..1210af9a 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivityMain.java +++ b/app/src/main/java/eu/faircode/netguard/ActivityMain.java @@ -137,15 +137,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences } }); - // Display status - ivInteractive.setVisibility(Util.isInteractive(this) ? View.VISIBLE : View.GONE); - if (Util.isWifiActive(this)) - ivWifi.setVisibility(View.VISIBLE); - else if (Util.isRoaming(this)) - ivRoaming.setVisibility(View.VISIBLE); - else - ivOther.setVisibility(View.VISIBLE); - // Disabled warning TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled); tvDisabled.setVisibility(enabled ? View.GONE : View.VISIBLE); @@ -196,6 +187,34 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); serviceIntent.setPackage("com.android.vending"); bindService(serviceIntent, billingConnection, Context.BIND_AUTO_CREATE); + + // First use + if (!prefs.getBoolean("initialized", false)) { + // Create view + LayoutInflater inflater = LayoutInflater.from(this); + View view = inflater.inflate(R.layout.first, null); + TextView tvFirst = (TextView) view.findViewById(R.id.tvFirst); + tvFirst.setMovementMethod(LinkMovementMethod.getInstance()); + + // Show dialog + AlertDialog dialog = new AlertDialog.Builder(this) + .setView(view) + .setCancelable(false) + .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + prefs.edit().putBoolean("initialized", true).apply(); + } + }) + .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + System.exit(0); + } + }) + .create(); + dialog.show(); + } } @Override @@ -221,7 +240,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences Log.i(TAG, "Received " + intent); Util.logExtras(TAG, intent); - ivInteractive.setVisibility(Intent.ACTION_SCREEN_ON.equals(intent.getAction()) ? View.VISIBLE : View.GONE); + ivInteractive.setVisibility(Intent.ACTION_SCREEN_ON.equals(intent.getAction()) ? View.VISIBLE : View.INVISIBLE); } }; @@ -590,7 +609,9 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences @Override protected void onPostExecute(Throwable ex) { - if (ex != null) + if (ex == null) + Toast.makeText(ActivityMain.this, R.string.msg_completed, Toast.LENGTH_LONG).show(); + else Toast.makeText(ActivityMain.this, ex.toString(), Toast.LENGTH_LONG).show(); } }.execute(); @@ -624,6 +645,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences if (ex == null) { SinkholeService.reload(null, ActivityMain.this); recreate(); + Toast.makeText(ActivityMain.this, R.string.msg_completed, Toast.LENGTH_LONG).show(); } else Toast.makeText(ActivityMain.this, ex.toString(), Toast.LENGTH_LONG).show(); } diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml index 2a461555..6a2a48a9 100644 --- a/app/src/main/res/layout/about.xml +++ b/app/src/main/res/layout/about.xml @@ -25,7 +25,7 @@ android:layout_gravity="center_vertical" android:layout_marginStart="8dp" android:text="@string/app_name" - android:textAppearance="@android:style/TextAppearance.Material.Medium" + android:textAppearance="@android:style/TextAppearance.Material.Large" android:textStyle="bold" /> diff --git a/app/src/main/res/layout/action.xml b/app/src/main/res/layout/action.xml index 309c170c..352cda74 100644 --- a/app/src/main/res/layout/action.xml +++ b/app/src/main/res/layout/action.xml @@ -18,7 +18,7 @@ android:layout_gravity="center_vertical" android:layout_marginStart="12dp" android:src="@drawable/ic_perm_identity_white_24dp" - android:visibility="gone" /> + android:visibility="invisible" /> + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 1197d613..abef9c1b 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1,6 +1,11 @@ الحقوق /u00A9 2015 بواسطة M. Bokhorst (M66B) By using NetGuard, you agree to the GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 البحث عن تطبيقات حظر الواي فاي بشكل افتراضي @@ -17,6 +22,7 @@ هل أنت متأكد؟ التطبيق غير مُفعّل, قم بتفعيل التطبيق من الخيار أعلاه. NetGuard has been disabled + Action completed السماح عند استخدام الجهاز Block when roaming diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 84098ebd..0645f167 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1,6 +1,11 @@ Copyright \u00A9 2015 by M. Bokhorst (M66B) Mit der Verwendung von NetGuard, akzeptierst zu die GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 Suche nach Apps Blockiere Wi-Fi standardmäßig @@ -17,6 +22,7 @@ Bist du sicher? NetGuard ist deaktiviert, verwende die Switch um NetGuard zu aktivieren NetGuard wurde deaktiviert + Action completed Erlauben wenn Gerät verwendet wird Blockiere bei Roaming diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 5f1f7718..4af4b51b 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1,6 +1,11 @@ Copyright \u00A9 2015 par M. Bokhorst (M66B) By using NetGuard, you agree to the GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 Recherche application Blocage Wi-Fi par défaut @@ -17,6 +22,7 @@ Etes-vous sûr ? NetGuard is disabled, use the switch above to enable NetGuard NetGuard has been disabled + Action completed Allow when device in use Block when roaming diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 758bea35..7bdae1fb 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1,6 +1,11 @@ Copyright \u00A9 2015 by M. Bokhorst (M66B) By using NetGuard, you agree to the GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 Cerca applicazione Blocca Wi-Fi di default @@ -17,6 +22,7 @@ Sei sicuro? NetGuard è disabilitata, usa lo switch per abilitarlo nuovamente NetGuard has been disabled + Action completed Consenti quando il dispositivo è in uso Block when roaming diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 530429ad..56b07839 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -1,6 +1,11 @@ Copyright \u00A9 2015 by M. Bokhorst (M66B) By using NetGuard, you agree to the GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 앱 검색 Wi-Fi 차단을 기본 설정으로 @@ -17,6 +22,7 @@ 계속 하시겠습니까? 넷가드가 해제되어 있습니다. 상단 스위치를 사용해 넷가드를 활성화하세요. 넷가드가 해제되었습니다 + Action completed 기기가 사용중일때 허용 Block when roaming diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index fdd6fe0d..c05007bf 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1,6 +1,11 @@ Copyright \u00A9 2015 by M. Bokhorst (M66B) Door NetGuard te gebruiken, gaat u akkoord met de GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 Zoek naar applicatie Blokkeer Wi-Fi standaard @@ -17,6 +22,7 @@ Weet u het zeker? NetGuard staat uit, gebruik de schakelaar boven om NetGuard aan te zetten NetGuard is uitgezet + Actie uitgevoerd Sta toe als apparaat in gebruik Blokkeer bij roamen diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index b1229baf..846b008f 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -1,6 +1,11 @@ Copyright \u00A9 2015 by M. Bokhorst (M66B) Folosind NetGuard, sunteti de acord cu GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 Cauta aplicatii Blocheaza implicit Wi-Fi @@ -17,6 +22,7 @@ Esti sigur? NetGuard este momentan dezactivat, foloseste comutatorul de mai sus pentru a il activa NetGuard a fost dezactivat + Action completed Permite cand dispozitivul este folosit Blocheaza in roaming diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 1e169d4b..f788f1eb 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -1,6 +1,11 @@ Autorské práva \u00A9 2015 od M. Bokhorst (M66B) By using NetGuard, you agree to the GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 Hľadať aplikáciu Predvolene blokovať Wi-Fi @@ -17,6 +22,7 @@ Ste si istý? NetGuard je vypnutý, použite prepínač vyššie na zapnutie NetGuard NetGuard je vypnutý + Action completed Povoliť pri používaní zariadenia Block when roaming diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 392a38d6..a63770b7 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,6 +1,11 @@ 版权所有 \u00A9 2015 by M. Bokhorst (M66B) By using NetGuard, you agree to the GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 搜索应用 默认阻止Wi-Fi网络 @@ -17,6 +22,7 @@ 是否确认? NetGuard已被停用, 请使用上方的开关启用NetGuard NetGuard已被停用 + Action completed 设备使用时允许 漫游时阻止 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ea6bc1d3..69abff80 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,6 +2,11 @@ NetGuard Copyright \u00A9 2015 by M. Bokhorst (M66B) By using NetGuard, you agree to the GNU General Public License version 3 + Great care has been taken to develop and test NetGuard, +however it is impossible to guarantee it will work correctly on each and every device. +NetGuard is known to crash when activated or known to block all traffic on some devices. +This is caused by bugs in Android, or in the software by the manufacturer, so please don\'t blame NetGuard for this. +\n\nBy using NetGuard, you agree to the GNU General Public License version 3 Search for application Block Wi-Fi by default @@ -18,6 +23,7 @@ Are you sure? NetGuard is disabled, use the switch above to enable NetGuard NetGuard has been disabled + Action completed Allow when device in use Block when roaming