Added first use / action completed message, real status icons

This commit is contained in:
M66B 2015-11-02 13:22:58 +01:00
parent 2f8cefdde6
commit 6cf7c9426e
14 changed files with 141 additions and 14 deletions

View File

@ -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();
}

View File

@ -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" />
<TextView
@ -34,7 +34,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="4dp"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
android:textAppearance="@android:style/TextAppearance.Material.Large"
android:textStyle="bold" />
</LinearLayout>

View File

@ -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" />
<ImageView
android:id="@+id/ivWifi"

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingEnd="20dp"
android:paddingStart="20dp"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:text="@string/app_name"
android:textAppearance="@android:style/TextAppearance.Material.Large"
android:textStyle="bold" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical">
<TextView
android:id="@+id/tvFirst"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_first"
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
</ScrollView>
</LinearLayout>

View File

@ -1,6 +1,11 @@
<resources>
<string name="app_copyright">الحقوق /u00A9 2015 بواسطة M. Bokhorst (M66B)</string>
<string name="app_license">By using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">البحث عن تطبيقات</string>
<string name="menu_whitelist_wifi">حظر الواي فاي بشكل افتراضي</string>
@ -17,6 +22,7 @@
<string name="msg_sure">هل أنت متأكد؟</string>
<string name="msg_disabled">التطبيق غير مُفعّل, قم بتفعيل التطبيق من الخيار أعلاه.</string>
<string name="msg_revoked">NetGuard has been disabled</string>
<string name="msg_completed">Action completed</string>
<string name="title_using">السماح عند استخدام الجهاز</string>
<string name="title_roaming">Block when roaming</string>

View File

@ -1,6 +1,11 @@
<resources>
<string name="app_copyright">Copyright \u00A9 2015 by M. Bokhorst (M66B)</string>
<string name="app_license">Mit der Verwendung von NetGuard, akzeptierst zu die <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">Suche nach Apps</string>
<string name="menu_whitelist_wifi">Blockiere Wi-Fi standardmäßig</string>
@ -17,6 +22,7 @@
<string name="msg_sure">Bist du sicher?</string>
<string name="msg_disabled">NetGuard ist deaktiviert, verwende die Switch um NetGuard zu aktivieren</string>
<string name="msg_revoked">NetGuard wurde deaktiviert</string>
<string name="msg_completed">Action completed</string>
<string name="title_using">Erlauben wenn Gerät verwendet wird</string>
<string name="title_roaming">Blockiere bei Roaming</string>

View File

@ -1,6 +1,11 @@
<resources>
<string name="app_copyright">Copyright \u00A9 2015 par M. Bokhorst (M66B)</string>
<string name="app_license">By using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">Recherche application</string>
<string name="menu_whitelist_wifi">Blocage Wi-Fi par défaut</string>
@ -17,6 +22,7 @@
<string name="msg_sure">Etes-vous sûr ?</string>
<string name="msg_disabled">NetGuard is disabled, use the switch above to enable NetGuard</string>
<string name="msg_revoked">NetGuard has been disabled</string>
<string name="msg_completed">Action completed</string>
<string name="title_using">Allow when device in use</string>
<string name="title_roaming">Block when roaming</string>

View File

@ -1,6 +1,11 @@
<resources>
<string name="app_copyright">Copyright \u00A9 2015 by M. Bokhorst (M66B)</string>
<string name="app_license">By using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">Cerca applicazione</string>
<string name="menu_whitelist_wifi">Blocca Wi-Fi di default</string>
@ -17,6 +22,7 @@
<string name="msg_sure">Sei sicuro?</string>
<string name="msg_disabled">NetGuard è disabilitata, usa lo switch per abilitarlo nuovamente</string>
<string name="msg_revoked">NetGuard has been disabled</string>
<string name="msg_completed">Action completed</string>
<string name="title_using">Consenti quando il dispositivo è in uso</string>
<string name="title_roaming">Block when roaming</string>

View File

@ -1,6 +1,11 @@
<resources>
<string name="app_copyright">Copyright \u00A9 2015 by M. Bokhorst (M66B)</string>
<string name="app_license">By using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">앱 검색</string>
<string name="menu_whitelist_wifi">Wi-Fi 차단을 기본 설정으로</string>
@ -17,6 +22,7 @@
<string name="msg_sure">계속 하시겠습니까?</string>
<string name="msg_disabled">넷가드가 해제되어 있습니다. 상단 스위치를 사용해 넷가드를 활성화하세요.</string>
<string name="msg_revoked">넷가드가 해제되었습니다</string>
<string name="msg_completed">Action completed</string>
<string name="title_using">기기가 사용중일때 허용</string>
<string name="title_roaming">Block when roaming</string>

View File

@ -1,6 +1,11 @@
<resources>
<string name="app_copyright">Copyright \u00A9 2015 by M. Bokhorst (M66B)</string>
<string name="app_license">Door NetGuard te gebruiken, gaat u akkoord met de <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">Zoek naar applicatie</string>
<string name="menu_whitelist_wifi">Blokkeer Wi-Fi standaard</string>
@ -17,6 +22,7 @@
<string name="msg_sure">Weet u het zeker?</string>
<string name="msg_disabled">NetGuard staat uit, gebruik de schakelaar boven om NetGuard aan te zetten</string>
<string name="msg_revoked">NetGuard is uitgezet</string>
<string name="msg_completed">Actie uitgevoerd</string>
<string name="title_using">Sta toe als apparaat in gebruik</string>
<string name="title_roaming">Blokkeer bij roamen</string>

View File

@ -1,6 +1,11 @@
<resources>
<string name="app_copyright">Copyright \u00A9 2015 by M. Bokhorst (M66B)</string>
<string name="app_license">Folosind NetGuard, sunteti de acord cu <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">Cauta aplicatii</string>
<string name="menu_whitelist_wifi">Blocheaza implicit Wi-Fi</string>
@ -17,6 +22,7 @@
<string name="msg_sure">Esti sigur?</string>
<string name="msg_disabled">NetGuard este momentan dezactivat, foloseste comutatorul de mai sus pentru a il activa</string>
<string name="msg_revoked">NetGuard a fost dezactivat</string>
<string name="msg_completed">Action completed</string>
<string name="title_using">Permite cand dispozitivul este folosit</string>
<string name="title_roaming">Blocheaza in roaming</string>

View File

@ -1,6 +1,11 @@
<resources>
<string name="app_copyright">Autorské práva \u00A9 2015 od M. Bokhorst (M66B)</string>
<string name="app_license">By using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">Hľadať aplikáciu</string>
<string name="menu_whitelist_wifi">Predvolene blokovať Wi-Fi</string>
@ -17,6 +22,7 @@
<string name="msg_sure">Ste si istý?</string>
<string name="msg_disabled">NetGuard je vypnutý, použite prepínač vyššie na zapnutie NetGuard</string>
<string name="msg_revoked">NetGuard je vypnutý</string>
<string name="msg_completed">Action completed</string>
<string name="title_using">Povoliť pri používaní zariadenia</string>
<string name="title_roaming">Block when roaming</string>

View File

@ -1,6 +1,11 @@
<resources>
<string name="app_copyright">版权所有 \u00A9 2015 by M. Bokhorst (M66B)</string>
<string name="app_license">By using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">搜索应用</string>
<string name="menu_whitelist_wifi">默认阻止Wi-Fi网络</string>
@ -17,6 +22,7 @@
<string name="msg_sure">是否确认?</string>
<string name="msg_disabled">NetGuard已被停用, 请使用上方的开关启用NetGuard</string>
<string name="msg_revoked">NetGuard已被停用</string>
<string name="msg_completed">Action completed</string>
<string name="title_using">设备使用时允许</string>
<string name="title_roaming">漫游时阻止</string>

View File

@ -2,6 +2,11 @@
<string name="app_name" translatable="false">NetGuard</string>
<string name="app_copyright">Copyright \u00A9 2015 by M. Bokhorst (M66B)</string>
<string name="app_license">By using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="app_first">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 <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
<string name="menu_search">Search for application</string>
<string name="menu_whitelist_wifi">Block Wi-Fi by default</string>
@ -18,6 +23,7 @@
<string name="msg_sure">Are you sure?</string>
<string name="msg_disabled">NetGuard is disabled, use the switch above to enable NetGuard</string>
<string name="msg_revoked">NetGuard has been disabled</string>
<string name="msg_completed">Action completed</string>
<string name="title_using">Allow when device in use</string>
<string name="title_roaming">Block when roaming</string>