|
6 | 6 | import android.content.ContentValues;
|
7 | 7 | import android.content.Context;
|
8 | 8 | import android.content.Intent;
|
| 9 | +import android.content.SharedPreferences; |
9 | 10 | import android.content.pm.PackageManager;
|
10 | 11 | import android.database.Cursor;
|
11 | 12 | import android.database.sqlite.SQLiteDatabase;
|
@@ -51,16 +52,20 @@ public class Detail extends AppCompatActivity {
|
51 | 52 |
|
52 | 53 | String dtm_consider;
|
53 | 54 | EditText editText2;
|
| 55 | + Boolean isSeviceMessage; |
| 56 | + SharedPreferences sharedpreferences; |
| 57 | + public static final String MyPREFERENCES = "MyPrefs" ; |
54 | 58 |
|
55 | 59 |
|
56 | 60 | @Override
|
57 | 61 | protected void onCreate(Bundle savedInstanceState) {
|
58 | 62 | super.onCreate(savedInstanceState);
|
59 | 63 | setContentView(R.layout.activity_detail);
|
60 | 64 | custid= getIntent().getStringExtra("CUSTOMER_ID_Name");
|
61 |
| - |
62 | 65 | custDB=openOrCreateDatabase("CustomerDB", Context.MODE_PRIVATE, null);
|
63 | 66 | feeDB = openOrCreateDatabase("feesDB", Context.MODE_PRIVATE, null);
|
| 67 | + sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE); |
| 68 | + isSeviceMessage = sharedpreferences.getBoolean("serviceMessage", false); |
64 | 69 |
|
65 | 70 | int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE);
|
66 | 71 |
|
@@ -104,7 +109,13 @@ public void onClick(View view) {
|
104 | 109 | String nameCustomer = nameView.getText().toString();
|
105 | 110 | String message = "Dear " + nameCustomer + ",\nYou have successfully deposited "+ amountfees +"/-" +"\nThanks,\nBody Fitness Zone";
|
106 | 111 | if (phoneNumber.length() > 0 && message.length() > 0) {
|
107 |
| - sendSms(phoneNumber, message); |
| 112 | + if(isSeviceMessage){ |
| 113 | + SendMessage sendSM = new SendMessage(); |
| 114 | + sendSM.execute(phoneNumber, message); |
| 115 | + } |
| 116 | + else{ |
| 117 | + sendSms(phoneNumber, message); |
| 118 | + } |
108 | 119 | } else
|
109 | 120 | Toast.makeText(getBaseContext(),
|
110 | 121 | "Please enter both phone number and message.",
|
@@ -358,7 +369,13 @@ public void onSendReminder(View v){
|
358 | 369 | String nameCustomer = nameView.getText().toString();
|
359 | 370 | String message = "Dear " + nameCustomer + ",\nPlease accept this message as a soft reminder for the pending fees of this month."+ "\nThanks,\nBody Fitness Zone.";
|
360 | 371 | if (phoneNumber.length() > 0 && message.length() > 0) {
|
361 |
| - sendSms(phoneNumber, message); |
| 372 | + if(isSeviceMessage){ |
| 373 | + SendMessage sendSM = new SendMessage(); |
| 374 | + sendSM.execute(phoneNumber, message); |
| 375 | + } |
| 376 | + else{ |
| 377 | + sendSms(phoneNumber, message); |
| 378 | + } |
362 | 379 | } else
|
363 | 380 | Toast.makeText(getBaseContext(),
|
364 | 381 | "Please enter both phone number and message.",
|
|
0 commit comments