1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-02-23 23:00:56 +00:00

Revert "Show if internet connectivity (experimental)"

This reverts commit ca65ab92a0.
This commit is contained in:
M66B 2017-02-12 09:44:26 +01:00
parent 589ac7db4d
commit fe70de0a0e
27 changed files with 2 additions and 87 deletions

View file

@ -138,6 +138,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />

View file

@ -86,7 +86,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
private ImageView ivIcon;
private ImageView ivQueue;
private SwitchCompat swEnabled;
private ImageView ivActive;
private ImageView ivMetered;
private SwipeRefreshLayout swipeRefresh;
private AdapterRule adapter = null;
@ -152,7 +151,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
ivIcon = (ImageView) actionView.findViewById(R.id.ivIcon);
ivQueue = (ImageView) actionView.findViewById(R.id.ivQueue);
swEnabled = (SwitchCompat) actionView.findViewById(R.id.swEnabled);
ivActive = (ImageView) actionView.findViewById(R.id.ivActive);
ivMetered = (ImageView) actionView.findViewById(R.id.ivMetered);
// Icon
@ -241,23 +239,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
if (enabled)
checkDoze();
// Network is active
ivActive.setImageResource(Util.isActive(ActivityMain.this) ? R.drawable.ic_cloud_queue_white_24dp : R.drawable.ic_cloud_off_white_24dp);
ivActive.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
int location[] = new int[2];
actionView.getLocationOnScreen(location);
Toast toast = Toast.makeText(ActivityMain.this, Util.isActive(ActivityMain.this) ? R.string.msg_active : R.string.msg_inactive, Toast.LENGTH_LONG);
toast.setGravity(
Gravity.TOP | Gravity.LEFT,
location[0] + ivActive.getLeft(),
Math.round(location[1] + ivActive.getBottom() - toast.getView().getPaddingTop()));
toast.show();
return true;
}
});
// Network is metered
ivMetered.setOnLongClickListener(new View.OnLongClickListener() {
@Override
@ -627,8 +608,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
Log.i(TAG, "Received " + intent);
Util.logExtras(intent);
if (adapter != null) {
ivActive.setImageResource(Util.isActive(ActivityMain.this) ? R.drawable.ic_cloud_queue_white_24dp : R.drawable.ic_cloud_off_white_24dp);
if (adapter != null)
if (intent.hasExtra(EXTRA_CONNECTED) && intent.hasExtra(EXTRA_METERED)) {
if (intent.getBooleanExtra(EXTRA_CONNECTED, false)) {
if (intent.getBooleanExtra(EXTRA_METERED, false))
@ -642,7 +622,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
}
} else
updateApplicationList(null);
}
}
};

View file

@ -114,11 +114,6 @@ public class Util {
}
}
public static boolean isActive(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
return (cm == null ? false : cm.getActiveNetworkInfo() != null);
}
public static boolean isConnected(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = (cm == null ? null : cm.getActiveNetworkInfo());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 784 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

View file

@ -30,14 +30,6 @@
android:layout_marginStart="16dp"
android:saveEnabled="false" />
<ImageView
android:id="@+id/ivActive"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp" />
<ImageView
android:id="@+id/ivMetered"
android:layout_width="24dp"

View file

@ -65,50 +65,6 @@
android:textAppearance="@style/TextMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_margin="4dp"
android:src="?attr/iconActive" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:text="@string/msg_active"
android:textAppearance="@style/TextMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_margin="4dp"
android:src="?attr/iconInactive" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:text="@string/msg_inactive"
android:textAppearance="@style/TextMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -197,8 +197,6 @@ Your internet traffic is not being sent to a remote VPN server.</string>
<string name="msg_start_forward" formatted="false">Start forwarding from %1$s port %2$d to %3$s:%4$d of \'%5$s\'?</string>
<string name="msg_stop_forward">Stop forwarding of %1$s port %2$d?</string>
<string name="msg_metered">Network is metered</string>
<string name="msg_active">Network is active</string>
<string name="msg_inactive">Network is inactive</string>
<string name="msg_queue">NetGuard is busy</string>
<string name="msg_update">Update available, tap to download</string>
<string name="msg_usage">You can allow (greenish) or deny (reddish) Wi-Fi or mobile internet access to by tapping on the icons next to an application</string>

View file

@ -3,8 +3,6 @@
<attr name="colorOff" format="reference" />
<attr name="expander" format="reference" />
<attr name="iconQueue" format="reference" />
<attr name="iconActive" format="reference" />
<attr name="iconInactive" format="reference" />
<attr name="iconMetered" format="reference" />
<attr name="iconSettings" format="reference" />
<attr name="iconDatasaver" format="reference" />
@ -21,8 +19,6 @@
<style name="BaseThemeDark" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="expander">@drawable/expander_black</item>
<item name="iconQueue">@drawable/ic_hourglass_empty_black_24dp</item>
<item name="iconActive">@drawable/ic_cloud_queue_black_24dp</item>
<item name="iconInactive">@drawable/ic_cloud_off_black_24dp</item>
<item name="iconMetered">@drawable/ic_attach_money_black_24dp</item>
<item name="iconSettings">@drawable/ic_settings_black_24dp</item>
<item name="iconDatasaver">@drawable/ic_perm_data_setting_black_24dp</item>
@ -36,8 +32,6 @@
<style name="BaseThemeLight" parent="Theme.AppCompat">
<item name="expander">@drawable/expander_white</item>
<item name="iconQueue">@drawable/ic_hourglass_empty_white_24dp</item>
<item name="iconActive">@drawable/ic_cloud_queue_white_24dp</item>
<item name="iconInactive">@drawable/ic_cloud_off_white_24dp</item>
<item name="iconMetered">@drawable/ic_attach_money_white_24dp</item>
<item name="iconSettings">@drawable/ic_settings_white_24dp</item>
<item name="iconDatasaver">@drawable/ic_perm_data_setting_white_24dp</item>