Java Code Examples for android.os.Handler.Callback

The following are top voted examples for showing how to use android.os.Handler.Callback. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: FMTech   File: SnackbarManager.java   View source code 6 votes vote down vote up
final void showNextSnackbarLocked()
{
  if (this.mNextSnackbar != null)
  {
    this.mCurrentSnackbar = this.mNextSnackbar;
    this.mNextSnackbar = null;
    Callback localCallback = (Callback)this.mCurrentSnackbar.callback.get();
    if (localCallback != null) {
      localCallback.show();
    }
  }
  else
  {
    return;
  }
  this.mCurrentSnackbar = null;
}
 
Example 2
Project: FMTech   File: Snackbar.java   View source code 6 votes vote down vote up
final void onViewHidden$13462e()
{
  ViewParent localViewParent = this.mView.getParent();
  if ((localViewParent instanceof ViewGroup)) {
    ((ViewGroup)localViewParent).removeView(this.mView);
  }
  SnackbarManager localSnackbarManager = SnackbarManager.getInstance();
  SnackbarManager.Callback localCallback = this.mManagerCallback;
  synchronized (localSnackbarManager.mLock)
  {
    if (localSnackbarManager.isCurrentSnackbarLocked(localCallback))
    {
      localSnackbarManager.mCurrentSnackbar = null;
      if (localSnackbarManager.mNextSnackbar != null) {
        localSnackbarManager.showNextSnackbarLocked();
      }
    }
    return;
  }
}
 
Example 3
Project: sms-ticket   File: GlobalHandlerService.java   View source code 6 votes vote down vote up
@Override
public boolean handleMessage(Message msg) {
    // proces listeners for specified type of message what
    synchronized (mListenersSpecific) {
        List<BetterWeakReference<Callback>> whatListofListeners = mListenersSpecific.get(msg.what);
        if (whatListofListeners != null) {
            handleListeners(whatListofListeners, msg);
            if (whatListofListeners.size() == 0) {
                mListenersSpecific.remove(msg.what);
            }
        }
    }

    // process universal listeners
    handleListeners(mListenersUniversal, msg);

    return true;
}
 
Example 4
Project: otm-android   File: TreeEditDisplay.java   View source code 6 votes vote down vote up
public void deleteTree(View view) {
    Callback confirm = msg -> {
        if (msg.getData().getBoolean("confirm")) {

            RequestGenerator rc = new RequestGenerator();
            try {
                rc.deleteCurrentTreeOnPlot(App.getAppInstance(), plot.getId(), deleteTreeHandler);
            } catch (JSONException e) {
                Logger.error("Error deleting tree", e);
            }
        }
        return true;
    };

    confirmDelete(R.string.confirm_delete_tree_msg, confirm);
}
 
Example 5
Project: otm-android   File: App.java   View source code 6 votes vote down vote up
/**
 * Callback to ensure the instance has been loaded, either via a loaded, pending
 * or missing instance info. This method is safe to call at any time to wait for
 * instance info before proceeding with the callback.
 *
 * @param callback
 */
public void ensureInstanceLoaded(final Callback callback) {
    if (currentInstance != null) {
        Message msg = Message.obtain();
        Bundle data = new Bundle();
        data.putBoolean("success", true);
        msg.setData(data);

        callback.handleMessage(msg);
    } else {
        // If an instance request is pending, register for a callback on completion,
        // otherwise, force an instance request
        if (loadingInstance) {
            registeredInstanceCallbacks.add(callback);
        } else {
            reloadInstanceInfo(callback);
        }
    }
}
 
Example 6
Project: cniao5   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 7
Project: cniao5   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 8
Project: MyFire   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 9
Project: MyFire   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = R.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 10
Project: yyox   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 11
Project: yyox   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 12
Project: POCenter   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 13
Project: POCenter   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 14
Project: YiZhi   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 15
Project: YiZhi   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 16
Project: topnews   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 17
Project: topnews   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 18
Project: weex-3d-map   File: WXThread.java   View source code 5 votes vote down vote up
public static Callback secure(Callback callback){
  if(callback == null || callback instanceof SafeCallback){
    return callback;
  }

  return new SafeCallback(callback);
}
 
Example 19
Project: ucar-weex-core   File: WXThread.java   View source code 5 votes vote down vote up
public static Callback secure(Callback callback){
  if(callback == null || callback instanceof SafeCallback){
    return callback;
  }

  return new SafeCallback(callback);
}
 
Example 20
Project: Huochexing12306   File: EditPage.java   View source code 5 votes vote down vote up
/** 显示平台列表 */
public void afterPlatformListGot() {
	String name = String.valueOf(reqData.get("platform"));
	int size = platformList == null ? 0 : platformList.length;
	views = new View[size];

	final int dp_24 = dipToPx(getContext(), 24);
	LinearLayout.LayoutParams lpItem = new LinearLayout.LayoutParams(dp_24, dp_24);
	final int dp_9 = dipToPx(getContext(), 9);
	lpItem.setMargins(0, 0, dp_9, 0);
	FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	lpMask.gravity = Gravity.LEFT | Gravity.TOP;
	int selection = 0;
	for (int i = 0; i < size; i++) {
		FrameLayout fl = new FrameLayout(getContext());
		fl.setLayoutParams(lpItem);
		if (i >= size - 1) {
			fl.setLayoutParams(new LinearLayout.LayoutParams(dp_24, dp_24));
		}
		llPlat.addView(fl);
		fl.setOnClickListener(this);

		ImageView iv = new ImageView(getContext());
		iv.setScaleType(ScaleType.CENTER_INSIDE);
		iv.setImageBitmap(getPlatLogo(platformList[i]));
		iv.setLayoutParams(new FrameLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		fl.addView(iv);

		views[i] = new View(getContext());
		views[i].setBackgroundColor(0xcfffffff);
		views[i].setOnClickListener(this);
		if (name != null && name.equals(platformList[i].getName())) {
			views[i].setVisibility(View.INVISIBLE);
			selection = i;

			// 编辑分享内容的统计
			ShareSDK.logDemoEvent(3, platformList[i]);
		}
		views[i].setLayoutParams(lpMask);
		fl.addView(views[i]);
	}

	final int postSel = selection;
	UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
		public boolean handleMessage(Message msg) {
			HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent();
			hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
			return false;
		}
	});
}
 
Example 21
Project: EventScheduler   File: EventQueueThread.java   View source code 5 votes vote down vote up
public boolean enqueue(T data,Callback callback) {

        if(callback == null){
            throw new EventSchedulerRuntimeException("callback must be not null");
        }

        this.mCallback = callback;
        Handler handler = getHandler();
        Message msg = Message.obtain(handler, DISPATCH);
        msg.obj = data;
        return handler.sendMessage(msg);
    }
 
Example 22
Project: LiuAGeAndroid   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 23
Project: LiuAGeAndroid   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 24
Project: TextEmoji   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 25
Project: TextEmoji   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 26
Project: boohee_v5.6   File: UIHandler.java   View source code 5 votes vote down vote up
private static void handleMessage(Message message) {
    InnerObj innerObj = (InnerObj) message.obj;
    Message message2 = innerObj.msg;
    Callback callback = innerObj.callback;
    if (callback != null) {
        callback.handleMessage(message2);
    }
}
 
Example 27
Project: boohee_v5.6   File: EditPage.java   View source code 5 votes vote down vote up
public void onCreate() {
    if (this.shareParamMap == null || this.platforms == null || this.platforms.size() < 1) {
        finish();
        return;
    }
    genBackground();
    this.activity.setContentView(getPageView());
    onTextChanged(this.etContent.getText(), 0, this.etContent.length(), 0);
    showThumb();
    new Thread() {
        public void run() {
            try {
                EditPage.this.platformList = ShareSDK.getPlatformList();
                if (EditPage.this.platformList != null) {
                    ArrayList<Platform> list = new ArrayList();
                    for (Platform plat : EditPage.this.platformList) {
                        String name = plat.getName();
                        if (!((plat instanceof CustomPlatform) || ShareCore.isUseClientToShare(name))) {
                            list.add(plat);
                        }
                    }
                    EditPage.this.platformList = new Platform[list.size()];
                    for (int i = 0; i < EditPage.this.platformList.length; i++) {
                        EditPage.this.platformList[i] = (Platform) list.get(i);
                    }
                    UIHandler.sendEmptyMessage(1, new Callback() {
                        public boolean handleMessage(Message msg) {
                            EditPage.this.afterPlatformListGot();
                            return false;
                        }
                    });
                }
            } catch (Throwable t) {
                t.printStackTrace();
            }
        }
    }.start();
}
 
Example 28
Project: androidgithub   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 29
Project: androidgithub   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = R.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 30
Project: LQRWeChat-master   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 31
Project: LQRWeChat-master   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 32
Project: QuanMinTV   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 33
Project: QuanMinTV   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 34
Project: Mobike   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 35
Project: Mobike   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = R.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 36
Project: LQRWeChat   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 37
Project: LQRWeChat   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 38
Project: Mybilibili   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
Example 39
Project: Mybilibili   File: OnekeyShareThemeImpl.java   View source code 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = ResHelper.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example 40
Project: lqrwechatrongcloud   File: FriendAdapter.java   View source code 5 votes vote down vote up
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}