Disable add contact button if adress text empty + landscape numpad
This commit is contained in:
parent
a82a9e3764
commit
1bb9feeb5e
3 changed files with 26 additions and 2 deletions
|
@ -28,7 +28,14 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:layout="@layout/status" />
|
tools:layout="@layout/status" />
|
||||||
|
|
||||||
<!-- TODO Add numpad -->
|
<org.linphone.ui.Numpad
|
||||||
|
android:id="@+id/numpad"
|
||||||
|
android:background="@drawable/dialer_alt_background"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:layout_below="@id/switchCamera"
|
||||||
|
android:layout_marginBottom="100dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/menu"
|
android:id="@+id/menu"
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class DialerFragment extends Fragment {
|
||||||
View view = inflater.inflate(R.layout.dialer, container, false);
|
View view = inflater.inflate(R.layout.dialer, container, false);
|
||||||
|
|
||||||
mAddress = (AddressText) view.findViewById(R.id.Adress);
|
mAddress = (AddressText) view.findViewById(R.id.Adress);
|
||||||
|
mAddress.setDialerFragment(this);
|
||||||
EraseButton erase = (EraseButton) view.findViewById(R.id.Erase);
|
EraseButton erase = (EraseButton) view.findViewById(R.id.Erase);
|
||||||
erase.setAddressWidget(mAddress);
|
erase.setAddressWidget(mAddress);
|
||||||
erase.requestFocus();
|
erase.requestFocus();
|
||||||
|
@ -167,5 +168,11 @@ public class DialerFragment extends Fragment {
|
||||||
mAddContact.setImageResource(R.drawable.add_contact);
|
mAddContact.setImageResource(R.drawable.add_contact);
|
||||||
mAddContact.setOnClickListener(addContactListener);
|
mAddContact.setOnClickListener(addContactListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enableDisableAddContact();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableDisableAddContact() {
|
||||||
|
mAddContact.setEnabled(!mAddress.getText().toString().equals(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone.ui;
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
import org.linphone.DialerFragment;
|
||||||
import org.linphone.LinphoneManager.AddressType;
|
import org.linphone.LinphoneManager.AddressType;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -36,7 +37,8 @@ public class AddressText extends EditText implements AddressType {
|
||||||
private String displayedName;
|
private String displayedName;
|
||||||
private Uri pictureUri;
|
private Uri pictureUri;
|
||||||
private Paint mTestPaint;
|
private Paint mTestPaint;
|
||||||
|
private DialerFragment dialer;
|
||||||
|
|
||||||
public void setPictureUri(Uri uri) {
|
public void setPictureUri(Uri uri) {
|
||||||
pictureUri = uri;
|
pictureUri = uri;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +82,10 @@ public class AddressText extends EditText implements AddressType {
|
||||||
resizedText = getHint().toString();
|
resizedText = getHint().toString();
|
||||||
}
|
}
|
||||||
refitText(resizedText, getWidth());
|
refitText(resizedText, getWidth());
|
||||||
|
|
||||||
|
if (dialer != null) {
|
||||||
|
dialer.enableDisableAddContact();
|
||||||
|
}
|
||||||
|
|
||||||
super.onTextChanged(text, start, before, after);
|
super.onTextChanged(text, start, before, after);
|
||||||
}
|
}
|
||||||
|
@ -133,4 +139,8 @@ public class AddressText extends EditText implements AddressType {
|
||||||
refitText(resizedText, parentWidth);
|
refitText(resizedText, parentWidth);
|
||||||
setMeasuredDimension(parentWidth, height);
|
setMeasuredDimension(parentWidth, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDialerFragment(DialerFragment dialerFragment) {
|
||||||
|
dialer = dialerFragment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue