Fix DTMF keyboard on conference Activity

This commit is contained in:
Guillaume Beraudo 2011-10-27 10:37:01 +02:00
parent 17056c3a8b
commit 6bcbe4bfc9
2 changed files with 17 additions and 6 deletions

View file

@ -38,6 +38,7 @@ import org.linphone.core.LinphoneCoreException;
import org.linphone.core.Log; import org.linphone.core.Log;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCall.State;
import org.linphone.mediastream.Version; import org.linphone.mediastream.Version;
import org.linphone.ui.Numpad;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -251,8 +252,8 @@ public class ConferenceActivity extends ListActivity implements
switch (id) { switch (id) {
case numpad_dialog_id: case numpad_dialog_id:
return new AlertDialog.Builder(this).setView( Numpad numpad = new Numpad(this, true);
getLayoutInflater().inflate(R.layout.numpad, null)) return new AlertDialog.Builder(this).setView(numpad)
// .setIcon(R.drawable.logo_linphone_57x57) // .setIcon(R.drawable.logo_linphone_57x57)
// .setTitle("Send DTMFs") // .setTitle("Send DTMFs")
.setPositiveButton(getString(R.string.close_button_text), new .setPositiveButton(getString(R.string.close_button_text), new

View file

@ -38,19 +38,29 @@ import android.widget.LinearLayout;
public class Numpad extends LinearLayout implements AddressAware { public class Numpad extends LinearLayout implements AddressAware {
private boolean mPlayDtmf; private boolean mPlayDtmf;
public void setPlayDtmf(boolean sendDtmf) {
this.mPlayDtmf = sendDtmf;
}
public Numpad(Context context, boolean playDtmf) {
super(context);
mPlayDtmf = playDtmf;
LayoutInflater.from(context).inflate(R.layout.numpad, this);
setLongClickable(true);
onFinishInflate();
}
public Numpad(Context context, AttributeSet attrs) { public Numpad(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.numpad, this);
setLongClickable(true);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Numpad); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Numpad);
mPlayDtmf = 1 == a.getInt(org.linphone.R.styleable.Numpad_play_dtmf, 1); mPlayDtmf = 1 == a.getInt(org.linphone.R.styleable.Numpad_play_dtmf, 1);
a.recycle(); a.recycle();
LayoutInflater.from(context).inflate(R.layout.numpad, this);
setLongClickable(true);
} }
@Override @Override
protected void onFinishInflate() { protected final void onFinishInflate() {
for (Digit v : retrieveChildren(this, Digit.class)) { for (Digit v : retrieveChildren(this, Digit.class)) {
v.setPlayDtmf(mPlayDtmf); v.setPlayDtmf(mPlayDtmf);
} }
@ -63,7 +73,7 @@ public class Numpad extends LinearLayout implements AddressAware {
} }
private <T> Collection<T> retrieveChildren(ViewGroup viewGroup, Class<T> clazz) { private final <T> Collection<T> retrieveChildren(ViewGroup viewGroup, Class<T> clazz) {
final Collection<T> views = new ArrayList<T>(); final Collection<T> views = new ArrayList<T>();
for (int i = 0; i < viewGroup.getChildCount(); i++) { for (int i = 0; i < viewGroup.getChildCount(); i++) {