Skip to content

Commit c546afc

Browse files
committed
Show progress dialog while repository is loading
Use RefreshRepositoryTask from SearchRepositoryListFragment to load the repository in a background task with an indeterminate progress dialog. Previously the task would load with no feedback between when the list item was clicked and when the repository was loaded and opened in a new activity
1 parent d4e6b89 commit c546afc

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

app/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,6 @@
206206
<string name="cancel">Cancel</string>
207207
<string name="authenticator_conflict_title">App Conflict</string>
208208
<string name="authenticator_conflict_message">Another installed app is already configured for GitHub authentication.\n\nYou must remove the other app from the Accounts &amp; sync settings and uninstall it before the GitHub app can be used.</string>
209+
<string name="opening_repository">"Opening {0}…"</string>
209210

210211
</resources>

app/src/main/java/com/github/mobile/core/repo/RefreshRepositoryTask.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import android.content.Context;
1919
import android.util.Log;
2020

21-
import com.github.mobile.accounts.AuthenticatedUserTask;
21+
import com.github.mobile.ui.ProgressDialogTask;
2222
import com.google.inject.Inject;
2323

2424
import org.eclipse.egit.github.core.IRepositoryIdProvider;
@@ -28,7 +28,7 @@
2828
/**
2929
* Task to refresh a repository
3030
*/
31-
public class RefreshRepositoryTask extends AuthenticatedUserTask<Repository> {
31+
public class RefreshRepositoryTask extends ProgressDialogTask<Repository> {
3232

3333
private static final String TAG = "RefreshRepositoryTask";
3434

app/src/main/java/com/github/mobile/ui/repo/SearchRepositoryListFragment.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222

2323
import com.github.mobile.R.string;
2424
import com.github.mobile.ThrowableLoader;
25-
import com.github.mobile.accounts.AuthenticatedUserTask;
25+
import com.github.mobile.core.repo.RefreshRepositoryTask;
2626
import com.github.mobile.ui.ItemListAdapter;
2727
import com.github.mobile.ui.ItemListFragment;
2828
import com.github.mobile.ui.ItemView;
2929
import com.google.inject.Inject;
3030

31+
import java.text.MessageFormat;
3132
import java.util.List;
3233

3334
import org.eclipse.egit.github.core.Repository;
@@ -65,11 +66,15 @@ public SearchRepositoryListFragment setQuery(final String query) {
6566
public void onListItemClick(ListView l, View v, int position, long id) {
6667
final SearchRepository result = (SearchRepository) l
6768
.getItemAtPosition(position);
68-
new AuthenticatedUserTask<Repository>(getActivity()) {
69+
new RefreshRepositoryTask(getActivity(), result) {
6970

7071
@Override
71-
public Repository run() throws Exception {
72-
return service.getRepository(result);
72+
public void execute() {
73+
showIndeterminate(MessageFormat.format(
74+
getString(string.opening_repository),
75+
result.generateId()));
76+
77+
super.execute();
7378
}
7479

7580
@Override

0 commit comments

Comments
 (0)