use runOnUiThread in autofill preferences activity

This commit is contained in:
Matthew Wong 2016-06-30 20:16:12 -04:00
parent a49399ab54
commit 7da9633a3c

View file

@ -74,8 +74,12 @@ public class AutofillPreferenceActivity extends AppCompatActivity {
private class populateTask extends AsyncTask<Void, Void, Void> { private class populateTask extends AsyncTask<Void, Void, Void> {
@Override @Override
protected void onPreExecute() { protected void onPreExecute() {
runOnUiThread(new Runnable() {
public void run() {
findViewById(R.id.progress_bar).setVisibility(View.VISIBLE); findViewById(R.id.progress_bar).setVisibility(View.VISIBLE);
} }
});
}
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
@ -105,14 +109,17 @@ public class AutofillPreferenceActivity extends AppCompatActivity {
@Override @Override
protected void onPostExecute(Void aVoid) { protected void onPostExecute(Void aVoid) {
runOnUiThread(new Runnable() {
public void run() {
findViewById(R.id.progress_bar).setVisibility(View.GONE); findViewById(R.id.progress_bar).setVisibility(View.GONE);
recyclerView.setAdapter(recyclerAdapter); recyclerView.setAdapter(recyclerAdapter);
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
if (extras != null) { if (extras != null) {
recyclerView.scrollToPosition(recyclerAdapter.getPosition(extras.getString("appName"))); recyclerView.scrollToPosition(recyclerAdapter.getPosition(extras.getString("appName")));
} }
} }
});
}
} }
@Override @Override