@Override public int hashCode() { int result = text != null ? text.hashCode() : 0; result = 31 * result + (mime != null ? mime.hashCode() : 0); result = 31 * result + (file != null ? file.hashCode() : 0); result = 31 * result + (type != null ? type.hashCode() : 0); return result; }
@Override public void onBindViewHolder(ContactCardRecyclerViewAdapter.ViewHolder holder, int position) { WContact item = this.mObjects.get(position); Log.d("ABDULL55", item.toString()); holder.contactNameTv.setText(item.getName()); holder.contactRemoveIv.setTag(item); holder.contactRemoveIv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { WContact contact = (WContact) v.getTag(); if(mDictionary.containsKey(contact)) mSelectedContacts[mDictionary.get(contact)] = false; mObjects.remove(contact); mDictionary.remove(contact); notifyDataSetChanged(); } }); Log.d("ABDULL!", item.toString()); }
@Override public void receiveWhatsappContacts(List<WContact> contacts) { mAllContacts = contacts; mAddContactsBtn.setEnabled(true); mSendMsgBtn.setEnabled(true); mContacts = new String[contacts.size()]; mSelectedContacts = new boolean[contacts.size()]; mAdapter = new ContactCardRecyclerViewAdapter(MainActivity.this, mReceivers, mContacts, mSelectedContacts, mDictionary); mContactsRv.setAdapter(mAdapter); int i = 0; for (WContact contact : contacts) { mContacts[i] = contact.getName();//+ ", " + contact.getId().split("@")[0]; i++; } } });
switch (message.getType()) { case TEXT: break; case VIDEO: name = message.getFile().getPath(); c = Calendar.getInstance(); df = new SimpleDateFormat("yyyyMMMdd"); source = new File(name); rand = new Random(); destination = new File(vidFolder, "VID-" + formattedDate + "-WA" + (rand.nextInt(100) + rand.nextInt(75) + rand.nextInt(50)) + "." + FilenameUtils.getExtension(message.getFile().getName())); if (source.exists()) { FileChannel src = new FileInputStream(source).getChannel(); break; case IMAGE: name = message.getFile().getPath(); c = Calendar.getInstance(); df = new SimpleDateFormat("yyyyMMdd"); source = new File(name); rand = new Random(); destination = new File(imgFolder, "IMG-" + formattedDate + "-WA" + (rand.nextInt(100) + rand.nextInt(75) + rand.nextInt(50)) + "." + FilenameUtils.getExtension(message.getFile().getName())); if (source.exists()) { FileChannel src = new FileInputStream(source).getChannel(); break; case AUDIO: name = message.getFile().getPath();
@Override protected List<WContact> doInBackground(Void... params) { Shell.SU.run("am force-stop com.whatsapp"); db = SQLiteDatabase.openOrCreateDatabase(new File("/data/data/com.whatsapp/databases/wa.db"), null); List<WContact> contactList = new LinkedList<>(); String selectQuery = "SELECT jid, display_name FROM wa_contacts where phone_type is not null and is_whatsapp_user = 1"; Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.moveToFirst()) { do { WContact contact = new WContact(cursor.getString(1), cursor.getString(0)); contactList.add(contact); } while (cursor.moveToNext()); } db.close(); return contactList; }
WMessage message = new WMessage(text, attachmentFile, this);