use of com.juns.wechat.net.NetClient in project wechat by motianhuo.
the class ChatActivity method initView.
/**
* initView
*/
protected void initView() {
netClient = new NetClient(this);
recordingContainer = findViewById(R.id.view_talk);
txt_title = (TextView) findViewById(R.id.txt_title);
img_right = (ImageView) findViewById(R.id.img_right);
micImage = (ImageView) findViewById(R.id.mic_image);
animationDrawable = (AnimationDrawable) micImage.getBackground();
animationDrawable.setOneShot(false);
recordingHint = (TextView) findViewById(R.id.recording_hint);
listView = (ListView) findViewById(R.id.list);
mEditTextContent = (PasteEditText) findViewById(R.id.et_sendmessage);
buttonSetModeKeyboard = findViewById(R.id.btn_set_mode_keyboard);
edittext_layout = (RelativeLayout) findViewById(R.id.edittext_layout);
buttonSetModeVoice = findViewById(R.id.btn_set_mode_voice);
buttonSend = findViewById(R.id.btn_send);
buttonPressToSpeak = findViewById(R.id.btn_press_to_speak);
expressionViewpager = (ViewPager) findViewById(R.id.vPager);
emojiIconContainer = (LinearLayout) findViewById(R.id.ll_face_container);
btnContainer = (LinearLayout) findViewById(R.id.ll_btn_container);
// locationImgview = (ImageView) findViewById(R.id.btn_location);
iv_emoticons_normal = (ImageView) findViewById(R.id.iv_emoticons_normal);
iv_emoticons_checked = (ImageView) findViewById(R.id.iv_emoticons_checked);
loadmorePB = (ProgressBar) findViewById(R.id.pb_load_more);
btnMore = (Button) findViewById(R.id.btn_more);
iv_emoticons_normal.setVisibility(View.VISIBLE);
iv_emoticons_checked.setVisibility(View.INVISIBLE);
more = findViewById(R.id.more);
edittext_layout.setBackgroundResource(R.drawable.input_bar_bg_normal);
// 表情list
reslist = getExpressionRes(62);
// 初始化表情viewpager
List<View> views = new ArrayList<View>();
View gv1 = getGridChildView(1);
View gv2 = getGridChildView(2);
View gv3 = getGridChildView(3);
views.add(gv1);
views.add(gv2);
views.add(gv3);
expressionViewpager.setAdapter(new ExpressionPagerAdapter(views));
edittext_layout.requestFocus();
voiceRecorder = new VoiceRecorder(micImageHandler);
buttonPressToSpeak.setOnTouchListener(new PressToSpeakListen());
mEditTextContent.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
edittext_layout.setBackgroundResource(R.drawable.input_bar_bg_active);
} else {
edittext_layout.setBackgroundResource(R.drawable.input_bar_bg_normal);
}
}
});
mEditTextContent.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
edittext_layout.setBackgroundResource(R.drawable.input_bar_bg_active);
more.setVisibility(View.GONE);
iv_emoticons_normal.setVisibility(View.VISIBLE);
iv_emoticons_checked.setVisibility(View.INVISIBLE);
emojiIconContainer.setVisibility(View.GONE);
btnContainer.setVisibility(View.GONE);
}
});
// 监听文字框
mEditTextContent.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!TextUtils.isEmpty(s)) {
btnMore.setVisibility(View.GONE);
buttonSend.setVisibility(View.VISIBLE);
} else {
btnMore.setVisibility(View.VISIBLE);
buttonSend.setVisibility(View.GONE);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
use of com.juns.wechat.net.NetClient in project wechat by motianhuo.
the class UpdateService method onCreate.
@Override
public void onCreate() {
super.onCreate();
netClient = new NetClient(this);
db = FinalDb.create(this, Constants.DB_NAME, false);
}
use of com.juns.wechat.net.NetClient in project wechat by motianhuo.
the class BaseActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = this;
App.getInstance2().addActivity(this);
netClient = new NetClient(this);
initControl();
initView();
initData();
setListener();
}
use of com.juns.wechat.net.NetClient in project wechat by motianhuo.
the class UserUtils method initUserInfo.
public static void initUserInfo(final Context context, final String telphone, final ImageView img_avar, final TextView txt_name) {
NetClient netClient = new NetClient(context);
RequestParams params = new RequestParams();
params.put("telphone", telphone);
netClient.post(Constants.getUserInfoURL, params, new BaseJsonRes() {
@Override
public void onMySuccess(String data) {
User user = JSON.parseObject(data, User.class);
if (user != null) {
if (user.getUserName() != null) {
txt_name.setText(user.getUserName());
}
if (user.getHeadUrl() != null) {
NetClient.getIconBitmap(img_avar, user.getHeadUrl());
}
FinalDb db = FinalDb.create(context, Constants.DB_NAME, false);
if (db.findById(user.getId(), User.class) != null)
db.deleteById(User.class, user.getId());
db.save(user);
GloableParams.UserInfos.add(user);
GloableParams.Users.put(user.getTelephone(), user);
}
}
@Override
public void onMyFailure() {
}
});
}
Aggregations