Migrate to MDC switches
This commit is contained in:
		
							parent
							
								
									3178624b4b
								
							
						
					
					
						commit
						a1369cdd67
					
				@ -28,7 +28,7 @@ import org.fdroid.fdroid.nearby.peers.Peer;
 | 
				
			|||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import androidx.annotation.Nullable;
 | 
					import androidx.annotation.Nullable;
 | 
				
			||||||
import androidx.appcompat.widget.SwitchCompat;
 | 
					import com.google.android.material.switchmaterial.SwitchMaterial;
 | 
				
			||||||
import androidx.core.content.ContextCompat;
 | 
					import androidx.core.content.ContextCompat;
 | 
				
			||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
 | 
					import androidx.localbroadcastmanager.content.LocalBroadcastManager;
 | 
				
			||||||
import cc.mvdan.accesspoint.WifiApControl;
 | 
					import cc.mvdan.accesspoint.WifiApControl;
 | 
				
			||||||
@ -79,7 +79,7 @@ public class StartSwapView extends SwapView {
 | 
				
			|||||||
    @Nullable /* Emulators typically don't have bluetooth adapters */
 | 
					    @Nullable /* Emulators typically don't have bluetooth adapters */
 | 
				
			||||||
    private final BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();
 | 
					    private final BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private SwitchCompat bluetoothSwitch;
 | 
					    private SwitchMaterial bluetoothSwitch;
 | 
				
			||||||
    private TextView viewBluetoothId;
 | 
					    private TextView viewBluetoothId;
 | 
				
			||||||
    private TextView textBluetoothVisible;
 | 
					    private TextView textBluetoothVisible;
 | 
				
			||||||
    private TextView viewWifiId;
 | 
					    private TextView viewWifiId;
 | 
				
			||||||
@ -175,7 +175,7 @@ public class StartSwapView extends SwapView {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            textBluetoothVisible = findViewById(R.id.bluetooth_visible);
 | 
					            textBluetoothVisible = findViewById(R.id.bluetooth_visible);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            bluetoothSwitch = (SwitchCompat) findViewById(R.id.switch_bluetooth);
 | 
					            bluetoothSwitch = (SwitchMaterial) findViewById(R.id.switch_bluetooth);
 | 
				
			||||||
            bluetoothSwitch.setOnCheckedChangeListener(onBluetoothSwitchToggled);
 | 
					            bluetoothSwitch.setOnCheckedChangeListener(onBluetoothSwitchToggled);
 | 
				
			||||||
            bluetoothSwitch.setChecked(SwapService.getBluetoothVisibleUserPreference());
 | 
					            bluetoothSwitch.setChecked(SwapService.getBluetoothVisibleUserPreference());
 | 
				
			||||||
            bluetoothSwitch.setEnabled(true);
 | 
					            bluetoothSwitch.setEnabled(true);
 | 
				
			||||||
 | 
				
			|||||||
@ -72,7 +72,7 @@ import androidx.annotation.StringRes;
 | 
				
			|||||||
import androidx.appcompat.app.AlertDialog;
 | 
					import androidx.appcompat.app.AlertDialog;
 | 
				
			||||||
import androidx.appcompat.app.AppCompatActivity;
 | 
					import androidx.appcompat.app.AppCompatActivity;
 | 
				
			||||||
import androidx.appcompat.widget.SearchView;
 | 
					import androidx.appcompat.widget.SearchView;
 | 
				
			||||||
import androidx.appcompat.widget.SwitchCompat;
 | 
					import com.google.android.material.switchmaterial.SwitchMaterial;
 | 
				
			||||||
import androidx.core.content.ContextCompat;
 | 
					import androidx.core.content.ContextCompat;
 | 
				
			||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
 | 
					import androidx.localbroadcastmanager.content.LocalBroadcastManager;
 | 
				
			||||||
import cc.mvdan.accesspoint.WifiApControl;
 | 
					import cc.mvdan.accesspoint.WifiApControl;
 | 
				
			||||||
@ -775,7 +775,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
				
			|||||||
    private final BroadcastReceiver bluetoothScanModeChanged = new BroadcastReceiver() {
 | 
					    private final BroadcastReceiver bluetoothScanModeChanged = new BroadcastReceiver() {
 | 
				
			||||||
        @Override
 | 
					        @Override
 | 
				
			||||||
        public void onReceive(Context context, Intent intent) {
 | 
					        public void onReceive(Context context, Intent intent) {
 | 
				
			||||||
            SwitchCompat bluetoothSwitch = container.findViewById(R.id.switch_bluetooth);
 | 
					            SwitchMaterial bluetoothSwitch = container.findViewById(R.id.switch_bluetooth);
 | 
				
			||||||
            TextView textBluetoothVisible = container.findViewById(R.id.bluetooth_visible);
 | 
					            TextView textBluetoothVisible = container.findViewById(R.id.bluetooth_visible);
 | 
				
			||||||
            if (bluetoothSwitch == null || textBluetoothVisible == null
 | 
					            if (bluetoothSwitch == null || textBluetoothVisible == null
 | 
				
			||||||
                    || !BluetoothManager.ACTION_STATUS.equals(intent.getAction())) {
 | 
					                    || !BluetoothManager.ACTION_STATUS.equals(intent.getAction())) {
 | 
				
			||||||
@ -987,7 +987,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SwitchCompat wifiSwitch = findViewById(R.id.switch_wifi);
 | 
					        SwitchMaterial wifiSwitch = findViewById(R.id.switch_wifi);
 | 
				
			||||||
        wifiSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 | 
					        wifiSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 | 
				
			||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
 | 
					            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
 | 
				
			||||||
@ -1111,7 +1111,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
				
			|||||||
    private final BroadcastReceiver bluetoothStatus = new BroadcastReceiver() {
 | 
					    private final BroadcastReceiver bluetoothStatus = new BroadcastReceiver() {
 | 
				
			||||||
        @Override
 | 
					        @Override
 | 
				
			||||||
        public void onReceive(Context context, Intent intent) {
 | 
					        public void onReceive(Context context, Intent intent) {
 | 
				
			||||||
            SwitchCompat bluetoothSwitch = container.findViewById(R.id.switch_bluetooth);
 | 
					            SwitchMaterial bluetoothSwitch = container.findViewById(R.id.switch_bluetooth);
 | 
				
			||||||
            TextView textBluetoothVisible = container.findViewById(R.id.bluetooth_visible);
 | 
					            TextView textBluetoothVisible = container.findViewById(R.id.bluetooth_visible);
 | 
				
			||||||
            TextView textDeviceIdBluetooth = container.findViewById(R.id.device_id_bluetooth);
 | 
					            TextView textDeviceIdBluetooth = container.findViewById(R.id.device_id_bluetooth);
 | 
				
			||||||
            TextView peopleNearbyText = container.findViewById(R.id.text_people_nearby);
 | 
					            TextView peopleNearbyText = container.findViewById(R.id.text_people_nearby);
 | 
				
			||||||
 | 
				
			|||||||
@ -53,7 +53,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        </LinearLayout>
 | 
					        </LinearLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <androidx.appcompat.widget.SwitchCompat
 | 
					        <com.google.android.material.switchmaterial.SwitchMaterial
 | 
				
			||||||
                android:layout_width="wrap_content"
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
                android:layout_height="wrap_content"
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
                android:enabled="false"
 | 
					                android:enabled="false"
 | 
				
			||||||
@ -110,7 +110,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        </LinearLayout>
 | 
					        </LinearLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <androidx.appcompat.widget.SwitchCompat
 | 
					        <com.google.android.material.switchmaterial.SwitchMaterial
 | 
				
			||||||
                android:layout_width="wrap_content"
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
                android:layout_height="wrap_content"
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
                android:id="@+id/switch_wifi"/>
 | 
					                android:id="@+id/switch_wifi"/>
 | 
				
			||||||
 | 
				
			|||||||
@ -56,7 +56,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    </LinearLayout>
 | 
					    </LinearLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <androidx.appcompat.widget.SwitchCompat
 | 
					    <com.google.android.material.switchmaterial.SwitchMaterial
 | 
				
			||||||
        android:id="@+id/repo_switch"
 | 
					        android:id="@+id/repo_switch"
 | 
				
			||||||
        android:layout_width="wrap_content"
 | 
					        android:layout_width="wrap_content"
 | 
				
			||||||
        android:layout_height="match_parent"/>
 | 
					        android:layout_height="match_parent"/>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user