From 3e46d984819dcadd665b0ea6c20982c03ed22de1 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Mon, 27 Jan 2014 06:18:11 +0000 Subject: [PATCH] Use the tunnel type ImageView to show tunnel status --- src/net/i2p/android/router/MainFragment.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/net/i2p/android/router/MainFragment.java b/src/net/i2p/android/router/MainFragment.java index 6d3863043..2589e75a5 100644 --- a/src/net/i2p/android/router/MainFragment.java +++ b/src/net/i2p/android/router/MainFragment.java @@ -1,13 +1,13 @@ package net.i2p.android.router; import android.app.Activity; +import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.ViewGroup.LayoutParams; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TableLayout; @@ -410,25 +410,20 @@ public class MainFragment extends I2PFragmentBase { dest.addView(destName); // Status - ImageView status = new ImageView(getActivity()); LeaseSet ls = ctx.netDb().lookupLeaseSetLocally(h); if (ls != null && ctx.tunnelManager().getOutboundClientTunnelCount(h) > 0) { long timeToExpire = ls.getEarliestLeaseDate() - ctx.clock().now(); if (timeToExpire < 0) { // red or yellow light - status.setImageDrawable(getActivity().getResources() - .getDrawable(R.drawable.local_inprogress)); + type.setBackgroundColor(Color.TRANSPARENT); } else { // green light - status.setImageDrawable(getActivity().getResources() - .getDrawable(R.drawable.local_up)); + type.setBackgroundColor(Color.GREEN); } } else { // yellow light - status.setImageDrawable(getActivity().getResources() - .getDrawable(R.drawable.local_inprogress)); + type.setBackgroundColor(Color.TRANSPARENT); } - dest.addView(status); dests.addView(dest); } -- GitLab