Readability & layout
This commit is contained in:
parent
3e162b88ce
commit
c58fd719b3
|
@ -108,7 +108,8 @@ public class WhitelistContactsActivity extends AppCompatActivity {
|
|||
private void contactSelected(String phoneNo){
|
||||
// We'll replace parenthesis, dashes and whitespaces to obtain a valid phone number
|
||||
phoneNo = phoneNo.replaceAll("[-()\\s]", "");
|
||||
if(whitelistDbHandler.isContactPresent(phoneNo)){
|
||||
|
||||
if(contacts.contains(phoneNo)){
|
||||
Toast.makeText(this, "Contact already in the list", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -54,11 +54,10 @@ public class WhitelistDbHandler extends SQLiteOpenHelper {
|
|||
}
|
||||
|
||||
public ArrayList<String> getAllContacts() {
|
||||
ArrayList<String> array_list = new ArrayList<String>();
|
||||
|
||||
//hp = new HashMap();
|
||||
ArrayList<String> array_list = new ArrayList<>();
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
Cursor cursor = db.rawQuery( "select * from " + TABLE_CONTACTS, null );
|
||||
String query = String.format("SELECT %s FROM %s", KEY_PH_NO, TABLE_CONTACTS);
|
||||
Cursor cursor = db.rawQuery( query, null );
|
||||
cursor.moveToFirst();
|
||||
|
||||
int columnIndex = cursor.getColumnIndex(KEY_PH_NO);
|
||||
|
@ -102,5 +101,4 @@ public class WhitelistDbHandler extends SQLiteOpenHelper {
|
|||
cursor.close();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="Add contacts"/>
|
||||
android:text="Whitelist contacts"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue