Show metered indication
|
@ -90,6 +90,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
private View actionView;
|
||||
private ImageView ivInteractive;
|
||||
private ImageView ivNetwork;
|
||||
private ImageView ivMetered;
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RuleAdapter adapter = null;
|
||||
private MenuItem menuSearch = null;
|
||||
|
@ -128,6 +129,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
SwitchCompat swEnabled = (SwitchCompat) actionView.findViewById(R.id.swEnabled);
|
||||
ivInteractive = (ImageView) actionView.findViewById(R.id.ivInteractive);
|
||||
ivNetwork = (ImageView) actionView.findViewById(R.id.ivNetwork);
|
||||
ivMetered = (ImageView) actionView.findViewById(R.id.ivMetered);
|
||||
getSupportActionBar().setDisplayShowCustomEnabled(true);
|
||||
getSupportActionBar().setCustomView(actionView);
|
||||
|
||||
|
@ -319,14 +321,17 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
Util.logExtras(TAG, intent);
|
||||
|
||||
ivNetwork.setVisibility(View.VISIBLE);
|
||||
ivMetered.setVisibility(View.VISIBLE);
|
||||
|
||||
if (Util.isMetered(context)) {
|
||||
if (Util.isWifiActive(context))
|
||||
ivNetwork.setImageLevel(1);
|
||||
else {
|
||||
if (Util.isRoaming(context))
|
||||
ivNetwork.setImageLevel(3);
|
||||
else
|
||||
ivNetwork.setImageLevel(2);
|
||||
} else
|
||||
ivNetwork.setImageLevel(1);
|
||||
}
|
||||
ivMetered.setImageLevel(Util.isMetered(context) ? 1 : 0);
|
||||
|
||||
actionView.postInvalidate();
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 397 B |
After Width: | Height: | Size: 366 B |
After Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 255 B |
After Width: | Height: | Size: 448 B |
After Width: | Height: | Size: 428 B |
After Width: | Height: | Size: 640 B |
After Width: | Height: | Size: 607 B |
After Width: | Height: | Size: 819 B |
After Width: | Height: | Size: 742 B |
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/ic_money_off_white_24dp"
|
||||
android:maxLevel="0"
|
||||
android:minLevel="0" />
|
||||
<item
|
||||
android:drawable="@drawable/ic_attach_money_white_24dp"
|
||||
android:maxLevel="1"
|
||||
android:minLevel="1" />
|
||||
</level-list>
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/ivInteractive"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@drawable/ic_perm_identity_white_24dp"
|
||||
|
@ -22,10 +22,19 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/ivNetwork"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="4dp"
|
||||
android:src="@drawable/network"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivMetered"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="4dp"
|
||||
android:src="@drawable/metered"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|