当前位置: 首页>>代码示例>>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;未经允许,请勿转载。