Android Open Source - checkit Prompt Dialog Fragment






From Project

Back to project page checkit.

License

The source code is released under:

GNU General Public License

If you think the Android project checkit 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

/**
 * Dialog fragment containing EditText. 
 */*  w  ww .j a  v  a 2 s  . c  om*/
 * @author  Yujian Zhang <yujian{dot}zhang[at]gmail(dot)com>
 *
 * License: 
 *   GNU General Public License v2
 *   http://www.gnu.org/licenses/gpl-2.0.html
 * Copyright (C) 2011-2012 Yujian Zhang
 */

package net.whily.android.checkit;


import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;

public final class PromptDialogFragment extends CustomDialogFragment {
  private EditText et;

  public static PromptDialogFragment newInstance(int titleId, String text) {
    PromptDialogFragment pdf = new PromptDialogFragment();
    pdf.titleId = titleId;
    Bundle bundle = new Bundle();
    bundle.putString("text", text);
    pdf.setArguments(bundle);
    return pdf;
  }

  @Override
  public CharSequence getMessage() {
    return et.getText();
  }

  @Override
  public View onInflateDialog(Bundle icicle) {
    LayoutInflater li = LayoutInflater.from(getActivity());
    View v = li.inflate(R.layout.prompt, null);
    et = (EditText)v.findViewById(R.id.prompt_entry);
    if (icicle != null) {
      et.setText(icicle.getCharSequence("input"));
    } else {
      et.setText(getArguments().getString("text"));
    }
    et.setSelectAllOnFocus(true);

    return v;
  }

  @Override
  public void onSaveInstanceState(Bundle icicle) {
    icicle.putCharSequence("input", et.getText());
    super.onPause();
  }
}




Java Source Code List

net.whily.android.checkit.AboutActivity.java
net.whily.android.checkit.Alert.java
net.whily.android.checkit.CheckActivity.java
net.whily.android.checkit.CheckedItem.java
net.whily.android.checkit.ChecklistMetadata.java
net.whily.android.checkit.ChecklistProvider.java
net.whily.android.checkit.CustomDialogFragment.java
net.whily.android.checkit.ExternalStorage.java
net.whily.android.checkit.HomeActivity.java
net.whily.android.checkit.OnDialogDoneListener.java
net.whily.android.checkit.PromptDialogFragment.java
net.whily.android.checkit.SelectionDialogFragment.java
net.whily.android.checkit.SettingsActivity.java
net.whily.android.checkit.Util.java