- The configuration and crypto model is now entirely independent of Android classes other than Nullable and TextUtils. - Model classes are immutable and use builders that enforce the appropriate optional/required attributes. - The Android config proxies (for Parcelable and databinding) are moved to the Android side of the codebase, and are designed to be safe for two-way databinding. This allows proper observability in TunnelDetailFragment. - Various robustness fixes and documentation updates to helper classes. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
55 lines
1.4 KiB
Java
55 lines
1.4 KiB
Java
/*
|
|
* Copyright © 2017-2018 WireGuard LLC. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
package com.wireguard.android.model;
|
|
|
|
import android.databinding.BaseObservable;
|
|
import android.databinding.Bindable;
|
|
import android.graphics.drawable.Drawable;
|
|
|
|
import com.wireguard.android.BR;
|
|
import com.wireguard.util.Keyed;
|
|
|
|
public class ApplicationData extends BaseObservable implements Keyed<String> {
|
|
private final Drawable icon;
|
|
private final String name;
|
|
private final String packageName;
|
|
private boolean excludedFromTunnel;
|
|
|
|
public ApplicationData(final Drawable icon, final String name, final String packageName, final boolean excludedFromTunnel) {
|
|
this.icon = icon;
|
|
this.name = name;
|
|
this.packageName = packageName;
|
|
this.excludedFromTunnel = excludedFromTunnel;
|
|
}
|
|
|
|
public Drawable getIcon() {
|
|
return icon;
|
|
}
|
|
|
|
@Override
|
|
public String getKey() {
|
|
return name;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public String getPackageName() {
|
|
return packageName;
|
|
}
|
|
|
|
@Bindable
|
|
public boolean isExcludedFromTunnel() {
|
|
return excludedFromTunnel;
|
|
}
|
|
|
|
public void setExcludedFromTunnel(final boolean excludedFromTunnel) {
|
|
this.excludedFromTunnel = excludedFromTunnel;
|
|
notifyPropertyChanged(BR.excludedFromTunnel);
|
|
}
|
|
}
|