├── AndroidManifest.xml ├── README.md ├── _config.yml ├── build.gradle ├── java └── com │ └── gajendraprofile │ └── callmask │ ├── AlarmSetter.java │ ├── DatabaseHelper.java │ ├── FakeCaller.java │ ├── GCMListenerService.java │ ├── IncomingCallTracker.java │ ├── MainActivity.java │ ├── Message.java │ ├── Notification.java │ └── welcome_start.java └── res ├── layout ├── activity_fake_caller.xml ├── activity_login.xml ├── activity_mainactivity.xml ├── activity_welcome_start.xml ├── alert_dialog.xml ├── item_layout.xml └── list.xml ├── mipmap-hdpi ├── ic_account_box_black_18dp.png ├── ic_phone_android_black_18dp.png ├── ic_phonelink_lock_black_18dp.png ├── ic_query_builder_black_24dp.png ├── ic_queue_play_next_black_24dp.png ├── ic_send_black_18dp.png ├── ic_today_black_24dp.png └── ic_vpn_key_black_18dp.png ├── mipmap-mdpi ├── ic_account_box_black_18dp.png ├── ic_phone_android_black_18dp.png ├── ic_phonelink_lock_black_18dp.png ├── ic_query_builder_black_24dp.png ├── ic_queue_play_next_black_24dp.png ├── ic_send_black_18dp.png ├── ic_today_black_24dp.png └── ic_vpn_key_black_18dp.png ├── mipmap-xhdpi ├── ic_account_box_black_18dp.png ├── ic_phone_android_black_18dp.png ├── ic_phonelink_lock_black_18dp.png ├── ic_query_builder_black_24dp.png ├── ic_queue_play_next_black_24dp.png ├── ic_send_black_18dp.png ├── ic_today_black_24dp.png └── ic_vpn_key_black_18dp.png ├── mipmap-xxhdpi ├── ic_account_box_black_18dp.png ├── ic_phone_android_black_18dp.png ├── ic_phonelink_lock_black_18dp.png ├── ic_query_builder_black_24dp.png ├── ic_queue_play_next_black_24dp.png ├── ic_send_black_18dp.png ├── ic_today_black_24dp.png └── ic_vpn_key_black_18dp.png ├── mipmap-xxxhdpi ├── ic_account_box_black_18dp.png ├── ic_launcher.png ├── ic_phone_android_black_18dp.png ├── ic_phonelink_lock_black_18dp.png ├── ic_query_builder_black_24dp.png ├── ic_queue_play_next_black_24dp.png ├── ic_send_black_18dp.png ├── ic_today_black_24dp.png └── ic_vpn_key_black_18dp.png ├── values-v21 └── styles.xml ├── values-w820dp └── dimens.xml └── values ├── colors.xml ├── dimens.xml └── styles.xml /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 35 | 38 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 59 | 62 | 63 | 64 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 78 | 79 | 80 | 81 | 82 | 83 | 86 | 87 | 88 | 89 | 90 | 93 | 95 | 96 | 97 | 100 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Call Mask

2 | 3 |

4 | 5 |

6 | 7 | Android Application for: 8 | 9 | * Deleting your specified `[contact_number]` automatically after you end the call `[INCOMING]`&`[OUTGOING]` calls. 10 | * Adding fake call log from your phonebook or any custom number. 11 | * Modifying date and time of any call log. 12 | * Hide the app existence on your mobile by dialling custom set number `eg:*1234` 13 | 14 | 15 | App is published on `Google Play`. You can download it for free from the following link: 16 | 17 | ``` 18 | https://play.google.com/store/apps/details?id=com.gajendraprofile.callmask 19 | ``` 20 | 21 | App Default Password `CallMask` 22 | 23 |

Screenshots

24 | 25 |

Homescreen


26 | 27 |

28 | 29 |

30 | 31 | 32 |

FakeCall


33 | 34 |

35 | 36 |

37 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-midnight -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | defaultConfig { 7 | applicationId "com.gajendraprofile.callmask" 8 | minSdkVersion 15 9 | targetSdkVersion 23 10 | versionCode 5 11 | versionName '1.4' 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | productFlavors { 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | testCompile 'junit:junit:4.12' 26 | compile 'com.android.support:appcompat-v7:23.1.1' 27 | compile 'com.google.android.gms:play-services:8.4.0' 28 | compile 'com.google.android.gms:play-services-ads:8.4.0' 29 | compile 'com.android.support:design:23.1.1' 30 | } 31 | -------------------------------------------------------------------------------- /java/com/gajendraprofile/callmask/AlarmSetter.java: -------------------------------------------------------------------------------- 1 | package com.gajendraprofile.callmask; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.os.IBinder; 6 | import android.support.annotation.Nullable; 7 | 8 | 9 | public class AlarmSetter extends Service { 10 | @Nullable 11 | @Override 12 | public IBinder onBind(Intent intent) { 13 | return null; 14 | } 15 | 16 | @Override 17 | public void onStart(Intent intent, int startId) { 18 | super.onStart(intent, startId); 19 | updateSub(); 20 | } 21 | 22 | 23 | private void updateSub(){ 24 | int value = Message.GetInt(getBaseContext(),"Sub","Days",0); 25 | if(value > 0) { 26 | Message.SetInt(getBaseContext(), "Sub", "Days", value - 1); 27 | stopSelf(); 28 | }else if(value == 0){ 29 | GCMListenerService.sendNotification(getBaseContext(),"Your subscription has expired! Please click on the ads twice to renew", 30 | Subscriptions.class); 31 | Message.SetSP(getBaseContext(),"Pass","switch","OFF"); 32 | Message.SetSP(getBaseContext(),"Pass","switchHide","OFF"); 33 | stopSelf(); 34 | }else{ 35 | stopSelf(); 36 | } 37 | } 38 | 39 | @Override 40 | public void onDestroy() { 41 | super.onDestroy(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /java/com/gajendraprofile/callmask/DatabaseHelper.java: -------------------------------------------------------------------------------- 1 | package com.gajendraprofile.callmask; 2 | 3 | 4 | import android.content.ContentValues; 5 | import android.content.Context; 6 | import android.database.Cursor; 7 | import android.database.sqlite.SQLiteDatabase; 8 | import android.database.sqlite.SQLiteOpenHelper; 9 | import android.util.Log; 10 | 11 | public class DatabaseHelper extends SQLiteOpenHelper{ 12 | 13 | public static final String DATABASE_NAME = "CallMask.db"; 14 | public static final String TABLE_NAME = "notification"; 15 | public static final String COL_1 = "_id"; 16 | public static final String COL_2 = "DATE"; 17 | public static final String COL_3 = "MESSAGE"; 18 | 19 | 20 | 21 | public DatabaseHelper(Context context) { 22 | super(context, DATABASE_NAME, null, 1); 23 | } 24 | 25 | @Override 26 | public void onCreate(SQLiteDatabase db) { 27 | db.execSQL("create table " + TABLE_NAME + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, DATE TEXT, MESSAGE TEXT)"); 28 | } 29 | 30 | @Override 31 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 32 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); 33 | onCreate(db); 34 | } 35 | 36 | public boolean insertData(String date, String Message){ 37 | SQLiteDatabase db = this.getWritableDatabase(); 38 | ContentValues contentValues = new ContentValues(); 39 | contentValues.put(COL_2, date); 40 | contentValues.put(COL_3, Message); 41 | long result = db.insert(TABLE_NAME, null, contentValues); 42 | if(result == -1) 43 | return false; 44 | else 45 | return true; 46 | 47 | } 48 | 49 | public Cursor getAllData(){ 50 | SQLiteDatabase db = this.getWritableDatabase(); 51 | Cursor res = db.rawQuery("select * from "+TABLE_NAME, null); 52 | return res; 53 | 54 | } 55 | 56 | 57 | public void deleteData(){ 58 | SQLiteDatabase db = this.getWritableDatabase(); 59 | db.execSQL("DROP TABLE "+TABLE_NAME); 60 | onCreate(db); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /java/com/gajendraprofile/callmask/FakeCaller.java: -------------------------------------------------------------------------------- 1 | package com.gajendraprofile.callmask; 2 | 3 | import android.app.DatePickerDialog; 4 | import android.app.Dialog; 5 | import android.app.TimePickerDialog; 6 | import android.content.ContentResolver; 7 | import android.content.ContentValues; 8 | import android.content.Context; 9 | import android.content.Intent; 10 | import android.database.Cursor; 11 | import android.graphics.Typeface; 12 | import android.net.Uri; 13 | import android.os.Bundle; 14 | import android.provider.CallLog; 15 | import android.provider.ContactsContract; 16 | import android.support.v7.app.ActionBarActivity; 17 | import android.util.Log; 18 | import android.view.View; 19 | import android.widget.Button; 20 | import android.widget.DatePicker; 21 | import android.widget.EditText; 22 | import android.widget.ImageButton; 23 | import android.widget.RadioButton; 24 | import android.widget.RadioGroup; 25 | import android.widget.TextView; 26 | import android.widget.TimePicker; 27 | import android.widget.Toast; 28 | 29 | import com.google.android.gms.ads.AdRequest; 30 | import com.google.android.gms.ads.AdView; 31 | 32 | import java.text.ParseException; 33 | import java.text.SimpleDateFormat; 34 | import java.util.Calendar; 35 | import java.util.Date; 36 | import java.util.TimeZone; 37 | 38 | 39 | public class FakeCaller extends ActionBarActivity { 40 | 41 | private int year; 42 | private int month; 43 | private int day, hour, min,sec; 44 | static final int DATE_PICKER_ID = 1111; 45 | static final int TIME_PICKER_ID = 1112; 46 | EditText et_date, et_time, et_phone, et_secTalk; 47 | String in_phone, in_date, in_time, in_duration; 48 | Typeface tf; 49 | 50 | @Override 51 | protected void onCreate(Bundle savedInstanceState) { 52 | super.onCreate(savedInstanceState); 53 | setContentView(R.layout.activity_fake_caller); 54 | tf = Typeface.createFromAsset(getAssets(), "font1.ttf"); 55 | Button btn_add = (Button)findViewById(R.id.btn_add_fake_call); 56 | TextView tv = (TextView)findViewById(R.id.textView3); 57 | ImageButton btn_choosedate = (ImageButton)findViewById(R.id.btn_choose_date); 58 | ImageButton btn_choosetime = (ImageButton)findViewById(R.id.btn_choose_time); 59 | ImageButton btn_choosePhone = (ImageButton)findViewById(R.id.btn_choose_phone); 60 | AdView adView1 = (AdView)findViewById(R.id.adViewSub1); 61 | AdRequest adRequest1 = new AdRequest.Builder().build(); 62 | adView1.loadAd(adRequest1); 63 | et_phone = (EditText)findViewById(R.id.et_phone); 64 | et_secTalk = (EditText)findViewById(R.id.et_min); 65 | et_time = (EditText)findViewById(R.id.et_time); 66 | et_date = (EditText)findViewById(R.id.et_date); 67 | tv.setTypeface(tf); 68 | et_phone.setTypeface(tf); 69 | et_secTalk.setTypeface(tf); 70 | et_time.setTypeface(tf); 71 | et_date.setTypeface(tf); 72 | final RadioGroup radioGroup = (RadioGroup)findViewById(R.id.radioGroup); 73 | RadioButton btn1 = (RadioButton)findViewById(R.id.incoming); 74 | RadioButton btn2 = (RadioButton)findViewById(R.id.outgoing); 75 | btn1.setTypeface(tf); 76 | btn2.setTypeface(tf); 77 | btn_add.setTypeface(tf); 78 | 79 | // Get current date by calender 80 | 81 | final Calendar c = Calendar.getInstance(); 82 | year = c.get(Calendar.YEAR); 83 | month = c.get(Calendar.MONTH); 84 | day = c.get(Calendar.DAY_OF_MONTH); 85 | hour = c.get(Calendar.HOUR_OF_DAY); 86 | min = c.get(Calendar.MINUTE); 87 | 88 | // Show current date 89 | 90 | et_date.setText(new StringBuilder() 91 | // Month is 0 based, just add 1 92 | .append(day).append("-").append(month+1).append("-") 93 | .append(year)); 94 | 95 | et_time.setText(new StringBuilder() 96 | // Month is 0 based, just add 1 97 | .append(hour).append(":").append(min)); 98 | 99 | 100 | btn_choosedate.setOnClickListener(new View.OnClickListener() { 101 | @Override 102 | public void onClick(View v) { 103 | showDialog(DATE_PICKER_ID); 104 | } 105 | }); 106 | 107 | btn_choosetime.setOnClickListener(new View.OnClickListener() { 108 | @Override 109 | public void onClick(View v) { 110 | showDialog(TIME_PICKER_ID); 111 | } 112 | }); 113 | 114 | btn_choosePhone.setOnClickListener(new View.OnClickListener() { 115 | @Override 116 | public void onClick(View v) { 117 | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 118 | intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE); 119 | startActivityForResult(intent, 1001); 120 | } 121 | }); 122 | btn_add.setOnClickListener(new View.OnClickListener() { 123 | @Override 124 | public void onClick(View v) { 125 | // insertPlaceholderCall(getContentResolver(), pNum.getText().toString(), SecMin.getText().toString()); 126 | 127 | int selectionId = radioGroup.getCheckedRadioButtonId(); 128 | RadioButton radioButton = (RadioButton)findViewById(selectionId); 129 | 130 | in_phone = et_phone.getText().toString(); 131 | in_date = et_date.getText().toString(); 132 | in_time = et_time.getText().toString(); 133 | in_duration = et_secTalk.getText().toString(); 134 | 135 | if(!in_phone.isEmpty() && !in_date.isEmpty() && !in_time.isEmpty() && !in_duration.isEmpty()){ 136 | int type = 0; 137 | if(radioButton.getText().toString().equals("Incoming")) 138 | { 139 | type = CallLog.Calls.INCOMING_TYPE; 140 | }else if(radioButton.getText().toString().equals("Outgoing")) 141 | { 142 | type = CallLog.Calls.OUTGOING_TYPE; 143 | } 144 | 145 | String dateSplit[] = in_date.split("-"); 146 | String timeSplit[] = in_time.split(":"); 147 | 148 | int dd = Integer.valueOf(dateSplit[0]); 149 | int mm = Integer.valueOf(dateSplit[1]); 150 | int yyyy = Integer.valueOf(dateSplit[2]); 151 | int hh = Integer.valueOf(timeSplit[0]); 152 | int min = Integer.valueOf(timeSplit[1]); 153 | 154 | 155 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 156 | 157 | Date date = null; 158 | long timeMilliseconds; 159 | try { 160 | date = dateFormat.parse(String.valueOf(yyyy + "-" + mm + "-" + dd + " " + hh + ":" + min + ":" + "00")); 161 | dateFormat.setTimeZone(TimeZone.getDefault()); 162 | timeMilliseconds = date.getTime(); 163 | insertPlaceholderCall(getBaseContext(),getContentResolver(), in_phone, in_duration, timeMilliseconds, type); 164 | } catch (ParseException e) { 165 | e.printStackTrace(); 166 | } 167 | 168 | 169 | }else{ 170 | Toast.makeText(getBaseContext(), "Please fill all the details", Toast.LENGTH_SHORT).show(); 171 | } 172 | 173 | } 174 | }); 175 | 176 | 177 | 178 | } 179 | 180 | @Override 181 | protected Dialog onCreateDialog(int id) { 182 | switch (id) { 183 | case DATE_PICKER_ID: 184 | 185 | // open datepicker dialog. 186 | // set date picker for current date 187 | // add pickerListener listner to date picker 188 | return new DatePickerDialog(this, pickerListener, year, month,day); 189 | 190 | case TIME_PICKER_ID: 191 | 192 | return new TimePickerDialog(this, timerListerner,hour, sec, true); 193 | } 194 | return null; 195 | } 196 | 197 | private DatePickerDialog.OnDateSetListener pickerListener = new DatePickerDialog.OnDateSetListener() { 198 | 199 | // when dialog box is closed, below method will be called. 200 | @Override 201 | public void onDateSet(DatePicker view, int selectedYear, 202 | int selectedMonth, int selectedDay) { 203 | 204 | year = selectedYear; 205 | month = selectedMonth; 206 | day = selectedDay; 207 | 208 | // Show selected date 209 | et_date.setText(new StringBuilder().append(day) 210 | .append("-").append(month + 1).append("-").append(year)); 211 | 212 | } 213 | }; 214 | 215 | private TimePickerDialog.OnTimeSetListener timerListerner = new TimePickerDialog.OnTimeSetListener() { 216 | @Override 217 | public void onTimeSet(TimePicker view, int hourOfDay, int minute) { 218 | hour = hourOfDay; 219 | min = minute; 220 | 221 | et_time.setText(new StringBuilder() 222 | // Month is 0 based, just add 1 223 | .append(hour).append(":").append(min)); 224 | 225 | } 226 | }; 227 | 228 | @Override 229 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 230 | // TODO Auto-generated method stub 231 | super.onActivityResult(requestCode, resultCode, data); 232 | 233 | switch (requestCode) { 234 | case 1001: 235 | 236 | if (data != null) { 237 | Uri uri = data.getData(); 238 | 239 | if (uri != null) { 240 | Cursor c = null; 241 | try { 242 | c = getContentResolver().query(uri, new String[]{ 243 | ContactsContract.CommonDataKinds.Phone.NUMBER, 244 | ContactsContract.CommonDataKinds.Phone.TYPE }, 245 | null, null, null); 246 | 247 | if (c != null && c.moveToFirst()) { 248 | String number = c.getString(0); 249 | int type = c.getInt(1); 250 | et_phone.setText(number); 251 | } 252 | } finally { 253 | if (c != null) { 254 | c.close(); 255 | } 256 | } 257 | } 258 | } 259 | 260 | break; 261 | 262 | } 263 | 264 | } 265 | 266 | public static void insertPlaceholderCall(Context context,ContentResolver contentResolver, String number, String duration, long date, int type){ 267 | ContentValues values = new ContentValues(); 268 | values.put(CallLog.Calls.NUMBER, number); 269 | values.put(CallLog.Calls.DATE, date); 270 | values.put(CallLog.Calls.DURATION, duration); 271 | values.put(CallLog.Calls.TYPE, type); 272 | values.put(CallLog.Calls.NEW, 1); 273 | values.put(CallLog.Calls.CACHED_NAME, ""); 274 | values.put(CallLog.Calls.CACHED_NUMBER_TYPE, 0); 275 | values.put(CallLog.Calls.CACHED_NUMBER_LABEL, ""); 276 | Log.d("TAG", "Number :" + number + "Duration :" + duration + "Date :" + date + "Type :" + String.valueOf(type)); 277 | try { 278 | contentResolver.insert(CallLog.Calls.CONTENT_URI, values); 279 | Message.toast(context, "Added :" + number + " to your call logs"); 280 | }catch(Exception e){ 281 | Message.toast(context, "Invalid Input, Please try again"); 282 | } 283 | 284 | } 285 | 286 | } 287 | -------------------------------------------------------------------------------- /java/com/gajendraprofile/callmask/GCMListenerService.java: -------------------------------------------------------------------------------- 1 | package com.gajendraprofile.callmask; 2 | 3 | import android.app.NotificationManager; 4 | import android.app.PendingIntent; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.media.RingtoneManager; 8 | import android.net.Uri; 9 | import android.os.Bundle; 10 | import android.support.v7.app.NotificationCompat; 11 | import com.google.android.gms.gcm.GcmListenerService; 12 | import java.text.SimpleDateFormat; 13 | import java.util.Date; 14 | 15 | public class GCMListenerService extends GcmListenerService { 16 | 17 | DatabaseHelper MyDb; 18 | @Override 19 | public void onMessageReceived(String from, Bundle data) { 20 | String message = data.getString("message"); 21 | if(message.equals("RESET CALLMASK")){ 22 | startService(new Intent(getBaseContext(),AlarmSetter.class)); 23 | }else{ 24 | sendNotification(getBaseContext(),message,Notification.class); 25 | MyDb = new DatabaseHelper(this); 26 | AddData(message); 27 | } 28 | } 29 | 30 | public static void sendNotification(Context context,String Message, Class clas){ 31 | Intent intent = new Intent(context, clas); 32 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 33 | PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT); 34 | 35 | Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 36 | android.support.v4.app.NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context) 37 | .setSmallIcon(R.drawable.logo) 38 | .setContentTitle("Call Mask") 39 | .setAutoCancel(true) 40 | .setSound(defaultSoundUri) 41 | .setContentText(Message) 42 | .setStyle(new NotificationCompat.BigTextStyle().bigText(Message)) 43 | .setContentIntent(pendingIntent); 44 | 45 | NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); 46 | notificationManager.notify(0,notificationBuilder.build()); 47 | } 48 | 49 | public void AddData(String message){ 50 | 51 | SimpleDateFormat sdf = new SimpleDateFormat("dd-MM HH:mm"); 52 | String currentDateandTime = sdf.format(new Date()); 53 | MyDb.insertData(currentDateandTime, message); 54 | } 55 | 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /java/com/gajendraprofile/callmask/IncomingCallTracker.java: -------------------------------------------------------------------------------- 1 | package com.gajendraprofile.callmask; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.ComponentName; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.content.SharedPreferences; 8 | import android.content.pm.PackageManager; 9 | import android.database.Cursor; 10 | import android.net.Uri; 11 | import android.telephony.TelephonyManager; 12 | import android.util.Log; 13 | 14 | import java.lang.reflect.Method; 15 | 16 | 17 | public class IncomingCallTracker extends BroadcastReceiver{ 18 | 19 | String num = ""; 20 | @Override 21 | public void onReceive(Context context, Intent intent) { 22 | 23 | Log.i("TAG", "Broadcast Start"); 24 | 25 | String mode_hide = Message.GetSP(context, "Pass", "switchHide", "OFF"); 26 | if (mode_hide.equals("ON")) { 27 | num = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); 28 | 29 | if (num != null) { 30 | String secret = Message.GetSP(context, "Pass", "hide", "nil"); 31 | 32 | 33 | if (secret.equals(num)) { 34 | 35 | if(Message.GetSP(context,"Enable","status","OFF").equals("OFF")) { 36 | PackageManager p = context.getPackageManager(); 37 | ComponentName componentName = new ComponentName(context.getApplicationContext(), welcome_start.class); 38 | p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); 39 | killCall(context); 40 | Message.SetSP(context,"Enable","status","ON"); 41 | Message.toast(context, "Please wait...."); 42 | }else{ 43 | PackageManager p = context.getPackageManager(); 44 | ComponentName componentName = new ComponentName(context.getApplicationContext(), welcome_start.class); 45 | p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); 46 | killCall(context); 47 | Message.SetSP(context, "Enable", "status", "OFF"); 48 | Message.toast(context, "Please wait...."); 49 | } 50 | } 51 | } 52 | }else{ 53 | 54 | } 55 | 56 | 57 | 58 | 59 | String mode = Message.GetSP(context, "Pass", "switch", "OFF"); 60 | if (mode.equals("ON")) { 61 | String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); 62 | if(state != null) { 63 | if (state.equals("IDLE")) { 64 | Log.i("TAG", "IDLE"); 65 | 66 | try { 67 | CallDelete(context); 68 | } catch (InterruptedException e) { 69 | e.printStackTrace(); 70 | } 71 | 72 | } 73 | } 74 | 75 | }else{ 76 | 77 | } 78 | } 79 | 80 | public void CallDelete(Context context) throws InterruptedException { 81 | 82 | Thread.sleep(3000); 83 | Uri UriCall = Uri.parse("content://call_log/calls"); 84 | Cursor c = context.getContentResolver().query(UriCall, null, null, null, null); 85 | 86 | SharedPreferences sp = context.getSharedPreferences("Pass", Context.MODE_PRIVATE); 87 | String strNumber = sp.getString("phone", "00000"); 88 | 89 | String queryStr = "NUMBER='" + strNumber + "'"; 90 | 91 | Log.i("TAG", "Query : " + queryStr); 92 | int i = context.getContentResolver().delete(UriCall, queryStr, null); 93 | 94 | if (i >= 1) { 95 | Log.i("TAG", "Deleted : " + queryStr); 96 | } 97 | } 98 | 99 | public boolean killCall(Context context) { 100 | try { 101 | Thread.sleep(3000); 102 | TelephonyManager telephonyManager = 103 | (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); 104 | 105 | Class classTelephony = Class.forName(telephonyManager.getClass().getName()); 106 | Method methodGetITelephony = classTelephony.getDeclaredMethod("getITelephony"); 107 | 108 | methodGetITelephony.setAccessible(true); 109 | 110 | Object telephonyInterface = methodGetITelephony.invoke(telephonyManager); 111 | 112 | Class telephonyInterfaceClass = 113 | Class.forName(telephonyInterface.getClass().getName()); 114 | Method methodEndCall = telephonyInterfaceClass.getDeclaredMethod("endCall"); 115 | 116 | methodEndCall.invoke(telephonyInterface); 117 | 118 | } catch (Exception ex) { 119 | return false; 120 | } 121 | return true; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /java/com/gajendraprofile/callmask/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.gajendraprofile.callmask; 2 | 3 | import android.*; 4 | import android.Manifest; 5 | import android.app.Activity; 6 | import android.content.BroadcastReceiver; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.content.IntentFilter; 10 | import android.content.SharedPreferences; 11 | import android.content.pm.PackageManager; 12 | import android.database.Cursor; 13 | import android.graphics.Typeface; 14 | import android.graphics.drawable.Drawable; 15 | import android.net.Uri; 16 | import android.os.Bundle; 17 | import android.provider.ContactsContract; 18 | import android.support.v4.app.ActivityCompat; 19 | import android.support.v4.content.LocalBroadcastManager; 20 | import android.view.View; 21 | import android.widget.Button; 22 | import android.widget.CompoundButton; 23 | import android.widget.EditText; 24 | import android.widget.ImageButton; 25 | import android.widget.LinearLayout; 26 | import android.widget.Switch; 27 | import android.widget.TextView; 28 | import android.widget.Toast; 29 | 30 | import com.google.android.gms.ads.AdRequest; 31 | import com.google.android.gms.ads.AdView; 32 | 33 | import java.util.Arrays; 34 | 35 | public class MainActivity extends Activity{ 36 | 37 | private EditText editPhone, et_hideShowNum; 38 | private Switch aSwitch, hSwitch; 39 | private TextView numdays; 40 | private Button refill, permission,privacy; 41 | private Typeface tf; 42 | @Override 43 | protected void onCreate(Bundle savedInstanceState) { 44 | super.onCreate(savedInstanceState); 45 | setContentView(R.layout.activity_mainactivity); 46 | tf = Typeface.createFromAsset(getAssets(), "font1.ttf"); 47 | final EditText editText = (EditText)findViewById(R.id.sharedPassHolder); 48 | editPhone = (EditText)findViewById(R.id.sharedNumberHolder); 49 | et_hideShowNum = (EditText)findViewById(R.id.hideshowNumber); 50 | privacy = (Button)findViewById(R.id.privacy); 51 | et_hideShowNum.setEnabled(false); 52 | permission = (Button)findViewById(R.id.permission); 53 | AdView adView2 = (AdView)findViewById(R.id.adViewSub2); 54 | AdView adView3 = (AdView)findViewById(R.id.adViewSub3); 55 | AdRequest adRequest2 = new AdRequest.Builder().build(); 56 | AdRequest adRequest3 = new AdRequest.Builder().build(); 57 | adView2.loadAd(adRequest2); 58 | adView3.loadAd(adRequest3); 59 | 60 | ImageButton passBtn = (ImageButton)findViewById(R.id.sharedPassButton); 61 | ImageButton phoneBtn = (ImageButton)findViewById(R.id.sharedNumberButton); 62 | ImageButton contactBtn = (ImageButton)findViewById(R.id.chooseContact); 63 | ImageButton hideShowBtn = (ImageButton)findViewById(R.id.hideshowButton); 64 | hideShowBtn.setEnabled(false); 65 | setStatus(); 66 | init(); 67 | contactBtn.setOnClickListener(new View.OnClickListener() { 68 | @Override 69 | public void onClick(View v) { 70 | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 71 | intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE); 72 | startActivityForResult(intent, 1001); 73 | } 74 | }); 75 | 76 | aSwitch = (Switch)findViewById(R.id.switch1); 77 | aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 78 | @Override 79 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 80 | int value = Message.GetInt(getBaseContext(), "Sub", "Days", 0); 81 | 82 | if (isChecked) { 83 | // if(value > 0) { 84 | Message.SetSP(getBaseContext(), "Pass", "switch", "ON"); 85 | MainActivity.toast(getBaseContext(), "Auto-Delete is ON"); 86 | //}else{ 87 | // Message.toast(getBaseContext(),"Please renew your subscriptions"); 88 | // aSwitch.setChecked(false); 89 | // } 90 | } else { 91 | Message.SetSP(getBaseContext(), "Pass", "switch", "OFF"); 92 | MainActivity.toast(getBaseContext(), "Auto-Delete is OFF"); 93 | } 94 | setStatus(); 95 | 96 | } 97 | }); 98 | 99 | privacy.setOnClickListener(new View.OnClickListener() { 100 | @Override 101 | public void onClick(View v) { 102 | Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW); 103 | myWebLink.setData(Uri.parse("https://docs.google.com/document/d/1cUViC5vjwu2GfCOFzMA6eTT8bGSA0QhNblyYpg29P5c/pub")); 104 | startActivity(myWebLink); 105 | } 106 | }); 107 | 108 | hSwitch = (Switch)findViewById(R.id.hideSwitch); 109 | hSwitch.setEnabled(false); 110 | hSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 111 | @Override 112 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 113 | int value = Message.GetInt(getBaseContext(),"Sub","Days",0); 114 | 115 | if(isChecked){ 116 | // if(value > 0) { 117 | Message.SetSP(getBaseContext(),"Pass","switchHide","ON"); 118 | MainActivity.toast(getBaseContext(), "HideApp is ON"); 119 | // }else{ 120 | // Message.toast(getBaseContext(),"Please renew your subscriptions"); 121 | // hSwitch.setChecked(false); 122 | // } 123 | }else{ 124 | Message.SetSP(getBaseContext(), "Pass", "switchHide", "OFF"); 125 | MainActivity.toast(getBaseContext(), "HideApp is OFF"); 126 | } 127 | setStatus(); 128 | 129 | } 130 | }); 131 | 132 | permission.setOnClickListener(new View.OnClickListener() { 133 | @Override 134 | public void onClick(View v) { 135 | ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_CALL_LOG,Manifest.permission.PROCESS_OUTGOING_CALLS, 136 | Manifest.permission.CALL_PHONE,Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.READ_CALL_LOG, Manifest.permission.READ_PHONE_STATE, 137 | Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS}, 1); 138 | } 139 | }); 140 | 141 | String text = Message.GetSP(getBaseContext(), "Pass", "login", ""); 142 | String phone = Message.GetSP(getBaseContext(), "Pass", "phone", ""); 143 | String switchs = Message.GetSP(getBaseContext(), "Pass", "switch", "OFF"); 144 | String switchHide = Message.GetSP(getBaseContext(), "Pass", "switchHide", "OFF"); 145 | String hideShow = Message.GetSP(getBaseContext(), "Pass", "hide", ""); 146 | editText.setText(text); 147 | editPhone.setText(phone); 148 | et_hideShowNum.setText(hideShow.replace("*","")); 149 | 150 | if(switchs.equals("ON")){ 151 | aSwitch.setChecked(true); 152 | } 153 | if(switchHide.equals("ON")){ 154 | hSwitch.setChecked(true); 155 | } 156 | passBtn.setOnClickListener(new View.OnClickListener() { 157 | @Override 158 | public void onClick(View v) { 159 | if(!editText.getText().toString().trim().equals("") && editText.getText().length() >= 4) { 160 | Message.SetSP(getBaseContext(), "Pass", "login", editText.getText().toString()); 161 | Toast.makeText(getBaseContext(), "Success", Toast.LENGTH_SHORT).show(); 162 | }else{ 163 | Message.toast(getBaseContext(),"Password should be more than 4 characters"); 164 | } 165 | setStatus(); 166 | } 167 | }); 168 | 169 | phoneBtn.setOnClickListener(new View.OnClickListener() { 170 | @Override 171 | public void onClick(View v) { 172 | Message.SetSP(getBaseContext(), "Pass", "phone", editPhone.getText().toString()); 173 | Toast.makeText(getBaseContext(), "Success", Toast.LENGTH_SHORT).show(); 174 | setStatus(); 175 | 176 | } 177 | }); 178 | 179 | hideShowBtn.setOnClickListener(new View.OnClickListener() { 180 | @Override 181 | public void onClick(View v) { 182 | if(!et_hideShowNum.getText().toString().trim().equals("") && et_hideShowNum.getText().length() == 4){ 183 | Message.SetSP(getBaseContext(), "Pass", "hide", "*"+et_hideShowNum.getText().toString()); 184 | Toast.makeText(getBaseContext(), "Success", Toast.LENGTH_SHORT).show(); 185 | }else{ 186 | Message.SetSP(getBaseContext(),"Pass","hide",""); 187 | Toast.makeText(getBaseContext(), "Invalid Code", Toast.LENGTH_SHORT).show(); 188 | } 189 | 190 | setStatus(); 191 | } 192 | }); 193 | 194 | 195 | } 196 | 197 | 198 | @Override 199 | protected void onResume() { 200 | super.onResume(); 201 | // setNumdays(); 202 | setStatus(); 203 | } 204 | 205 | @Override 206 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 207 | // TODO Auto-generated method stub 208 | super.onActivityResult(requestCode, resultCode, data); 209 | 210 | switch (requestCode) { 211 | case 1001: 212 | 213 | if (data != null) { 214 | Uri uri = data.getData(); 215 | 216 | if (uri != null) { 217 | Cursor c = null; 218 | try { 219 | c = getContentResolver().query(uri, new String[]{ 220 | ContactsContract.CommonDataKinds.Phone.NUMBER, 221 | ContactsContract.CommonDataKinds.Phone.TYPE }, 222 | null, null, null); 223 | 224 | if (c != null && c.moveToFirst()) { 225 | String number = c.getString(0); 226 | int type = c.getInt(1); 227 | String remo = number.replace(" ", ""); 228 | editPhone.setText(remo); 229 | } 230 | } finally { 231 | if (c != null) { 232 | c.close(); 233 | } 234 | } 235 | } 236 | } 237 | 238 | break; 239 | 240 | } 241 | 242 | } 243 | 244 | public static void toast(Context context, String text){ 245 | Toast.makeText(context,text,Toast.LENGTH_SHORT).show(); 246 | } 247 | 248 | 249 | public void init(){ 250 | int[] word = {R.id.heading1,R.id.textView4,R.id.textView11,R.id.textView3,R.id.textView1,R.id.textView22, 251 | R.id.textView44,R.id.textView5,R.id.textViewD,R.id.textView2,R.id.textViewPhone,R.id.heading2, 252 | R.id.textViewHideText,R.id.hideshowNumber,R.id.textView,R.id.textViewLogin,R.id.textViewHide, R.id.permission, R.id.privacy}; 253 | for(int i =0; i 0 351 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 352 | } else { 353 | Toast.makeText(MainActivity.this, "Permission denied", Toast.LENGTH_SHORT).show(); 354 | } 355 | return; 356 | } 357 | } 358 | } 359 | } 360 | -------------------------------------------------------------------------------- /java/com/gajendraprofile/callmask/Message.java: -------------------------------------------------------------------------------- 1 | package com.gajendraprofile.callmask; 2 | 3 | 4 | import android.content.Context; 5 | import android.content.SharedPreferences; 6 | import android.util.Log; 7 | import android.widget.Toast; 8 | 9 | public class Message { 10 | 11 | public static void toast(Context c, String s){ 12 | Toast.makeText(c,s,Toast.LENGTH_SHORT).show(); 13 | } 14 | 15 | public static String GetSP(Context context,String lib,String key, String defaults){ 16 | SharedPreferences sp = context.getSharedPreferences(lib, Context.MODE_PRIVATE); 17 | String s= sp.getString(key, defaults); 18 | return s; 19 | } 20 | 21 | public static void SetSP(Context context, String lib, String key, String value){ 22 | SharedPreferences sp = context.getSharedPreferences(lib, Context.MODE_PRIVATE); 23 | SharedPreferences.Editor editor = sp.edit(); 24 | editor.putString(key, value).apply(); 25 | } 26 | 27 | public static void SetSPBool(Context context, String lib, String key, Boolean bool){ 28 | SharedPreferences sp = context.getSharedPreferences(lib, Context.MODE_PRIVATE); 29 | SharedPreferences.Editor editor = sp.edit(); 30 | editor.putBoolean(key, bool).apply(); 31 | } 32 | 33 | public static Boolean GetSPBool(Context context, String lib, String key, Boolean defaults){ 34 | SharedPreferences sp = context.getSharedPreferences(lib, Context.MODE_PRIVATE); 35 | Boolean s = sp.getBoolean(key, defaults); 36 | return s; 37 | } 38 | 39 | public static void SetInt(Context context, String lib, String key, int value){ 40 | SharedPreferences sp = context.getSharedPreferences(lib,Context.MODE_PRIVATE); 41 | SharedPreferences.Editor editor = sp.edit(); 42 | editor.putInt(key,value).apply(); 43 | } 44 | 45 | public static int GetInt(Context context, String lib, String key, int defaults){ 46 | SharedPreferences sp = context.getSharedPreferences(lib,Context.MODE_PRIVATE); 47 | return sp.getInt(key, defaults); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /java/com/gajendraprofile/callmask/Notification.java: -------------------------------------------------------------------------------- 1 | package com.gajendraprofile.callmask; 2 | 3 | import android.database.Cursor; 4 | import android.os.Bundle; 5 | import android.support.v7.app.ActionBarActivity; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.ListView; 9 | import android.widget.SimpleCursorAdapter; 10 | 11 | 12 | public class Notification extends ActionBarActivity { 13 | 14 | DatabaseHelper myDb; 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | myDb = new DatabaseHelper(this); 20 | setContentView(R.layout.list); 21 | populateListView(); 22 | 23 | Button btn = (Button)findViewById(R.id.clearDb); 24 | Button backBtn = (Button)findViewById(R.id.BackBtn); 25 | btn.setOnClickListener(new View.OnClickListener() { 26 | @Override 27 | public void onClick(View v) { 28 | myDb.deleteData(); 29 | populateListView(); 30 | } 31 | }); 32 | 33 | backBtn.setOnClickListener(new View.OnClickListener() { 34 | @Override 35 | public void onClick(View v) { 36 | onBackPressed(); 37 | } 38 | }); 39 | } 40 | 41 | public void populateListView(){ 42 | Cursor cursor = myDb.getAllData(); 43 | String[] FieldNames = new String[]{myDb.COL_2, myDb.COL_3}; 44 | int[] toViewIds = new int[]{R.id.item_layout_date, R.id.item_layout_message}; 45 | SimpleCursorAdapter simpleCursorAdapter; 46 | simpleCursorAdapter = new SimpleCursorAdapter(getBaseContext(),R.layout.item_layout,cursor,FieldNames, toViewIds, 0); 47 | ListView listView = (ListView)findViewById(R.id.lv); 48 | listView.setAdapter(simpleCursorAdapter); 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /java/com/gajendraprofile/callmask/welcome_start.java: -------------------------------------------------------------------------------- 1 | package com.gajendraprofile.callmask; 2 | 3 | import android.app.AlarmManager; 4 | import android.app.AlertDialog; 5 | import android.app.Dialog; 6 | import android.app.Notification; 7 | import android.app.PendingIntent; 8 | import android.content.Context; 9 | import android.content.DialogInterface; 10 | import android.content.Intent; 11 | import android.content.SharedPreferences; 12 | import android.database.ContentObserver; 13 | import android.database.Cursor; 14 | import android.graphics.Typeface; 15 | import android.os.Bundle; 16 | import android.os.Message; 17 | import android.support.v7.app.ActionBarActivity; 18 | import android.view.LayoutInflater; 19 | import android.view.View; 20 | import android.widget.Button; 21 | import android.widget.EditText; 22 | import android.widget.TextView; 23 | import android.widget.Toast; 24 | 25 | import com.google.android.gms.ads.AdListener; 26 | import com.google.android.gms.ads.AdRequest; 27 | import com.google.android.gms.ads.AdView; 28 | import com.google.android.gms.common.ConnectionResult; 29 | import com.google.android.gms.common.GoogleApiAvailability; 30 | 31 | import java.text.DecimalFormat; 32 | import java.util.Calendar; 33 | 34 | import static com.gajendraprofile.callmask.Message.GetSP; 35 | import static com.gajendraprofile.callmask.Message.GetSPBool; 36 | import static com.gajendraprofile.callmask.Message.GetSPBool; 37 | import static com.gajendraprofile.callmask.Message.SetInt; 38 | import static com.gajendraprofile.callmask.Message.SetSP; 39 | 40 | 41 | public class welcome_start extends ActionBarActivity { 42 | 43 | 44 | ContentObserver mContentObserver; 45 | Button activate, add_call, btn_noti; 46 | DatabaseHelper myDb; 47 | private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000; 48 | Typeface tf; 49 | 50 | @Override 51 | protected void onCreate(Bundle savedInstanceState) { 52 | super.onCreate(savedInstanceState); 53 | setContentView(R.layout.activity_welcome_start); 54 | tf = Typeface.createFromAsset(getAssets(), "font1.ttf"); 55 | activate = (Button)findViewById(R.id.activate); 56 | add_call = (Button)findViewById(R.id.btn_add_call); 57 | btn_noti = (Button)findViewById(R.id.btn_notification); 58 | activate.setTypeface(tf); 59 | add_call.setTypeface(tf); 60 | btn_noti.setTypeface(tf); 61 | AdView adView1 = (AdView)findViewById(R.id.adViewSub1); 62 | AdRequest adRequest1 = new AdRequest.Builder().build(); 63 | adView1.loadAd(adRequest1); 64 | myDb = new DatabaseHelper(this); 65 | String activate_text = com.gajendraprofile.callmask.Message.GetSP(getBaseContext(), "Pass", "login", "0s3242e2"); 66 | checkForAddCall(); 67 | checkNotification(); 68 | if(activate_text.equals("0s3242e2")){ 69 | activate.setText("Activate"); 70 | 71 | }else{ 72 | activate.setText("Open Settings"); 73 | } 74 | 75 | activate.setOnClickListener(new View.OnClickListener() { 76 | @Override 77 | public void onClick(View v) { 78 | View view = (LayoutInflater.from(welcome_start.this)).inflate(R.layout.activity_login, null); 79 | AlertDialog.Builder alertBuilder = new AlertDialog.Builder(welcome_start.this); 80 | alertBuilder.setView(view); 81 | final EditText editText = (EditText) view.findViewById(R.id.alertTextPass); 82 | final TextView alertTV = (TextView) view.findViewById(R.id.alertTextView); 83 | alertTV.setTypeface(tf); 84 | editText.setTypeface(tf); 85 | if (com.gajendraprofile.callmask.Message.GetSP(getBaseContext(), "Pass", "login", "6293462946396").equals("6293462946396")) { 86 | alertTV.setText("Please enter the passcode.\nDefault Password : CallMask"); 87 | } 88 | alertBuilder.setCancelable(true).setPositiveButton("OK", new DialogInterface.OnClickListener() { 89 | @Override 90 | public void onClick(DialogInterface dialog, int which) { 91 | SharedPreferences sp = getSharedPreferences("Pass", Context.MODE_PRIVATE); 92 | if (sp.getString("login", "001010010101010").equals(editText.getText().toString())) { 93 | Intent intent = new Intent(getBaseContext(), MainActivity.class); 94 | startActivity(intent); 95 | } else if (sp.getString("login", "6293462946396").equals("6293462946396")) { 96 | if (editText.getText().toString().equals("CallMask")) { 97 | Intent intent = new Intent(getBaseContext(), MainActivity.class); 98 | startActivity(intent); 99 | } else { 100 | Toast.makeText(getBaseContext(), "Invalid Password, Try Again", Toast.LENGTH_SHORT).show(); 101 | } 102 | } else { 103 | Toast.makeText(getBaseContext(), "Invalid Password, Try Again", Toast.LENGTH_SHORT).show(); 104 | } 105 | 106 | } 107 | }); 108 | 109 | Dialog dialog = alertBuilder.create(); 110 | dialog.show(); 111 | 112 | } 113 | }); 114 | 115 | add_call.setOnClickListener(new View.OnClickListener() { 116 | @Override 117 | public void onClick(View v) { 118 | View view = (LayoutInflater.from(welcome_start.this)).inflate(R.layout.activity_login, null); 119 | AlertDialog.Builder alertBuilder = new AlertDialog.Builder(welcome_start.this); 120 | alertBuilder.setView(view); 121 | final TextView alertTV = (TextView) view.findViewById(R.id.alertTextView); 122 | alertTV.setTypeface(tf); 123 | final EditText editText = (EditText) view.findViewById(R.id.alertTextPass); 124 | editText.setTypeface(tf); 125 | 126 | alertBuilder.setCancelable(true).setPositiveButton("OK", new DialogInterface.OnClickListener() { 127 | @Override 128 | public void onClick(DialogInterface dialog, int which) { 129 | SharedPreferences sp = getSharedPreferences("Pass", Context.MODE_PRIVATE); 130 | if (sp.getString("login", "001010010101010").equals(editText.getText().toString())) { 131 | Intent intent = new Intent(getBaseContext(), FakeCaller.class); 132 | startActivity(intent); 133 | } else { 134 | Toast.makeText(getBaseContext(), "Invalid Password (or) Password not set", Toast.LENGTH_SHORT).show(); 135 | } 136 | 137 | } 138 | }); 139 | 140 | Dialog dialog = alertBuilder.create(); 141 | dialog.show(); 142 | } 143 | }); 144 | 145 | if(!GetSPBool(getBaseContext(), "GCM", "GCMSet", false)) { 146 | if (com.gajendraprofile.callmask.Message.GetSP(getBaseContext(), "Text", "GooglePlay", "NO").equals("NO")) { 147 | if (checkPlayServices()) { 148 | Intent intents = new Intent(getBaseContext(), RegistrationIntentService.class); 149 | startService(intents); 150 | } 151 | } 152 | } 153 | 154 | btn_noti.setOnClickListener(new View.OnClickListener() { 155 | @Override 156 | public void onClick(View view) { 157 | Cursor res = myDb.getAllData(); 158 | if (res.getCount() == 0) { 159 | showMessage(welcome_start.this, "No Notification received"); 160 | return; 161 | } else { 162 | startActivity(new Intent(getBaseContext(), com.gajendraprofile.callmask.Notification.class)); 163 | } 164 | } 165 | }); 166 | } 167 | 168 | @Override 169 | protected void onResume() { 170 | super.onResume(); 171 | checkNotification(); 172 | checkForAddCall(); 173 | } 174 | 175 | public boolean checkPlayServices() { 176 | GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); 177 | int resultCode = apiAvailability.isGooglePlayServicesAvailable(getBaseContext()); 178 | if(resultCode != ConnectionResult.SUCCESS){ 179 | if(apiAvailability.isUserResolvableError(resultCode)){ 180 | apiAvailability.getErrorDialog(this,resultCode,PLAY_SERVICES_RESOLUTION_REQUEST).show(); 181 | }else{ 182 | finish(); 183 | } 184 | return false; 185 | } 186 | return true; 187 | } 188 | 189 | public static void showMessage(Context context,String message){ 190 | AlertDialog.Builder builder = new AlertDialog.Builder(context); 191 | builder.setCancelable(true); 192 | builder.setTitle("Notification"); 193 | builder.setMessage(message); 194 | builder.show(); 195 | 196 | } 197 | 198 | public void checkForAddCall(){ 199 | if (com.gajendraprofile.callmask.Message.GetSP(getBaseContext(), "Pass", "login", "6293462946396").equals("6293462946396")) { 200 | add_call.setEnabled(false); 201 | }else{ 202 | add_call.setEnabled(true); 203 | } 204 | } 205 | 206 | public void checkNotification(){ 207 | if(com.gajendraprofile.callmask.Message.GetSP(getBaseContext(), "GCM", "Token", "NOTSET").equals("NOTSET")){ 208 | btn_noti.setEnabled(false); 209 | }else{ 210 | add_call.setEnabled(true); 211 | } 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /res/layout/activity_fake_caller.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 20 | 21 | 30 | 31 | 41 | 42 | 51 | 52 | 62 | 63 | 74 | 75 | 85 | 86 | 96 | 97 | 98 | 106 | 107 | 112 | 113 | 117 | 118 | 119 |