SD-230 #31
@ -25,6 +25,7 @@ public abstract class AbstractLiveActivity extends AppCompatActivity {
|
||||
public abstract void vehicleStatusReceived(long imei, int opCode, int status); // --> UpdateOptions
|
||||
public abstract void emergencyAlarmReceived(int position, double lat, double lng); // --> UpdateEmergencyAlarm
|
||||
public abstract GoogleMap getMap(); // --> UpdateEmergencyAlarm
|
||||
public abstract void setLanguage();
|
||||
|
||||
/** Misc */
|
||||
public AbstractSDParentActivity getParentTab() {
|
||||
|
@ -132,6 +132,17 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
|
||||
setDate();
|
||||
}
|
||||
|
||||
public void setLanguage() {
|
||||
TextView labelVehicle = findViewById(R.id.labelVehicle);
|
||||
TextView labelStartDate = findViewById(R.id.labelStartDate);
|
||||
TextView labelEndDate = findViewById(R.id.labelEndDate);
|
||||
|
||||
labelVehicle.setText(R.string.vehicle);
|
||||
labelStartDate.setText(R.string.startDate);
|
||||
labelEndDate.setText(R.string.endDate);
|
||||
displayButton.setText(R.string.display);
|
||||
}
|
||||
|
||||
private void displayHistory(ArrayList<HistPos> positions) {
|
||||
LatLng latLng = null;
|
||||
PolylineOptions polylineOptions = new PolylineOptions();
|
||||
|
@ -296,6 +296,11 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
|
||||
registerBroadcastIntents();
|
||||
}
|
||||
|
||||
public void setLanguage() {
|
||||
TextView textView = findViewById(R.id.unit_name);
|
||||
textView.setText(R.string.unitName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manipulates the map once available.
|
||||
* This callback is triggered when the map is ready to be used.
|
||||
|
@ -732,12 +732,13 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
|
||||
// recreate UI
|
||||
Locale locale = new Locale(AppParams.LANGUAGETMP);
|
||||
Locale.setDefault(locale);
|
||||
android.content.res.Configuration configuration = new android.content.res.Configuration();
|
||||
configuration.locale = locale;
|
||||
getBaseContext().getResources().updateConfiguration(configuration,
|
||||
getBaseContext().getResources().getDisplayMetrics());
|
||||
setLocale(getLiveActivity(), locale);
|
||||
|
||||
// change UI for RadioActivity and MessageActivity
|
||||
if (getLiveActivity() != null)
|
||||
getLiveActivity().setLanguage();
|
||||
if (getHistoryActivity() != null)
|
||||
getHistoryActivity().setLanguage();
|
||||
if (getRadioActivity() != null)
|
||||
getRadioActivity().onCreate(getRadioActivity().savedInstanceState);
|
||||
if (getMessageActivity() != null)
|
||||
@ -748,6 +749,13 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
|
||||
getAlarmActivity().onCreate(getAlarmActivity().getSavedInstanceState());
|
||||
}
|
||||
|
||||
public static void setLocale(Activity activity, Locale locale) {
|
||||
Resources resources = activity.getResources();
|
||||
Configuration config = resources.getConfiguration();
|
||||
config.setLocale(locale);
|
||||
resources.updateConfiguration(config, resources.getDisplayMetrics());
|
||||
}
|
||||
|
||||
//timer stuff
|
||||
private void timerMethod() {
|
||||
if (!AppParams.DEMO)
|
||||
|
@ -10,6 +10,7 @@
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unit_name"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/unitName"
|
||||
|
Loading…
Reference in New Issue
Block a user