欢迎来到三一文库! | 帮助中心 三一文库31doc.com 一个上传文档投稿赚钱的网站
三一文库
全部分类
  • 研究报告>
  • 工作总结>
  • 合同范本>
  • 心得体会>
  • 工作报告>
  • 党团相关>
  • 幼儿/小学教育>
  • 高等教育>
  • 经济/贸易/财会>
  • 建筑/环境>
  • 金融/证券>
  • 医学/心理学>
  • ImageVerifierCode 换一换
    首页 三一文库 > 资源分类 > DOC文档下载  

    [计算机软件及应用]AndroidICS40锁屏流程.doc

    • 资源ID:1991440       资源大小:755.77KB        全文页数:32页
    • 资源格式: DOC        下载积分:6
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录   微博登录  
    二维码
    微信扫一扫登录
    下载资源需要6
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    [计算机软件及应用]AndroidICS40锁屏流程.doc

    淄博怡源网络科技有限公司www.yywlkj.com先来说说LockScreen分类;一、无锁屏;二、锁屏:1、UnLockScreen:图案锁、 PIN锁, 密码锁;2、LockScreen:波纹锁;接着我们来看看LockScreen的时序图: 综上所述:1、createUnlockScreenFor()方法创建的是UnLockScreen界面,代码如下:java view plaincopyprint?1. View createUnlockScreenFor(UnlockMode unlockMode) 2. View unlockView = null; 3.4. if (DEBUG) Log.d(TAG, 5. "createUnlockScreenFor(" + unlockMode + "): mEnableFallback=" + mEnableFallback); 6.7. if (unlockMode = UnlockMode.Pattern) 8. PatternUnlockScreen view = new PatternUnlockScreen( 9. mContext, 10. mConfiguration, 11. mLockPatternUtils, 12. mUpdateMonitor, 13. mKeyguardScreenCallback, 14. mUpdateMonitor.getFailedAttempts(); 15. view.setEnableFallback(mEnableFallback); 16. unlockView = view; 17. else if (unlockMode = UnlockMode.SimPuk) 18. unlockView = new SimPukUnlockScreen( 19. mContext, 20. mConfiguration, 21. mUpdateMonitor, 22. mKeyguardScreenCallback, 23. mLockPatternUtils, MSimTelephonyManager.getDefault().getDefaultSubscription(); 24. else if (unlockMode = UnlockMode.SimPin) 25. unlockView = new SimUnlockScreen( 26. mContext, 27. mConfiguration, 28. mUpdateMonitor, 29. mKeyguardScreenCallback, 30. mLockPatternUtils); 31. else if (unlockMode = UnlockMode.Account) 32. try 33. unlockView = new AccountUnlockScreen( 34. mContext, 35. mConfiguration, 36. mUpdateMonitor, 37. mKeyguardScreenCallback, 38. mLockPatternUtils); 39. catch (IllegalStateException e) 40. Log.i(TAG, "Couldn't instantiate AccountUnlockScreen" 41. + " (IAccountsService isn't available)"); 42. / TODO: Need a more general way to provide a 43. / platform-specific fallback UI here. 44. / For now, if we can't display the account login 45. / unlock UI, just bring back the regular "Pattern" unlock mode. 46.47. / (We do this by simply returning a regular UnlockScreen 48. / here. This means that the user will still see the 49. / regular pattern unlock UI, regardless of the value of 50. / mUnlockScreenMode or whether or not we're in the 51. / "permanently locked" state.) 52. return createUnlockScreenFor(UnlockMode.Pattern); 53. 54. else if (unlockMode = UnlockMode.Password) 55. unlockView = new PasswordUnlockScreen( 56. mContext, 57. mConfiguration, 58. mLockPatternUtils, 59. mUpdateMonitor, 60. mKeyguardScreenCallback); 61. else 62. throw new IllegalArgumentException("unknown unlock mode " + unlockMode); 63. 64. initializeTransportControlView(unlockView); 65. initializeFaceLockAreaView(unlockView); / Only shows view if FaceLock is enabled 66.67. mUnlockScreenMode = unlockMode; 68. return unlockView; 69. 2、createLockScreen()就是创建LockScreen界面:java view plaincopyprint?1. View createLockScreen() 2. /*View lockView = new LockScreen( 3. mContext, 4. mConfiguration, 5. mLockPatternUtils, 6. mUpdateMonitor, 7. mKeyguardScreenCallback); 8. initializeTransportControlView(lockView); 9. return lockView;*/ 10.11. long lockscreenType = 0; 12. try 13. lockscreenType = android.provider.Settings.Secure. 14. getLong(mContext.getContentResolver(), "lockscreen.disabled"); 15. catch(Exception e) 16. e.printStackTrace(); 17. 18. View lockView = null; 19. lockView = new LockScreen( 20. mContext, 21. mConfiguration, 22. mLockPatternUtils, 23. mUpdateMonitor, 24. mKeyguardScreenCallback); 25. initializeTransportControlView(lockView); 26. return lockView; 27. 我们来看看锁屏界面的流程:step 1:创建LockScreen.java类>先看看构造函数:java view plaincopyprint?1. LockScreen(Context context, Configuration configuration, LockPatternUtils lockPatternUtils, 2. KeyguardUpdateMonitor updateMonitor, 3. KeyguardScreenCallback callback) 4. super(context); 5. mLockPatternUtils = lockPatternUtils; 6. mUpdateMonitor = updateMonitor; 7. mCallback = callback; 8.9. mEnableMenuKeyInLockScreen = shouldEnableMenuKey(); 10.11. mCreationOrientation = configuration.orientation; 12.13. mKeyboardHidden = configuration.hardKeyboardHidden; 14.15. if (LockPatternKeyguardView.DEBUG_CONFIGURATION) 16. Log.v(TAG, "* CREATING LOCK SCREEN", new RuntimeException(); 17. Log.v(TAG, "Cur orient=" + mCreationOrientation 18. + " res orient=" + context.getResources().getConfiguration().orientation); 19. 20.21. final LayoutInflater inflater = LayoutInflater.from(context); 22. if (DBG) Log.v(TAG, "Creation orientation = " + mCreationOrientation); 23. if (mCreationOrientation != Configuration.ORIENTATION_LANDSCAPE) 24. inflater.inflate(R.layout.keyguard_screen_tab_unlock, this, true); 25. else 26. inflater.inflate(R.layout.keyguard_screen_tab_unlock_land, this, true); 27. 28.29. if (TelephonyManager.getDefault().isMultiSimEnabled() 30. mStatusViewManager = new MSimKeyguardStatusViewManager(this, mUpdateMonitor, 31. mLockPatternUtils, mCallback, false); 32. else 33. mStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor, 34. mLockPatternUtils, mCallback, false); 35. 36.37. setFocusable(true); 38. setFocusableInTouchMode(true); 39. setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); 40.41. mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); 42. / modify by wangxianming in 2012-06-22 43. if (mAudioManager != null) 44. mSilentMode = isSilentMode(); 45. 46.47. mUnlockWidget = findViewById(R.id.unlock_widget); 48. if (mUnlockWidget instanceof SlidingTab) 49. SlidingTab slidingTabView = (SlidingTab) mUnlockWidget; 50. slidingTabView.setHoldAfterTrigger(true, false); 51. slidingTabView.setLeftHintText(R.string.lockscreen_unlock_label); 52. slidingTabView.setLeftTabResources( 53. R.drawable.ic_jog_dial_unlock, 54. R.drawable.jog_tab_target_green, 55. R.drawable.jog_tab_bar_left_unlock, 56. R.drawable.jog_tab_left_unlock); 57. SlidingTabMethods slidingTabMethods = new SlidingTabMethods(slidingTabView); 58. slidingTabView.setOnTriggerListener(slidingTabMethods); 59. mUnlockWidgetMethods = slidingTabMethods; 60. else if (mUnlockWidget instanceof WaveView) 61. WaveView waveView = (WaveView) mUnlockWidget; 62. WaveViewMethods waveViewMethods = new WaveViewMethods(waveView); 63. waveView.setOnTriggerListener(waveViewMethods); 64. mUnlockWidgetMethods = waveViewMethods; 65. else if (mUnlockWidget instanceof MultiWaveView) 66. MultiWaveView multiWaveView = (MultiWaveView) mUnlockWidget; 67. MultiWaveViewMethods multiWaveViewMethods = new MultiWaveViewMethods(multiWaveView); 68. multiWaveView.setOnTriggerListener(multiWaveViewMethods); 69. mUnlockWidgetMethods = multiWaveViewMethods; 70. else 71. throw new IllegalStateException("Unrecognized unlock widget: " + mUnlockWidget); 72. 73.74. / Update widget with initial ring state 75. mUnlockWidgetMethods.updateResources(); 76.77. if (DBG) Log.v(TAG, "* LockScreen accel is " 78. + (mUnlockWidget.isHardwareAccelerated() ? "on":"off"); 79. Step 2:在Step 1步骤中根据横竖屏来加载横竖屏的布局:java view plaincopyprint?1. if (mCreationOrientation != Configuration.ORIENTATION_LANDSCAPE) 2. inflater.inflate(R.layout.keyguard_screen_tab_unlock, this, true); 3. else 4. inflater.inflate(R.layout.keyguard_screen_tab_unlock_land, this, true); 5. Step 3:来看看竖屏的布局文件的代码:java view plaincopyprint?1. <GridLayout 2. xmlns:android="http:/schemas.android.com/apk/res/android" 3. android:orientation="vertical" 4. android:layout_width="match_parent" 5. android:layout_height="match_parent" 6. android:gravity="center_horizontal"> 7. <!- 锁屏界面加载数字时钟 -> 8. <com.android.internal.widget.DigitalClock android:id="+id/time" 9. android:layout_marginTop="dimen/keyguard_lockscreen_status_line_clockfont_top_margin" 10. android:layout_marginBottom="12dip" 11. android:layout_marginRight="dimen/keyguard_lockscreen_status_line_font_right_margin" 12. android:layout_gravity="right"> 13.14. <!- Because we can't have multi-tone fonts, we render two TextViews, one on 15. top of the other. Hence the redundant layout. -> 16. <TextView android:id="+id/timeDisplayBackground" 17. android:layout_width="wrap_content" 18. android:layout_height="wrap_content" 19. android:singleLine="true" 20. android:ellipsize="none" 21. android:textSize="dimen/keyguard_lockscreen_clock_font_size" 22. android:textAppearance="?android:attr/textAppearanceMedium" 23. android:layout_marginBottom="6dip" 24. android:textColor="color/lockscreen_clock_background" 25. /> 26.27. <TextView android:id="+id/timeDisplayForeground" 28. android:layout_width="wrap_content" 29. android:layout_height="wrap_content" 30. android:singleLine="true" 31. android:ellipsize="none" 32. android:textSize="dimen/keyguard_lockscreen_clock_font_size" 33. android:textAppearance="?android:attr/textAppearanceMedium" 34. android:layout_marginBottom="6dip" 35. android:textColor="color/lockscreen_clock_foreground" 36. android:layout_alignLeft="id/timeDisplayBackground" 37. android:layout_alignTop="id/timeDisplayBackground" 38. /> 39.40. </com.android.internal.widget.DigitalClock> 41.42. <LinearLayout 43. android:orientation="horizontal" 44. android:layout_gravity="right" 45. android:layout_marginRight="dimen/keyguard_lockscreen_status_line_font_right_margin"> 46. <!- 锁屏界面加载日期 -> 47. <TextView 48. android:id="+id/date" 49. android:layout_width="wrap_content" 50. android:layout_height="wrap_content" 51. android:singleLine="true" 52. android:ellipsize="marquee" 53. android:textAppearance="?android:attr/textAppearanceMedium" 54. android:textSize="dimen/keyguard_lockscreen_status_line_font_size" 55. /> 56. <!- 锁屏界面加载闹钟状态 -> 57. <TextView 58. android:id="+id/alarm_status" 59. android:layout_width="wrap_content" 60. android:layout_height="wrap_content" 61. android:layout_marginLeft="16dip" 62. android:singleLine="true" 63. android:ellipsize="marquee" 64. android:textAppearance="?android:attr/textAppearanceMedium" 65. android:textSize="dimen/keyguard_lockscreen_status_line_font_size" 66. android:drawablePadding="4dip" 67. /> 68.69. </LinearLayout> 70. <!- 锁屏界面加载充电状态 -> 71. <TextView 72. android:id="+id/status1" 73. android:layout_gravity="right" 74. android:layout_marginRight="dimen/keyguard_lockscreen_status_line_font_right_margin" 75. android:singleLine="true" 76. android:ellipsize="marquee" 77. android:textAppearance="?android:attr/textAppearanceMedium" 78. android:textSize="dimen/keyguard_lockscreen_status_line_font_size" 79. android:drawablePadding="4dip" 80. /> 81.82. <Space android:layout_gravity="fill" /> 83. <RelativeLayout 84. android:layout_width="match_parent" 85. android:layout_height="302dip"> 86. <!- 锁屏界面加载波纹的锁屏 -> 87. <com.android.internal.widget.multiwaveview.MultiWaveView 88. android:id="+id/unlock_widget" 89. android:orientation="horizontal" 90. android:layout_width="match_parent" 91. android:layout_height="match_parent" 92. android:layout_alignParentBottom="true" 93.94. android:targetDrawables="array/lockscreen_targets_with_camera" 95. android:targetDescriptions="array/lockscreen_target_descriptions_with_camera" 96. android:directionDescriptions="array/lockscreen_direction_descriptions" 97. android:handleDrawable="drawable/ic_lockscreen_handle" 98. android:waveDrawable="drawable/ic_lockscreen_outerring" 99. android:outerRadius="dimen/multiwaveview_target_placement_radius" 100. android:snapMargin="dimen/multiwaveview_snap_margin" 101. android:hitRadius="dimen/multiwaveview_hit_radius" 102. android:rightChevronDrawable="drawable/ic_lockscreen_chevron_right" 103. android:horizontalOffset="0dip" 104. android:verticalOffset="60dip" 105. android:feedbackCount="3" 106. android:vibrationDuration="20" 107. /> 108. <!- 锁屏界面加载运营商状态 -> 109. <TextView 110. android:id="+id/carrier" 111. android:layout_width="fill_parent" 112. android:layout_height="wrap_content" 113. android:layout_alignParentBottom="true" 114. android:layout_marginBottom="12dip" 115. android:gravity="center_horizontal" 116. android:singleLine="true" 117. android:ellipsize="marquee" 118. android:textAppearance="?android:attr/textAppearanceMedium" 119. android:textSize="dimen/keyguard_lockscreen_status_line_font_size" 120. android:textColor="?android:attr/textColorSecondary" 121. /> 122.123. </RelativeLayout> 124.125. <LinearLayout 126. android:orientation="horizontal" 127. android:layout_width="match_parent" 128. style="?android:attr/buttonBarStyle" 129. android:gravity="center" 130. android:weightSum="2"> 131. <!- 锁屏界面加载紧急拨号按钮 -> 132. <Button android:id="+id/emergencyCallButton" 133. android:layout_gravity="center_horizontal" 134. android:layout_width="0dip" 135. android:layout_height="wrap_content" 136. android:layout_weight="1" 137. style="?android:attr/buttonBarButtonStyle" 138. android:textSize="dimen/keyguard_lockscreen_status_line_font_size" 139. android:text="*android:string/lockscreen_emergency_call" 140. android:drawableLeft="*android:drawable/lockscreen_emergency_button" 141. android:drawablePadding="0dip" 142. android:visibility="gone" 143. /> 144.145. </LinearLayout> 146.147. </GridLayout> Step 4:在Step 3中重点看com.android.internal.widget.multiwaveview.MultiWaveView这个自定义的view,这个view是处理ICS4.0锁屏的拖拽的功能,具体代码如下:java view plaincopyprint?1. public MultiWaveView(Context context, AttributeSet attrs) 2. super(context, attrs); 3. Resources res = context.getResources(); 4. 。 。 5. 加载资源 6. 。 。 7. 通过onMeasure()来计算自定义view的大小:java view plaincopyprint?1. protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) 2. final int minimumWidth = getSuggestedMinimumWidth(); 3. final int minimumHeight = getSuggestedMinimumHeight(); 4. int viewWidth = resolveMeasured(widthMeasureSpec, minimumWidth); 5. int viewHeight = resolveMeasured(heightMeasureSpec, minimumHeight); 6. setMeasuredDimension(viewWidth, viewHeight); 7. 通过onLayout()来加载布局:java view plaincopyprint?1. protected void onLayout(boolean changed, int left, int top, int right, int bottom) 2. super.onLayout(changed, left, top, right, bottom); 3. final int width = right - left; 4. final int height = bottom - top; 5. float newWaveCenterX = mHorizontalOffset + Math.max(width, mOuterRing.getWidth() ) / 2; 6. float newWaveCenterY = mVerticalOffset + Math.max(height, mOuterRing.getHeight() / 2; 7. if (newWaveCenterX != mWaveCenterX | newWaveCenterY != mWaveCenterY) 8. if (mWaveCenterX = 0 && mWaveCenterY = 0) 9. performInitialLayout(newWaveCenterX, newWaveCenterY); 10. 11. mWaveCenterX = newWaveCen

    注意事项

    本文([计算机软件及应用]AndroidICS40锁屏流程.doc)为本站会员(音乐台)主动上传,三一文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    经营许可证编号:宁ICP备18001539号-1

    三一文库
    收起
    展开