當前位置: 首頁>>代碼示例>>Java>>正文


Java Callback類代碼示例

本文整理匯總了Java中android.os.Handler.Callback的典型用法代碼示例。如果您正苦於以下問題:Java Callback類的具體用法?Java Callback怎麽用?Java Callback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Callback類屬於android.os.Handler包,在下文中一共展示了Callback類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showNextSnackbarLocked

import android.os.Handler.Callback; //導入依賴的package包/類
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;
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:18,代碼來源:SnackbarManager.java

示例2: if

import android.os.Handler.Callback; //導入依賴的package包/類
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;
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:21,代碼來源:Snackbar.java

示例3: handleMessage

import android.os.Handler.Callback; //導入依賴的package包/類
@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;
}
 
開發者ID:avast,項目名稱:sms-ticket,代碼行數:19,代碼來源:GlobalHandlerService.java

示例4: deleteTree

import android.os.Handler.Callback; //導入依賴的package包/類
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);
}
 
開發者ID:OpenTreeMap,項目名稱:otm-android,代碼行數:17,代碼來源:TreeEditDisplay.java

示例5: ensureInstanceLoaded

import android.os.Handler.Callback; //導入依賴的package包/類
/**
 * 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);
        }
    }
}
 
開發者ID:OpenTreeMap,項目名稱:otm-android,代碼行數:26,代碼來源:App.java

示例6: onCancel

import android.os.Handler.Callback; //導入依賴的package包/類
public void onCancel(Platform plat, int action) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			activity.finish();
			return false;
		}
	});
}
 
開發者ID:gaolhjy,項目名稱:cniao5,代碼行數:9,代碼來源:FriendAdapter.java

示例7: toast

import android.os.Handler.Callback; //導入依賴的package包/類
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;
		}
	});
}
 
開發者ID:gaolhjy,項目名稱:cniao5,代碼行數:14,代碼來源:OnekeyShareThemeImpl.java

示例8: toast

import android.os.Handler.Callback; //導入依賴的package包/類
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;
		}
	});
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:14,代碼來源:OnekeyShareThemeImpl.java

示例9: secure

import android.os.Handler.Callback; //導入依賴的package包/類
public static Callback secure(Callback callback){
  if(callback == null || callback instanceof SafeCallback){
    return callback;
  }

  return new SafeCallback(callback);
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:8,代碼來源:WXThread.java

示例10: afterPlatformListGot

import android.os.Handler.Callback; //導入依賴的package包/類
/** 顯示平台列表 */
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;
		}
	});
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:54,代碼來源:EditPage.java

示例11: enqueue

import android.os.Handler.Callback; //導入依賴的package包/類
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);
    }
 
開發者ID:devyok,項目名稱:EventScheduler,代碼行數:13,代碼來源:EventQueueThread.java

示例12: handleMessage

import android.os.Handler.Callback; //導入依賴的package包/類
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);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:9,代碼來源:UIHandler.java

示例13: onCreate

import android.os.Handler.Callback; //導入依賴的package包/類
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();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:39,代碼來源:EditPage.java


注:本文中的android.os.Handler.Callback類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。