Skip to content

Commit

Permalink
Pressure refresh option adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatApo committed Aug 25, 2019
1 parent c52f867 commit 78deb8e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {

final int custom_refresh_rate = sharedPreferences.getInt( "custom_refresh_rate", getResources().getInteger(R.integer.custom_refresh_rate)*1000);
settings.add(
new IncrementalSetting(null, "Air pressure refresh", "Current: "+((custom_refresh_rate/1000<=60)?Math.round(custom_refresh_rate/1000)+" sec":Math.round(custom_refresh_rate/1000)/60+" min"),
new IncrementalSetting(null, "Air pressure refresh", "Current: "+((custom_refresh_rate/1000<120)?Math.round(custom_refresh_rate/1000)+" sec":Math.round(custom_refresh_rate/1000)/60+" min"),
new View.OnClickListener() {
@Override
public void onClick(View view) {
Expand All @@ -208,21 +208,21 @@ public void onClick(View view) {
sharedPreferences.edit().putInt("custom_refresh_rate", new_value*1000).apply();
View parent = (View) view.getParent();
TextView value = (TextView) parent.findViewById(R.id.value);
value.setText((new_value<=60)?new_value+" sec":new_value/60+" min");
value.setText((new_value<120)?new_value+" sec":new_value/60+" min");
}
}
},new View.OnClickListener() {
@Override
public void onClick(View view) {
int new_value = Math.round(sharedPreferences.getInt( "custom_refresh_rate", getResources().getInteger(R.integer.custom_refresh_rate)*1000)/1000+5);
if(new_value>125)
if(new_value>120)
new_value = new_value + 55;
sharedPreferences.edit().putInt("custom_refresh_rate", new_value*1000).apply();
View parent = (View) view.getParent();
TextView value = (TextView) parent.findViewById(R.id.value);
value.setText((new_value<=60)?new_value+" sec":new_value/60+" min");
value.setText((new_value<120)?new_value+" sec":new_value/60+" min");
}
}, (custom_refresh_rate/1000<=60)?Math.round(custom_refresh_rate/1000)+" sec":Math.round(custom_refresh_rate/1000)/60+" min")
}, (custom_refresh_rate/1000<120)?Math.round(custom_refresh_rate/1000)+" sec":Math.round(custom_refresh_rate/1000)/60+" min")
);

final boolean pressure_to_mmhg = sharedPreferences.getBoolean( "pressure_to_mmhg", getResources().getBoolean(R.bool.pressure_to_mmhg));
Expand Down

0 comments on commit 78deb8e

Please sign in to comment.