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


Java BmobUser類代碼示例

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


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

示例1: registerData

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
/**
 * 注冊
 */
private void registerData() {

    final String name = etusername.getText().toString();
    final String password = etpassword.getText().toString();
    final String email = etemail.getText().toString();
    BmobUser bu = new BmobUser();
    bu.setUsername(name);
    bu.setPassword(password);
    bu.setEmail(email);
    bu.signUp(new SaveListener<BmobUser>() {
        @Override
        public void done(BmobUser bmobUser, BmobException e) {
            if(e==null){
                Toast.makeText(RegisterActivity.this, "注冊成功", Toast.LENGTH_SHORT).show();
                RegisterActivity.this.finish();
            }else{
                Toast.makeText(RegisterActivity.this, "注冊失敗", Toast.LENGTH_SHORT).show();
            }}
    });
}
 
開發者ID:chenlindev,項目名稱:beyondwords,代碼行數:24,代碼來源:RegisterActivity.java

示例2: findWeibos_

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
private void findWeibos_()
{
	nico.styTool.MyUser user = BmobUser.getCurrentUser(this, nico.styTool.MyUser.class);
	BmobQuery<Post_> query = new BmobQuery<Post_>();
	query.addWhereEqualTo("author", user);	// 查詢當前用戶的所有微博
	query.order("-updatedAt");
	query.include("author");// 希望在查詢微博信息的同時也把發布人的信息查詢出來,可以使用include方法
	query.findObjects(this, new FindListener<Post_>() {
			@Override
			public void onSuccess(List<Post_> object)
			{
				// TODO Auto-generated method stub
				weibos = object;
				adapter.notifyDataSetChanged();
				//et_content.setText("");
			}

			@Override
			public void onError(int code, String msg)
			{
				// TODO Auto-generated method stub
				//toast("查詢失敗:"+msg);
			}
		});
}
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:26,代碼來源:WeiboListActivity.java

示例3: onCreate

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null){
        Log.e("fragment","恢複fragment"+KEY_FRAGMENT_TAG);
        restoreFragments();//恢複fragment
        mFragmentCurrentTag = savedInstanceState.getString(KEY_FRAGMENT_TAG);
    }
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    Bmob.initialize(getApplication(), "8641a3984f7c4a4e3d19558a69423ecf");
    user = BmobUser.getCurrentUser(this, User.class);
    mDrawer = (FlowingDrawer) findViewById(R.id.drawerlayout);
    mDrawer.setTouchMode(ElasticDrawer.TOUCH_MODE_BEZEL);
    mLayouts = new LinearLayout[]{
            layoutHome, layoutCategorize, layoutMore
    };
    setupToolbar();
    setupFeed();
    setupMenu();
    setListener();
    update();
}
 
開發者ID:Break369,項目名稱:MyLife,代碼行數:24,代碼來源:MainActivity.java

示例4: updateUserLocation

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
private void updateUserLocation(String city) {
    User mCurrentUser = BmobUser.getCurrentUser(User.class);
    if (mCurrentUser != null) {
        // 允許用戶使用應用
        User user = new User();
        user.setLocation(city);
        user.update(mCurrentUser.getObjectId(), new UpdateListener() {
            @Override
            public void done(BmobException e) {
                if (e == null) {

                } else {
                    ToastUtils.showToast(WeatherActivity.this, "Error:" + e.getMessage());
                }
            }
        });
    } else {
        //緩存用戶對象為空時, 可打開用戶注冊界麵…
        ToastUtils.showToast(WeatherActivity.this, "no cache");
    }

}
 
開發者ID:monsterLin,項目名稱:Pigeon,代碼行數:23,代碼來源:WeatherActivity.java

示例5: refreshData

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
/**
  * 刷新數據操作
  */
 private void refreshData(List<KeepInfo> mDatas){

     MyUser bmobUser=BmobUser.getCurrentUser(MyUser.class);

     if (bmobUser!=null){
         MyUser newUser=new MyUser();
newUser.setValue("keep",mDatas);

         newUser.update(bmobUser.getObjectId(), new UpdateListener() {
             @Override
             public void done(BmobException e) {

                 if (e==null){

                     Toast.makeText(UIUtils.getContext(),"刪除成功",Toast.LENGTH_SHORT).show();
                 }else {
                     Toast.makeText(UIUtils.getContext(),"刪除失敗 請重試",Toast.LENGTH_SHORT).show();
                 }
             }
         });
     }
 }
 
開發者ID:android-jian,項目名稱:topnews,代碼行數:26,代碼來源:KeepOneFragment.java

示例6: onCreateView

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.she_qu_fragment, container, false);
    ButterKnife.bind(this, view);

    mMyUser = BmobUser.getCurrentUser(MyUser.class);
    mSheQuAdapter = new SheQuAdapter(getActivity());
    initToolbar();
    initRecycler();
    initRefresh();
    scrollMoreData();
    // 想讓Fragment中的onCreateOptionsMenu生效必須先調用setHasOptionsMenu方法
    // 否則Toolbar沒有菜單
    setHasOptionsMenu(true);
    return view;
}
 
開發者ID:struggledhard,項目名稱:USay,代碼行數:18,代碼來源:SheQuFragment.java

示例7: initData

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
@Override
public void initData() {
    mCurrentUser = BmobUser.getCurrentUser(User.class);
    BmobFile userPhotoFile = mCurrentUser.getUserPhoto();
    String nick = mCurrentUser.getNick();
    String objectId = mCurrentUser.getObjectId();


    if (!TextUtils.isEmpty(nick)) {
        mTvName.setText(nick);
    }

    if (!TextUtils.isEmpty(objectId)) {
        mTvID.setText("飛鴿號:" + objectId);
    }

    if (userPhotoFile == null) {
        mCivUserPhoto.setImageResource(R.drawable.ic_default);
    } else {
        Picasso.with(getContext()).load(userPhotoFile.getFileUrl()).into(mCivUserPhoto);
    }

}
 
開發者ID:monsterLin,項目名稱:Pigeon,代碼行數:24,代碼來源:PersonFragment.java

示例8: sendToChildrenLocation

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
private void sendToChildrenLocation(final String address, final LatLng latLng) {
    LocationMessage message = new LocationMessage();
    message.setContent("location");
    Map<String, Object> map = new HashMap<>();
    map.put("id", BmobUser.getCurrentUser(User.class).getUsername());
    map.put("address", address);
    map.put("latitude", latLng.latitude);
    map.put("longitude", latLng.longitude);
    message.setExtraMap(map);

    L.i("send location");

    mConversationManager.sendMessage(message, new MessageSendListener() {
        @Override
        public void done(BmobIMMessage bmobIMMessage, BmobException e) {
            if (e != null) {
                L.i("send location failed " + e.getMessage());
            } else {
                L.i("send location successfully");
                L.i("address: " + address);
                L.i("latitude: " + latLng.latitude);
                L.i("longitude: " + latLng.longitude);
            }
        }
    });
}
 
開發者ID:InnoFang,項目名稱:FamilyBond,代碼行數:27,代碼來源:HandleMessageService.java

示例9: refreshView

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
private void refreshView() {
    Cache cache = ArmsUtils.obtainAppComponentFromContext(FollowButton.this.getContext()).extras();
    List<MyAttentionEntity> entities = CommonUtils.getFollowedInfo(mContext);
    if (entities != null && BmobUser.getCurrentUser() != null) {
        boolean isFollowed = false;
        for (MyAttentionEntity entity : entities) {
            if (entity.getId() == this.attention.getId()) {
                isFollowed = true;
            }
        }
        if (isFollowed) {
            setState(FOLLOWED);
        } else {
            setState(UNFOLLOWED);
        }
    }
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:18,代碼來源:FollowButton.java

示例10: initData

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
@Override
    public void initData() {
        bmobUser = BmobUser.getCurrentUser();
//        if (bmobUser != null) {
//
//            isExist = SPUtils.getBoolean(FamilyConfig.SPEXIST, false);
//
//            if (isExist) {
//                AppManager.getAppManager().finishActivity();
//                nextActivity(MainActivity.class);
//            } else {
//                AppManager.getAppManager().finishActivity();
//                nextActivity(GuideFamilyActivity.class);
//            }
//
//        }
    }
 
開發者ID:monsterLin,項目名稱:Pigeon,代碼行數:18,代碼來源:LoginActivity.java

示例11: queryFanNum

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
/**
 * 查詢粉絲數目
 */

private void queryFanNum() {
    BmobQuery<User> query = new BmobQuery<>();
    query.include("focus");
    BmobQuery<BmobUser> innerQuery = new BmobQuery<>();
    innerQuery.addWhereEqualTo("objectId", dynamicAuthor.getObjectId());
    query.addWhereMatchesQuery("focus", "_User", innerQuery);
    query.count(User.class, new CountListener() {
        @Override
        public void done(Integer integer, BmobException e) {
            if (e == null) {
                tvFan.setText(integer.toString());
            } else {
                showToast("查詢粉絲數目失敗" + e.getErrorCode() + e.getMessage());
            }
        }
    });
}
 
開發者ID:HowieTianDev,項目名稱:ChenYan,代碼行數:22,代碼來源:PersonPageActivity.java

示例12: isShowLike

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
private boolean isShowLike() {

        if (article.getLikeIdList() != null && MyApp.isLogin()) {
            HashSet<String> set = new HashSet<>();
            for (String id : article.getLikeIdList()) {
                set.add(id);
            }
            if (set.contains(BmobUser.getCurrentUser(User.class).getObjectId())) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }

    }
 
開發者ID:HowieTianDev,項目名稱:ChenYan,代碼行數:18,代碼來源:ArticleDetailActivity.java

示例13: isShowCollect

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
private boolean isShowCollect() {
    if (article.getCollectIdList() != null && MyApp.isLogin()) {
        HashSet<String> set = new HashSet<>();
        for (String id : article.getCollectIdList()) {
            set.add(id);
        }
        if (set.contains(BmobUser.getCurrentUser(User.class).getObjectId())) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }

}
 
開發者ID:HowieTianDev,項目名稱:ChenYan,代碼行數:17,代碼來源:ArticleDetailActivity.java

示例14: toCollect

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
private void toCollect() {
        BmobRelation relation = new BmobRelation();
//        將當前用戶添加到MActivity表中的collect字段中,表名當前用戶收藏了該活動內容
        relation.add(BmobUser.getCurrentUser(User.class));
        article.setCollect(relation);

        if (article.getCollectIdList() != null) {
            collectIdList = article.getCollectIdList();
        }
        collectIdList.add(user.getObjectId());
        article.setCollectIdList(collectIdList);
        article.update(new UpdateListener() {
            @Override
            public void done(BmobException e) {
                if (e == null) {
                    Log.e(TAG, "收藏成功");

                    ivCollect.setImageResource(R.drawable.ic_favorite_orange_500_24dp);
                    isCollect = true;
                } else {
                    Log.e(TAG, "收藏失敗" + e.getMessage() + e.getErrorCode());
                }
            }
        });

    }
 
開發者ID:HowieTianDev,項目名稱:ChenYan,代碼行數:27,代碼來源:ArticleDetailActivity.java

示例15: cancelCollect

import cn.bmob.v3.BmobUser; //導入依賴的package包/類
private void cancelCollect() {
    BmobRelation relation = new BmobRelation();
    relation.remove(BmobUser.getCurrentUser(User.class));
    article.setCollect(relation);
    //                    移除當前用戶的收藏ID
    if (article.getCollectIdList() != null) {
        collectIdList = article.getCollectIdList();
    }
    collectIdList.remove(user.getObjectId());
    article.setCollectIdList(collectIdList);
    article.update(new UpdateListener() {
        @Override
        public void done(BmobException e) {
            if (e == null) {
                Log.e(TAG, "取消收藏成功");


                ivCollect.setImageResource(R.drawable.ic_favorite_border_grey_500_24dp);
                isCollect = false;

            } else {
                Log.e(TAG, "取消收藏失敗" + e.getErrorCode() + e.getMessage());
            }
        }
    });
}
 
開發者ID:HowieTianDev,項目名稱:ChenYan,代碼行數:27,代碼來源:ArticleDetailActivity.java


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