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; }
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; } }
@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; }
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); }
/** * 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); } } }
public void onCancel(Platform plat, int action) { UIHandler.sendEmptyMessage(0, new Callback() { public boolean handleMessage(Message msg) { activity.finish(); return false; } }); }
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; } }); }
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; } }); }
public static Callback secure(Callback callback){ if(callback == null || callback instanceof SafeCallback){ return callback; } return new SafeCallback(callback); }
/** 显示平台列表 */ 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; } }); }
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); }
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); } }
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(); }