Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void rebuildIndex(boolean reCreate) {
- final TextView indexStatus = (TextView) this.findViewById(R.id.index_status);
- indexStatus.setVisibility(View.INVISIBLE);
- indexStatus.setText(R.string.rebuild_index_progress_title);
- final Handler statusHandler = new Handler(Looper.getMainLooper(), new Handler.Callback() {
- @Override
- public boolean handleMessage(Message msg) {
- if (msg.obj == null) {
- indexStatus.setVisibility(View.GONE);
- } else if (msg.obj.equals("show")) { // TODO quick demo, shouldn't use literal text.
- indexStatus.setVisibility(View.VISIBLE);
- } else {
- Log.d(TAG, msg.obj.toString());
- if (indexStatus.getVisibility() != View.VISIBLE) {
- indexStatus.setVisibility(View.VISIBLE);
- }
- indexStatus.setText(msg.obj.toString());
- }
- return false;
- }
- });
- Indexer.rebuildIndexIfNecessary(statusHandler, reCreate);
- }
- private void updateIndexStatus(String msg) {
- indexStatus.setText(msg);
- }
- } else {
- Log.d(TAG, msg.obj.toString());
- if (indexStatus.getVisibility() != View.VISIBLE) {
- indexStatus.setVisibility(View.VISIBLE);
- }
- updateIndexStatus(msg.obj.toString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement