Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-06-18 15:02:16 +02:00 committed by Alper Öztürk
parent 3a0fd16e9d
commit 7d9c88b173
2 changed files with 39 additions and 2 deletions

View file

@ -20,6 +20,7 @@ import android.app.Activity;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@ -27,6 +28,7 @@ import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources.NotFoundException;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@ -35,6 +37,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Parcelable;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuInflater;
@ -131,6 +134,8 @@ import com.owncloud.android.utils.PushUtils;
import com.owncloud.android.utils.StringUtils;
import com.owncloud.android.utils.theme.CapabilityUtils;
import net.fortuna.ical4j.model.property.Contact;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -278,6 +283,30 @@ public class FileDisplayActivity extends FileActivity
initSyncBroadcastReceiver();
observeWorkerState();
registerRefreshFolderEventReceiver();
getAllContacts();
}
public void getAllContacts() {
ContentResolver contentResolver = getContentResolver();
Uri uri = ContactsContract.Contacts.CONTENT_URI;
String[] projection = new String[]{
ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME
};
Cursor cursor = contentResolver.query(uri, projection, null, null, null);
if (cursor != null && cursor.getCount() > 0) {
while (cursor.moveToNext()) {
String id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
Log_OC.d(TAG, "CONTACT_ID: " + id);
Log_OC.d(TAG, "CONTACT_NAME: " + name);
}
cursor.close();
}
// Do something with the list of contacts
}
@SuppressWarnings("unchecked")

View file

@ -8,8 +8,11 @@
package com.owncloud.android.ui.adapter
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.drawable.Drawable
import android.net.Uri
import android.provider.ContactsContract
import android.view.View
import androidx.core.content.res.ResourcesCompat
import com.afollestad.sectionedrecyclerview.SectionedViewHolder
@ -70,12 +73,17 @@ class UnifiedSearchItemViewHolder(
if (entry.isFile) {
binding.more.visibility = View.VISIBLE
binding.more.setOnClickListener { filesAction.showFilesAction(entry) }
binding.more.setOnClickListener {
filesAction.showFilesAction(entry)
}
} else {
binding.more.visibility = View.GONE
}
binding.unifiedSearchItemLayout.setOnClickListener { listInterface.onSearchResultClicked(entry) }
binding.unifiedSearchItemLayout.setOnClickListener {
// listInterface.onSearchResultClicked(entry)
}
}
private fun getPlaceholder(entry: SearchResultEntry, mimetype: String?): Drawable {