Migrate to MDC switches

This commit is contained in:
proletarius101 2021-05-18 07:47:39 +08:00 committed by Hans-Christoph Steiner
parent 3178624b4b
commit a1369cdd67
4 changed files with 10 additions and 10 deletions

View File

@ -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);

View File

@ -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);

View File

@ -53,7 +53,7 @@
</LinearLayout>
<androidx.appcompat.widget.SwitchCompat
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
@ -110,7 +110,7 @@
</LinearLayout>
<androidx.appcompat.widget.SwitchCompat
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/switch_wifi"/>

View File

@ -56,7 +56,7 @@
</LinearLayout>
<androidx.appcompat.widget.SwitchCompat
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/repo_switch"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>