当前位置: 首页>>代码示例>>Java>>正文


Java MobSDK类代码示例

本文整理汇总了Java中com.mob.MobSDK的典型用法代码示例。如果您正苦于以下问题:Java MobSDK类的具体用法?Java MobSDK怎么用?Java MobSDK使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MobSDK类属于com.mob包,在下文中一共展示了MobSDK类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerSDK

import com.mob.MobSDK; //导入依赖的package包/类
private void registerSDK() {
	// 在尝试读取通信录时以弹窗提示用户(可选功能)
	SMSSDK.setAskPermisionOnReadContact(true);
	if ("moba6b6c6d6".equalsIgnoreCase(MobSDK.getAppkey())) {
		Toast.makeText(this, R.string.smssdk_dont_use_demo_appkey, Toast.LENGTH_SHORT).show();
	}
	final Handler handler = new Handler(this);
	EventHandler eventHandler = new EventHandler() {
		public void afterEvent(int event, int result, Object data) {
			Message msg = new Message();
			msg.arg1 = event;
			msg.arg2 = result;
			msg.obj = data;
			handler.sendMessage(msg);
		}
	};
	// 注册回调监听接口
	SMSSDK.registerEventHandler(eventHandler);
	ready = true;

	// 获取新好友个数
	showDialog();
	SMSSDK.getNewFriendsCount();
	gettingFriends = true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:MainActivity.java

示例2: onCreate

import com.mob.MobSDK; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    mInstance = this;
    // 通过代码注册你的AppKey和AppSecret
    MobSDK.init(this, "201f8a7a91c30", "c63ec5c1eeac1f873ec78c1365120431");

    sContext = getApplicationContext();
    initUser();
    Utils.init(this);

    locationService = new LocationService(getApplicationContext());
    mVibrator =(Vibrator)getApplicationContext().getSystemService(Service.VIBRATOR_SERVICE);

    //配置数据库
    setupDatabase();

}
 
开发者ID:gaolhjy,项目名称:cniao5,代码行数:19,代码来源:CNiaoApplication.java

示例3: shareDataToShareParams

import com.mob.MobSDK; //导入依赖的package包/类
final ShareParams shareDataToShareParams(Platform plat) {
	if (plat == null || shareParamsMap == null) {
		toast("ssdk_oks_share_failed");
		return null;
	}

	try {
		String imagePath = ResHelper.forceCast(shareParamsMap.get("imagePath"));
		Bitmap viewToShare = ResHelper.forceCast(shareParamsMap.get("viewToShare"));
		if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
			String path = ResHelper.getCachePath(MobSDK.getContext(), "screenshot");
			File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
			FileOutputStream fos = new FileOutputStream(ss);
			viewToShare.compress(CompressFormat.JPEG, 100, fos);
			fos.flush();
			fos.close();
			shareParamsMap.put("imagePath", ss.getAbsolutePath());
		}
	} catch (Throwable t) {
		t.printStackTrace();
		toast("ssdk_oks_share_failed");
		return null;
	}

	return new ShareParams(shareParamsMap);
}
 
开发者ID:Horrarndoo,项目名称:YiZhi,代码行数:27,代码来源:OnekeyShareThemeImpl.java

示例4: OnAttachmentClick

import com.mob.MobSDK; //导入依赖的package包/类
@Override
protected void OnAttachmentClick(ForumThreadAttachment attachment) {
	String extension = attachment.extension;
	PageAttachmentViewer page;
	if ("pdf".equals(extension)) {
		page = new PagePDFViewer();
	} else if ("doc".equals(extension) || "docx".equals(extension) || "xlsx".equals(extension)
			|| "xls".equals(extension) || "txt".equals(extension)) {
		page = new PageOfficeViewer();
	} else if ("3gp".equals(extension) || "mp4".equals(extension)) {
		page = new PageVideoViewer();
	} else {
		super.OnAttachmentClick(attachment);
		return;
	}
	page.setAttachment(attachment);
	page.show(MobSDK.getContext());
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:19,代码来源:MainActivity.java

示例5: onCreate

import com.mob.MobSDK; //导入依赖的package包/类
@Override
	protected void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MobSDK.init(this);
		setContentView(ResHelper.getLayoutRes(this, "layout_test"));
		cleverImageView = (CleverImageView) findViewById(ResHelper.getIdRes(this, "cleverImageView"));
		btnTest = (Button) findViewById(ResHelper.getIdRes(this, "btnTest"));
		btnTest.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View view) {
//                cleverImageView.setOval(false);
				cleverImageView.setBorderColor(Color.BLUE);
				cleverImageView.setBorderWidthDP(2);
				cleverImageView.setCornerRadiiDP(10, 5, 20, 30);
				cleverImageView.setImageUrl(IMAGE_URL);
			}
		});
	}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:19,代码来源:TestActivity.java

示例6: ensureLogin

import com.mob.MobSDK; //导入依赖的package包/类
public User ensureLogin(boolean gotologinpage) {
	User user = null;
	try {
		user = BBSSDK.getApi(UserAPI.class).getCurrentUser();
	} catch (Exception e) {
		user = null;
	}
	if (user == null) {
		if (gotologinpage) {
			PageLogin page = buildPageLogin();
			page.show(MobSDK.getContext());
		}
		return null;
	}
	return user;
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:17,代码来源:BBSViewBuilder.java

示例7: setGifImageView

import com.mob.MobSDK; //导入依赖的package包/类
public static boolean setGifImageView(GifImageView gifimageview, String key) {
	if (gifimageview == null || StringUtils.isEmpty(key)) {
		return false;
	}
	byte[] gifbytes = null;
	try {
		String filename = EmojiManager.getInstance().getEmojiDir(key);
		InputStream is = MobSDK.getContext().getAssets().open(filename);
		gifbytes = new byte[is.available()];
		is.read(gifbytes);
		is.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
	if (gifbytes != null) {
		gifimageview.setBytes(gifbytes);
		gifimageview.startAnimation();
		return true;
	}
	return false;
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:22,代码来源:EmojiManager.java

示例8: loadEmojiMap

import com.mob.MobSDK; //导入依赖的package包/类
protected void loadEmojiMap() {
	try {
		InputStream is = MobSDK.getContext().getAssets().open("bbssdk/emoji.json");
		int size = is.available();
		byte[] buffer = new byte[size];
		is.read(buffer);
		is.close();
		String text = new String(buffer);
		Map<String, String> mapfromjson = new Hashon().fromJson(text);

		listEmoji = new ArrayList<Map.Entry<String, String>>(mapfromjson.entrySet());
		Collections.sort(listEmoji, new Comparator<Map.Entry<String, String>>() {
			@Override
			public int compare(Map.Entry<String, String> lhs, Map.Entry<String, String> rhs) {
				return lhs.getValue().split("\\/")[0].compareTo(rhs.getValue().split("\\/")[0]);
			}
		});
		for (Map.Entry<String, String> entry : listEmoji) {
			mapEmoji.put(entry.getKey(), entry.getValue());
			mapEmojiReversed.put(entry.getValue(), entry.getKey());
		}
	} catch (IOException e) {
		// Should never happen!
		throw new RuntimeException(e);
	}
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:27,代码来源:EmojiManager.java

示例9: getHeaders

import com.mob.MobSDK; //导入依赖的package包/类
private ArrayList<KVPair<String>> getHeaders(byte[] reqBody) throws Throwable {
	ArrayList<KVPair<String>> headers = new ArrayList<KVPair<String>>();

	// 对明文请求体json文本 拼接appsecret 做一次md5的指纹计算,并保存为http头字段:sign
	// 将图片byte字节数组与appsecret的字节数组(appsecret.getBytes(UTF-8))拼接, 做一次md5的指纹计算,并保存为http头字段:sign
	byte[] bSecret = MobSDK.getAppSecret().getBytes("utf-8");
	byte[] btmp = new byte[reqBody.length + bSecret.length];
	System.arraycopy(reqBody, 0, btmp, 0, reqBody.length);
	System.arraycopy(bSecret, 0, btmp, reqBody.length, bSecret.length);
	String sign = Data.MD5(btmp);
	headers.add(new KVPair<String>("sign", sign));
	headers.add(new KVPair<String>("key", MobSDK.getAppkey()));

	// User-Identity 格式 "[APPPKG]/[APPVER]  ([SDK_TYPE]/[SDK_VERSION])+   [SYSTEM_NAME]/[SYSTEM_VERSION] [TIME_ZONE] Lang/[LANG]"
	// 参见:http://c.mob.com/pages/viewpage.action?pageId=4232327
	ArrayList<MobProduct> products = MobProductCollector.getProducts();
	String userIdentity = MobProductCollector.getUserIdentity(products);
	headers.add(new KVPair<String>("User-Identity", userIdentity));

	return headers;
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:22,代码来源:ProtocolBase.java

示例10: show

import com.mob.MobSDK; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	if (!(context instanceof MobApplication)) {
		MobSDK.init(context.getApplicationContext());
	}

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme")));
	} catch (Throwable t) {}
	OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
	OnekeyShareThemeImpl themeImpl = theme.getImpl();

	themeImpl.setShareParamsMap(shareParamsMap);
	themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
	themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
	themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
	themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
	themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
	themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
	if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
		themeImpl.disableSSO();
	}

	themeImpl.show(context.getApplicationContext());
}
 
开发者ID:gaolhjy,项目名称:cniao5,代码行数:33,代码来源:OnekeyShare.java

示例11: onCreateView

import com.mob.MobSDK; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.fragment_verifyphone, container, false);
    editDisCode = view.findViewById(R.id.findpwd_discode);
    editPhone = view.findViewById(R.id.findpwd_phonenum);
    editVerCode = view.findViewById(R.id.findpwd_vercode);
    getVerCode = view.findViewById(R.id.findpwd_get_vercode);
    nextStep = view.findViewById(R.id.findpwd_next);

    getVerCode.setOnClickListener(this);
    nextStep.setOnClickListener(this);

    editDisCode.clearFocus();
    editPhone.requestFocus();

    //初始化短信SDK
    MobSDK.init(getContext(), "228198a34c17d", "73b44581dcf3914180feb22fcdf3dbb9");

    // 创建EventHandler对象
    eventHandler = new EventHandler() {
        public void afterEvent(int event, int result, Object data) {
            Message msg = new Message();
            msg.arg1 = event;
            msg.arg2 = result;
            msg.obj = data;
            mHandler.handleMessage(msg);
        }
    };

    // 注册短信监听器
    SMSSDK.registerEventHandler(eventHandler);

    fragmentResetPassword = new FragmentResetPassword();

    return view;
}
 
开发者ID:838030195,项目名称:DaiGo,代码行数:38,代码来源:FragmentVerifyPhone.java

示例12: onCreate

import com.mob.MobSDK; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reset_phone);

    //初始化短信SDK
    MobSDK.init(this, "228198a34c17d", "73b44581dcf3914180feb22fcdf3dbb9");

    userIntent = (UserIntent) getIntent().getSerializableExtra("user");

    initView();

    initSMSSDK();
}
 
开发者ID:838030195,项目名称:DaiGo,代码行数:15,代码来源:ResetPhoneActivity.java

示例13: show

import com.mob.MobSDK; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	MobSDK.init(context.getApplicationContext());
	ShareSDK.initSDK(context);

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme")));
	} catch (Throwable t) {}
	OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
	OnekeyShareThemeImpl themeImpl = theme.getImpl();

	themeImpl.setShareParamsMap(shareParamsMap);
	themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
	themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
	themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
	themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
	themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
	themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
	if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
		themeImpl.disableSSO();
	}

	themeImpl.show(context.getApplicationContext());
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:32,代码来源:OnekeyShare.java

示例14: initAndStartMainActivity

import com.mob.MobSDK; //导入依赖的package包/类
private boolean initAndStartMainActivity(String key, String secret) {
	if (StringUtils.isEmpty(key) || !key.matches(REGREX_KEY)) {
		ToastUtils.showToast(InitActivity.this, getStringByResName("bbs_init_illegalkey"));
		return false;
	}

	if (StringUtils.isEmpty(secret) || !secret.matches(REGREX_SECRET)) {
		ToastUtils.showToast(InitActivity.this, getStringByResName("bbs_init_illegalsecret"));
		return false;
	}

	MobSDK.init(InitActivity.this, key, secret);
	if (initTheme != null) {
		if (initTheme == 0) {
			BBSTheme0.init();
		} else {
			BBSTheme1.init();
		}
	}
	//init success or fail?
	finish();
	Intent intent = new Intent(InitActivity.this, MainActivity.class);
	startActivity(intent);

	//open web link page if valid
	if (!StringUtils.isEmpty(strFid) && ! StringUtils.isEmpty(strTid)) {
		final PageForumThreadDetail details = BBSViewBuilder.getInstance().buildPageForumThreadDetail();
		details.setForumThread(Long.parseLong(strFid), Long.parseLong(strTid), "");
		UIHandler.sendMessageDelayed(null, 300, new Handler.Callback() {
			@Override
			public boolean handleMessage(Message msg) {
				details.show(InitActivity.this);
				return false;
			}
		});
	}
	return true;
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:39,代码来源:InitActivity.java

示例15: getEmoji

import com.mob.MobSDK; //导入依赖的package包/类
public Bitmap getEmoji(String key) {
	String dir = getEmojiDir(key);
	if (StringUtils.isEmpty(dir)) {
		return null;
	}
	InputStream is = null;
	try {
		is = MobSDK.getContext().getResources().getAssets().open(dir);
		return BitmapFactory.decodeStream(is);
	} catch (IOException e) {
	}
	return null;
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:14,代码来源:EmojiManager.java


注:本文中的com.mob.MobSDK类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。