Java Code Examples for android.os.Bundle#getStringArray()

The following examples show how to use android.os.Bundle#getStringArray() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public static WhereFilter fromBundle(Bundle bundle) {
	String title = bundle.getString(TITLE_EXTRA);
	WhereFilter filter = new WhereFilter(title);
	String[] a = bundle.getStringArray(FILTER_EXTRA);
	if (a != null) {
           for (String s : a) {
               filter.put(Criteria.fromStringExtra(s));
           }
	}
	String sortOrder = bundle.getString(SORT_ORDER_EXTRA);
	if (sortOrder != null) {
		String[] orders = sortOrder.split(",");
		if (orders != null && orders.length > 0) {
			filter.sorts.addAll(Arrays.asList(orders));
		}
	}
	return filter;
}
 
Example 2
Source Project: AndroidQuick   File: BottomDialogFragment.java    License: MIT License 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    Bundle bundle = getArguments();
    itemData = bundle.getStringArray("key");
    // 去掉默认的标题
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
    View view = View.inflate(getContext(), R.layout.fragment_bottom, null);
    ListView listView = view.findViewById(R.id.lv_result);
    ArrayAdapter<String> mAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_expandable_list_item_1, itemData);
    listView.setAdapter(mAdapter);
    listView.setTextFilterEnabled(true);
    listView.setOnItemClickListener((parent, v, position, id) -> {
        listener.onClick(position);
        dismiss();
    });
    return view;
}
 
Example 3
Source Project: candybar   File: InAppBillingFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null) {
        mType = savedInstanceState.getInt(TYPE);
        mKey = savedInstanceState.getString(KEY);
        mProductsId = savedInstanceState.getStringArray(PRODUCT_ID);
        mProductsCount = savedInstanceState.getIntArray(PRODUCT_COUNT);
    }

    mAsyncTask = new InAppProductsLoader().execute();
}
 
Example 4
/**
 * Returns structured sort args formatted as an SQL sort clause.
 *
 * NOTE: Collator clauses are suitable for use with non text fields. We might
 * choose to omit any collation clause since we don't know the underlying
 * type of data to be collated. Imperical testing shows that sqlite3 doesn't
 * appear to care much about the presence of collate clauses in queries
 * when ordering by numeric fields. For this reason we include collate
 * clause unilaterally when {@link #QUERY_ARG_SORT_COLLATION} is present
 * in query args bundle.
 *
 * TODO: Would be nice to explicitly validate that colums referenced in
 * {@link #QUERY_ARG_SORT_COLUMNS} are present in the associated projection.
 *
 * @hide
 */
public static String createSqlSortClause(Bundle queryArgs) {
    String[] columns = queryArgs.getStringArray(QUERY_ARG_SORT_COLUMNS);
    if (columns == null || columns.length == 0) {
        throw new IllegalArgumentException("Can't create sort clause without columns.");
    }

    String query = TextUtils.join(", ", columns);

    // Interpret PRIMARY and SECONDARY collation strength as no-case collation based
    // on their javadoc descriptions.
    int collation = queryArgs.getInt(
            ContentResolver.QUERY_ARG_SORT_COLLATION, java.text.Collator.IDENTICAL);
    if (collation == java.text.Collator.PRIMARY || collation == java.text.Collator.SECONDARY) {
        query += " COLLATE NOCASE";
    }

    int sortDir = queryArgs.getInt(QUERY_ARG_SORT_DIRECTION, Integer.MIN_VALUE);
    if (sortDir != Integer.MIN_VALUE) {
        switch (sortDir) {
            case QUERY_SORT_DIRECTION_ASCENDING:
                query += " ASC";
                break;
            case QUERY_SORT_DIRECTION_DESCENDING:
                query += " DESC";
                break;
            default:
                throw new IllegalArgumentException("Unsupported sort direction value."
                        + " See ContentResolver documentation for details.");
        }
    }
    return query;
}
 
Example 5
/**
 * Returns structured sort args formatted as an SQL sort clause.
 *
 * NOTE: Collator clauses are suitable for use with non text fields. We might
 * choose to omit any collation clause since we don't know the underlying
 * type of data to be collated. Imperical testing shows that sqlite3 doesn't
 * appear to care much about the presence of collate clauses in queries
 * when ordering by numeric fields. For this reason we include collate
 * clause unilaterally when {@link #QUERY_ARG_SORT_COLLATION} is present
 * in query args bundle.
 *
 * TODO: Would be nice to explicitly validate that colums referenced in
 * {@link #QUERY_ARG_SORT_COLUMNS} are present in the associated projection.
 *
 * @hide
 */
public static String createSqlSortClause(Bundle queryArgs) {
    String[] columns = queryArgs.getStringArray(QUERY_ARG_SORT_COLUMNS);
    if (columns == null || columns.length == 0) {
        throw new IllegalArgumentException("Can't create sort clause without columns.");
    }

    String query = TextUtils.join(", ", columns);

    // Interpret PRIMARY and SECONDARY collation strength as no-case collation based
    // on their javadoc descriptions.
    int collation = queryArgs.getInt(
            ContentResolver.QUERY_ARG_SORT_COLLATION, java.text.Collator.IDENTICAL);
    if (collation == java.text.Collator.PRIMARY || collation == java.text.Collator.SECONDARY) {
        query += " COLLATE NOCASE";
    }

    int sortDir = queryArgs.getInt(QUERY_ARG_SORT_DIRECTION, Integer.MIN_VALUE);
    if (sortDir != Integer.MIN_VALUE) {
        switch (sortDir) {
            case QUERY_SORT_DIRECTION_ASCENDING:
                query += " ASC";
                break;
            case QUERY_SORT_DIRECTION_DESCENDING:
                query += " DESC";
                break;
            default:
                throw new IllegalArgumentException("Unsupported sort direction value."
                        + " See ContentResolver documentation for details.");
        }
    }
    return query;
}
 
Example 6
/**
 * Returns structured sort args formatted as an SQL sort clause.
 *
 * NOTE: Collator clauses are suitable for use with non text fields. We might
 * choose to omit any collation clause since we don't know the underlying
 * type of data to be collated. Imperical testing shows that sqlite3 doesn't
 * appear to care much about the presence of collate clauses in queries
 * when ordering by numeric fields. For this reason we include collate
 * clause unilaterally when {@link #QUERY_ARG_SORT_COLLATION} is present
 * in query args bundle.
 *
 * TODO: Would be nice to explicitly validate that colums referenced in
 * {@link #QUERY_ARG_SORT_COLUMNS} are present in the associated projection.
 *
 * @hide
 */
public static String createSqlSortClause(Bundle queryArgs) {
    String[] columns = queryArgs.getStringArray(QUERY_ARG_SORT_COLUMNS);
    if (columns == null || columns.length == 0) {
        throw new IllegalArgumentException("Can't create sort clause without columns.");
    }

    String query = TextUtils.join(", ", columns);

    // Interpret PRIMARY and SECONDARY collation strength as no-case collation based
    // on their javadoc descriptions.
    int collation = queryArgs.getInt(
            ContentResolver.QUERY_ARG_SORT_COLLATION, java.text.Collator.IDENTICAL);
    if (collation == java.text.Collator.PRIMARY || collation == java.text.Collator.SECONDARY) {
        query += " COLLATE NOCASE";
    }

    int sortDir = queryArgs.getInt(QUERY_ARG_SORT_DIRECTION, Integer.MIN_VALUE);
    if (sortDir != Integer.MIN_VALUE) {
        switch (sortDir) {
            case QUERY_SORT_DIRECTION_ASCENDING:
                query += " ASC";
                break;
            case QUERY_SORT_DIRECTION_DESCENDING:
                query += " DESC";
                break;
            default:
                throw new IllegalArgumentException("Unsupported sort direction value."
                        + " See ContentResolver documentation for details.");
        }
    }
    return query;
}
 
Example 7
public void initializeView() {
    Bundle bundle = getArguments();
    backgroundColor = bundle.getInt(BACKGROUND_COLOR);
    buttonsColor = bundle.getInt(BUTTONS_COLOR);
    image = bundle.getInt(IMAGE, 0);
    title = bundle.getString(TITLE);
    description = bundle.getString(DESCRIPTION);
    neededPermissions = bundle.getStringArray(NEEDED_PERMISSIONS);
    possiblePermissions = bundle.getStringArray(POSSIBLE_PERMISSIONS);

    updateViewWithValues();
}
 
Example 8
@Override
protected void onResume() {
    super.onResume();
    // Only do request when there is no pending request to avoid duplicated requests.
    if (mPendingRequestCode == INVALID_REQUEST_CODE) {
        final Bundle extras = getIntent().getExtras();
        final String[] permissionsToRequest =
                extras.getStringArray(EXTRA_PERMISSION_REQUESTED_PERMISSIONS);
        mPendingRequestCode = extras.getInt(EXTRA_PERMISSION_REQUEST_CODE);
        // Assuming that all supplied permissions are not granted yet, so that we don't need to
        // check them again.
        PermissionsUtil.requestPermissions(this, mPendingRequestCode, permissionsToRequest);
    }
}
 
Example 9
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  if (DEBUG) {
    Log.d(getClass().getSimpleName(), "onCreate(): this=" + this + ", savedInstanceState=" + savedInstanceState);
  }

  if (savedInstanceState != null) {
    allowablePermissions = savedInstanceState.getStringArray("permissions");
    permissiveMessenger = savedInstanceState.getParcelable("messenger");
  }
  permissiveMessenger.restoreActivity(getActivity());
}
 
Example 10
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Bundle args = getArguments();
    if (args == null) {
        throw new IllegalStateException("An arguments bundle must be provided.");
    }
    values = args.getStringArray(ARGUMENT_VALUES);
    indices = args.getIntArray(ARGUMENT_INDICES);
    Timber.d("Displayed values: %s", Arrays.toString(values));
}
 
Example 11
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (!mProgressBar.isShown()) {
        mProgressBar.setVisibility(View.VISIBLE);
    }
    String[] projection = args.getStringArray(RecordsActivity.args.projection.name());
    String selection = args.getString(RecordsActivity.args.selection.name());
    String[] selectionArgs = args.getStringArray(RecordsActivity.args.selectionArguments.name());
    String sort = mPreferenceHelper.getSortSelection()
            + mPreferenceHelper.getSortArrange();
    int limit = args.getInt(RecordsActivity.args.limit.name());
    int offset = args.getInt(RecordsActivity.args.offset.name());

    switch (id) {
        case 0:
            Uri uri = RecordDbContract.CONTENT_URL
                    .buildUpon()
                    .appendQueryParameter(RecordsContentProvider.QUERY_PARAMETER_LIMIT,
                            String.valueOf(limit))
                    .appendQueryParameter(RecordsContentProvider.QUERY_PARAMETER_OFFSET,
                            String.valueOf(offset))
                    .build();
            return new CursorLoader(this, uri, projection, selection, selectionArgs, sort);

        default:
            throw new IllegalArgumentException("no loader id handled!");
    }
}
 
Example 12
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // STRING_LIST is supposed to be immutable, so no point of saving instance state.
    Bundle args = getArguments();
    if (args != null) {
        if (args.containsKey(BUNDLE_STRING_LIST)) mStringList = args.getStringArray(BUNDLE_STRING_LIST);
        if (args.containsKey(BUNDLE_PARCELABLE_LIST)) mParcelableList = args.getParcelableArray(BUNDLE_PARCELABLE_LIST);
    }
}
 
Example 13
Source Project: youqu_master   File: SlideFragment.java    License: Apache License 2.0 5 votes vote down vote up
public void initializeView() {
    Bundle bundle = getArguments();
    backgroundColor = bundle.getInt(BACKGROUND_COLOR);
    buttonsColor = bundle.getInt(BUTTONS_COLOR);
    image = bundle.getInt(IMAGE, 0);
    title = bundle.getString(TITLE);
    description = bundle.getString(DESCRIPTION);
    neededPermissions = bundle.getStringArray(NEEDED_PERMISSIONS);
    possiblePermissions = bundle.getStringArray(POSSIBLE_PERMISSIONS);

    updateViewWithValues();
}
 
Example 14
Source Project: material-intro-screen   File: SlideFragment.java    License: MIT License 5 votes vote down vote up
public void initializeView() {
    Bundle bundle = getArguments();
    backgroundColor = bundle.getInt(BACKGROUND_COLOR);
    buttonsColor = bundle.getInt(BUTTONS_COLOR);
    image = bundle.getInt(IMAGE, 0);
    title = bundle.getString(TITLE);
    description = bundle.getString(DESCRIPTION);
    neededPermissions = bundle.getStringArray(NEEDED_PERMISSIONS);
    possiblePermissions = bundle.getStringArray(POSSIBLE_PERMISSIONS);

    updateViewWithValues();
}
 
Example 15
RationaleDialogConfig(Bundle bundle) {
    positiveButton = bundle.getString(KEY_POSITIVE_BUTTON);
    negativeButton = bundle.getString(KEY_NEGATIVE_BUTTON);
    rationaleMsg = bundle.getString(KEY_RATIONALE_MESSAGE);
    theme = bundle.getInt(KEY_THEME);
    requestCode = bundle.getInt(KEY_REQUEST_CODE);
    permissions = bundle.getStringArray(KEY_PERMISSIONS);
}
 
Example 16
private int runGetPermissions(String authority) {
    if (Binder.getCallingUid() != Process.SHELL_UID
            && Binder.getCallingUid() != Process.ROOT_UID) {
        getOutPrintWriter().println("Only shell can get permissions");
        return -1;
    }
    Context context = mService.getContext();
    long ident = Binder.clearCallingIdentity();
    try {
        Uri uri = new Uri.Builder()
                .scheme(ContentResolver.SCHEME_CONTENT)
                .authority(authority)
                .build();
        if (!SliceProvider.SLICE_TYPE.equals(context.getContentResolver().getType(uri))) {
            getOutPrintWriter().println(authority + " is not a slice provider");
            return -1;
        }
        Bundle b = context.getContentResolver().call(uri, SliceProvider.METHOD_GET_PERMISSIONS,
                null, null);
        if (b == null) {
            getOutPrintWriter().println("An error occurred getting permissions");
            return -1;
        }
        String[] permissions = b.getStringArray(SliceProvider.EXTRA_RESULT);
        final PrintWriter pw = getOutPrintWriter();
        Set<String> listedPackages = new ArraySet<>();
        if (permissions != null && permissions.length != 0) {
            List<PackageInfo> apps =
                    context.getPackageManager().getPackagesHoldingPermissions(permissions, 0);
            for (PackageInfo app : apps) {
                pw.println(app.packageName);
                listedPackages.add(app.packageName);
            }
        }
        for (String pkg : mService.getAllPackagesGranted(authority)) {
            if (!listedPackages.contains(pkg)) {
                pw.println(pkg);
                listedPackages.add(pkg);
            }
        }
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
    return 0;
}
 
Example 17
Source Project: letv   File: HttpUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static String encodeUrl(Bundle bundle) {
    if (bundle == null) {
        return "";
    }
    StringBuilder stringBuilder = new StringBuilder();
    Object obj = 1;
    for (String str : bundle.keySet()) {
        Object obj2 = bundle.get(str);
        if ((obj2 instanceof String) || (obj2 instanceof String[])) {
            Object obj3;
            if (obj2 instanceof String[]) {
                if (obj != null) {
                    obj = null;
                } else {
                    stringBuilder.append("&");
                }
                stringBuilder.append(URLEncoder.encode(str) + SearchCriteria.EQ);
                String[] stringArray = bundle.getStringArray(str);
                if (stringArray != null) {
                    for (int i = 0; i < stringArray.length; i++) {
                        if (i == 0) {
                            stringBuilder.append(URLEncoder.encode(stringArray[i]));
                        } else {
                            stringBuilder.append(URLEncoder.encode("," + stringArray[i]));
                        }
                    }
                    obj3 = obj;
                }
            } else {
                if (obj != null) {
                    obj = null;
                } else {
                    stringBuilder.append("&");
                }
                stringBuilder.append(URLEncoder.encode(str) + SearchCriteria.EQ + URLEncoder.encode(bundle.getString(str)));
                obj3 = obj;
            }
            obj = obj3;
        }
    }
    return stringBuilder.toString();
}
 
Example 18
/**
 * OpenAPIParser#parse(String) に testEnum.json を渡して解析を行う。
 * 
 * parameter の type と異なる enum の宣言が存在する testEnum.json をよみこむ。
 * <pre>
 * 【期待する動作】
 * ・Swagger オブジェクトが取得できること。
 * ・parameter の enum が取得できること。
 * </pre>
 */
@Test
public void testEnum() throws JSONException {
    DevicePluginContext pluginContext = Mockito.mock(DevicePluginContext.class);

    String jsonString = FileLoader.readString("parser/testEnum.json");

    DConnectServiceSpec spec = new DConnectServiceSpec(pluginContext);
    spec.addProfileSpec("testEnum", jsonString);

    Bundle swagger = spec.findProfileSpec("testEnum").toBundle();
    assertThat(swagger, is(notNullValue()));

    Bundle paths = swagger.getBundle("paths");
    assertThat(paths, is(notNullValue()));
    assertThat(paths.size(), is(1));

    Bundle a0 = paths.getBundle("/a0");
    assertThat(a0, is(notNullValue()));

    Bundle a0Get = a0.getBundle("get");
    assertThat(a0Get, is(notNullValue()));

    Parcelable[] parameters = a0Get.getParcelableArray("parameters");
    assertThat(parameters, is(notNullValue()));
    assertThat(parameters.length, is(7));

    Bundle stringInt = (Bundle) parameters[1];
    assertThat(stringInt.getString("type"), is("string"));
    String[] stringIntEnum = stringInt.getStringArray("enum");
    assertThat(stringIntEnum, is(notNullValue()));
    assertThat(stringIntEnum[0], is("1"));
    assertThat(stringIntEnum[1], is("2"));
    assertThat(stringIntEnum[2], is("3"));
    assertThat(stringIntEnum[3], is("4"));

    Bundle stringNumber = (Bundle) parameters[2];
    assertThat(stringNumber.getString("type"), is("string"));
    String[] stringNumberEnum = stringNumber.getStringArray("enum");
    assertThat(stringNumberEnum, is(notNullValue()));
    assertThat(stringNumberEnum[0], is("1.1"));
    assertThat(stringNumberEnum[1], is("2.2"));
    assertThat(stringNumberEnum[2], is("3.3"));
    assertThat(stringNumberEnum[3], is("4.4"));

    Bundle intString = (Bundle) parameters[3];
    assertThat(intString.getString("type"), is("integer"));
    assertThat(intString.getString("format"), is("int32"));
    int[] intStringEnum = intString.getIntArray("enum");
    assertThat(intStringEnum, is(notNullValue()));
    assertThat(intStringEnum[0], is(1));
    assertThat(intStringEnum[1], is(2));
    assertThat(intStringEnum[2], is(3));
    assertThat(intStringEnum[3], is(4));

    Bundle longString = (Bundle) parameters[4];
    assertThat(longString.getString("type"), is("integer"));
    assertThat(longString.getString("format"), is("int64"));
    long[] longStringEnum = longString.getLongArray("enum");
    assertThat(longStringEnum, is(notNullValue()));
    assertThat(longStringEnum[0], is(1L));
    assertThat(longStringEnum[1], is(2L));
    assertThat(longStringEnum[2], is(3L));
    assertThat(longStringEnum[3], is(4L));

    Bundle floatString = (Bundle) parameters[5];
    assertThat(floatString.getString("type"), is("number"));
    assertThat(floatString.getString("format"), is("float"));
    float[] floatStringEnum = floatString.getFloatArray("enum");
    assertThat(floatStringEnum, is(notNullValue()));
    assertThat(floatStringEnum[0], is(1.1F));
    assertThat(floatStringEnum[1], is(2.2F));
    assertThat(floatStringEnum[2], is(3.3F));
    assertThat(floatStringEnum[3], is(4.4F));

    Bundle doubleString = (Bundle) parameters[6];
    assertThat(doubleString.getString("type"), is("number"));
    assertThat(doubleString.getString("format"), is("double"));
    double[] doubleStringEnum = doubleString.getDoubleArray("enum");
    assertThat(doubleStringEnum, is(notNullValue()));
    assertThat(doubleStringEnum[0], is(1.1D));
    assertThat(doubleStringEnum[1], is(2.2D));
    assertThat(doubleStringEnum[2], is(3.3D));
    assertThat(doubleStringEnum[3], is(4.4D));
}
 
Example 19
/**
 * Check whether to initialize the editor on a dump file or on
 * a new dump directly from {@link ReadTag}
 * (or recreate instance state if the activity was killed).
 * Also it will color the caption of the dump editor.
 * @see #initEditor(String[])
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dump_editor);

    mLayout = findViewById(
            R.id.linearLayoutDumpEditor);

    // Color caption.
    SpannableString keyA = Common.colorString(
            getString(R.string.text_keya),
            getResources().getColor(R.color.light_green));
    SpannableString keyB =  Common.colorString(
            getString(R.string.text_keyb),
            getResources().getColor(R.color.dark_green));
    SpannableString ac = Common.colorString(
            getString(R.string.text_ac),
            getResources().getColor(R.color.orange));
    SpannableString uidAndManuf = Common.colorString(
            getString(R.string.text_uid_and_manuf),
            getResources().getColor(R.color.purple));
    SpannableString vb = Common.colorString(
            getString(R.string.text_valueblock),
            getResources().getColor(R.color.yellow));

    TextView caption = findViewById(
            R.id.textViewDumpEditorCaption);
    caption.setText(TextUtils.concat(uidAndManuf, " | ",
            vb, " | ", keyA, " | ", keyB, " | ", ac), BufferType.SPANNABLE);
    // Add web-link optic to update colors text view (= caption title).
    TextView captionTitle = findViewById(
            R.id.textViewDumpEditorCaptionTitle);
    SpannableString updateText = Common.colorString(
            getString(R.string.text_update_colors),
            getResources().getColor(R.color.blue));
    updateText.setSpan(new UnderlineSpan(), 0, updateText.length(), 0);
    captionTitle.setText(TextUtils.concat(
            getString(R.string.text_caption_title),
            ": (", updateText, ")"));

    if (getIntent().hasExtra(EXTRA_DUMP)) {
        // Called from ReadTag (init editor by intent).
        String[] dump = getIntent().getStringArrayExtra(EXTRA_DUMP);
        // Set title with UID.
        if (Common.getUID() != null) {
            mUID = Common.byte2HexString(Common.getUID());
            setTitle(getTitle() + " (UID: " + mUID+ ")");
        }
        initEditor(dump);
        setIntent(null);
    } else if (getIntent().hasExtra(
            FileChooser.EXTRA_CHOSEN_FILE)) {
        // Called form FileChooser (init editor by file).
        File file = new File(getIntent().getStringExtra(
                FileChooser.EXTRA_CHOSEN_FILE));
        mDumpName = file.getName();
        setTitle(getTitle() + " (" + mDumpName + ")");
        initEditor(Common.readFileLineByLine(file, false, this));
        setIntent(null);
    } else if (savedInstanceState != null) {
        // Recreated after kill by Android (due to low memory).
        mDumpName = savedInstanceState.getString("file_name");
        if (mDumpName != null) {
            setTitle(getTitle() + " (" + mDumpName + ")");
        }
        mLines = savedInstanceState.getStringArray("lines");
        if (mLines != null) {
            initEditor(mLines);
        }
    }
}
 
Example 20
/**
 * Initializes the activity.
 *
 * An intent with a valid ACTION is expected; if none is found, an
 * {@link IllegalArgumentException} will be thrown.
 *
 * @param savedInstanceState    Previously saved state - irrelevant in this case
 */
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.passcodelock);

    getWindow().setDimAmount(0.9f);
    //getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

    mBCancel = (Button) findViewById(R.id.cancel);
    mPassCodeHdr = (TextView) findViewById(R.id.header);
    mPassCodeHdrExplanation = (TextView) findViewById(R.id.explanation);
    mPassCodeEditTexts[0] = (EditText) findViewById(R.id.txt0);
    mPassCodeEditTexts[0].requestFocus();
    getWindow().setSoftInputMode(
            android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    mPassCodeEditTexts[1] = (EditText) findViewById(R.id.txt1);
    mPassCodeEditTexts[2] = (EditText) findViewById(R.id.txt2);
    mPassCodeEditTexts[3] = (EditText) findViewById(R.id.txt3);

    if (ACTION_CHECK.equals(getIntent().getAction())) {
        /// this is a pass code request; the user has to input the right value
        mPassCodeHdr.setText(R.string.pass_code_enter_pass_code);
        mPassCodeHdrExplanation.setVisibility(View.INVISIBLE);
        setCancelButtonEnabled(false);      // no option to cancel

    } else if (ACTION_REQUEST_WITH_RESULT.equals(getIntent().getAction())) {
        if (savedInstanceState != null) {
            mConfirmingPassCode = savedInstanceState.getBoolean(PassCodeActivity.KEY_CONFIRMING_PASSCODE);
            mPassCodeDigits = savedInstanceState.getStringArray(PassCodeActivity.KEY_PASSCODE_DIGITS);
        }
        if(mConfirmingPassCode){
            //the app was in the passcodeconfirmation
            requestPassCodeConfirmation();
        }else{
            /// pass code preference has just been activated in Preferences;
            // will receive and confirm pass code value
            mPassCodeHdr.setText(R.string.pass_code_configure_your_pass_code);
            //mPassCodeHdr.setText(R.string.pass_code_enter_pass_code);
            // TODO choose a header, check iOS
            mPassCodeHdrExplanation.setVisibility(View.VISIBLE);
            setCancelButtonEnabled(true);
        }

    } else if (ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) {
        /// pass code preference has just been disabled in Preferences;
        // will confirm user knows pass code, then remove it
        mPassCodeHdr.setText(R.string.pass_code_remove_your_pass_code);
        mPassCodeHdrExplanation.setVisibility(View.INVISIBLE);
        setCancelButtonEnabled(true);

    } else {
        throw new IllegalArgumentException("A valid ACTION is needed in the Intent passed to "
                + TAG);
    }

    setTextListeners();
}