I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 3e46d984 authored by str4d's avatar str4d
Browse files

Use the tunnel type ImageView to show tunnel status

parent 124b1499
No related branches found
No related tags found
No related merge requests found
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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment