源码简介
本源码是一个老版本的陌陌源码,翻了翻代码,发现有完整的登陆注册功能(基于本地)其余都是静态页面。有需要的朋友可以拿去研究一下。其中登陆账号是86930007密码为123456。
源码截图
源码片段:
public class WelcomeActivity extends BaseActivity implements OnClickListener {
private LinearLayout mLinearCtrlbar;
private LinearLayout mLinearAvatars;
private Button mBtnRegister;
private Button mBtnLogin;
private ImageButton mIbtnAbout;
private View[] mMemberBlocks;
private String[] mAvatars = new String[] { "welcome_0", "welcome_1",
"welcome_2", "welcome_3", "welcome_4", "welcome_5" };
private String[] mDistances = new String[] { "0.84km", "1.02km", "1.34km",
"1.88km", "2.50km", "2.78km" };
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
initViews();
initEvents();
initAvatarsItem();
showWelcomeAnimation();
}
@Override
protected void initViews() {
mLinearCtrlbar = (LinearLayout) findViewById(R.id.welcome_linear_ctrlbar);
mLinearAvatars = (LinearLayout) findViewById(R.id.welcome_linear_avatars);
mBtnRegister = (Button) findViewById(R.id.welcome_btn_register);
mBtnLogin = (Button) findViewById(R.id.welcome_btn_login);
mIbtnAbout = (ImageButton) findViewById(R.id.welcome_ibtn_about);
}
@Override
protected void initEvents() {
mBtnRegister.setOnClickListener(this);
mBtnLogin.setOnClickListener(this);
mIbtnAbout.setOnClickListener(this);
}
private void initAvatarsItem() {
initMemberBlocks();
for (int i = 0; i < mMemberBlocks.length; i++) {
((ImageView) mMemberBlocks[i]
.findViewById(R.id.welcome_item_iv_avatar))
.setImageBitmap(mApplication.getAvatar(mAvatars[i]));
((HandyTextView) mMemberBlocks[i]
.findViewById(R.id.welcome_item_htv_distance))
.setText(mDistances[i]);
}
}
private void initMemberBlocks() {
mMemberBlocks = new View[6];
mMemberBlocks[0] = findViewById(R.id.welcome_include_member_avatar_block0);
mMemberBlocks[1] = findViewById(R.id.welcome_include_member_avatar_block1);
mMemberBlocks[2] = findViewById(R.id.welcome_include_member_avatar_block2);
mMemberBlocks[3] = findViewById(R.id.welcome_include_member_avatar_block3);
mMemberBlocks[4] = findViewById(R.id.welcome_include_member_avatar_block4);
mMemberBlocks[5] = findViewById(R.id.welcome_include_member_avatar_block5);
int margin = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
.getDisplayMetrics());
int widthAndHeight = (mScreenWidth - margin * 12) / 6;
for (int i = 0; i < mMemberBlocks.length; i++) {
ViewGroup.LayoutParams params = mMemberBlocks[i].findViewById(
R.id.welcome_item_iv_avatar).getLayoutParams();
params.width = widthAndHeight;
params.height = widthAndHeight;
mMemberBlocks[i].findViewById(R.id.welcome_item_iv_avatar)
.setLayoutParams(params);
}
mLinearAvatars.invalidate();
}
private void showWelcomeAnimation() {
Animation animation = AnimationUtils.loadAnimation(
WelcomeActivity.this, R.anim.welcome_ctrlbar_slideup);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
mLinearAvatars.setVisibility(View.GONE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mLinearAvatars.setVisibility(View.VISIBLE);
}
}, 800);
}
});
mLinearCtrlbar.startAnimation(animation);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.welcome_btn_register:
startActivity(RegisterActivity.class);
break;
case R.id.welcome_btn_login:
startActivity(LoginActivity.class);
break;
case R.id.welcome_ibtn_about:
startActivity(AboutTabsActivity.class);
break;
}
}
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.