Created
November 16, 2014 16:41
-
-
Save ties/659af336283ac4c5cf82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/topLayout" | |
android:orientation="vertical" | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content"> | |
<com.haibison.android.lockpattern.widget.LockPatternView android:id="@+id/lockPattern" | |
android:layout_width="@dimen/alp_42447968_separator_size" | |
android:layout_height="@dimen/alp_42447968_separator_size" | |
android:layout_marginTop="@dimen/alp_42447968_separator_size" | |
android:layout_marginBottom="@dimen/alp_42447968_separator_size" | |
android:layout_gravity="center_horizontal" | |
/> | |
</LinearLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.haibison.android.lockpattern.widget; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.text.Html; | |
import android.util.Log; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.Button; | |
import android.widget.TextView; | |
import com.haibison.android.lockpattern.R; | |
public class LockPatternFragment extends android.app.Fragment { | |
public static final String NUMBER_OF_MEASUREMENTS = "number_of_measurements"; | |
public static final String PATTERN_STRING = "pattern_string"; | |
private String mPatternString; | |
private LockPatternView.OnPatternListener mEvents; | |
public LockPatternFragment() { | |
// no-op | |
} | |
@Override | |
public void onAttach(Activity activity) { | |
super.onAttach(activity); | |
mEvents = (LockPatternView.OnPatternListener)activity; | |
} | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
// Get the number of measurements from the bundle, or load the default: | |
mPatternString = getArguments().getString(PATTERN_STRING); | |
View rootView = inflater.inflate(R.layout.alp_42447968_lock_pattern_fragment, container, false); | |
final LockPatternView lpv = (LockPatternView)rootView.findViewById(R.id.lockPattern); | |
lpv.setPattern(LockPatternView.DisplayMode.Correct, LockPatternUtils.stringToPattern(mPatternString)); | |
lpv.setOnPatternListener(mEvents); | |
return rootView; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment