Skip to content

Commit

Permalink
Merge pull request #965 from gerhardol/feature/spinner-norestore
Browse files Browse the repository at this point in the history
Feature/spinner norestore
  • Loading branch information
gerhardol authored Aug 31, 2020
2 parents f9a9d4a + 352e76e commit 800da3e
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 18 deletions.
8 changes: 5 additions & 3 deletions app/assets/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
</head>
<body>
<h1>What's new</h1>
<h2>v2.2.3.0</h2>
<h2>v2.2.3.2/h2>
<p>
<ul>
<li>#963 Exception for download activities</li>
<li>#964 Exception for download activities</li>
<li>Ukranian translation, nl update</li>
<li>#965 Do not present 0 HR in graph</li>
<li>Do not restore spinner state to avoid exceptions</li>
</ul>
h2>v2.2.2.4</h2>
<h2>v2.2.2.4</h2>
<p>
<ul>
<li>#961 Resource ids must be unique</li>
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/org/runnerup/util/GraphWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,16 @@ void emit(double tot_distance) {
if (first) {
if(tot_distance > 0) {
velocityList.add(new DataPoint(0, velocity));
hrList.add(new DataPoint(0, Math.round(avg_hr)));
if (avg_hr > 0) {
hrList.add(new DataPoint(0, Math.round(avg_hr)));
}
}
first = false;
}
velocityList.add(new DataPoint(tot_distance, velocity));
hrList.add(new DataPoint(tot_distance, Math.round(avg_hr)));
if (avg_hr > 0) {
hrList.add(new DataPoint(tot_distance, Math.round(avg_hr)));
}
acc_time = 0;

tot_avg_hr += avg_hr;
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/org/runnerup/view/MainLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ public class MainLayout extends TabActivity {

private View getTabView(CharSequence label, int iconResource) {
@SuppressLint("InflateParams")View tabView = getLayoutInflater().inflate(R.layout.bottom_tab_indicator, null);
tabView.findViewById(R.id.icon).setContentDescription(label);
ImageView iconView = tabView.findViewById(R.id.icon);
iconView.setContentDescription(label);
Drawable icon = AppCompatResources.getDrawable(this, iconResource);
((ImageView)tabView.findViewById(R.id.icon)).setImageDrawable(icon);
iconView.setImageDrawable(icon);
return tabView;
}

Expand Down
3 changes: 1 addition & 2 deletions app/src/main/org/runnerup/view/RunActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,8 @@ private void bindGpsTracker() {
// class name because we want a specific service implementation that
// we know will be running in our own process (and thus won't be
// supporting component replacement by other applications).
getApplicationContext().bindService(new Intent(this, Tracker.class),
mIsBound = getApplicationContext().bindService(new Intent(this, Tracker.class),
mConnection, Context.BIND_AUTO_CREATE);
mIsBound = true;
}

private void unbindGpsTracker() {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/org/runnerup/view/StartActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1029,9 +1029,8 @@ private void bindGpsTracker() {
// class name because we want a specific service implementation that
// we know will be running in our own process (and thus won't be
// supporting component replacement by other applications).
getApplicationContext().bindService(new Intent(this, Tracker.class),
mIsBound = getApplicationContext().bindService(new Intent(this, Tracker.class),
mConnection, Context.BIND_AUTO_CREATE);
mIsBound = true;
}

private void unbindGpsTracker() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/org/runnerup/widget/DistancePicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public DistancePicker(Context context, AttributeSet attrs) {
super(context, attrs);

unitMeters = new NumberPicker(context, attrs);
LinearLayout unitStringLayout = new LinearLayout(context, attrs);
LinearLayout unitStringLayout = new LinearLayout(context);
unitStringLayout.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
unitStringLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.MATCH_PARENT));
unitString = new TextView(context, attrs);
unitString = new TextView(context);
unitString.setTextSize(25);
unitString.setMinimumHeight(48);
unitString.setMinimumWidth(48);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/org/runnerup/widget/SpinnerPresenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private enum Type {
private long mCurrValue = -1;
private final CharSequence mLabel;

SpinnerPresenter(Context context, AttributeSet attrs, SpinnerInterface spinnerInterface) { //todo duration + other pickers don't appear to work
SpinnerPresenter(Context context, AttributeSet attrs, SpinnerInterface spinnerInterface) {
mContext = context;
mSpin = spinnerInterface;

Expand Down
1 change: 1 addition & 0 deletions app/src/main/org/runnerup/widget/TitleSpinner.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public TitleSpinner(Context context, AttributeSet attrs) {
mLabel = findViewById(R.id.title);
mValue = findViewById(R.id.value);
mSpinner = findViewById(R.id.spinner);
mSpinner.setSaveEnabled(false);

mPresenter = new SpinnerPresenter(context, attrs, this);
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ project.ext {
mockitoVersion = '2.3.7'

//The Git tag for the release must be identical for F-Droid
versionName = '2.2.3.0'
versionCode = 270
versionName = '2.2.3.2'
versionCode = 272
latestBaseVersionCode = 15000000

travisBuild = System.getenv("TRAVIS") == "true"
Expand Down
8 changes: 6 additions & 2 deletions wear/src/main/java/org/runnerup/view/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class MainActivity extends Activity implements Constants, ValueModel.Chan
private boolean pauseStep = false;
private int scroll = 0;
private boolean postScrollRightRunning = false;
private boolean mIsBound;

private static final int RUN_INFO_ROW = 0;
private static final int PAUSE_RESUME_ROW = 1;
Expand Down Expand Up @@ -77,7 +78,7 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
protected void onResume() {
super.onResume();
getApplicationContext().bindService(new Intent(this, StateService.class),
mIsBound = getApplicationContext().bindService(new Intent(this, StateService.class),
mStateServiceConnection, Context.BIND_AUTO_CREATE);
}

Expand All @@ -88,7 +89,10 @@ protected void onPause() {
mStateService.unregisterTrackerStateListener(this);
mStateService.unregisterHeadersListener(this);
}
getApplicationContext().unbindService(mStateServiceConnection);
if (mIsBound) {
getApplicationContext().unbindService(mStateServiceConnection);
mIsBound = false;
}
mStateService = null;
}

Expand Down

0 comments on commit 800da3e

Please sign in to comment.