1.隐藏输入法
public static void onInactive(Context context, EditText et) {
if (et == null)
return;
et.clearFocus();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
}
2.给背景图片设置不断来回移动的动画
mImg_Background = (ImageView) findViewById(R.id.de_img_backgroud);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Animation animation = AnimationUtils.loadAnimation(LoginActivity.this, R.anim.translate_anim);
mImg_Background.startAnimation(animation);
}
}, 200);
3.创建一个对话框在界面跳出来
final AlertDialog dlg = new AlertDialog.Builder(LoginActivity.this).create();
dlg.show();
Window window = dlg.getWindow();
window.setContentView(R.layout.other_devices);
TextView text = (TextView) window.findViewById(R.id.ok);
text.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dlg.cancel();
}
});
4.给EditText设置晃动动画,放在自定义的EditText中:
public static Animation shakeAnimation(int counts) {
Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
translateAnimation.setInterpolator(new CycleInterpolator(counts));
translateAnimation.setDuration(500);
return translateAnimation;
}
5.HiSeat里面的网络请求是通过httpClient进行的,在基类里面进行网络请求的封装,通过一个
AsyncTaskManager类来进行真正的网络请求操作,通过EvengBus实现线程之间的切换(异步),再通过EventBus实现线程切换,
通过传递来的参数实现回调对应activity里面的网络操作方法,真正的网络操作的实现是通过一个SealAction类来进行的,
完成以后传递结果给EventBus,同时通过最初的参数实现回调对应activity里面的网络请求成功或者失败的方法。
6.获取AndroidManifest.xml中存储的数据
AndroidManifest.xml中这样写:
<meta-data android:name="RONG_CLOUD_APP_KEY" android:value="e0x9wycfx7flq" />
获取的代码这样写:
ApplicationInfo applicationInfo = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), PackageManager.GET_META_DATA); if (applicationInfo != null) { appKey = applicationInfo.metaData.getString("RONG_CLOUD_APP_KEY"); }
为什么用27来进行用户信息的同步
mGetAllUserInfoState用于描述是否拉取了用户的好友信息
hasGetFriends用于描述