Back to project page HNdroid.
The source code is released under:
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...
If you think the Android project HNdroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.gluegadget.hndroid; /*from w ww.j ava 2 s . co m*/ import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class CommentDialog extends Dialog { Button submitButton; String name; String replyUrl; private ReadyListener readyListener; EditText text; public interface ReadyListener { public void ready(String text); public void ready(String text, String replyUrl); } public CommentDialog(Context context, String name, ReadyListener readyListener) { super(context); this.readyListener = readyListener; this.name = name; } public CommentDialog(Context context, String name, String replyUrl, ReadyListener readyListener) { super(context); this.readyListener = readyListener; this.name = name; this.replyUrl = replyUrl; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.comment); setTitle(name); submitButton = (Button)findViewById(R.id.submit_button); submitButton.setOnClickListener(new loginListener()); text = (EditText)findViewById(R.id.text); } private class loginListener implements android.view.View.OnClickListener { @Override public void onClick(View v) { if (replyUrl == null) readyListener.ready(String.valueOf(text.getText())); else readyListener.ready(String.valueOf(text.getText()), replyUrl); dismiss(); } } public void onClick(View v) { if (v == submitButton) { dismiss(); } } }