Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. void rebuildIndex(boolean reCreate) {
  2. final TextView indexStatus = (TextView) this.findViewById(R.id.index_status);
  3. indexStatus.setVisibility(View.INVISIBLE);
  4. indexStatus.setText(R.string.rebuild_index_progress_title);
  5.  
  6. final Handler statusHandler = new Handler(Looper.getMainLooper(), new Handler.Callback() {
  7. @Override
  8. public boolean handleMessage(Message msg) {
  9. if (msg.obj == null) {
  10. indexStatus.setVisibility(View.GONE);
  11. } else if (msg.obj.equals("show")) { // TODO quick demo, shouldn't use literal text.
  12. indexStatus.setVisibility(View.VISIBLE);
  13. } else {
  14. Log.d(TAG, msg.obj.toString());
  15. if (indexStatus.getVisibility() != View.VISIBLE) {
  16. indexStatus.setVisibility(View.VISIBLE);
  17. }
  18. indexStatus.setText(msg.obj.toString());
  19. }
  20. return false;
  21. }
  22. });
  23.  
  24. Indexer.rebuildIndexIfNecessary(statusHandler, reCreate);
  25. }
  26.  
  27. private void updateIndexStatus(String msg) {
  28. indexStatus.setText(msg);
  29. }
  30.  
  31. } else {
  32. Log.d(TAG, msg.obj.toString());
  33. if (indexStatus.getVisibility() != View.VISIBLE) {
  34. indexStatus.setVisibility(View.VISIBLE);
  35. }
  36. updateIndexStatus(msg.obj.toString());
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement