Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!BuildConfig.DEBUG) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } setContentView(R.layout.activity_pattern_lock); patternHeaderView = (TextView) findViewById(R.id.header_pattern); patternExpView = (TextView) findViewById(R.id.explanation_pattern); cancelButton = (Button) findViewById(R.id.cancel_pattern); patternLockView = (PatternLockView) findViewById(R.id.pattern_lock_view); patternLockView.clearPattern(); if (ACTION_CHECK.equals(getIntent().getAction())) { patternHeaderView.setText(R.string.pattern_enter_pattern); patternExpView.setVisibility(View.INVISIBLE); setCancelButtonEnabled(false); } else if (ACTION_REQUEST_WITH_RESULT.equals(getIntent().getAction())) { if (savedInstanceState != null) { patternPresent = savedInstanceState.getBoolean(KEY_CONFIRMING_PATTERN); patternValue = savedInstanceState.getString(KEY_PATTERN_STRING); patternHeaderViewText = savedInstanceState.getString(PATTERN_HEADER_VIEW_TEXT); patternExpViewState = savedInstanceState.getBoolean(PATTERN_EXP_VIEW_STATE); count = savedInstanceState.getInt(COUNT_VALUE); } if (patternPresent) { patternHeaderView.setText(patternHeaderViewText); if (!patternExpViewState) { patternExpView.setVisibility(View.INVISIBLE); } checkPattern(); } else { patternHeaderView.setText(R.string.pattern_configure_pattern); patternExpView.setVisibility(View.VISIBLE); setCancelButtonEnabled(true); } } else if (ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) { patternHeaderView.setText(R.string.pattern_remove_pattern); patternExpView.setVisibility(View.VISIBLE); setCancelButtonEnabled(true); } else { throw new IllegalArgumentException(R.string.illegal_argument_exception_message + " " + TAG); } setPatternListener(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!BuildConfig.DEBUG) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } setContentView(R.layout.activity_pattern_lock); String mPatternHeaderViewText = ""; boolean mPatternExpShouldVisible = false; mPatternHeader = (TextView) findViewById(R.id.header_pattern); mPatternExplanation = (TextView) findViewById(R.id.explanation_pattern); mPatternLockView = (PatternLockView) findViewById(R.id.pattern_lock_view); mPatternLockView.clearPattern(); if (ACTION_CHECK.equals(getIntent().getAction())) { mPatternHeader.setText(R.string.pattern_enter_pattern); mPatternExplanation.setVisibility(View.INVISIBLE); setCancelButtonEnabled(false); } else if (ACTION_REQUEST_WITH_RESULT.equals(getIntent().getAction())) { if (savedInstanceState != null) { mPatternPresent = savedInstanceState.getBoolean(KEY_CONFIRMING_PATTERN); mPatternValue = savedInstanceState.getString(KEY_PATTERN_STRING); mPatternHeaderViewText = savedInstanceState.getString(PATTERN_HEADER_VIEW_TEXT); mPatternExpShouldVisible = savedInstanceState.getBoolean(PATTERN_EXP_VIEW_STATE); } if (mPatternPresent) { mPatternHeader.setText(mPatternHeaderViewText); if (!mPatternExpShouldVisible) { mPatternExplanation.setVisibility(View.INVISIBLE); } checkPattern(); } else { mPatternHeader.setText(R.string.pattern_configure_pattern); mPatternExplanation.setVisibility(View.VISIBLE); setCancelButtonEnabled(true); } } else if (ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) { mPatternHeader.setText(R.string.pattern_remove_pattern); mPatternExplanation.setText(getResources().getString(R.string.pattern_no_longer_required)); mPatternExplanation.setVisibility(View.VISIBLE); setCancelButtonEnabled(true); } else { throw new IllegalArgumentException(R.string.illegal_argument_exception_message + " " + TAG); } setPatternListener(); }