TunnelDetailFragment: Remove state text and last change
Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
parent
dbed7155d6
commit
193de10972
@ -12,8 +12,6 @@ import com.wireguard.android.util.ExceptionLoggers;
|
|||||||
import com.wireguard.android.util.Keyed;
|
import com.wireguard.android.util.Keyed;
|
||||||
import com.wireguard.config.Config;
|
import com.wireguard.config.Config;
|
||||||
|
|
||||||
import org.threeten.bp.Instant;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -33,7 +31,6 @@ public class Tunnel extends BaseObservable implements Keyed<String> {
|
|||||||
private final ConfigStore configStore;
|
private final ConfigStore configStore;
|
||||||
private final String name;
|
private final String name;
|
||||||
private Config config;
|
private Config config;
|
||||||
private Instant lastStateChange = Instant.EPOCH;
|
|
||||||
private State state = State.UNKNOWN;
|
private State state = State.UNKNOWN;
|
||||||
private Statistics statistics;
|
private Statistics statistics;
|
||||||
|
|
||||||
@ -67,11 +64,6 @@ public class Tunnel extends BaseObservable implements Keyed<String> {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bindable
|
|
||||||
public Instant getLastStateChange() {
|
|
||||||
return lastStateChange;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bindable
|
@Bindable
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
@ -106,10 +98,6 @@ public class Tunnel extends BaseObservable implements Keyed<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onStateChanged(final State oldState, final State newState) {
|
private void onStateChanged(final State oldState, final State newState) {
|
||||||
if (oldState != State.UNKNOWN) {
|
|
||||||
lastStateChange = Instant.now();
|
|
||||||
notifyPropertyChanged(BR.lastStateChange);
|
|
||||||
}
|
|
||||||
if (newState != State.UP)
|
if (newState != State.UP)
|
||||||
setStatisticsInternal(null);
|
setStatisticsInternal(null);
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,23 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/interface_title"
|
android:id="@+id/interface_title"
|
||||||
style="?android:attr/textAppearanceMedium"
|
style="?android:attr/textAppearanceMedium"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_toStartOf="@+id/tunnel_switch"
|
||||||
android:text="@string/iface" />
|
android:text="@string/iface" />
|
||||||
|
|
||||||
|
<com.wireguard.android.widget.ToggleSwitch
|
||||||
|
android:id="@+id/tunnel_switch"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBaseline="@+id/interface_title"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:enabled="@{tunnel.state != State.UNKNOWN}"
|
||||||
|
app:checked="@{tunnel.state == State.UP}"
|
||||||
|
app:onBeforeCheckedChanged="@{() -> tunnel.setState(State.TOGGLE)}" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/interface_name_label"
|
android:id="@+id/interface_name_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -60,57 +72,11 @@
|
|||||||
android:layout_below="@+id/interface_name_label"
|
android:layout_below="@+id/interface_name_label"
|
||||||
android:text="@{tunnel.name}" />
|
android:text="@{tunnel.name}" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/status_label"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/interface_name_text"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:labelFor="@+id/status_text"
|
|
||||||
android:text="@string/status" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/status_text"
|
|
||||||
style="?android:attr/textAppearanceMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_below="@+id/status_label"
|
|
||||||
android:layout_toStartOf="@+id/tunnel_switch"
|
|
||||||
android:text="@{tunnel.state.name}" />
|
|
||||||
|
|
||||||
<com.wireguard.android.widget.ToggleSwitch
|
|
||||||
android:id="@+id/tunnel_switch"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignBaseline="@+id/status_text"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:enabled="@{tunnel.state != State.UNKNOWN}"
|
|
||||||
app:checked="@{tunnel.state == State.UP}"
|
|
||||||
app:onBeforeCheckedChanged="@{() -> tunnel.setState(State.TOGGLE)}" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/last_change_label"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/status_text"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:labelFor="@+id/last_change_text"
|
|
||||||
android:text="@string/last_change" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/last_change_text"
|
|
||||||
style="?android:attr/textAppearanceMedium"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/last_change_label"
|
|
||||||
android:text="@{tunnel.lastStateChange}" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/public_key_label"
|
android:id="@+id/public_key_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/last_change_text"
|
android:layout_below="@id/interface_name_text"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:labelFor="@+id/public_key_text"
|
android:labelFor="@+id/public_key_text"
|
||||||
android:text="@string/public_key" />
|
android:text="@string/public_key" />
|
||||||
|
Loading…
Reference in New Issue
Block a user