Skip to content

Commit

Permalink
feat: Show APP version on status bar in network list page
Browse files Browse the repository at this point in the history
  • Loading branch information
kaaass committed Jul 11, 2023
1 parent fde9f0d commit 1781d23
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.zerotier.sdk.Version;
import com.zerotier.sdk.VirtualNetworkConfig;

import net.kaaass.zerotierfix.BuildConfig;
import net.kaaass.zerotierfix.R;
import net.kaaass.zerotierfix.ZerotierFixApplication;
import net.kaaass.zerotierfix.events.AfterJoinNetworkEvent;
Expand Down Expand Up @@ -232,6 +233,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
this.nodeStatusView = view.findViewById(R.id.node_status);
this.nodeClientVersionView = view.findViewById(R.id.client_version);
setNodeIdText();
TextView appVersionView = view.findViewById(R.id.app_version);
appVersionView.setText(String.format(getString(R.string.app_version_format),
BuildConfig.VERSION_NAME));

// 加载网络数据
updateNetworkListAndNotify();
Expand Down
13 changes: 11 additions & 2 deletions app/src/main/res/layout/fragment_network_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/node_id"
android:layout_toEndOf="@+id/node_id"
android:padding="5dp"
android:text="@string/status_offline"
android:textColor="?attr/lightGreyText" />
Expand All @@ -73,10 +73,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/node_status"
android:layout_toEndOf="@+id/node_status"
android:padding="5dp"
android:text="@string/unknown_version"
android:textColor="?attr/lightGreyText" />

<TextView
android:id="@+id/app_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/client_version"
android:text="@string/unknown_version"
android:textColor="?attr/lightGreyText" />
</RelativeLayout>

</RelativeLayout>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,5 @@
<string name="toast_network_status_authentication_required">无法连接至网络 %1$s: 需要授权</string>
<string name="toast_vpn_error">VPN 服务发生错误!%1$s</string>
<string name="empty_network_name">未知</string>
<string name="app_version_format">(APP: %s)</string>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<string name="moon_orbit_exist">Moon Orbit information exists!</string>
<string name="moon_orbit_add_success">Moon orbit added successfully.</string>
<string name="moon_orbit_delete_success">Moon orbit deleted successfully. Disconnect &amp; reconnect for this setting to take effect.</string>
<string name="unknown_version" translatable="false">-</string>
<string name="unknown_version" translatable="false">-.-.-</string>
<string name="network_connected">Connected</string>
<string name="connected_to_network">Connected to %s</string>
<string name="network_detail">Network Detail</string>
Expand Down Expand Up @@ -148,4 +148,5 @@
<string name="toast_network_status_authentication_required">Cannot connect to network %1$s: Authorization required</string>
<string name="toast_vpn_error">A VPN service error has occurred! %1$s</string>
<string name="empty_network_name">Unknown</string>
<string name="app_version_format">(APP: %s)</string>
</resources>

0 comments on commit 1781d23

Please sign in to comment.