diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-09-03 08:14:48 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-09-03 10:13:36 +0000 |
| commit | 37a8f67af8cb67abb68728094443b03e415e8c18 (patch) | |
| tree | 79514e0893a7813a46385d8164cc7b346be558a3 /android/src/main | |
| parent | e95dd9792fb8107a6cc0f472a711c183b4fe9fed (diff) | |
| download | mullvadvpn-37a8f67af8cb67abb68728094443b03e415e8c18.tar.xz mullvadvpn-37a8f67af8cb67abb68728094443b03e415e8c18.zip | |
Use new `SwitchLocationButton` widget
Diffstat (limited to 'android/src/main')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt | 9 | ||||
| -rw-r--r-- | android/src/main/res/layout/connect.xml | 10 |
2 files changed, 9 insertions, 10 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt index 4c2d498baf..b1a4f6f2cb 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt @@ -13,6 +13,7 @@ import net.mullvad.mullvadvpn.ui.notification.TunnelStateNotification import net.mullvad.mullvadvpn.ui.notification.VersionInfoNotification import net.mullvad.mullvadvpn.ui.widget.HeaderBar import net.mullvad.mullvadvpn.ui.widget.NotificationBanner +import net.mullvad.mullvadvpn.ui.widget.SwitchLocationButton import org.joda.time.DateTime val KEY_IS_TUNNEL_INFO_EXPANDED = "is_tunnel_info_expanded" @@ -68,8 +69,9 @@ class ConnectFragment : ServiceDependentFragment(OnNoService.GoToLaunchScreen) { onDisconnect = { connectionProxy.disconnect() } } - switchLocationButton = SwitchLocationButton(view, resources) - switchLocationButton.onClick = { openSwitchLocationScreen() } + switchLocationButton = view.findViewById<SwitchLocationButton>(R.id.switch_location).apply { + onClick = { openSwitchLocationScreen() } + } return view } @@ -122,7 +124,6 @@ class ConnectFragment : ServiceDependentFragment(OnNoService.GoToLaunchScreen) { override fun onSafelyDestroyView() { notificationBanner.onDestroy() - switchLocationButton.onDestroy() } override fun onSafelySaveInstanceState(state: Bundle) { @@ -136,7 +137,7 @@ class ConnectFragment : ServiceDependentFragment(OnNoService.GoToLaunchScreen) { status.setState(realState) actionButton.tunnelState = uiState - switchLocationButton.state = uiState + switchLocationButton.tunnelState = uiState } private fun openSwitchLocationScreen() { diff --git a/android/src/main/res/layout/connect.xml b/android/src/main/res/layout/connect.xml index a7887e5076..7fd06fd4bc 100644 --- a/android/src/main/res/layout/connect.xml +++ b/android/src/main/res/layout/connect.xml @@ -121,12 +121,10 @@ android:paddingHorizontal="@dimen/side_margin" android:paddingTop="@dimen/button_separation" android:paddingBottom="@dimen/screen_vertical_margin"> - <Button android:id="@+id/switch_location" - android:layout_marginBottom="@dimen/button_separation" - android:paddingHorizontal="9dp" - android:text="@string/switch_location" - android:drawableRight="@drawable/icon_chevron" - style="@style/White20Button" /> + <net.mullvad.mullvadvpn.ui.widget.SwitchLocationButton android:id="@+id/switch_location" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/button_separation" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> |
