@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Log.d("DEBUG", "onCreateView"); // view View v = inflater.inflate(R.layout.detail_contact, container, false); // set back icon in toolbar Toolbar tl = MainActivity.getToolbar(); tl.setTitle(contact.getName()); tl.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); tl.setNavigationOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { getActivity().onBackPressed(); } }); // find views and put data on it ImageView icon = (ImageView) v.findViewById(R.id.detail_icon); TextView status = (TextView) v.findViewById(R.id.detail_status); TextView name = (TextView) v.findViewById(R.id.detail_name); status.setText(contact.getStatus()); icon.setImageResource(contact.getIcon()); name.setText(contact.getName()); return v; }
public void saveClicked(View currView) { Contact currentContact = new Contact(); this.getUpdatedContactInfo(currentContact); if (null != currentContact.getName() && !currentContact.getName().trim().isEmpty()) { List<Contact> contactList = ContactRepository.getContacts(getApplicationContext()); contactList.add(currentContact); ContactRepository.saveContacts(getApplicationContext()); getIntent().putExtra("contact", currentContact); setResult(RESULT_OK, getIntent()); finish(); } else { Toast.makeText(this, "Please enter a name to create a contact", Toast.LENGTH_SHORT).show(); } }
private ArrayList<String> getContactNames(ArrayList<Contact> friends) { ArrayList<String> friendNames = new ArrayList<String>(); for (Contact c : friends) { friendNames.add(c.getName()); } return friendNames; }
private void setContact() { Contact contact = new Contact(id); firstName = contact.getName(); surname = contact.getSurname(); designation = contact.getDesignation(); phone = new Phone(contact.getId()).getNumber(); }
public String formatNames(String separator) { String[] names = new String[size()]; int i = 0; for (Contact c : this) { names[i++] = c.getName(); } return TextUtils.join(separator, names); }
// Updating single contact public int updateContact(Contact contact) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, contact.getName()); values.put(KEY_PH_NO, contact.getPhoneNumber()); // updating row return db.update( TABLE_CONTACTS, values, KEY_ID + " = ?", new String[] {String.valueOf(contact.getID())}); }
// Adding new contact void addContact(Contact contact) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, contact.getName()); // Contact Name values.put(KEY_PH_NO, contact.getPhoneNumber()); // Contact Phone // Inserting Row db.insert(TABLE_CONTACTS, null, values); db.close(); // Closing database connection }
// Involves populating data into the item through holder @Override public void onBindViewHolder(ContactsAdapter.ViewHolder viewHolder, int position) { // Get the data model based on position Contact contact = mContacts.get(position); // Set item views based on your views and data model TextView textView = viewHolder.nameTextView; textView.setText(contact.getName()); Button button = viewHolder.messageButton; button.setText("Message"); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); contact = (Contact) this.getIntent().getSerializableExtra("contact"); titleText = (TextView) findViewById(R.id.textView1); btnSend = (Button) findViewById(R.id.button1); titleText.setText("Chat with " + contact.getName()); btnSend.setOnClickListener(this); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View rowView; rowView = mInflater.inflate(R.layout.row_layout, null); TextView textView = (TextView) rowView.findViewById(R.id.textView); TextView textView1 = (TextView) rowView.findViewById(R.id.textView1); ImageView imageView = (ImageView) rowView.findViewById(R.id.imageView); Contact contact = mContactList.get(position); textView.setText(contact.getName()); textView1.setText(contact.getNumber()); // imageView.setImageResource(R.drawable.can); return rowView; }
public void addContact(Contact contact) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(CONTACTS_COLUMN_CONTACT_ID, contact.getId()); values.put(CONTACTS_COLUMN_NAME, contact.getName()); // Contact Name values.put(CONTACTS_COLUMN_PHONE, contact.getPhone()); // Contact Phone // Number values.put(CONTACTS_COLUMN_EMAIL, contact.getEmail()); values.put(CONTACTS_COLUMN_CATEGORY, contact.getCategory()); // Inserting Row db.insert(CONTACTS_TABLE_NAME, null, values); db.close(); // Closing database connection }
public int updateContact(Contact contact) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(CONTACTS_COLUMN_NAME, contact.getName()); values.put(CONTACTS_COLUMN_PHONE, contact.getPhone()); values.put(CONTACTS_COLUMN_EMAIL, contact.getEmail()); values.put(CONTACTS_COLUMN_CATEGORY, contact.getCategory()); // updating row return db.update( CONTACTS_TABLE_NAME, values, CONTACTS_COLUMN_ID + " = ?", new String[] {String.valueOf(contact.getId())}); }
// Insert new contact information public void insertContact(Contact c) { db = this.getWritableDatabase(); ContentValues values = new ContentValues(); String query = "select * from contacts"; Cursor cursor = db.rawQuery(query, null); int count = cursor.getCount(); values.put(COLUMN_ID, count); values.put(COLUMN_NAME, c.getName()); values.put(COLUMN_EMAIL, c.getEmail()); values.put(COLUMN_STAGE, "0"); values.put(COLUMN_PASS, c.getPass()); db.insert(TABLE_NAME, null, values); db.close(); }
public void action() { Contact contact = new Contact(); String name, phone; name = JOptionPane.showInputDialog("Ange namn"); contact.setName(name); phone = JOptionPane.showInputDialog("Ange hemtelefon"); contact.setPhone(phone); contact.setMobile(JOptionPane.showInputDialog("Ange mobil")); contact.setEmail(JOptionPane.showInputDialog("Ange mail-adress")); JOptionPane.showMessageDialog(null, contact.toString()); JOptionPane.showMessageDialog( null, contact.getName() + "\n" + contact.getPhone() + "\n" + contact.getMobile() + "\n" + contact.getEmail()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_contact); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final EditText name = (EditText) findViewById(R.id.edit_name); final EditText phone = (EditText) findViewById(R.id.edit_phone); final EditText email = (EditText) findViewById(R.id.edit_email); final EditText address = (EditText) findViewById(R.id.edit_address); final EditText digicode = (EditText) findViewById(R.id.edit_digicode); Bundle extra = getIntent().getExtras(); if (extra != null) { final int id = extra.getInt("id"); Contact contact = db.getContact(id); name.setText(contact.getName()); phone.setText(contact.getPhone()); email.setText(contact.getEmail()); address.setText(contact.getAddress()); digicode.setText(contact.getDigicode()); FloatingActionButton update = (FloatingActionButton) findViewById(R.id.update_btn); update.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { db.updateContact( id, name.getText().toString(), phone.getText().toString(), email.getText().toString(), address.getText().toString(), digicode.getText().toString()); Intent i = new Intent(EditContact.this, MainActivity.class); startActivity(i); } }); } }
public void updateCategory(Contact contact) { SQLiteDatabase db = this.getWritableDatabase(); String selectQuery = "UPDATE " + CONTACTS_TABLE_NAME + " SET category='" + contact.getCategory() + "'" + " WHERE name='" + contact.getName() + "' AND " + "phone='" + contact.getPhone() + "' AND " + "email='" + contact.getEmail() + "';"; // String selectQuery = "UPDATE " + CONTACTS_TABLE_NAME // + " SET category='" + contact.getCategory() + "';"; db.execSQL(selectQuery); }
public Set<Contact> getContacts(String name) { /** * @param lowerCaseContactName, @param lowerCaseInput - I convert both strings into lower case * before the string comparison, so it does not matter if user gives this method "ann" when * they want to find "Ann Smith" */ String lowerCaseContactName; String lowerCaseInput = name.toLowerCase(); Set<Contact> setToReturn = new HashSet<Contact>(); if (name == null) { throw new NullPointerException("Cannot compare contact names against a null string"); } else { for (Contact contact : contactSet) { lowerCaseContactName = contact.getName().toLowerCase(); if (lowerCaseContactName.contains(lowerCaseInput)) // we have a match! setToReturn.add(contact); } } return setToReturn; }
public List<Meeting> getFutureMeetingList(Contact contact) { /** @throws IllegalArgumentException if the contact does not exist */ if (!contactSet.contains(contact)) { throw new IllegalArgumentException( "Contact \"" + contact.getName() + "\" does not exist! Please try again"); } else { /** @param list a list to store any matching Meetings; will be returned empty if no matches */ List<Meeting> list = new ArrayList<Meeting>(); for (Meeting m : meetingSet) { if (m.getContacts().contains(contact)) { /** each time a matching Meeting is found, it is added to the list. */ list.add(m); } } /** * @see MeetingImpl#MeetingComparator - calls custom comparator in MeetingImpl to * chronologically sort */ Collections.sort(list, MeetingImpl.MeetingComparator); return list; } }
public List<PastMeeting> getPastMeetingList(Contact contact) { /** @throws IllegalArgumentException if the contact does not exist */ if (!contactSet.contains(contact)) { throw new IllegalArgumentException( "Contact \"" + contact.getName() + "\" does not exist! Please try again"); } else { /** * @param list a list to store any matching PastMeetings; will be returned empty if no matches */ List<PastMeeting> list = new ArrayList<PastMeeting>(); for (PastMeeting pm : pastMeetings) { if (pm.getContacts().contains(contact)) { list.add(pm); } } /** * @see MeetingImpl#MeetingComparator - calls custom comparator in MeetingImpl to * chronologically sort */ Collections.sort(list, MeetingImpl.MeetingComparator); return list; } }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflater(); View item = inflater.inflate(R.layout.contact_list_item, parent, false); Contact contact = getItem(position); ((TextView) item.findViewById(R.id.item_name)).setText(contact.getName()); ((TextView) item.findViewById(R.id.item_title)).setText(contact.getTitle()); // Check if we have gravatar on disk String filename = contact.getId() + "-gravatar.jpg"; try { File imgFile = getFileStreamPath(filename); if (imgFile.exists()) { ImageView iv = (ImageView) item.findViewById(R.id.item_profile_image); Bitmap gravatar = BitmapFactory.decodeFile(imgFile.getAbsolutePath()); iv.setImageBitmap(gravatar); } } catch (Exception e) { Log.e("gravatar", e.getMessage()); } return item; }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.add_update_screen); // set screen Set_Add_Update_Screen(); // set visibility of view as per calling activity String called_from = getIntent().getStringExtra("called"); if (called_from.equalsIgnoreCase("add")) { add_view.setVisibility(View.VISIBLE); update_view.setVisibility(View.GONE); } else { update_view.setVisibility(View.VISIBLE); add_view.setVisibility(View.GONE); USER_ID = Integer.parseInt(getIntent().getStringExtra("USER_ID")); Contact c = dbHandler.Get_Contact(USER_ID); add_name.setText(c.getName()); add_mobile.setText(c.getPhoneNumber()); add_email.setText(c.getEmail()); // dbHandler.close(); } add_mobile.addTextChangedListener( new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub // min lenth 10 and max lenth 12 (2 extra for - as per phone // matcher format) Is_Valid_Sign_Number_Validation(12, 12, add_mobile); } }); add_mobile.addTextChangedListener(new PhoneNumberFormattingTextWatcher()); add_email.addTextChangedListener( new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub Is_Valid_Email(add_email); } }); add_name.addTextChangedListener( new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub Is_Valid_Person_Name(add_name); } }); add_save_btn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // check the value state is null or not if (valid_name != null && valid_mob_number != null && valid_email != null && valid_name.length() != 0 && valid_mob_number.length() != 0 && valid_email.length() != 0) { dbHandler.Add_Contact(new Contact(valid_name, valid_mob_number, valid_email)); Toast_msg = "Data inserted successfully"; Show_Toast(Toast_msg); Reset_Text(); } } }); update_btn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub valid_name = add_name.getText().toString(); valid_mob_number = add_mobile.getText().toString(); valid_email = add_email.getText().toString(); // check the value state is null or not if (valid_name != null && valid_mob_number != null && valid_email != null && valid_name.length() != 0 && valid_mob_number.length() != 0 && valid_email.length() != 0) { dbHandler.Update_Contact( new Contact(USER_ID, valid_name, valid_mob_number, valid_email)); dbHandler.close(); Toast_msg = "Data Update successfully"; Show_Toast(Toast_msg); Reset_Text(); } else { Toast_msg = "Sorry Some Fields are missing.\nPlease Fill up all."; Show_Toast(Toast_msg); } } }); update_view_all.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent view_user = new Intent(Add_Update_User.this, Main_Screen.class); view_user.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(view_user); finish(); } }); add_view_all.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent view_user = new Intent(Add_Update_User.this, Main_Screen.class); view_user.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(view_user); finish(); } }); }
/** * Overrides SubscriptionInitiator.handleInform(), defining what to do each time the DF is * modified by a contact Basically it adds/removes/updates contacts from ContactList according * to what has happened to DF. It also fires events on the GUI any time a view refresh is * needed. * * @param inform the message from DF containing a list of changes */ protected void handleInform(ACLMessage inform) { myLogger.log( Logger.FINE, "Thread " + Thread.currentThread().getId() + ": Notification received from DF"); ContactManager.getInstance().resetModifications(); try { DFAgentDescription[] results = DFService.decodeNotification(inform.getContent()); if (results.length > 0) { for (int i = 0; i < results.length; ++i) { DFAgentDescription dfd = results[i]; AID contactAID = dfd.getName(); // Do something only if the notification deals with an agent different from the current // one if (!contactAID.equals(myAgent.getAID())) { myLogger.log( Logger.INFO, "Thread " + Thread.currentThread().getId() + ":df says that agent " + myAgent.getAID().getLocalName() + " updates or registers"); Iterator serviceIter = dfd.getAllServices(); // Registered or updated if (serviceIter.hasNext()) { ServiceDescription serviceDesc = (ServiceDescription) serviceIter.next(); Iterator propertyIt = serviceDesc.getAllProperties(); Location loc = Helper.extractLocation(propertyIt); String phoneNum = contactAID.getLocalName(); ContactManager.getInstance().addOrUpdateOnlineContact(phoneNum, loc); } else { myLogger.log( Logger.INFO, "Thread " + Thread.currentThread().getId() + ":df says that agent " + myAgent.getAID().getLocalName() + " deregisters"); String phoneNumber = contactAID.getLocalName(); Contact c = ContactManager.getInstance().getContact(phoneNumber); ContactManager.getInstance().setContactOffline(phoneNumber); MsnEvent event = MsnEventMgr.getInstance().createEvent(MsnEvent.CONTACT_DISCONNECT_EVENT); event.addParam(MsnEvent.CONTACT_DISCONNECT_PARAM_CONTACTNAME, c.getName()); MsnEventMgr.getInstance().fireEvent(event); } MsnEvent event = MsnEventMgr.getInstance().createEvent(MsnEvent.VIEW_REFRESH_EVENT); ContactListChanges changes = ContactManager.getInstance().getModifications(); Map<String, Contact> cMap = ContactManager.getInstance().getAllContacts(); Map<String, ContactLocation> cLocMap = ContactManager.getInstance().getAllContactLocations(); myLogger.log( Logger.FINE, "Thread " + Thread.currentThread().getId() + ":Adding to VIEW_REFRESH_EVENT this list of changes: " + changes.toString()); event.addParam(MsnEvent.VIEW_REFRESH_PARAM_LISTOFCHANGES, changes); event.addParam(MsnEvent.VIEW_REFRESH_CONTACTSMAP, cMap); event.addParam(MsnEvent.VIEW_REFRESH_PARAM_LOCATIONMAP, cLocMap); MsnEventMgr.getInstance().fireEvent(event); } } } } catch (Exception e) { myLogger.log(Logger.WARNING, "See printstack for Exception.", e); e.printStackTrace(); } }
/** Builds the document header of the swagger model */ private void overview() { Info info = swagger.getInfo(); this.markupDocBuilder.documentTitle(info.getTitle()); this.markupDocBuilder.sectionTitleLevel1(OVERVIEW); if (isNotBlank(info.getDescription())) { this.markupDocBuilder.textLine(info.getDescription()); } if (isNotBlank(info.getVersion())) { this.markupDocBuilder.sectionTitleLevel2(CURRENT_VERSION); this.markupDocBuilder.textLine(VERSION + info.getVersion()); } Contact contact = info.getContact(); if (contact != null) { this.markupDocBuilder.sectionTitleLevel2(CONTACT_INFORMATION); if (isNotBlank(contact.getName())) { this.markupDocBuilder.textLine(CONTACT_NAME + contact.getName()); } if (isNotBlank(contact.getEmail())) { this.markupDocBuilder.textLine(CONTACT_EMAIL + contact.getEmail()); } } License license = info.getLicense(); if (license != null && (isNotBlank(license.getName()) || isNotBlank(license.getUrl()))) { this.markupDocBuilder.sectionTitleLevel2(LICENSE_INFORMATION); if (isNotBlank(license.getName())) { this.markupDocBuilder.textLine(LICENSE + license.getName()); } if (isNotBlank(license.getUrl())) { this.markupDocBuilder.textLine(LICENSE_URL + license.getUrl()); } } if (isNotBlank(info.getTermsOfService())) { this.markupDocBuilder.textLine(TERMS_OF_SERVICE + info.getTermsOfService()); } if (isNotBlank(swagger.getHost()) || isNotBlank(swagger.getBasePath()) || isNotEmpty(swagger.getSchemes())) { this.markupDocBuilder.sectionTitleLevel2(URI_SCHEME); if (isNotBlank(swagger.getHost())) { this.markupDocBuilder.textLine(HOST + swagger.getHost()); } if (isNotBlank(swagger.getBasePath())) { this.markupDocBuilder.textLine(BASE_PATH + swagger.getBasePath()); } if (isNotEmpty(swagger.getSchemes())) { List<String> schemes = new ArrayList<>(); for (Scheme scheme : swagger.getSchemes()) { schemes.add(scheme.toString()); } this.markupDocBuilder.textLine(SCHEMES + join(schemes, ", ")); } } if (isNotEmpty(swagger.getTags())) { this.markupDocBuilder.sectionTitleLevel2(TAGS); List<String> tags = new ArrayList<>(); for (Tag tag : swagger.getTags()) { String name = tag.getName(); String description = tag.getDescription(); if (isNoneBlank(description)) { tags.add(name + ": " + description); } else { tags.add(name); } } this.markupDocBuilder.unorderedList(tags); } if (isNotEmpty(swagger.getConsumes())) { this.markupDocBuilder.sectionTitleLevel2(CONSUMES); this.markupDocBuilder.unorderedList(swagger.getConsumes()); } if (isNotEmpty(swagger.getProduces())) { this.markupDocBuilder.sectionTitleLevel2(PRODUCES); this.markupDocBuilder.unorderedList(swagger.getProduces()); } }
public String getLoginUserName() { Contact loginUser = getLoginUser(); return loginUser == null ? null : loginUser.getName(); }
private void launch() { myContact = new ContactImpl(984, "Michael Jordan", "NBA legend"); output = 0; expected = 0; strOutput = ""; strExpected = ""; try { diary = new ContactManagerImpl(); pastMeetIds = new ArrayList<Integer>(); futMeetIds = new ArrayList<Integer>(); contactsGroup = new HashSet<Contact>(); aux = new HashSet<Contact>(); meetingDate = new GregorianCalendar(); contactsGroup.clear(); aux.clear(); } catch (Exception ex) { ex.printStackTrace(); } output = myContact.getId(); expected = 984; if (intExpected == intOutput) { System.out.println("TEST PASSED"); } else { System.out.println("TEST FAILED!"); } strOutput = myContact.getName(); strExpected = "Michael Jordan"; if (strExpected.equals(strOutput)) { System.out.println("TEST PASSED"); } else { System.out.println("TEST FAILED!"); } strOutput = myContact.getNotes(); strExpected = "NBA legend"; if (strExpected.equals(strOutput)) { System.out.println("TEST PASSED"); } else { System.out.println("TEST FAILED!"); } myContact.addNotes("Best shooting guard of all time"); strOutput = myContact.getNotes(); strExpected = "Best shooting guard of all time"; if (strExpected.equals(strOutput)) { System.out.println("TEST PASSED"); } else { System.out.println("TEST FAILED!"); } // add new contacts to the diary diary.addNewContact("Jamie O'Regan", "Best buddy"); diary.addNewContact("Travis Wallach", "MC"); diary.addNewContact("Wade Kelly", "Groomsman"); diary.addNewContact("Richard Barker", "Neighbour"); diary.addNewContact("Kate Crowne", "Family friend"); diary.addNewContact("Laura Edwards", "Girl friend"); diary.addNewContact("Willem Botha", "Squash Guru"); diary.addNewContact("Oli Callington", "Footie fiend"); diary.addNewContact("Tondi Busse", "DJ Baby Mumma Trouble"); diary.addNewContact("James Gill", "Pedal Juice Partner"); diary.addNewContact("James McLeod", "Law Consultant"); diary.addNewContact("Nicky Ho", "Interior Designer"); diary.addNewContact("Philippa Ho", "Dr"); diary.addNewContact("Matthew Swinson", "Jacky boy fan club"); diary.addNewContact("Dominic Leavy", "B52 bomber"); // build past meeting 1 contactsGroup.clear(); aux.clear(); // set contact group aux = diary.getContacts("Willem Botha"); contactsGroup.addAll(aux); aux = diary.getContacts("Oli Callington"); contactsGroup.addAll(aux); aux = diary.getContacts("Tondi Busse"); contactsGroup.addAll(aux); // set past date meetingDate.set(Calendar.YEAR, 2013); meetingDate.set(Calendar.MONTH, Calendar.JANUARY); meetingDate.set(Calendar.DAY_OF_MONTH, 28); // set past meeting 1; diary.addNewPastMeeting(contactsGroup, meetingDate, "Savoy Equity Awards Dinner"); // build past meeting 2 contactsGroup.clear(); aux.clear(); // set contact group aux = diary.getContacts("Willem Botha"); contactsGroup.addAll(aux); aux = diary.getContacts("Laura Edwards"); contactsGroup.addAll(aux); aux = diary.getContacts("Oli Callington"); contactsGroup.addAll(aux); // set past date meetingDate.set(Calendar.YEAR, 2014); meetingDate.set(Calendar.MONTH, Calendar.FEBRUARY); meetingDate.set(Calendar.DAY_OF_MONTH, 1); // set past meeting 2 diary.addNewPastMeeting(contactsGroup, meetingDate, "Dry January fall off wagon party"); // build past meeting 3 contactsGroup.clear(); aux.clear(); // set contact group aux = diary.getContacts("Richard Barker"); contactsGroup.addAll(aux); aux = diary.getContacts("Kate Crowne"); contactsGroup.addAll(aux); aux = diary.getContacts("Laura Edwards"); contactsGroup.addAll(aux); // set past date meetingDate.set(Calendar.YEAR, 2011); meetingDate.set(Calendar.MONTH, Calendar.JULY); meetingDate.set(Calendar.DAY_OF_MONTH, 14); // set past meeting 3; diary.addNewPastMeeting(contactsGroup, meetingDate, "Summer trip to the beach in 2011"); // build past meeting 4 contactsGroup.clear(); aux.clear(); // set contact group aux = diary.getContacts("Richard Barker"); contactsGroup.addAll(aux); aux = diary.getContacts("Matthew Swinson"); contactsGroup.addAll(aux); aux = diary.getContacts("Dominic Leavy"); contactsGroup.addAll(aux); // set past date meetingDate.set(Calendar.YEAR, 2013); meetingDate.set(Calendar.MONTH, Calendar.APRIL); meetingDate.set(Calendar.DAY_OF_MONTH, 11); // set past meeting 4; diary.addNewPastMeeting(contactsGroup, meetingDate, "Watched Football"); // add new past meetings to the pMeetIds list - could add this separately in the buildUp method? pastMeetIds = diary.getPastMeetingIdList(); // build future meeting 1 contactsGroup.clear(); aux.clear(); // set contact group aux = diary.getContacts("Jamie O'Regan"); contactsGroup.addAll(aux); aux = diary.getContacts("Travis Wallach"); contactsGroup.addAll(aux); aux = diary.getContacts("Wade Kelly"); contactsGroup.addAll(aux); // set future date meetingDate.set(Calendar.YEAR, 2014); meetingDate.set(Calendar.MONTH, Calendar.OCTOBER); meetingDate.set(Calendar.DAY_OF_MONTH, 31); // set future meeting 1 int id = diary.addFutureMeeting(contactsGroup, meetingDate); futMeetIds.add(id); // build future meeting 2 contactsGroup.clear(); aux.clear(); // set contact group aux = diary.getContacts("James Gill"); contactsGroup.addAll(aux); aux = diary.getContacts("James McLeod"); contactsGroup.addAll(aux); aux = diary.getContacts("Oli Callington"); contactsGroup.addAll(aux); // set future date meetingDate.set(Calendar.YEAR, 2014); meetingDate.set(Calendar.MONTH, Calendar.JUNE); meetingDate.set(Calendar.DAY_OF_MONTH, 21); // set future meeting 2 id = diary.addFutureMeeting(contactsGroup, meetingDate); futMeetIds.add(id); // build future meeting 3 contactsGroup.clear(); aux.clear(); // set contact group aux = diary.getContacts("Nicky Ho"); contactsGroup.addAll(aux); aux = diary.getContacts("Philippa Ho"); contactsGroup.addAll(aux); aux = diary.getContacts("Laura Edwards"); contactsGroup.addAll(aux); // set future date meetingDate.set(Calendar.YEAR, 2015); meetingDate.set(Calendar.MONTH, Calendar.SEPTEMBER); meetingDate.set(Calendar.DAY_OF_MONTH, 2); // set future meeting 3 id = diary.addFutureMeeting(contactsGroup, meetingDate); futMeetIds.add(id); // build future meeting 4 contactsGroup.clear(); aux.clear(); // set contact group aux = diary.getContacts("Philippa Ho"); contactsGroup.addAll(aux); aux = diary.getContacts("Matthew Swinson"); contactsGroup.addAll(aux); aux = diary.getContacts("Willem Botha"); contactsGroup.addAll(aux); // set future date meetingDate.set(Calendar.YEAR, 2016); meetingDate.set(Calendar.MONTH, Calendar.FEBRUARY); meetingDate.set(Calendar.DAY_OF_MONTH, 4); // set future meeting 4 id = diary.addFutureMeeting(contactsGroup, meetingDate); futMeetIds.add(id); diary.flush(); diary.readFile(); // System.out.println("*****decoded file******* MEETING SCHEDULE: " + // diary.getMeetingSchedule); // System.out.println("*****decoded file******* CONTACT SET: " + diary.getContactSet); // System.out.println("*****decoded file******* CONTACT LIST: " + diary.getContactList); }
@Override public String getContactLastName() { return contact.getName().split(", ")[0]; }
@Test public void newContact_instantiatesCorrectly() { Contact newContact = new Contact("Jane Doe"); assertEquals("Jane Doe", newContact.getName()); }
private void updateUI() { mContactName.setText(mContact.getName()); mAdapter.notifyDataSetChanged(); }