Layout improvement

This commit is contained in:
M66B 2016-02-19 09:43:14 +01:00
parent bb2b9a9d44
commit c992aa56fe
3 changed files with 19 additions and 14 deletions

View File

@ -100,6 +100,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/objectFiles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-rules" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />

View File

@ -64,8 +64,9 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
private static final String TAG = "NetGuard.Main";
private boolean running = false;
private SwitchCompat swEnabled;
private ImageView ivIcon;
private ImageView ivQueue;
private SwitchCompat swEnabled;
private ImageView ivMetered;
private SwipeRefreshLayout swipeRefresh;
private AdapterRule adapter = null;
@ -126,9 +127,9 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
// Action bar
final View actionView = getLayoutInflater().inflate(R.layout.actionmain, null, false);
ImageView ivIcon = (ImageView) actionView.findViewById(R.id.ivIcon);
swEnabled = (SwitchCompat) actionView.findViewById(R.id.swEnabled);
ivIcon = (ImageView) actionView.findViewById(R.id.ivIcon);
ivQueue = (ImageView) actionView.findViewById(R.id.ivQueue);
swEnabled = (SwitchCompat) actionView.findViewById(R.id.swEnabled);
ivMetered = (ImageView) actionView.findViewById(R.id.ivMetered);
// Icon, no title
@ -517,7 +518,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
Log.i(TAG, "Received " + intent);
Util.logExtras(intent);
int size = intent.getIntExtra(EXTRA_SIZE, -1);
ivQueue.setVisibility(size == 0 ? View.INVISIBLE : View.VISIBLE);
ivIcon.setVisibility(size == 0 ? View.VISIBLE : View.GONE);
ivQueue.setVisibility(size == 0 ? View.GONE : View.VISIBLE);
}
};

View File

@ -6,10 +6,20 @@
<ImageView
android:id="@+id/ivIcon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_security_white_24dp" />
<ImageView
android:id="@+id/ivQueue"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_security_white_24dp" />
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:src="@drawable/ic_hourglass_empty_white_24dp"
android:visibility="gone" />
<android.support.v7.widget.SwitchCompat
android:id="@+id/swEnabled"
@ -21,20 +31,12 @@
android:saveEnabled="false" />
<ImageView
android:id="@+id/ivQueue"
android:id="@+id/ivMetered"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_hourglass_empty_white_24dp"
android:visibility="invisible" />
<ImageView
android:id="@+id/ivMetered"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_attach_money_white_24dp"
android:visibility="invisible" />
</LinearLayout>