ConfigDetailFragment: wire up toggle switch
Finally no gross colors. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
		
							parent
							
								
									6bc6aea2d0
								
							
						
					
					
						commit
						2cc7f6c2ea
					
				@ -5,6 +5,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <data>
 | 
					    <data>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <import type="com.wireguard.android.backends.VpnService" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <variable
 | 
					        <variable
 | 
				
			||||||
            name="config"
 | 
					            name="config"
 | 
				
			||||||
            type="com.wireguard.config.Config" />
 | 
					            type="com.wireguard.config.Config" />
 | 
				
			||||||
@ -39,19 +41,17 @@
 | 
				
			|||||||
                    android:layout_alignParentStart="true"
 | 
					                    android:layout_alignParentStart="true"
 | 
				
			||||||
                    android:layout_alignParentTop="true"
 | 
					                    android:layout_alignParentTop="true"
 | 
				
			||||||
                    android:layout_marginBottom="8dp"
 | 
					                    android:layout_marginBottom="8dp"
 | 
				
			||||||
 | 
					                    android:layout_toStartOf="@+id/config_switch"
 | 
				
			||||||
                    android:text="@string/status" />
 | 
					                    android:text="@string/status" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                <TextView
 | 
					                <com.wireguard.android.widgets.ToggleSwitch
 | 
				
			||||||
                    android:id="@+id/status_text"
 | 
					                    android:id="@+id/config_switch"
 | 
				
			||||||
                    style="?android:attr/textAppearanceMedium"
 | 
					 | 
				
			||||||
                    android:layout_width="wrap_content"
 | 
					                    android:layout_width="wrap_content"
 | 
				
			||||||
                    android:layout_height="wrap_content"
 | 
					                    android:layout_height="wrap_content"
 | 
				
			||||||
                    android:layout_alignBaseline="@+id/status_label"
 | 
					                    android:layout_alignBaseline="@+id/status_label"
 | 
				
			||||||
                    android:layout_alignParentEnd="true"
 | 
					                    android:layout_alignParentEnd="true"
 | 
				
			||||||
                    android:layout_toEndOf="@+id/status_label"
 | 
					                    app:checked="@{config.enabled}"
 | 
				
			||||||
                    android:gravity="end"
 | 
					                    app:onBeforeCheckedChanged="@{(v, checked) -> checked ? VpnService.instance.enable(config.name) : VpnService.instance.disable(config.name)}" />
 | 
				
			||||||
                    android:text="@{config.enabled ? @string/enabled : @string/disabled}"
 | 
					 | 
				
			||||||
                    android:textColor="@{config.enabled ? @android:color/holo_green_dark : @android:color/holo_red_dark}" />
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                <TextView
 | 
					                <TextView
 | 
				
			||||||
                    android:id="@+id/public_key_label"
 | 
					                    android:id="@+id/public_key_label"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user