Android源码之陌陌源码

移动开发
本源码是一个老版本的陌陌源码,翻了翻代码,发现有完整的登陆注册功能(基于本地)其余都是静态页面。有需要的朋友可以拿去研究一下。其中登陆账号是86930007密码为123456。

源码简介

本源码是一个老版本的陌陌源码,翻了翻代码,发现有完整的登陆注册功能(基于本地)其余都是静态页面。有需要的朋友可以拿去研究一下。其中登陆账号是86930007密码为123456。
源码截图

源码片段:

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

源码链接:http://down.51cto.com/data/2013979

责任编辑:chenqingxiang 来源: 网络整理
相关推荐

2012-08-31 14:36:19

陌陌林志霖社交应用

2014-07-25 15:41:12

陌陌WOT2014GoRedis

2012-08-27 09:39:23

陌陌社交APP

2021-12-06 16:35:33

QQ微博社交软件

2015-05-12 14:34:09

陌陌

2014-08-15 17:51:39

听云

2012-08-21 15:52:48

2015-05-27 11:05:46

阿里云陌陌CDN

2014-05-13 14:11:36

GoRedis

2015-07-23 11:53:39

我是歌手

2012-08-23 16:41:10

陌陌投资

2012-11-14 09:45:57

陌陌

2015-07-24 16:49:40

陌陌礼物

2015-10-21 16:39:43

陌陌魅蓝

2015-06-09 12:05:23

华尔街分析师

2015-11-11 15:17:16

双十一单身陌陌

2016-10-21 17:12:00

故障高可用技术

2014-03-05 09:31:54

陌陌争霸数据库

2014-03-09 23:29:12

2017-11-21 10:11:19

陌陌K8sDocker
点赞
收藏

51CTO技术栈公众号