-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update progress bar and time remaining counter behavior
- Display total "Time remaining counter" instead of single timer for single test (#487). - Improve progress bar of tests (#490).
- Loading branch information
Showing
6 changed files
with
437 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
app/src/main/java/org/openobservatory/ooniprobe/common/TestProgressRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.openobservatory.ooniprobe.common; | ||
|
||
import androidx.lifecycle.LiveData; | ||
import androidx.lifecycle.MutableLiveData; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
/** | ||
* TestProgressRepository used to track the {@link org.openobservatory.ooniprobe.common.service.RunTestService} progress with using {@link LiveData} | ||
*/ | ||
@Singleton | ||
public class TestProgressRepository { | ||
/** | ||
* Instantiates a new {@link TestProgressRepository} | ||
*/ | ||
@Inject | ||
TestProgressRepository() { | ||
} | ||
|
||
private final MutableLiveData<Integer> progressData = new MutableLiveData<>(); | ||
private final MutableLiveData<Double> etaData = new MutableLiveData<>(); | ||
|
||
/** | ||
* Gets progress. | ||
* | ||
* @return the progress | ||
*/ | ||
public LiveData<Integer> getProgress() { | ||
return progressData; | ||
} | ||
|
||
/** | ||
* Update progress. | ||
* | ||
* @param progress the progress | ||
*/ | ||
public void updateProgress(Integer progress) { | ||
progressData.setValue(progress); | ||
} | ||
|
||
/** | ||
* Gets eta. | ||
* | ||
* @return the eta | ||
*/ | ||
public LiveData<Double> getEta() { | ||
return etaData; | ||
} | ||
|
||
/** | ||
* Update eta. | ||
* | ||
* @param eta the eta | ||
*/ | ||
public void updateEta(Double eta) { | ||
etaData.setValue(eta); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.