本文整理汇总了Java中com.umeng.comm.core.impl.CommunityFactory类的典型用法代码示例。如果您正苦于以下问题:Java CommunityFactory类的具体用法?Java CommunityFactory怎么用?Java CommunityFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommunityFactory类属于com.umeng.comm.core.impl包,在下文中一共展示了CommunityFactory类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
// 【注意】如果来源于通知栏打开详情页,需要进行相关初始化操作,如果已经初始化,则方法内部会直接返回~
CommunityFactory.getCommSDK(getApplicationContext());
setContentView(ResFinder.getLayout("umeng_comm_feed_detail"));
CommonUtils.injectComponentImpl(getApplicationContext());// 重新注入登录组件的实现,避免的推送启动时无自定义的登录组件实现
// 设置Fragment的container id
setFragmentContainerId(ResFinder.getId("umeng_comm_feed_container"));
mActivityPresenter = new FeedDetailActivityPresenter(this);
mActivityPresenter.attach(this);
initViews();
initFeed(getIntent());
BroadcastUtils.registerFeedUpdateBroadcast(this, mReceiver);
}
示例2: onCreate
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, getToolBar(),
R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
navigationView.setCheckedItem(R.id.nav_gank);
setFragment(GankIoFragment.getInstance());
CommunitySDK mCommSDK = CommunityFactory.getCommSDK(this);
mCommSDK.initSDK(this);
}
示例3: onClick
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
@OnClick(R.id.get_in)
public void onClick() {
userModel = new UserModel(getActivity());
if (userModel.isLogin()) {
final CommunitySDK mCommSDK = CommunityFactory.getCommSDK(getActivity());
CommUser user = new CommUser();
String nowId = getActivity().getSharedPreferences(Config.CARD_LOGIN_NAME, Context.MODE_PRIVATE).getString(Config.USER_ID,"");
String tmpName;
if(nowId.length() == 12){
//学生
tmpName = "游客" + new StringBuilder(nowId.substring(2,4)).reverse().toString()
+ new StringBuilder(nowId.substring(6)).reverse().toString() ;
}else{
tmpName = "游客" + new StringBuilder(nowId).reverse().toString();
}
user.id = nowId;
user.name = tmpName;
mCommSDK.loginToUmengServerBySelfAccount(getActivity(), user, new LoginListener() {
@Override
public void onStart() {
loadingView.show(((AppCompatActivity)getActivity()).getSupportFragmentManager(),"");
}
@Override
public void onComplete(int i, CommUser commUser) {
loadingView.dismiss();
Log.d("tag", "login result is"+i); //获取登录结果状态码
if (ErrorCode.NO_ERROR==i) {
//登录成功,可以打开社区,也可以进行其他的操作,开发者自己定义
mCommSDK.openCommunity(getActivity());
}else{
Toast.makeText(getActivity(),"啊哦出错了,请稍后再试~",Toast.LENGTH_SHORT).show();
}
}
});
} else {
((HomeActivity) getActivity()).login();
}
}
示例4: ActionDialog
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
public ActionDialog(Context context, int theme) {
super(context, theme);
mPresenter = new FeedDetailActivityPresenter();
mPresenter.attach(context);
mCommunitySDK = CommunityFactory.getCommSDK(getContext());
mDatabaseAPI = DatabaseAPI.getInstance();
initDialog();
initViewClickListeners();
}
示例5: updateUserPortrait
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
/**
* 更新用户头像
*/
private void updateUserPortrait(final Bitmap bmp) {
final ProgressDialog progressDialog = new ProgressDialog(getContext());
progressDialog.setMessage(ResFinder.getString("umeng_comm_update_user_icon"));
progressDialog.setCanceledOnTouchOutside(false);
CommunityFactory.getCommSDK(getContext()).updateUserProtrait(bmp,
new SimpleFetchListener<PortraitUploadResponse>() {
@Override
public void onStart() {
progressDialog.show();
}
@Override
public void onComplete(PortraitUploadResponse response) {
progressDialog.dismiss();
if (response != null && response.errCode == ErrorCode.NO_ERROR) {
Log.d("", "头像更新成功 : " + response.mJsonObject.toString());
CommUser user = CommConfig.getConfig().loginedUser;
user.iconUrl = response.mIconUrl;
Log.d("", "#### 登录用户的头像 : "
+ CommConfig.getConfig().loginedUser.iconUrl);
// 同步到数据库中
syncUserIconUrlToDB(user);
CommonUtils.saveLoginUserInfo(getContext(), user);
BroadcastUtils.sendUserUpdateBroadcast(getContext(), user);
dismiss();
} else {
ToastMsg.showShortMsgByResName("umeng_comm_update_icon_failed");
}
}
});
}
示例6: FeedDetailActivityPresenter
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
public FeedDetailActivityPresenter(MvpFeedDetailActivityView view) {
mActivityView = view;
if (mActivityView instanceof Context) {
mContext = (Context) mActivityView;
mCommunitySDK = CommunityFactory.getCommSDK(mContext);
} else {
throw new NullPointerException("FeedDetailActivityPresenter构造函数的参数不是Context类型");
}
}
示例7: UserReportPresenter
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
public UserReportPresenter(Context context) {
mContext = context;
mCommunitySDK = CommunityFactory.getCommSDK(context);
}
示例8: PickerDialog
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
public PickerDialog(Context context, int theme) {
super(context, theme);
mSdkImpl = CommunityFactory.getCommSDK(context);
}
示例9: initPresenters
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
@Override
protected void initPresenters() {
mCommunitySDK = CommunityFactory.getCommSDK(mContext);
super.initPresenters();
}
示例10: attach
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
public void attach(Context context) {
mContext = context;
mCommunitySDK = CommunityFactory.getCommSDK(context);
}
示例11: UserInfoPresenter
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
public UserInfoPresenter(Activity activity, MvpUserInfoView userInfoView, CommUser user) {
this.mActivity = activity;
this.mUserInfoView = userInfoView;
this.mUser = user;
this.mSdkImpl = CommunityFactory.getCommSDK(activity);
}
示例12: UserSettingPresenter
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
public UserSettingPresenter(Activity context, MvpUserProfileSettingView view) {
mActivity = context;
mCommunitySDK = CommunityFactory.getCommSDK(context);
mProfileSettingView = view;
}
示例13: onCreate
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
requestWindowFeature(Window.FEATURE_NO_TITLE);
// 1、初始化友盟微社区
mCommSDK = CommunityFactory.getCommSDK(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// ==================== 注意 ===================
// 开发者如果想将友盟微社区作为ViewPager中的一个页面集成到应用中时,请将您的ViewPager替换为CommunityViewPager,
// 避免滑动时间冲突导致问题
// CommunityViewPager viewPager = (CommunityViewPager)
// findViewById(R.id.viewPager);
// // 设置ViewPager的Adapter
// viewPager.setAdapter(new
// FragmentTabAdapter(getSupportFragmentManager()));
// ===============================================
// 2、单纯Fragment使用方式
CommunityMainFragment fragment = new CommunityMainFragment();
fragment.setBackButtonVisibility(View.GONE);
// 3、将友盟微社区的首页Fragment添加到Activity中
getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit();
// =================== 自定义设置部分 =================
// 在初始化CommunitySDK之前配置推送和登录等组件
useSocialLogin();
// 使用自定义的ImageLoader
// useMyImageLoader();
// 使用自定义的登录系统
// useCustomLogin();
initPlatforms(this);
// 设置地理位置SDK
LocationSDKManager.getInstance().addAndUse(new DefaultLocationImpl());
}
示例14: setLikeIconOnClick
import com.umeng.comm.core.impl.CommunityFactory; //导入依赖的package包/类
private void setLikeIconOnClick(final TextView likeIconTv , final Comment comment){
likeIconTv.setOnClickListener(new LoginOnViewClickListener() {
@Override
protected void doAfterLogin(final View v) {
synchronized (mLock) {
CommunityFactory.getCommSDK(mContext).likeComment(comment, new FetchListener<SimpleResponse>() {
@Override
public void onStart() {
clickAnima(v);
}
@Override
public void onComplete(SimpleResponse response) {
if (response != null) {
if (ErrorCode.NO_ERROR == response.errCode) {
if (comment.liked) {
comment.liked = false;
comment.likeCount--;
likeIconTv.setCompoundDrawablesWithIntrinsicBounds(ResFinder.getResourceId(ResType.DRAWABLE, "umeng_comm_like_normal"), 0, 0, 0);
} else {
comment.liked = true;
comment.likeCount++;
likeIconTv.setCompoundDrawablesWithIntrinsicBounds(ResFinder.getResourceId(ResType.DRAWABLE, "umeng_comm_like_pressed"), 0, 0, 0);
}
likeIconTv.setText(comment.likeCount + "");
comment.saveEntity();
}else if(ErrorCode.ERROR_COMMENT_LIKED==response.errCode){
comment.liked=true;
comment.likeCount++;
comment.saveEntity();
likeIconTv.setText(comment.likeCount + "");
likeIconTv.setCompoundDrawablesWithIntrinsicBounds(ResFinder.getResourceId(ResType.DRAWABLE, "umeng_comm_like_pressed"), 0, 0, 0);
}else if(ErrorCode.ERROR_COMMENT_LIKE_CANCELED==response.errCode){
comment.liked=false;
comment.likeCount--;
comment.saveEntity();
likeIconTv.setText(comment.likeCount + "");
likeIconTv.setCompoundDrawablesWithIntrinsicBounds(ResFinder.getResourceId(ResType.DRAWABLE, "umeng_comm_like_normal"), 0, 0, 0);
}
}
}
});
}
}});
}