forked from jens/Automation
		
	send mms with attachment
This commit is contained in:
		| @@ -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) | ||||
| 		{ | ||||
|   | ||||
| @@ -41,6 +41,30 @@ | ||||
|             <requestFocus /> | ||||
|         </EditText> | ||||
|  | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="@string/messageType" /> | ||||
|  | ||||
|         <RadioGroup | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" > | ||||
|  | ||||
|             <RadioButton | ||||
|                 android:id="@+id/rbMessageTypeSms" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:checked="true" | ||||
|                 android:text="@string/sms" /> | ||||
|  | ||||
|             <RadioButton | ||||
|                 android:id="@+id/rbMessageTypeMms" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="@string/mms" /> | ||||
|  | ||||
|         </RadioGroup> | ||||
|  | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
| @@ -67,6 +91,23 @@ | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="@string/urlLegend" /> | ||||
|  | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="@string/attachment" /> | ||||
|  | ||||
|         <TextView | ||||
|             android:id="@+id/sendMmsFileAttachment" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" /> | ||||
|  | ||||
|         <Button | ||||
|             android:id="@+id/bMmsAttachment" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:enabled="false" | ||||
|             android:text="@string/chooseFile" /> | ||||
|  | ||||
|         <Button | ||||
|             android:id="@+id/bSaveSendTextMessage" | ||||
|             android:layout_marginTop="15dp" | ||||
|   | ||||
| @@ -868,4 +868,9 @@ | ||||
|     <string name="checkVariableExplanation">If you leave the value empty the variable must not be set for the condition to return true.</string> | ||||
|     <string name="variableCheckString">if variable %1$s is %2$s</string> | ||||
|     <string name="variableCheckStringDeleted">if variable %1$s is not set</string> | ||||
|     <string name="messageType">Message type</string> | ||||
|     <string name="sms">SMS</string> | ||||
|     <string name="mms">MMS</string> | ||||
|     <string name="attachment">Attachment</string> | ||||
|     <string name="chooseFile">choose file</string> | ||||
| </resources> | ||||
		Reference in New Issue
	
	Block a user