Android Open Source - Matrix-Mate Number Picker Dialog






From Project

Back to project page Matrix-Mate.

License

The source code is released under:

MIT License

If you think the Android project Matrix-Mate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (C) 2010-2012 Mike Novak <michael.novakjr@gmail.com>
 *//from  ww  w.ja  v a 2s  .  com
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.RSen.MatrixMate;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.view.LayoutInflater;
import android.view.View;

public class NumberPickerDialog extends AlertDialog implements OnClickListener {
  private OnNumberSetListener mListener;
  private NumberPicker mNumberPicker;

  private int mInitialValue;

  public NumberPickerDialog(Context context, int theme, int initialValue) {
    super(context, theme);
    mInitialValue = initialValue;

    setButton(BUTTON_POSITIVE,
        context.getString(R.string.dialog_set_number), this);
    setButton(BUTTON_NEGATIVE, context.getString(R.string.dialog_cancel),
        (OnClickListener) null);

    LayoutInflater inflater = (LayoutInflater) context
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.dialog_number_picker, null);
    setView(view);

    mNumberPicker = (NumberPicker) view.findViewById(R.id.num_picker);
    mNumberPicker.setCurrent(mInitialValue);
  }

  public void setOnNumberSetListener(OnNumberSetListener listener) {
    mListener = listener;
  }

  public void onClick(DialogInterface dialog, int which) {
    if (mListener != null) {
      mListener.onNumberSet(mNumberPicker.getCurrent());
    }
  }

  public interface OnNumberSetListener {
    public void onNumberSet(int selectedNumber);
  }
}




Java Source Code List

com.RSen.MatrixMate.GmailSender.java
com.RSen.MatrixMate.JSSEProvider.java
com.RSen.MatrixMate.MainSearchLayout.java
com.RSen.MatrixMate.ManipulateActivity.java
com.RSen.MatrixMate.MatrixMateActivity.java
com.RSen.MatrixMate.NumberPickerButton.java
com.RSen.MatrixMate.NumberPickerDialog.java
com.RSen.MatrixMate.NumberPickerPreference.java
com.RSen.MatrixMate.NumberPicker.java
com.RSen.MatrixMate.ReportDialog.java
com.RSen.MatrixMate.SimpleEula.java