/** {@inheritDoc} */ public void onGrabbedStateChange(View v, int grabbedState) { if (grabbedState == SlidingTab.OnTriggerListener.RIGHT_HANDLE) { mSilentMode = isSilentMode(); mSlidingTab.setRightHintText( mSilentMode ? R.string.lockscreen_sound_on_label : R.string.lockscreen_sound_off_label); } // Don't poke the wake lock when returning to a state where the handle is // not grabbed since that can happen when the system (instead of the user) // cancels the grab. if (grabbedState != SlidingTab.OnTriggerListener.NO_HANDLE) { mCallback.pokeWakelock(); } }
public void updateResources() { boolean vibe = mSilentMode && (mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE); mSlidingTab.setRightTabResources( mSilentMode ? (vibe ? R.drawable.ic_jog_dial_vibrate_on : R.drawable.ic_jog_dial_sound_off) : R.drawable.ic_jog_dial_sound_on, mSilentMode ? R.drawable.jog_tab_target_yellow : R.drawable.jog_tab_target_gray, mSilentMode ? R.drawable.jog_tab_bar_right_sound_on : R.drawable.jog_tab_bar_right_sound_off, mSilentMode ? R.drawable.jog_tab_right_sound_on : R.drawable.jog_tab_right_sound_off); }
/** * @param context Used to setup the view. * @param configuration The current configuration. Used to use when selecting layout, etc. * @param lockPatternUtils Used to know the state of the lock pattern settings. * @param updateMonitor Used to register for updates on various keyguard related state, and query * the initial state at setup. * @param callback Used to communicate back to the host keyguard view. */ LockScreen( Context context, Configuration configuration, LockPatternUtils lockPatternUtils, KeyguardUpdateMonitor updateMonitor, KeyguardScreenCallback callback) { super(context); mLockPatternUtils = lockPatternUtils; mUpdateMonitor = updateMonitor; mCallback = callback; mEnableMenuKeyInLockScreen = shouldEnableMenuKey(); mCreationOrientation = configuration.orientation; mKeyboardHidden = configuration.hardKeyboardHidden; if (LockPatternKeyguardView.DEBUG_CONFIGURATION) { Log.v(TAG, "***** CREATING LOCK SCREEN", new RuntimeException()); Log.v( TAG, "Cur orient=" + mCreationOrientation + " res orient=" + context.getResources().getConfiguration().orientation); } final LayoutInflater inflater = LayoutInflater.from(context); if (DBG) Log.v(TAG, "Creation orientation = " + mCreationOrientation); if (mCreationOrientation != Configuration.ORIENTATION_LANDSCAPE) { inflater.inflate(R.layout.keyguard_screen_tab_unlock, this, true); } else { inflater.inflate(R.layout.keyguard_screen_tab_unlock_land, this, true); } mStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor, mLockPatternUtils, mCallback, false); setFocusable(true); setFocusableInTouchMode(true); setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); mSilentMode = isSilentMode(); mUnlockWidget = findViewById(R.id.unlock_widget); if (mUnlockWidget instanceof SlidingTab) { SlidingTab slidingTabView = (SlidingTab) mUnlockWidget; slidingTabView.setHoldAfterTrigger(true, false); slidingTabView.setLeftHintText(R.string.lockscreen_unlock_label); slidingTabView.setLeftTabResources( R.drawable.ic_jog_dial_unlock, R.drawable.jog_tab_target_green, R.drawable.jog_tab_bar_left_unlock, R.drawable.jog_tab_left_unlock); SlidingTabMethods slidingTabMethods = new SlidingTabMethods(slidingTabView); slidingTabView.setOnTriggerListener(slidingTabMethods); mUnlockWidgetMethods = slidingTabMethods; } else if (mUnlockWidget instanceof WaveView) { WaveView waveView = (WaveView) mUnlockWidget; WaveViewMethods waveViewMethods = new WaveViewMethods(waveView); waveView.setOnTriggerListener(waveViewMethods); mUnlockWidgetMethods = waveViewMethods; } else if (mUnlockWidget instanceof MultiWaveView) { MultiWaveView multiWaveView = (MultiWaveView) mUnlockWidget; MultiWaveViewMethods multiWaveViewMethods = new MultiWaveViewMethods(multiWaveView); multiWaveView.setOnTriggerListener(multiWaveViewMethods); mUnlockWidgetMethods = multiWaveViewMethods; } else { throw new IllegalStateException("Unrecognized unlock widget: " + mUnlockWidget); } // Update widget with initial ring state mUnlockWidgetMethods.updateResources(); if (DBG) Log.v( TAG, "*** LockScreen accel is " + (mUnlockWidget.isHardwareAccelerated() ? "on" : "off")); }
public void reset(boolean animate) { mSlidingTab.reset(animate); }