Исправлено переключение локали на экране сканера
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.dinect.checker"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0.5">
|
||||
android:versionName="1.1.0">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
|
||||
@@ -210,8 +210,10 @@ public abstract class AbstractScannerActivity extends AppCompatActivity {
|
||||
} else {
|
||||
handleFail(card);
|
||||
}
|
||||
break;
|
||||
case 204:
|
||||
handleFail(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (final IOException | JSONException e) {
|
||||
|
||||
@@ -111,6 +111,14 @@ public class MainActivity extends FlutterActivity {
|
||||
result.success(connected);
|
||||
}
|
||||
|
||||
private void setLocale(String locale) {
|
||||
Resources res = getResources();
|
||||
Configuration configuration = new Configuration(res.getConfiguration());
|
||||
configuration.locale = new Locale(locale);
|
||||
Locale.setDefault(configuration.locale);
|
||||
res.updateConfiguration(configuration, res.getDisplayMetrics());
|
||||
}
|
||||
|
||||
private void startScannerActivity() {
|
||||
final int idx = getSharedPreferences("scanner", Context.MODE_PRIVATE).getInt(SCANNER_BACKEND_KEY, 0);
|
||||
Intent cameraIntent = new Intent(MainActivity.this, SCANNER_BACKEND[idx]);
|
||||
@@ -118,6 +126,7 @@ public class MainActivity extends FlutterActivity {
|
||||
cameraIntent.putExtra(PREF_APP_TOKEN, (String) mScannerArgs.get("appToken"));
|
||||
cameraIntent.putExtra(PREF_POS_TOKEN, (String) mScannerArgs.get("token"));
|
||||
cameraIntent.putExtra(PREF_APP_BAR_COLOR, (Long) mScannerArgs.get("color"));
|
||||
setLocale((String) mScannerArgs.get("locale"));
|
||||
startActivityForResult(cameraIntent, START_SCANNER_REQUEST_CODE);
|
||||
}
|
||||
|
||||
@@ -161,6 +170,10 @@ public class MainActivity extends FlutterActivity {
|
||||
|
||||
}
|
||||
|
||||
public void setUserLocale() {
|
||||
|
||||
}
|
||||
|
||||
public void startScanner() {
|
||||
|
||||
}
|
||||
|
||||
@@ -51,9 +51,6 @@ public class ScannerActivity extends AbstractScannerActivity
|
||||
initToolbar(getIntent());
|
||||
|
||||
scannerView = (ZXingScannerView) initScanner();
|
||||
ArrayList<BarcodeFormat> formats = new ArrayList<>();
|
||||
formats.add(BarcodeFormat.UPC_EAN_EXTENSION);
|
||||
scannerView.setFormats(formats);
|
||||
addScanner(scannerView, R.id.zxingRoot);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user