From a1369cdd673300ee55764ab3fd317a17b7517c05 Mon Sep 17 00:00:00 2001 From: proletarius101 Date: Tue, 18 May 2021 07:47:39 +0800 Subject: [PATCH] Migrate to MDC switches --- .../full/java/org/fdroid/fdroid/nearby/StartSwapView.java | 6 +++--- .../org/fdroid/fdroid/nearby/SwapWorkflowActivity.java | 8 ++++---- app/src/full/res/layout/swap_start_swap.xml | 4 ++-- app/src/main/res/layout/repo_item.xml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/full/java/org/fdroid/fdroid/nearby/StartSwapView.java b/app/src/full/java/org/fdroid/fdroid/nearby/StartSwapView.java index ab5f45440..4b699a842 100644 --- a/app/src/full/java/org/fdroid/fdroid/nearby/StartSwapView.java +++ b/app/src/full/java/org/fdroid/fdroid/nearby/StartSwapView.java @@ -28,7 +28,7 @@ import org.fdroid.fdroid.nearby.peers.Peer; import java.util.ArrayList; import androidx.annotation.Nullable; -import androidx.appcompat.widget.SwitchCompat; +import com.google.android.material.switchmaterial.SwitchMaterial; import androidx.core.content.ContextCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import cc.mvdan.accesspoint.WifiApControl; @@ -79,7 +79,7 @@ public class StartSwapView extends SwapView { @Nullable /* Emulators typically don't have bluetooth adapters */ private final BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter(); - private SwitchCompat bluetoothSwitch; + private SwitchMaterial bluetoothSwitch; private TextView viewBluetoothId; private TextView textBluetoothVisible; private TextView viewWifiId; @@ -175,7 +175,7 @@ public class StartSwapView extends SwapView { textBluetoothVisible = findViewById(R.id.bluetooth_visible); - bluetoothSwitch = (SwitchCompat) findViewById(R.id.switch_bluetooth); + bluetoothSwitch = (SwitchMaterial) findViewById(R.id.switch_bluetooth); bluetoothSwitch.setOnCheckedChangeListener(onBluetoothSwitchToggled); bluetoothSwitch.setChecked(SwapService.getBluetoothVisibleUserPreference()); bluetoothSwitch.setEnabled(true); diff --git a/app/src/full/java/org/fdroid/fdroid/nearby/SwapWorkflowActivity.java b/app/src/full/java/org/fdroid/fdroid/nearby/SwapWorkflowActivity.java index d8ecdeec7..e05205d86 100644 --- a/app/src/full/java/org/fdroid/fdroid/nearby/SwapWorkflowActivity.java +++ b/app/src/full/java/org/fdroid/fdroid/nearby/SwapWorkflowActivity.java @@ -72,7 +72,7 @@ import androidx.annotation.StringRes; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.SearchView; -import androidx.appcompat.widget.SwitchCompat; +import com.google.android.material.switchmaterial.SwitchMaterial; import androidx.core.content.ContextCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import cc.mvdan.accesspoint.WifiApControl; @@ -775,7 +775,7 @@ public class SwapWorkflowActivity extends AppCompatActivity { private final BroadcastReceiver bluetoothScanModeChanged = new BroadcastReceiver() { @Override 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); if (bluetoothSwitch == null || textBluetoothVisible == null || !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() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @@ -1111,7 +1111,7 @@ public class SwapWorkflowActivity extends AppCompatActivity { private final BroadcastReceiver bluetoothStatus = new BroadcastReceiver() { @Override 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 textDeviceIdBluetooth = container.findViewById(R.id.device_id_bluetooth); TextView peopleNearbyText = container.findViewById(R.id.text_people_nearby); diff --git a/app/src/full/res/layout/swap_start_swap.xml b/app/src/full/res/layout/swap_start_swap.xml index 6fdc72f0d..980e8d843 100644 --- a/app/src/full/res/layout/swap_start_swap.xml +++ b/app/src/full/res/layout/swap_start_swap.xml @@ -53,7 +53,7 @@ - - diff --git a/app/src/main/res/layout/repo_item.xml b/app/src/main/res/layout/repo_item.xml index 413558fcf..ea84af999 100644 --- a/app/src/main/res/layout/repo_item.xml +++ b/app/src/main/res/layout/repo_item.xml @@ -56,7 +56,7 @@ -