Android Open Source - Crescendo New Project Dialog






From Project

Back to project page Crescendo.

License

The source code is released under:

GNU General Public License

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

package com.crescendo.crescendo;
//from  w w  w  .j ava  2  s. c o  m
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.widget.EditText;
import android.widget.SimpleAdapter;



@SuppressLint("ValidFragment")
public class NewProjectDialog extends android.app.DialogFragment {

  private Activity context;
  private List <Map<String,String>> y;
  private SimpleAdapter sa;
  

  public NewProjectDialog(Activity c, List <Map<String,String>> y, SimpleAdapter sa) {
    this.context = c;
    this.y = y;
    this.sa = sa;
    
  }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
      AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
      // Get the layout inflater
      LayoutInflater inflater = getActivity().getLayoutInflater();

      // Inflate and set the layout for the dialog
      // Pass null as the parent view because its going in the dialog layout
      builder.setView(inflater.inflate(R.layout.project_dialog, null))
      // Add action buttons
             .setPositiveButton(R.string.dialogposbutton, new DialogInterface.OnClickListener() {
                
               
               @Override
                 public void onClick(DialogInterface dialog, int id) {
                  EditText t= (EditText) context.findViewById(R.id.dialogT);
              EditText g= (EditText) context.findViewById(R.id.dialogG);
              
              if (t == null || g == null){
                Log.e("NULL", "NULL");
                return;
              }
              
              Map <String,String> m = new HashMap <String,String>();
              m.put("title", t.getText().toString());
              m.put("genre", g.getText().toString());
              
              y.add(m);
              sa.notifyDataSetChanged();
              
                 }
             })
             .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                 
               public void onClick(DialogInterface dialog, int id) {
                     
                 }
             });      
      return builder.create();
  }
}




Java Source Code List

com.crescendo.crescendo.MainActivity.java
com.crescendo.crescendo.NewProjectDialog.java
com.crescendo.crescendo.RhyInput.java
com.crescendo.crescendo.RhymeDictionary.java
com.crescendo.crescendo.RhymeGetter.java
com.crescendo.crescendo.aboutactivity.java
com.crescendo.crescendo.songs.java
com.crescendo.crescendo.texteditor.java