diff --git a/app/src/main/java/com/jens/automation2/ActivityManageActionSendTextMessage.java b/app/src/main/java/com/jens/automation2/ActivityManageActionSendTextMessage.java index 8310d6d9..f9bc909a 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageActionSendTextMessage.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageActionSendTextMessage.java @@ -9,10 +9,14 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.ContactsContract; +import android.provider.MediaStore; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; +import android.widget.CompoundButton; import android.widget.EditText; +import android.widget.RadioButton; +import android.widget.RadioGroup; import android.widget.Toast; import androidx.annotation.NonNull; @@ -22,14 +26,13 @@ import com.jens.automation2.Action.Action_Enum; public class ActivityManageActionSendTextMessage extends Activity { - Button bSaveSendTextMessage, bImportNumberFromContacts; + Button bSaveSendTextMessage, bImportNumberFromContacts, bMmsAttachment; EditText etPhoneNumber, etSendTextMessage; + RadioButton rbMessageTypeSms, rbMessageTypeMms; protected final static int requestCodeForContactsPermissions = 9876; protected final static int requestCodeGetContact = 3235; -// private String existingUrl = ""; - public static boolean edit = false; public static Action resultingAction = null; @@ -43,6 +46,9 @@ public class ActivityManageActionSendTextMessage extends Activity etPhoneNumber = (EditText)findViewById(R.id.etPhoneNumber); bSaveSendTextMessage = (Button)findViewById(R.id.bSaveSendTextMessage); bImportNumberFromContacts = (Button)findViewById(R.id.bImportNumberFromContacts); + rbMessageTypeSms = (RadioButton)findViewById(R.id.rbMessageTypeSms); + rbMessageTypeMms = (RadioButton) findViewById(R.id.rbMessageTypeMms); + bMmsAttachment = (Button)findViewById(R.id.bMmsAttachment); bSaveSendTextMessage.setOnClickListener(new OnClickListener() { @@ -78,6 +84,16 @@ public class ActivityManageActionSendTextMessage extends Activity } }); + RadioButton.OnCheckedChangeListener checkedChangedListener = new RadioButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean b) + { + bMmsAttachment.setEnabled(rbMessageTypeMms.isChecked()); + } + }; + rbMessageTypeSms.setOnCheckedChangeListener(checkedChangedListener); + rbMessageTypeMms.setOnCheckedChangeListener(checkedChangedListener); + ActivityManageActionSendTextMessage.edit = getIntent().getBooleanExtra("edit", false); if(edit) { diff --git a/app/src/main/res/layout/activity_manage_action_send_textmessage.xml b/app/src/main/res/layout/activity_manage_action_send_textmessage.xml index 25611e61..8eab8431 100644 --- a/app/src/main/res/layout/activity_manage_action_send_textmessage.xml +++ b/app/src/main/res/layout/activity_manage_action_send_textmessage.xml @@ -41,6 +41,30 @@ + + + + + + + + + + + + + + +