├── README.md └── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src ├── androidTest └── java │ └── shehryar │ └── paighaam │ └── ApplicationTest.java ├── main ├── AndroidManifest.xml ├── java │ └── shehryar │ │ └── paighaam │ │ ├── AboutActivity.java │ │ ├── AppCompatPreferenceActivity.java │ │ ├── MainActivity.java │ │ ├── SettingsActivity.java │ │ └── SimpleFileDialog.java └── res │ ├── drawable-hdpi │ ├── ic_info_black_24dp.png │ ├── ic_notifications_black_24dp.png │ └── ic_sync_black_24dp.png │ ├── drawable-mdpi │ ├── ic_info_black_24dp.png │ ├── ic_notifications_black_24dp.png │ └── ic_sync_black_24dp.png │ ├── drawable-v21 │ ├── ic_info_black_24dp.xml │ ├── ic_menu_camera.xml │ ├── ic_menu_gallery.xml │ ├── ic_menu_manage.xml │ ├── ic_menu_send.xml │ ├── ic_menu_share.xml │ ├── ic_menu_slideshow.xml │ ├── ic_notifications_black_24dp.xml │ └── ic_sync_black_24dp.xml │ ├── drawable-xhdpi │ ├── ic_info_black_24dp.png │ ├── ic_notifications_black_24dp.png │ └── ic_sync_black_24dp.png │ ├── drawable-xxhdpi │ ├── ic_info_black_24dp.png │ ├── ic_notifications_black_24dp.png │ └── ic_sync_black_24dp.png │ ├── drawable-xxxhdpi │ ├── ic_info_black_24dp.png │ ├── ic_notifications_black_24dp.png │ └── ic_sync_black_24dp.png │ ├── drawable │ ├── edit_text.xml │ └── side_nav_bar.xml │ ├── layout │ ├── activity_first_time.xml │ ├── activity_main.xml │ ├── activity_pause_setting.xml │ ├── activity_scrolling.xml │ ├── app_bar_main.xml │ ├── content_main.xml │ ├── content_scrolling.xml │ ├── list_item.xml │ └── nav_header_main.xml │ ├── menu │ ├── activity_main_drawer.xml │ ├── main.xml │ └── menu_scrolling.xml │ ├── mipmap-hdpi │ ├── ic_action_about.png │ └── ic_launcher.png │ ├── mipmap-mdpi │ ├── ic_action_about.png │ └── ic_launcher.png │ ├── mipmap-xhdpi │ ├── file.png │ ├── ic_action_about.png │ ├── ic_launcher.png │ └── iconsms.png │ ├── mipmap-xxhdpi │ ├── ic_action_about.png │ ├── ic_action_chat.png │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ ├── ic_action_help.png │ ├── ic_action_new_label.png │ ├── ic_action_settings.png │ └── ic_launcher.png │ ├── values-v21 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ ├── values │ ├── colors.xml │ ├── dimens.xml │ ├── drawables.xml │ ├── strings.xml │ └── styles.xml │ └── xml │ ├── pref_data_sync.xml │ ├── pref_general.xml │ ├── pref_headers.xml │ └── pref_notification.xml └── test └── java └── shehryar └── paighaam └── ExampleUnitTest.java /README.md: -------------------------------------------------------------------------------- 1 | # BulkSMSSender 2 | Bulk SMS Sender is a small and powerful open source android application that enables users to send generic and customized SMS messages through their carrier network to contacts that are listed in a Text input file. 3 | 4 | You can find Demo and Step by Step Discription here http://codinginfinite.com/open-source-bulk-sms-sender-android-app/ 5 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | buildToolsVersion "27.0.3" 6 | 7 | useLibrary 'org.apache.http.legacy' 8 | 9 | defaultConfig { 10 | applicationId "shehryar.paighaam" 11 | minSdkVersion 16 12 | targetSdkVersion 27 13 | versionCode 1 14 | versionName "1.0" 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | testImplementation 'junit:junit:4.12' 28 | implementation 'com.android.support:appcompat-v7:27.1.1' 29 | implementation 'com.android.support:design:27.1.1' 30 | implementation 'com.android.support:support-v4:27.1.1' 31 | } 32 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/shehryar/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/shehryar/paighaam/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package shehryar.paighaam; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/java/shehryar/paighaam/AboutActivity.java: -------------------------------------------------------------------------------- 1 | package shehryar.paighaam; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.ActionBar; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.MenuItem; 8 | 9 | public class AboutActivity extends AppCompatActivity { 10 | 11 | @Override 12 | protected void onCreate(Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | setContentView(R.layout.activity_scrolling); 15 | Toolbar toolbar = findViewById(R.id.toolbar); 16 | setSupportActionBar(toolbar); 17 | ActionBar actionBar = getSupportActionBar(); 18 | if (actionBar != null) 19 | actionBar.setDisplayHomeAsUpEnabled(true); 20 | } 21 | 22 | @Override 23 | public boolean onOptionsItemSelected(MenuItem item) { 24 | switch (item.getItemId()) { 25 | case android.R.id.home: 26 | finish(); 27 | return true; 28 | } 29 | return true; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/shehryar/paighaam/AppCompatPreferenceActivity.java: -------------------------------------------------------------------------------- 1 | package shehryar.paighaam; 2 | 3 | import android.content.res.Configuration; 4 | import android.os.Bundle; 5 | import android.preference.PreferenceActivity; 6 | import android.support.annotation.LayoutRes; 7 | import android.support.annotation.NonNull; 8 | import android.support.annotation.Nullable; 9 | import android.support.v7.app.ActionBar; 10 | import android.support.v7.app.AppCompatDelegate; 11 | import android.support.v7.widget.Toolbar; 12 | import android.view.MenuInflater; 13 | import android.view.View; 14 | import android.view.ViewGroup; 15 | 16 | /** 17 | * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls 18 | * to be used with AppCompat. 19 | */ 20 | public abstract class AppCompatPreferenceActivity extends PreferenceActivity { 21 | 22 | private AppCompatDelegate mDelegate; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | getDelegate().installViewFactory(); 27 | getDelegate().onCreate(savedInstanceState); 28 | super.onCreate(savedInstanceState); 29 | } 30 | 31 | @Override 32 | protected void onPostCreate(Bundle savedInstanceState) { 33 | super.onPostCreate(savedInstanceState); 34 | getDelegate().onPostCreate(savedInstanceState); 35 | } 36 | 37 | public ActionBar getSupportActionBar() { 38 | return getDelegate().getSupportActionBar(); 39 | } 40 | 41 | public void setSupportActionBar(@Nullable Toolbar toolbar) { 42 | getDelegate().setSupportActionBar(toolbar); 43 | } 44 | 45 | @NonNull 46 | @Override 47 | public MenuInflater getMenuInflater() { 48 | return getDelegate().getMenuInflater(); 49 | } 50 | 51 | @Override 52 | public void setContentView(@LayoutRes int layoutResID) { 53 | getDelegate().setContentView(layoutResID); 54 | } 55 | 56 | @Override 57 | public void setContentView(View view) { 58 | getDelegate().setContentView(view); 59 | } 60 | 61 | @Override 62 | public void setContentView(View view, ViewGroup.LayoutParams params) { 63 | getDelegate().setContentView(view, params); 64 | } 65 | 66 | @Override 67 | public void addContentView(View view, ViewGroup.LayoutParams params) { 68 | getDelegate().addContentView(view, params); 69 | } 70 | 71 | @Override 72 | protected void onPostResume() { 73 | super.onPostResume(); 74 | getDelegate().onPostResume(); 75 | } 76 | 77 | @Override 78 | protected void onTitleChanged(CharSequence title, int color) { 79 | super.onTitleChanged(title, color); 80 | getDelegate().setTitle(title); 81 | } 82 | 83 | @Override 84 | public void onConfigurationChanged(Configuration newConfig) { 85 | super.onConfigurationChanged(newConfig); 86 | getDelegate().onConfigurationChanged(newConfig); 87 | } 88 | 89 | @Override 90 | protected void onStop() { 91 | super.onStop(); 92 | getDelegate().onStop(); 93 | } 94 | 95 | @Override 96 | protected void onDestroy() { 97 | super.onDestroy(); 98 | getDelegate().onDestroy(); 99 | } 100 | 101 | public void invalidateOptionsMenu() { 102 | getDelegate().invalidateOptionsMenu(); 103 | } 104 | 105 | private AppCompatDelegate getDelegate() { 106 | if (mDelegate == null) { 107 | mDelegate = AppCompatDelegate.create(this, null); 108 | } 109 | return mDelegate; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /app/src/main/java/shehryar/paighaam/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2016 CodingInfinite Technologies - All Rights Reserved 2 | * NOTICE: All information contained herein is, and remains 3 | * the property of CodingInfinite Technologies and its suppliers, 4 | * if any. The intellectual and technical concepts contained 5 | * herein are proprietary to CodingInfinite Technologies 6 | * and its suppliers and may be covered by Foreign Patents, 7 | * patents in process, and are protected by trade secret or copyright law. 8 | * Dissemination of this information or reproduction of this material 9 | * is strictly forbidden unless prior written permission is obtained 10 | * from CodingInfinite Technologies. 11 | */ 12 | 13 | 14 | package shehryar.paighaam; 15 | 16 | import android.app.Activity; 17 | import android.app.PendingIntent; 18 | import android.app.ProgressDialog; 19 | import android.content.BroadcastReceiver; 20 | import android.content.Context; 21 | import android.content.Intent; 22 | import android.content.IntentFilter; 23 | import android.content.SharedPreferences; 24 | import android.os.Bundle; 25 | import android.os.PowerManager; 26 | import android.support.annotation.NonNull; 27 | import android.telephony.SmsManager; 28 | import android.view.View; 29 | import android.support.design.widget.NavigationView; 30 | import android.support.v4.view.GravityCompat; 31 | import android.support.v4.widget.DrawerLayout; 32 | import android.support.v7.app.ActionBarDrawerToggle; 33 | import android.support.v7.app.AppCompatActivity; 34 | import android.support.v7.widget.Toolbar; 35 | import android.view.MenuItem; 36 | import android.widget.ArrayAdapter; 37 | import android.widget.Button; 38 | import android.widget.EditText; 39 | import android.widget.ImageButton; 40 | import android.widget.ListView; 41 | import android.widget.Toast; 42 | 43 | import java.io.BufferedReader; 44 | import java.io.FileNotFoundException; 45 | import java.io.FileReader; 46 | import java.io.IOException; 47 | import java.io.PrintWriter; 48 | import java.util.ArrayList; 49 | 50 | public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { 51 | 52 | ImageButton sendSMSBtn; 53 | EditText smsMessageET; 54 | ListView nmbrsList; 55 | int count = 0, i = 0; 56 | PendingIntent sentPI; 57 | 58 | public static int limit, pause, deleteNum; 59 | 60 | ProgressDialog progressBar; 61 | ArrayList nmbers = new ArrayList<>(); 62 | 63 | SharedPreferences sharedpreferences; 64 | 65 | String filePath = ""; 66 | PowerManager.WakeLock wl; 67 | 68 | @Override 69 | protected void onCreate(Bundle savedInstanceState) { 70 | super.onCreate(savedInstanceState); 71 | setContentView(R.layout.activity_main); 72 | Toolbar toolbar = findViewById(R.id.toolbar); 73 | setSupportActionBar(toolbar); 74 | DrawerLayout drawer = findViewById(R.id.drawer_layout); 75 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( 76 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); 77 | drawer.setDrawerListener(toggle); 78 | toggle.syncState(); 79 | NavigationView navigationView = findViewById(R.id.nav_view); 80 | navigationView.setNavigationItemSelectedListener(this); 81 | sharedpreferences = getSharedPreferences("smsppppt", Context.MODE_PRIVATE); 82 | if (sharedpreferences.getAll().isEmpty()) { 83 | SharedPreferences.Editor editor = sharedpreferences.edit(); 84 | editor.putString("limit", "900"); 85 | editor.putString("pause", "3"); 86 | editor.putString("deleteNum", "1"); 87 | editor.putString("key", "0"); 88 | editor.apply(); 89 | 90 | limit = 900; 91 | pause = 3; 92 | deleteNum = 1; 93 | } else { 94 | limit = Integer.parseInt(sharedpreferences.getString("limit", "")); 95 | pause = Integer.parseInt(sharedpreferences.getString("pause", "")); 96 | deleteNum = Integer.parseInt(sharedpreferences.getString("deleteNum", "")); 97 | } 98 | nmbrsList = findViewById(R.id.listView1); 99 | Button dirChooserButton1 = findViewById(R.id.button1); 100 | dirChooserButton1.setOnClickListener(new View.OnClickListener() { 101 | String m_chosen; 102 | 103 | @Override 104 | public void onClick(View v) { 105 | SimpleFileDialog FileOpenDialog = new SimpleFileDialog(MainActivity.this, "FileOpen", 106 | new SimpleFileDialog.SimpleFileDialogListener() { 107 | @Override 108 | public void onChosenDir(String chosenDir) { 109 | m_chosen = chosenDir; 110 | filePath = m_chosen; 111 | Toast.makeText(MainActivity.this, "Chosen File: " + m_chosen, Toast.LENGTH_SHORT).show(); 112 | BufferedReader br; 113 | try { 114 | br = new BufferedReader(new FileReader(m_chosen)); 115 | String line; 116 | while ((line = br.readLine()) != null) { 117 | nmbers.add(line); 118 | } 119 | String[] namesArr = nmbers.toArray(new String[nmbers.size()]); 120 | ArrayAdapter adaptr = new ArrayAdapter<>(MainActivity.this, android.R.layout.simple_list_item_1, namesArr); 121 | nmbrsList.setAdapter(adaptr); 122 | } catch (IOException io) { 123 | io.printStackTrace(); 124 | } 125 | 126 | } 127 | }); 128 | FileOpenDialog.Default_File_Name = ""; 129 | FileOpenDialog.chooseFile_or_Dir(); 130 | PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); 131 | wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag"); 132 | wl.acquire(10*60*1000L /*10 minutes*/); 133 | progressBar = new ProgressDialog(v.getContext()); 134 | progressBar.setCancelable(false); 135 | progressBar.setMessage("SMS Sending..."); 136 | progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 137 | progressBar.setProgress(0); 138 | } 139 | }); 140 | sendSMSBtn = findViewById(R.id.btnSendSMS); 141 | sendSMSBtn.setOnClickListener(new View.OnClickListener() { 142 | public void onClick(View view) { 143 | smsMessageET = findViewById(R.id.editText1); 144 | if (smsMessageET.getText().toString().isEmpty()) 145 | Toast.makeText(getBaseContext(), "Message can not be empty!", Toast.LENGTH_SHORT).show(); 146 | else if (filePath.isEmpty()) { 147 | Toast.makeText(getBaseContext(), "Please choose a file!", Toast.LENGTH_SHORT).show(); 148 | } else 149 | sendSMS(); 150 | } 151 | }); 152 | 153 | } 154 | 155 | @Override 156 | public void onBackPressed() { 157 | DrawerLayout drawer = findViewById(R.id.drawer_layout); 158 | if (drawer.isDrawerOpen(GravityCompat.START)) { 159 | drawer.closeDrawer(GravityCompat.START); 160 | } else { 161 | super.onBackPressed(); 162 | } 163 | } 164 | 165 | @SuppressWarnings("StatementWithEmptyBody") 166 | @Override 167 | public boolean onNavigationItemSelected(@NonNull MenuItem item) { 168 | // Handle navigation view item clicks here. 169 | int id = item.getItemId(); 170 | if (id == R.id.send_sms) { 171 | } else if (id == R.id.settings) { 172 | Intent intent = new Intent(MainActivity.this, SettingsActivity.class); 173 | startActivity(intent); 174 | } else if (id == R.id.about) { 175 | Intent intent = new Intent(MainActivity.this, AboutActivity.class); 176 | startActivity(intent); 177 | } else if (id == R.id.exit_app) { 178 | finish(); 179 | } 180 | DrawerLayout drawer = findViewById(R.id.drawer_layout); 181 | drawer.closeDrawer(GravityCompat.START); 182 | return true; 183 | } 184 | 185 | protected void sendSMS() { 186 | String SENT = "SENT_SMS_ACTION"; 187 | sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); 188 | registerReceiver(new BroadcastReceiver() { 189 | @Override 190 | public void onReceive(Context arg0, Intent arg1) { 191 | count++; 192 | i++; 193 | switch (getResultCode()) { 194 | case Activity.RESULT_OK: 195 | if (deleteNum == 1) { 196 | String nm = nmbers.get(i - 1); 197 | nmbers.remove(nm); 198 | i--; 199 | PrintWriter writer; 200 | try { 201 | writer = new PrintWriter(filePath); 202 | for (int t = 0; t < nmbers.size(); t++) { 203 | writer.println(nmbers.get(t)); 204 | } 205 | writer.close(); 206 | } catch (FileNotFoundException e) { 207 | e.printStackTrace(); 208 | } 209 | } 210 | break; 211 | case SmsManager.RESULT_ERROR_GENERIC_FAILURE: 212 | Toast.makeText(getBaseContext(), "Generic failure", 213 | Toast.LENGTH_SHORT).show(); 214 | break; 215 | case SmsManager.RESULT_ERROR_NO_SERVICE: 216 | Toast.makeText(getBaseContext(), "No service", 217 | Toast.LENGTH_SHORT).show(); 218 | break; 219 | case SmsManager.RESULT_ERROR_NULL_PDU: 220 | Toast.makeText(getBaseContext(), "Null PDU", 221 | Toast.LENGTH_SHORT).show(); 222 | break; 223 | case SmsManager.RESULT_ERROR_RADIO_OFF: 224 | Toast.makeText(getBaseContext(), "Radio off", 225 | Toast.LENGTH_SHORT).show(); 226 | break; 227 | } 228 | if (i < nmbers.size()) { 229 | progressBar.setProgress(count); 230 | if (count % limit == 0 && count > 0) { 231 | try { 232 | Thread.sleep((pause * 1000)); 233 | } catch (InterruptedException e) { 234 | //e.printStackTrace(); 235 | } 236 | } 237 | sendIt(); 238 | } else { 239 | progressBar.dismiss(); 240 | Toast.makeText(getBaseContext(), "All SMS Sent", Toast.LENGTH_SHORT).show(); 241 | wl.release(); 242 | } 243 | } 244 | }, new IntentFilter(SENT)); 245 | progressBar.setMax(nmbers.size()); 246 | progressBar.show(); 247 | sendIt(); 248 | } 249 | 250 | void sendIt() { 251 | try { 252 | 253 | SmsManager smsManager = SmsManager.getDefault(); 254 | smsManager.sendTextMessage(nmbers.get(i), null, smsMessageET.getText().toString(), sentPI, null); 255 | } catch (Exception e) { 256 | Toast.makeText(getApplicationContext(), "failed to " + nmbers.get(i), Toast.LENGTH_LONG).show(); 257 | } 258 | } 259 | } 260 | -------------------------------------------------------------------------------- /app/src/main/java/shehryar/paighaam/SettingsActivity.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2016 CodingInfinite Technologies - All Rights Reserved */ 2 | 3 | package shehryar.paighaam; 4 | 5 | import android.content.Context; 6 | import android.content.SharedPreferences; 7 | import android.support.v7.app.ActionBar; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.os.Bundle; 10 | import android.text.Html; 11 | import android.text.method.LinkMovementMethod; 12 | import android.view.MenuItem; 13 | import android.view.View; 14 | import android.widget.Button; 15 | import android.widget.CheckBox; 16 | import android.widget.EditText; 17 | import android.widget.TextView; 18 | import android.widget.Toast; 19 | 20 | public class SettingsActivity extends AppCompatActivity { 21 | 22 | EditText limitEditText, pauseEditText; 23 | CheckBox checkBox; 24 | Button saveButton; 25 | SharedPreferences sharedpreferences; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.activity_pause_setting); 31 | ActionBar actionBar = getSupportActionBar(); 32 | if (actionBar != null) 33 | actionBar.setDisplayHomeAsUpEnabled(true); 34 | TextView textView = findViewById(R.id.textView2); 35 | textView.setClickable(true); 36 | textView.setMovementMethod(LinkMovementMethod.getInstance()); 37 | String text = "Powered by: " + "Coding Infinite"; 38 | textView.setText(Html.fromHtml(text)); 39 | 40 | 41 | checkBox = findViewById(R.id.checkBox1); 42 | 43 | if (MainActivity.deleteNum == 1) { 44 | checkBox.setChecked(true); 45 | } else { 46 | checkBox.setChecked(false); 47 | } 48 | 49 | limitEditText = findViewById(R.id.editText); 50 | limitEditText.setText(String.valueOf(Integer.toString(MainActivity.pause))); 51 | 52 | pauseEditText = findViewById(R.id.editText2); 53 | pauseEditText.setText(String.valueOf(Integer.toString(MainActivity.limit))); 54 | 55 | saveButton = findViewById(R.id.button); 56 | saveButton.setOnClickListener(new View.OnClickListener() { 57 | 58 | @Override 59 | public void onClick(View v) { 60 | 61 | sharedpreferences = getSharedPreferences("smsppppt", Context.MODE_PRIVATE); 62 | 63 | SharedPreferences.Editor editor = sharedpreferences.edit(); 64 | editor.putString("limit", pauseEditText.getText().toString()); 65 | editor.putString("pause", limitEditText.getText().toString()); 66 | 67 | 68 | if (checkBox.isChecked()) { 69 | MainActivity.deleteNum = 1; 70 | editor.putString("deleteNum", "1"); 71 | } else { 72 | MainActivity.deleteNum = 0; 73 | editor.putString("deleteNum", "0"); 74 | } 75 | 76 | editor.apply(); 77 | 78 | 79 | MainActivity.pause = Integer.parseInt(limitEditText.getText().toString()); 80 | MainActivity.limit = Integer.parseInt(pauseEditText.getText().toString()); 81 | 82 | Toast.makeText(SettingsActivity.this, "Saved!", Toast.LENGTH_SHORT).show(); 83 | finish(); 84 | } 85 | }); 86 | 87 | } 88 | 89 | @Override 90 | public boolean onOptionsItemSelected(MenuItem item) { 91 | switch (item.getItemId()) { 92 | case android.R.id.home: 93 | // app icon in action bar clicked; go home 94 | finish(); 95 | return true; 96 | 97 | } 98 | 99 | return true; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /app/src/main/java/shehryar/paighaam/SimpleFileDialog.java: -------------------------------------------------------------------------------- 1 | package shehryar.paighaam; 2 | 3 | 4 | import java.io.File; 5 | import java.io.IOException; 6 | import java.util.ArrayList; 7 | import java.util.Collections; 8 | import java.util.Comparator; 9 | import java.util.List; 10 | 11 | import android.app.AlertDialog; 12 | import android.content.Context; 13 | import android.content.DialogInterface; 14 | import android.content.DialogInterface.OnClickListener; 15 | import android.os.Environment; 16 | import android.support.annotation.NonNull; 17 | import android.text.Editable; 18 | import android.view.Gravity; 19 | import android.view.View; 20 | import android.view.ViewGroup; 21 | import android.view.ViewGroup.LayoutParams; 22 | import android.widget.ArrayAdapter; 23 | import android.widget.Button; 24 | import android.widget.EditText; 25 | import android.widget.LinearLayout; 26 | import android.widget.TextView; 27 | import android.widget.Toast; 28 | 29 | public class SimpleFileDialog { 30 | private int FileOpen = 0; 31 | private int FileSave = 1; 32 | private int FolderChoose = 2; 33 | private int Select_type; 34 | private String m_sdcardDirectory; 35 | private Context m_context; 36 | private TextView m_titleView; 37 | public String Default_File_Name = "default.txt"; 38 | private String Selected_File_Name = Default_File_Name; 39 | private EditText input_text; 40 | 41 | private String m_dir = ""; 42 | private List m_subdirs = null; 43 | private SimpleFileDialogListener m_SimpleFileDialogListener; 44 | private ArrayAdapter m_listAdapter = null; 45 | 46 | 47 | ////////////////////////////////////////////////////// 48 | // Callback interface for selected directory 49 | ////////////////////////////////////////////////////// 50 | public interface SimpleFileDialogListener { 51 | public void onChosenDir(String chosenDir); 52 | } 53 | 54 | SimpleFileDialog(Context context, String file_select_type, SimpleFileDialogListener SimpleFileDialogListener) { 55 | switch (file_select_type) { 56 | case "FileOpen": 57 | Select_type = FileOpen; 58 | break; 59 | case "FileSave": 60 | Select_type = FileSave; 61 | break; 62 | case "FolderChoose": 63 | Select_type = FolderChoose; 64 | break; 65 | default: 66 | Select_type = FileOpen; 67 | break; 68 | } 69 | 70 | m_context = context; 71 | m_sdcardDirectory = Environment.getExternalStorageDirectory().getAbsolutePath(); 72 | m_SimpleFileDialogListener = SimpleFileDialogListener; 73 | 74 | try { 75 | m_sdcardDirectory = new File(m_sdcardDirectory).getCanonicalPath(); 76 | } catch (IOException ignored) { 77 | } 78 | } 79 | 80 | /////////////////////////////////////////////////////////////////////// 81 | // chooseFile_or_Dir() - load directory chooser dialog for initial 82 | // default sdcard directory 83 | /////////////////////////////////////////////////////////////////////// 84 | public void chooseFile_or_Dir() { 85 | // Initial directory is sdcard directory 86 | if (m_dir.equals("")) chooseFile_or_Dir(m_sdcardDirectory); 87 | else chooseFile_or_Dir(m_dir); 88 | } 89 | 90 | //////////////////////////////////////////////////////////////////////////////// 91 | // chooseFile_or_Dir(String dir) - load directory chooser dialog for initial 92 | // input 'dir' directory 93 | //////////////////////////////////////////////////////////////////////////////// 94 | private void chooseFile_or_Dir(String dir) { 95 | File dirFile = new File(dir); 96 | if (!dirFile.exists() || !dirFile.isDirectory()) { 97 | dir = m_sdcardDirectory; 98 | } 99 | 100 | try { 101 | dir = new File(dir).getCanonicalPath(); 102 | } catch (IOException ioe) { 103 | return; 104 | } 105 | 106 | m_dir = dir; 107 | m_subdirs = getDirectories(dir); 108 | 109 | class SimpleFileDialogOnClickListener implements OnClickListener { 110 | public void onClick(DialogInterface dialog, int item) { 111 | String m_dir_old = m_dir; 112 | String sel = "" + ((AlertDialog) dialog).getListView().getAdapter().getItem(item); 113 | if (sel.charAt(sel.length() - 1) == '/') sel = sel.substring(0, sel.length() - 1); 114 | 115 | // Navigate into the sub-directory 116 | if (sel.equals("..")) { 117 | m_dir = m_dir.substring(0, m_dir.lastIndexOf("/")); 118 | } else { 119 | m_dir += "/" + sel; 120 | } 121 | Selected_File_Name = Default_File_Name; 122 | 123 | if ((new File(m_dir).isFile())) // If the selection is a regular file 124 | { 125 | m_dir = m_dir_old; 126 | Selected_File_Name = sel; 127 | } 128 | 129 | updateDirectory(); 130 | } 131 | } 132 | 133 | AlertDialog.Builder dialogBuilder = createDirectoryChooserDialog(dir, m_subdirs, 134 | new SimpleFileDialogOnClickListener()); 135 | 136 | dialogBuilder.setPositiveButton("OK", new OnClickListener() { 137 | @Override 138 | public void onClick(DialogInterface dialog, int which) { 139 | // Current directory chosen 140 | // Call registered listener supplied with the chosen directory 141 | if (m_SimpleFileDialogListener != null) { 142 | { 143 | if (Select_type == FileOpen || Select_type == FileSave) { 144 | Selected_File_Name = input_text.getText() + ""; 145 | m_SimpleFileDialogListener.onChosenDir(m_dir + "/" + Selected_File_Name); 146 | } else { 147 | m_SimpleFileDialogListener.onChosenDir(m_dir); 148 | } 149 | } 150 | } 151 | } 152 | }).setNegativeButton("Cancel", null); 153 | 154 | final AlertDialog dirsDialog = dialogBuilder.create(); 155 | 156 | // Show directory chooser dialog 157 | dirsDialog.show(); 158 | } 159 | 160 | private boolean createSubDir(String newDir) { 161 | File newDirFile = new File(newDir); 162 | return !newDirFile.exists() && newDirFile.mkdir(); 163 | } 164 | 165 | private List getDirectories(String dir) { 166 | List dirs = new ArrayList<>(); 167 | try { 168 | File dirFile = new File(dir); 169 | 170 | // if directory is not the base sd card directory add ".." for going up one directory 171 | if (!m_dir.equals(m_sdcardDirectory)) dirs.add(".."); 172 | 173 | if (!dirFile.exists() || !dirFile.isDirectory()) { 174 | return dirs; 175 | } 176 | 177 | for (File file : dirFile.listFiles()) { 178 | if (file.isDirectory()) { 179 | // Add "/" to directory names to identify them in the list 180 | dirs.add(file.getName() + "/"); 181 | } else if (Select_type == FileSave || Select_type == FileOpen) { 182 | // Add file names to the list if we are doing a file save or file open operation 183 | dirs.add(file.getName()); 184 | } 185 | } 186 | } catch (Exception ignored) { 187 | } 188 | 189 | Collections.sort(dirs, new Comparator() { 190 | public int compare(String o1, String o2) { 191 | return o1.compareTo(o2); 192 | } 193 | }); 194 | return dirs; 195 | } 196 | 197 | ////////////////////////////////////////////////////////////////////////////////////////////////////////// 198 | ////// START DIALOG DEFINITION ////// 199 | ////////////////////////////////////////////////////////////////////////////////////////////////////////// 200 | private AlertDialog.Builder createDirectoryChooserDialog(String title, List listItems, 201 | OnClickListener onClickListener) { 202 | AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(m_context); 203 | //////////////////////////////////////////////// 204 | // Create title text showing file select type // 205 | //////////////////////////////////////////////// 206 | TextView m_titleView1 = new TextView(m_context); 207 | m_titleView1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 208 | //m_titleView1.setTextAppearance(m_context, android.R.style.TextAppearance_Large); 209 | //m_titleView1.setTextColor( m_context.getResources().getColor(android.R.color.black) ); 210 | 211 | if (Select_type == FileOpen) m_titleView1.setText(String.valueOf("Open")); 212 | if (Select_type == FileSave) m_titleView1.setText(String.valueOf("Save As")); 213 | if (Select_type == FolderChoose) m_titleView1.setText(String.valueOf("Folder Select")); 214 | 215 | //need to make this a variable Save as, Open, Select Directory 216 | m_titleView1.setGravity(Gravity.CENTER_VERTICAL); 217 | m_titleView1.setBackgroundColor(-12303292); // dark gray -12303292 218 | m_titleView1.setTextColor(m_context.getResources().getColor(android.R.color.white)); 219 | 220 | // Create custom view for AlertDialog title 221 | LinearLayout titleLayout1 = new LinearLayout(m_context); 222 | titleLayout1.setOrientation(LinearLayout.VERTICAL); 223 | titleLayout1.addView(m_titleView1); 224 | 225 | if (Select_type == FolderChoose || Select_type == FileSave) { 226 | /////////////////////////////// 227 | // Create New Folder Button // 228 | /////////////////////////////// 229 | Button newDirButton = new Button(m_context); 230 | newDirButton.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 231 | newDirButton.setText(String.valueOf("New Folder")); 232 | newDirButton.setOnClickListener(new View.OnClickListener() { 233 | @Override 234 | public void onClick(View v) { 235 | final EditText input = new EditText(m_context); 236 | 237 | // Show new folder name input dialog 238 | new AlertDialog.Builder(m_context). 239 | setTitle("New Folder Name"). 240 | setView(input).setPositiveButton("OK", new OnClickListener() { 241 | public void onClick(DialogInterface dialog, int whichButton) { 242 | Editable newDir = input.getText(); 243 | String newDirName = newDir.toString(); 244 | // Create new directory 245 | if (createSubDir(m_dir + "/" + newDirName)) { 246 | // Navigate into the new directory 247 | m_dir += "/" + newDirName; 248 | updateDirectory(); 249 | } else { 250 | Toast.makeText(m_context, "Failed to create '" 251 | + newDirName + "' folder", Toast.LENGTH_SHORT).show(); 252 | } 253 | } 254 | }).setNegativeButton("Cancel", null).show(); 255 | } 256 | } 257 | ); 258 | titleLayout1.addView(newDirButton); 259 | } 260 | 261 | ///////////////////////////////////////////////////// 262 | // Create View with folder path and entry text box // 263 | ///////////////////////////////////////////////////// 264 | LinearLayout titleLayout = new LinearLayout(m_context); 265 | titleLayout.setOrientation(LinearLayout.VERTICAL); 266 | 267 | m_titleView = new TextView(m_context); 268 | m_titleView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); 269 | m_titleView.setBackgroundColor(-12303292); // dark gray -12303292 270 | m_titleView.setTextColor(m_context.getResources().getColor(android.R.color.white)); 271 | m_titleView.setGravity(Gravity.CENTER_VERTICAL); 272 | m_titleView.setText(title); 273 | 274 | titleLayout.addView(m_titleView); 275 | 276 | if (Select_type == FileOpen || Select_type == FileSave) { 277 | input_text = new EditText(m_context); 278 | input_text.setText(Default_File_Name); 279 | titleLayout.addView(input_text); 280 | } 281 | ////////////////////////////////////////// 282 | // Set Views and Finish Dialog builder // 283 | ////////////////////////////////////////// 284 | dialogBuilder.setView(titleLayout); 285 | dialogBuilder.setCustomTitle(titleLayout1); 286 | m_listAdapter = createListAdapter(listItems); 287 | dialogBuilder.setSingleChoiceItems(m_listAdapter, -1, onClickListener); 288 | dialogBuilder.setCancelable(false); 289 | return dialogBuilder; 290 | } 291 | 292 | private void updateDirectory() { 293 | m_subdirs.clear(); 294 | m_subdirs.addAll(getDirectories(m_dir)); 295 | m_titleView.setText(m_dir); 296 | m_listAdapter.notifyDataSetChanged(); 297 | //#scorch 298 | if (Select_type == FileSave || Select_type == FileOpen) { 299 | input_text.setText(Selected_File_Name); 300 | } 301 | } 302 | 303 | private ArrayAdapter createListAdapter(List items) { 304 | return new ArrayAdapter(m_context, android.R.layout.select_dialog_item, android.R.id.text1, items) { 305 | @NonNull 306 | @Override 307 | public View getView(int position, View convertView, @NonNull ViewGroup parent) { 308 | View v = super.getView(position, convertView, parent); 309 | if (v instanceof TextView) { 310 | // Enable list item (directory) text wrapping 311 | TextView tv = (TextView) v; 312 | tv.getLayoutParams().height = LayoutParams.WRAP_CONTENT; 313 | tv.setEllipsize(null); 314 | } 315 | return v; 316 | } 317 | }; 318 | } 319 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-hdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-mdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_info_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_camera.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_gallery.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_manage.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_send.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_share.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_slideshow.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_notifications_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_sync_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-xxxhdpi/ic_notifications_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/BulkSMSSender/3a2b5156472a929949b34aff12f878b6c454ad97/app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/edit_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/side_nav_bar.xml: -------------------------------------------------------------------------------- 1 | 3 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_first_time.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | 21 | 22 | 27 | 28 | 35 | 36 | 41 | 42 |