mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-18 06:37:47 +01:00
Improve discovery activity internationalization
This commit is contained in:
parent
4bc2032a55
commit
8a54f5dd1c
@ -18,6 +18,7 @@ package nodomain.freeyourgadget.gadgetbridge.adapter;
|
|||||||
|
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -25,6 +26,7 @@ import android.widget.ArrayAdapter;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
@ -65,27 +67,24 @@ public class DeviceCandidateAdapter extends ArrayAdapter<GBDeviceCandidate> {
|
|||||||
deviceAddressLabel.setText(device.getMacAddress());
|
deviceAddressLabel.setText(device.getMacAddress());
|
||||||
deviceImageView.setImageResource(device.getDeviceType().getIcon());
|
deviceImageView.setImageResource(device.getDeviceType().getIcon());
|
||||||
|
|
||||||
String status = "";
|
final List<String> statusLines = new ArrayList<>();
|
||||||
if (device.getDevice().getBondState() == BluetoothDevice.BOND_BONDED) {
|
if (device.getDevice().getBondState() == BluetoothDevice.BOND_BONDED) {
|
||||||
status += getContext().getString(R.string.device_is_currently_bonded);
|
statusLines.add(getContext().getString(R.string.device_is_currently_bonded));
|
||||||
if (!GBApplication.getPrefs().getBoolean("ignore_bonded_devices", true)) { // This could be passed to the constructor instead
|
if (!GBApplication.getPrefs().getBoolean("ignore_bonded_devices", true)) { // This could be passed to the constructor instead
|
||||||
deviceImageView.setImageResource(device.getDeviceType().getDisabledIcon());
|
deviceImageView.setImageResource(device.getDeviceType().getDisabledIcon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!device.getDeviceType().isSupported()) {
|
if (!device.getDeviceType().isSupported()) {
|
||||||
status += " UNSUPPORTED";
|
statusLines.add(getContext().getString(R.string.device_unsupported));
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
|
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
|
||||||
if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_REQUIRE_KEY) {
|
if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_REQUIRE_KEY) {
|
||||||
if (device.getDevice().getBondState() == BluetoothDevice.BOND_BONDED) {
|
statusLines.add(getContext().getString(R.string.device_requires_key));
|
||||||
status += "\n";
|
|
||||||
}
|
|
||||||
status += getContext().getString(R.string.device_requires_key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceStatus.setText(status);
|
deviceStatus.setText(TextUtils.join("\n", statusLines));
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Bluetooth scan:" />
|
android:text="@string/discovery_bluetooth_scan" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/discovery_progressbar"
|
android:id="@+id/discovery_progressbar"
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Bluetooth LE scan:" />
|
android:text="@string/discovery_bluetooth_le_scan" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/discovery_ble_progressbar"
|
android:id="@+id/discovery_ble_progressbar"
|
||||||
|
@ -379,6 +379,8 @@
|
|||||||
<string name="title_activity_discovery">Device discovery</string>
|
<string name="title_activity_discovery">Device discovery</string>
|
||||||
<string name="discovery_stop_scanning">Stop scanning</string>
|
<string name="discovery_stop_scanning">Stop scanning</string>
|
||||||
<string name="discovery_start_scanning">Start discovery</string>
|
<string name="discovery_start_scanning">Start discovery</string>
|
||||||
|
<string name="discovery_bluetooth_scan">Bluetooth scan:</string>
|
||||||
|
<string name="discovery_bluetooth_le_scan">Bluetooth LE scan:</string>
|
||||||
<string name="action_discover">Connect new device</string>
|
<string name="action_discover">Connect new device</string>
|
||||||
<string name="device_with_rssi">%1$s (%2$s)</string>
|
<string name="device_with_rssi">%1$s (%2$s)</string>
|
||||||
<string name="title_activity_android_pairing">Pair device</string>
|
<string name="title_activity_android_pairing">Pair device</string>
|
||||||
@ -1102,6 +1104,7 @@
|
|||||||
<string name="error_background_service_reason_truncated">Starting the background service failed because…</string>
|
<string name="error_background_service_reason_truncated">Starting the background service failed because…</string>
|
||||||
<string name="device_is_currently_bonded">ALREADY BONDED</string>
|
<string name="device_is_currently_bonded">ALREADY BONDED</string>
|
||||||
<string name="device_requires_key">KEY REQUIRED</string>
|
<string name="device_requires_key">KEY REQUIRED</string>
|
||||||
|
<string name="device_unsupported">UNSUPPORTED</string>
|
||||||
<string name="error_background_service_reason">Starting the background service failed because of an exception. Error: </string>
|
<string name="error_background_service_reason">Starting the background service failed because of an exception. Error: </string>
|
||||||
<string name="pref_check_permission_status">Check permission status</string>
|
<string name="pref_check_permission_status">Check permission status</string>
|
||||||
<string name="pref_check_permission_status_summary">Check and ask for missing permissions even when they might not be instantly needed. Disable this only if your devices actually doesn\'t support any of these features. Not granting a permission might cause issues!</string>
|
<string name="pref_check_permission_status_summary">Check and ask for missing permissions even when they might not be instantly needed. Disable this only if your devices actually doesn\'t support any of these features. Not granting a permission might cause issues!</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user