本文整理汇总了Java中com.lqr.wechat.util.UIUtils类的典型用法代码示例。如果您正苦于以下问题:Java UIUtils类的具体用法?Java UIUtils怎么用?Java UIUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UIUtils类属于com.lqr.wechat.util包,在下文中一共展示了UIUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyApp.activities.add(this);
init();
//判断是否使用MVP模式
mPresenter = createPresenter();
if (mPresenter != null) {
mPresenter.attachView((V) this);//因为之后所有的子类都要实现对应的View接口
}
//子类不再需要设置布局ID,也不再需要使用ButterKnife.bind()
setContentView(provideContentViewId());
ButterKnife.bind(this);
setupAppBarAndToolbar();
//沉浸式状态栏
StatusBarUtil.setColor(this, UIUtils.getColor(R.color.colorPrimaryDark), 10);
initView();
initData();
initListener();
}
示例2: changeHasFocusViewBackgroundColor
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
public void changeHasFocusViewBackgroundColor(View view) {
if (view.hasFocus()) {
view.setBackgroundColor(UIUtils.getColor(R.color.green0));
} else {
view.setBackgroundColor(UIUtils.getColor(R.color.line));
}
}
示例3: initListener
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
/**
* 初始化各类事件
*/
@Override
public void initListener() {
mEtPwd.addTextChangedListener(watcher);
mEtPhone.addTextChangedListener(watcher);
/**
* 判断焦点是否存在EditText的输入框上
*/
mEtPwd.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
mVLinePwd.setBackgroundColor(UIUtils.getColor(R.color.green0));
} else {
mVLinePwd.setBackgroundColor(UIUtils.getColor(R.color.line));
}
});
mEtPhone.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
mVLinePhone.setBackgroundColor(UIUtils.getColor(R.color.green0));
} else {
mVLinePhone.setBackgroundColor(UIUtils.getColor(R.color.line));
}
});
//调用登录方法
mBtnLogin.setOnClickListener(v -> mPresenter.login());
}
示例4: loadOtherInfo
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
public void loadOtherInfo(int sessionType, String sessionId) {
setToTop();
switch (sessionType) {
case SESSION_TYPE_PRIVATE:
break;
case SESSION_TYPE_GROUP:
Observable.just(DBManager.getInstance().getGroupsById(sessionId))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(groups -> {
if (groups == null)
return;
mGroups = groups;
//设置群信息
getView().getOivGroupName().setRightText(groups.getName());
mDisplayName = TextUtils.isEmpty(groups.getDisplayName()) ?
DBManager.getInstance().getUserInfo(UserCache.getId()).getName() :
groups.getDisplayName();
getView().getOivNickNameInGroup().setRightText(mDisplayName);
getView().getBtnQuit().setText(groups.getRole().equals("0") ? UIUtils.getString(R.string.dismiss_this_group) :
UIUtils.getString(R.string.delete_and_exit));
}, this::loadOtherError);
break;
}
}
示例5: getGroupMember
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
public void getGroupMember(String groupId) {
if (!mHasFetchedGroupMembers) {
deleteGroupMembers();
mGroupsList = getGroups();
fetchGroupMembers();
} else {
ApiRetrofit.getInstance().getGroupMember(groupId)
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe(getGroupMemberResponse -> {
if (getGroupMemberResponse != null && getGroupMemberResponse.getCode() == 200) {
List<GetGroupMemberResponse.ResultEntity> list = getGroupMemberResponse.getResult();
if (list != null && list.size() > 0) {
deleteGroupMembersByGroupId(groupId);
saveGroupMembers(list, groupId);
BroadcastManager.getInstance(UIUtils.getContext()).sendBroadcast(AppConst.UPDATE_GROUP_MEMBER, groupId);
BroadcastManager.getInstance(UIUtils.getContext()).sendBroadcast(AppConst.UPDATE_CONVERSATIONS);
}
}
}, this::loadError);
}
}
示例6: changeMyName
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
private void changeMyName() {
showWaitingDialog(UIUtils.getString(R.string.please_wait));
String nickName = mEtName.getText().toString().trim();
ApiRetrofit.getInstance().setName(nickName)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(setNameResponse -> {
hideWaitingDialog();
if (setNameResponse.getCode() == 200) {
Friend friend = DBManager.getInstance().getFriendById(UserCache.getId());
if (friend != null) {
friend.setName(nickName);
friend.setDisplayName(nickName);
DBManager.getInstance().saveOrUpdateFriend(friend);
BroadcastManager.getInstance(ChangeMyNameActivity.this).sendBroadcast(AppConst.CHANGE_INFO_FOR_ME);
BroadcastManager.getInstance(ChangeMyNameActivity.this).sendBroadcast(AppConst.CHANGE_INFO_FOR_CHANGE_NAME);
}
finish();
}
}, this::loadError);
}
示例7: selectBottomOne
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
public void selectBottomOne(int switchItem) {
mIvSaomaPress.setVisibility(View.GONE);
mIvFengmianPress.setVisibility(View.GONE);
mIvJiejingPress.setVisibility(View.GONE);
mIvFanyiPress.setVisibility(View.GONE);
switch (switchItem) {
case 0:
setToolbarTitle(UIUtils.getString(R.string.qr_cord_or_bar_code));
mIvSaomaPress.setVisibility(View.VISIBLE);
break;
case 1:
setToolbarTitle(UIUtils.getString(R.string.cover_or_movie_poster));
mIvFengmianPress.setVisibility(View.VISIBLE);
break;
case 2:
setToolbarTitle(UIUtils.getString(R.string.street_scape));
mIvJiejingPress.setVisibility(View.VISIBLE);
break;
case 3:
setToolbarTitle(UIUtils.getString(R.string.translate));
mIvFanyiPress.setVisibility(View.VISIBLE);
break;
}
}
示例8: initView
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
@Override
public void initView() {
setToolbarTitle(UIUtils.getString(R.string.app_name));
mIbAddMenu.setVisibility(View.VISIBLE);
//等待全局数据获取完毕
showWaitingDialog(UIUtils.getString(R.string.please_wait));
//默认选中第一个
setTransparency();
mTvMessagePress.getBackground().setAlpha(255);
mTvMessageTextPress.setTextColor(Color.argb(255, 69, 192, 26));
//设置ViewPager的最大缓存页面
mVpContent.setOffscreenPageLimit(3);
mFragmentList.add(FragmentFactory.getInstance().getRecentMessageFragment());
mFragmentList.add(FragmentFactory.getInstance().getContactsFragment());
mFragmentList.add(FragmentFactory.getInstance().getDiscoveryFragment());
mFragmentList.add(FragmentFactory.getInstance().getMeFragment());
mVpContent.setAdapter(new CommonFragmentPagerAdapter(getSupportFragmentManager(), mFragmentList));
}
示例9: onActivityResult
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {//返回多张照片
if (data != null) {
final ArrayList<ImageItem> images = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
if (images != null && images.size() > 0) {
//取第一张照片
ThreadPoolFactory.getNormalPool().execute(new Runnable() {
@Override
public void run() {
String result = QRCodeDecoder.syncDecodeQRCode(images.get(0).path);
if (TextUtils.isEmpty(result)) {
UIUtils.showToast(UIUtils.getString(R.string.scan_fail));
} else {
handleResult(result);
}
}
});
}
}
}
}
示例10: loadData
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
private void loadData() {
Observable.just(DBManager.getInstance().getFriends())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(friends -> {
if (friends != null && friends.size() > 0) {
mData.clear();
mData.addAll(friends);
getView().getFooterView().setText(UIUtils.getString(R.string.count_of_contacts, mData.size()));
//整理排序
SortUtils.sortContacts(mData);
if (mAdapter != null)
mAdapter.notifyDataSetChanged();
}
}, this::loadError);
}
示例11: clearConversationMsg
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
public void clearConversationMsg() {
mContext.showMaterialDialog(null, UIUtils.getString(R.string.are_you_sure_to_clear_msg_record), UIUtils.getString(R.string.clear), UIUtils.getString(R.string.cancel)
, v1 -> RongIMClient.getInstance().clearMessages(mConversationType, mSessionId, new RongIMClient.ResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean aBoolean) {
mContext.hideMaterialDialog();
BroadcastManager.getInstance(mContext).sendBroadcast(AppConst.UPDATE_CONVERSATIONS);
BroadcastManager.getInstance(mContext).sendBroadcast(AppConst.REFRESH_CURRENT_SESSION);
}
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
mContext.hideMaterialDialog();
}
}), v2 -> mContext.hideMaterialDialog());
}
示例12: initView
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
@Override
public void initView() {
mBtnToolbarSend.setText(UIUtils.getString(R.string.save));
mBtnToolbarSend.setVisibility(View.VISIBLE);
UserInfo userInfo = DBManager.getInstance().getUserInfo(UserCache.getId());
if (userInfo != null)
mEtName.setText(userInfo.getName());
mEtName.setSelection(mEtName.getText().toString().trim().length());
}
示例13: initView
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
@Override
public void initView(View rootView) {
mHeaderView = View.inflate(getActivity(), R.layout.header_rv_contacts, null);
mTvNewFriendUnread = (TextView) mHeaderView.findViewById(R.id.tvNewFriendUnread);
mFooterView = new TextView(getContext());
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, UIUtils.dip2Px(50));
mFooterView.setLayoutParams(params);
mFooterView.setGravity(Gravity.CENTER);
registerBR();
}
示例14: updateTotalUnreadView
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
private void updateTotalUnreadView() {
if (mUnreadCountTotal > 0) {
((MainActivity) mContext).getTvMessageCount().setText(mUnreadCountTotal + "");
((MainActivity) mContext).getTvMessageCount().setVisibility(View.VISIBLE);
((MainActivity) mContext).setToolbarTitle(UIUtils.getString(R.string.app_name) + "(" + mUnreadCountTotal + ")");
} else {
((MainActivity) mContext).getTvMessageCount().setVisibility(View.GONE);
((MainActivity) mContext).setToolbarTitle(UIUtils.getString(R.string.app_name));
}
}
示例15: connect
import com.lqr.wechat.util.UIUtils; //导入依赖的package包/类
/**
* 建立与融云服务器的连接
*
* @param token
*/
private void connect(String token) {
if (UIUtils.getContext().getApplicationInfo().packageName.equals(MyApp.getCurProcessName(UIUtils.getContext()))) {
/**
* IMKit SDK调用第二步,建立与服务器的连接
*/
RongIMClient.connect(token, new RongIMClient.ConnectCallback() {
/**
* Token 错误,在线上环境下主要是因为 Token 已经过期,您需要向 App Server 重新请求一个新的 Token
*/
@Override
public void onTokenIncorrect() {
LogUtils.e("--onTokenIncorrect");
}
/**
* 连接融云成功
* @param userid 当前 token
*/
@Override
public void onSuccess(String userid) {
LogUtils.e("--onSuccess---" + userid);
BroadcastManager.getInstance(mContext).sendBroadcast(AppConst.UPDATE_CONVERSATIONS);
}
/**
* 连接融云失败
* @param errorCode 错误码,可到官网 查看错误码对应的注释
*/
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
LogUtils.e("--onError" + errorCode);
UIUtils.showToast(UIUtils.getString(R.string.disconnect_server));
}
});
}
}