mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-18 14:31:23 +02:00
fixed bug for fetching strings, see issue #608
This commit is contained in:
@@ -67,8 +67,6 @@ import java.util.Map;
|
|||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class BluetoothSettingsFragment extends Fragment {
|
public class BluetoothSettingsFragment extends Fragment {
|
||||||
private Context context;
|
|
||||||
|
|
||||||
public static final String PREFERENCE_KEY_BLUETOOTH_DEVICE_NAME = "btDeviceName";
|
public static final String PREFERENCE_KEY_BLUETOOTH_DEVICE_NAME = "btDeviceName";
|
||||||
public static final String PREFERENCE_KEY_BLUETOOTH_HW_ADDRESS = "btHwAddress";
|
public static final String PREFERENCE_KEY_BLUETOOTH_HW_ADDRESS = "btHwAddress";
|
||||||
|
|
||||||
@@ -86,8 +84,6 @@ public class BluetoothSettingsFragment extends Fragment {
|
|||||||
|
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
context = getContext();
|
|
||||||
|
|
||||||
deviceListView = root.findViewById(R.id.deviceListView);
|
deviceListView = root.findViewById(R.id.deviceListView);
|
||||||
txtSearching = root.findViewById(R.id.txtSearching);
|
txtSearching = root.findViewById(R.id.txtSearching);
|
||||||
progressBar = root.findViewById(R.id.progressBar);
|
progressBar = root.findViewById(R.id.progressBar);
|
||||||
@@ -156,9 +152,9 @@ public class BluetoothSettingsFragment extends Fragment {
|
|||||||
txtSearching.setText(R.string.label_bluetooth_searching_finished);
|
txtSearching.setText(R.string.label_bluetooth_searching_finished);
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
BluetoothDeviceView notSupported = new BluetoothDeviceView(context);
|
BluetoothDeviceView notSupported = new BluetoothDeviceView(getContext());
|
||||||
notSupported.setDeviceName(getString(R.string.label_scale_not_supported));
|
notSupported.setDeviceName(getContext().getString(R.string.label_scale_not_supported));
|
||||||
notSupported.setSummaryText(getString(R.string.label_click_to_help_add_support));
|
notSupported.setSummaryText(getContext().getString(R.string.label_click_to_help_add_support));
|
||||||
notSupported.setOnClickListener(new View.OnClickListener() {
|
notSupported.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@@ -207,7 +203,7 @@ public class BluetoothSettingsFragment extends Fragment {
|
|||||||
Timber.d("Found unsupported device %s",
|
Timber.d("Found unsupported device %s",
|
||||||
formatDeviceName(device));
|
formatDeviceName(device));
|
||||||
deviceView.setIcon(R.drawable.ic_bluetooth_device_not_supported);
|
deviceView.setIcon(R.drawable.ic_bluetooth_device_not_supported);
|
||||||
deviceView.setSummaryText(getString(R.string.label_bt_device_no_support));
|
deviceView.setSummaryText(getContext().getString(R.string.label_bt_device_no_support));
|
||||||
deviceView.setEnabled(false);
|
deviceView.setEnabled(false);
|
||||||
|
|
||||||
if (OpenScale.DEBUG_MODE) {
|
if (OpenScale.DEBUG_MODE) {
|
||||||
@@ -346,7 +342,7 @@ public class BluetoothSettingsFragment extends Fragment {
|
|||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
BluetoothDevice device = foundDevices.get(getDeviceAddress());
|
BluetoothDevice device = foundDevices.get(getDeviceAddress());
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
|
|
||||||
prefs.edit()
|
prefs.edit()
|
||||||
.putString(PREFERENCE_KEY_BLUETOOTH_HW_ADDRESS, device.getAddress())
|
.putString(PREFERENCE_KEY_BLUETOOTH_HW_ADDRESS, device.getAddress())
|
||||||
|
Reference in New Issue
Block a user