Skip to content

Commit

Permalink
Remove some more download workout related
Browse files Browse the repository at this point in the history
Remove unused imports
  • Loading branch information
gerhardol committed Oct 2, 2021
1 parent b74b272 commit 22b4e55
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 66 deletions.
1 change: 0 additions & 1 deletion app/src/main/org/runnerup/view/HRSettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

import com.jjoe64.graphview.DefaultLabelFormatter;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.Viewport;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;

Expand Down
60 changes: 0 additions & 60 deletions app/src/main/org/runnerup/view/ManageWorkoutsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public class ManageWorkoutsActivity extends AppCompatActivity implements Constan

private boolean uploading = false;
private CompoundButton currentlySelectedWorkout = null;
private Button downloadButton = null;
private Button deleteButton = null;
private Button shareButton = null;
private Button editButton = null;
Expand All @@ -115,10 +114,6 @@ public void onCreate(Bundle savedInstanceState) {
ExpandableListView list = findViewById(R.id.expandable_list_view);
list.setAdapter(adapter);

downloadButton = findViewById(R.id.download_workout_button);
downloadButton.setOnClickListener(downloadButtonClick);
// No download provider currently exists
downloadButton.setVisibility(View.GONE);
deleteButton = findViewById(R.id.delete_workout_button);
deleteButton.setOnClickListener(deleteButtonClick);
createButton = findViewById(R.id.create_workout_button);
Expand Down Expand Up @@ -283,7 +278,6 @@ protected void onResume() {

private void handleButtons() {
if (currentlySelectedWorkout == null) {
downloadButton.setEnabled(false);
deleteButton.setEnabled(false);
shareButton.setEnabled(false);
editButton.setEnabled(false);
Expand All @@ -293,12 +287,10 @@ private void handleButtons() {

WorkoutRef selected = (WorkoutRef) currentlySelectedWorkout.getTag();
if (PHONE_STRING.contentEquals(selected.synchronizer)) {
downloadButton.setEnabled(false);
deleteButton.setEnabled(true);
shareButton.setEnabled(true);
editButton.setEnabled(true);
} else {
downloadButton.setEnabled(true);
deleteButton.setEnabled(false);
shareButton.setEnabled(false);
editButton.setEnabled(false);
Expand Down Expand Up @@ -424,58 +416,6 @@ private ArrayList<SyncManager.WorkoutRef> filter(List<SyncManager.WorkoutRef> li
.show();
};

private final OnClickListener downloadButtonClick = new OnClickListener() {

@Override
public void onClick(View v) {
if (currentlySelectedWorkout == null)
return;

final WorkoutRef selected = (WorkoutRef) currentlySelectedWorkout.getTag();
ArrayList<WorkoutRef> local = workouts.get(PHONE_STRING);
if (contains(local, selected)) {
new AlertDialog.Builder(ManageWorkoutsActivity.this)
.setTitle(getString(R.string.Downloading_1s_will_overwrite_2_workout_with_same_name, selected.workoutName, PHONE_STRING))
.setMessage(R.string.Are_you_sure)
.setPositiveButton(R.string.Yes,
(dialog, which) -> {
dialog.dismiss();
downloadWorkout(selected);
})
.setNegativeButton(R.string.No,
// Do nothing but close the dialog
(dialog, which) -> dialog.dismiss()
)
.show();
return;
}

downloadWorkout(selected);
}

private void downloadWorkout(WorkoutRef selected) {
uploading = true;
HashSet<WorkoutRef> list = new HashSet<>();
list.add((WorkoutRef) currentlySelectedWorkout.getTag());
syncManager.loadWorkouts(list, (synchronizerName, status) -> {
uploading = false;
currentlySelectedWorkout = null;
listLocal();
handleButtons();
});
}

private boolean contains(ArrayList<WorkoutRef> local,
WorkoutRef selected) {
for (WorkoutRef w : local) {
if (selected.workoutName.contentEquals(w.workoutName)) {
return true;
}
}
return false;
}
};

private final OnClickListener deleteButtonClick = v -> {
if (currentlySelectedWorkout == null)
return;
Expand Down
3 changes: 1 addition & 2 deletions common/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<string name="Cancellingplease_wait">Cancelling, please wait…</string>
<string name="Are_you_sure">Are you sure?</string>
<string name="Configure_audio_cues">Configure audio cues</string>
<string name="Downloadeditremove_workouts">Download/edit/remove workouts</string>
<string name="Downloadeditremove_workouts">Edit workouts</string>
<string name="Note_you_need_to_connect_to_the_account_too">You must connect to a RunnerUp Live account</string>
<string name="Use_your_headset_to_startpauseresume_RunnerUp">Use your headset to start/pause/resume RunnerUp</string>
<string name="Convert_reststep_with_type_distance_to_recoverystep_for_Intervaltab">On the Interval tab, use Recovery instead of Rest (pause) steps</string>
Expand Down Expand Up @@ -283,7 +283,6 @@
<string name="Overwrite_existing">Overwrite existing</string>
<string name="Create_new_workout">Create new workout</string>
<string name="Set_workout_name">Set workout name</string>
<string name="Downloading_1s_will_overwrite_2_workout_with_same_name">Downloading %1$s will overwrite %2$s workout with same name</string>
<string name="Delete_workout">Delete workout</string>
<string name="RunnerUp_workout">RunnerUp workout</string>
<string name="HinHere_is_a_workout_I_think_you_might_like">Hi\nI think you might like this workout.</string>
Expand Down
1 change: 0 additions & 1 deletion hrdevice/src/org/runnerup/hr/AndroidBLEHRProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
Expand Down
1 change: 0 additions & 1 deletion hrdevice/src/org/runnerup/hr/BtHRBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import android.os.Looper;

import java.util.UUID;
import java.util.regex.Pattern;

abstract class BtHRBase implements HRProvider {
static final UUID HRP_SERVICE = UUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import android.app.Fragment;
import android.graphics.drawable.AnimationDrawable;
import android.os.Build;
import android.os.Bundle;
import android.support.wearable.view.CircledImageView;
import android.view.LayoutInflater;
Expand Down

0 comments on commit 22b4e55

Please sign in to comment.