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.LinphoneCall.State;
import org.linphone.mediastream.Version;
import org.linphone.ui.Numpad;
import android.app.AlertDialog;
import android.app.Dialog;
@ -251,8 +252,8 @@ public class ConferenceActivity extends ListActivity implements
switch (id) {
case numpad_dialog_id:
return new AlertDialog.Builder(this).setView(
getLayoutInflater().inflate(R.layout.numpad, null))
Numpad numpad = new Numpad(this, true);
return new AlertDialog.Builder(this).setView(numpad)
// .setIcon(R.drawable.logo_linphone_57x57)
// .setTitle("Send DTMFs")
.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 {
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) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.numpad, this);
setLongClickable(true);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Numpad);
mPlayDtmf = 1 == a.getInt(org.linphone.R.styleable.Numpad_play_dtmf, 1);
a.recycle();
LayoutInflater.from(context).inflate(R.layout.numpad, this);
setLongClickable(true);
}
@Override
protected void onFinishInflate() {
protected final void onFinishInflate() {
for (Digit v : retrieveChildren(this, Digit.class)) {
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>();
for (int i = 0; i < viewGroup.getChildCount(); i++) {