Merge remote-tracking branch 'origin/dev' into combo-scripter-v2
* origin/dev: missing file illegalState crash fix combo-bolus-fix
This commit is contained in:
commit
53a8cd4eac
|
@ -112,12 +112,16 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
recreate();
|
||||
try { // activity may be destroyed
|
||||
setUpTabs(true);
|
||||
} catch (IllegalStateException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
if(ev.recreate) {
|
||||
recreate();
|
||||
}else {
|
||||
try { // activity may be destroyed
|
||||
setUpTabs(true);
|
||||
} catch (IllegalStateException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
boolean lockScreen = BuildConfig.NSCLIENTOLNY && SP.getBoolean("lockscreen", false);
|
||||
if (lockScreen)
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.EditTextPreference;
|
||||
|
@ -58,8 +59,9 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
if (key.equals("language")) {
|
||||
String lang = sharedPreferences.getString("language", "en");
|
||||
LocaleHelper.setLocale(getApplicationContext(), lang);
|
||||
recreate();
|
||||
MainApp.bus().post(new EventRefreshGui());
|
||||
MainApp.bus().post(new EventRefreshGui(true));
|
||||
//recreate() does not update language so better close settings
|
||||
finish();
|
||||
}
|
||||
if (key.equals("short_tabtitles")) {
|
||||
MainApp.bus().post(new EventRefreshGui());
|
||||
|
|
|
@ -4,4 +4,11 @@ package info.nightscout.androidaps.events;
|
|||
* Created by mike on 13.06.2016.
|
||||
*/
|
||||
public class EventRefreshGui extends Event {
|
||||
public boolean recreate = false;
|
||||
public EventRefreshGui(boolean recreate) {
|
||||
this.recreate = recreate;
|
||||
}
|
||||
public EventRefreshGui(){
|
||||
this(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -533,7 +533,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
if (options.eventType == R.id.careportal_combobolus) {
|
||||
Double enteredInsulin = SafeParse.stringToDouble(editInsulin.getText());
|
||||
data.put("enteredinsulin", enteredInsulin);
|
||||
data.put("insulin", enteredInsulin * SafeParse.stringToDouble(editInsulin.getText()) / 100);
|
||||
data.put("insulin", enteredInsulin * SafeParse.stringToDouble(editSplit.getText()) / 100);
|
||||
data.put("relative", enteredInsulin * (100 - SafeParse.stringToDouble(editSplit.getText())) / 100 / SafeParse.stringToDouble(editDuration.getText()) * 60);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
|
|
|
@ -9,8 +9,12 @@ import android.support.v4.app.FragmentManager;
|
|||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import info.nightscout.androidaps.MainActivity;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
|
||||
/**
|
||||
|
@ -22,6 +26,8 @@ public class TabPageAdapter extends FragmentStatePagerAdapter {
|
|||
|
||||
Context context;
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(TabPageAdapter.class);
|
||||
|
||||
public TabPageAdapter(FragmentManager fm, Context context) {
|
||||
super(fm);
|
||||
this.context = context;
|
||||
|
@ -40,6 +46,8 @@ public class TabPageAdapter extends FragmentStatePagerAdapter {
|
|||
super.finishUpdate(container);
|
||||
} catch (NullPointerException nullPointerException){
|
||||
System.out.println("Catch the NullPointerException in FragmentStatePagerAdapter.finishUpdate");
|
||||
} catch (IllegalStateException e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue