mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
commit
753b4591db
10 changed files with 166 additions and 165 deletions
|
@ -113,7 +113,7 @@ import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFER
|
|||
|
||||
/**
|
||||
* Main Application of the project
|
||||
* <p>
|
||||
*
|
||||
* Contains methods to build the "static" strings. These strings were before constants in different classes
|
||||
*/
|
||||
public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
||||
|
@ -122,6 +122,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
public static final OwnCloudVersion MINIMUM_SUPPORTED_SERVER_VERSION = OwnCloudVersion.nextcloud_12;
|
||||
|
||||
private static final String TAG = MainApp.class.getSimpleName();
|
||||
public static final String DOT = ".";
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
|
@ -233,11 +234,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
|
||||
insertConscrypt();
|
||||
|
||||
SecurityKeyManager securityKeyManager = SecurityKeyManager.getInstance();
|
||||
SecurityKeyManagerConfig config = new SecurityKeyManagerConfig.Builder()
|
||||
.setEnableDebugLogging(BuildConfig.DEBUG)
|
||||
.build();
|
||||
securityKeyManager.init(this, config);
|
||||
initSecurityKeyManager();
|
||||
|
||||
registerActivityLifecycleCallbacks(new ActivityInjector());
|
||||
|
||||
|
@ -307,7 +304,10 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
.build()
|
||||
.schedule();
|
||||
|
||||
// register global protection with pass code
|
||||
registerGlobalPassCodeProtection();
|
||||
}
|
||||
|
||||
private void registerGlobalPassCodeProtection() {
|
||||
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||
|
||||
@Override
|
||||
|
@ -350,6 +350,14 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
});
|
||||
}
|
||||
|
||||
private void initSecurityKeyManager() {
|
||||
SecurityKeyManager securityKeyManager = SecurityKeyManager.getInstance();
|
||||
SecurityKeyManagerConfig config = new SecurityKeyManagerConfig.Builder()
|
||||
.setEnableDebugLogging(BuildConfig.DEBUG)
|
||||
.build();
|
||||
securityKeyManager.init(this, config);
|
||||
}
|
||||
|
||||
public static void initContactsBackup(UserAccountManager accountManager) {
|
||||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(mContext.getContentResolver());
|
||||
Account[] accounts = accountManager.getAccounts();
|
||||
|
@ -368,9 +376,9 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
Conscrypt.Version version = Conscrypt.version();
|
||||
Log_OC.i(TAG, "Using Conscrypt/"
|
||||
+ version.major()
|
||||
+ "."
|
||||
+ DOT
|
||||
+ version.minor()
|
||||
+ "." + version.patch()
|
||||
+ DOT + version.patch()
|
||||
+ " for TLS");
|
||||
SSLEngine engine = SSLContext.getDefault().createSSLEngine();
|
||||
Log_OC.i(TAG, "Enabled protocols: " + Arrays.toString(engine.getEnabledProtocols()) + " }");
|
||||
|
|
|
@ -54,6 +54,8 @@ import com.owncloud.android.utils.FileStorageUtils;
|
|||
import com.owncloud.android.utils.MimeType;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -81,6 +83,7 @@ public class FileDataStorageManager {
|
|||
private static final String EXCEPTION_MSG = "Exception in batch of operations ";
|
||||
|
||||
public static final int ROOT_PARENT_ID = 0;
|
||||
public static final String NULL_STRING = "null";
|
||||
|
||||
private ContentResolver contentResolver;
|
||||
private ContentProviderClient contentProviderClient;
|
||||
|
@ -999,7 +1002,7 @@ public class FileDataStorageManager {
|
|||
|
||||
String sharees = c.getString(c.getColumnIndex(ProviderTableMeta.FILE_SHAREES));
|
||||
|
||||
if (sharees == null || "null".equals(sharees) || sharees.isEmpty()) {
|
||||
if (sharees == null || NULL_STRING.equals(sharees) || sharees.isEmpty()) {
|
||||
file.setSharees(new ArrayList<>());
|
||||
} else {
|
||||
try {
|
||||
|
@ -1920,8 +1923,50 @@ public class FileDataStorageManager {
|
|||
public OCCapability saveCapabilities(OCCapability capability) {
|
||||
|
||||
// Prepare capabilities data
|
||||
ContentValues cv = createContentValues(account.name, capability);
|
||||
|
||||
if (capabilityExists(account.name)) {
|
||||
if (getContentResolver() != null) {
|
||||
getContentResolver().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv,
|
||||
ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
|
||||
new String[]{account.name});
|
||||
} else {
|
||||
try {
|
||||
getContentProviderClient().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES,
|
||||
cv, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
|
||||
new String[]{account.name});
|
||||
} catch (RemoteException e) {
|
||||
Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Uri result_uri = null;
|
||||
if (getContentResolver() != null) {
|
||||
result_uri = getContentResolver().insert(
|
||||
ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv);
|
||||
} else {
|
||||
try {
|
||||
result_uri = getContentProviderClient().insert(
|
||||
ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv);
|
||||
} catch (RemoteException e) {
|
||||
Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
if (result_uri != null) {
|
||||
long new_id = Long.parseLong(result_uri.getPathSegments()
|
||||
.get(1));
|
||||
capability.setId(new_id);
|
||||
capability.setAccountName(account.name);
|
||||
}
|
||||
}
|
||||
|
||||
return capability;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ContentValues createContentValues(String accountName, OCCapability capability) {
|
||||
ContentValues cv = new ContentValues();
|
||||
cv.put(ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME, account.name);
|
||||
cv.put(ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME, accountName);
|
||||
cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MAYOR, capability.getVersionMayor());
|
||||
cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MINOR, capability.getVersionMinor());
|
||||
cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MICRO, capability.getVersionMicro());
|
||||
|
@ -1980,43 +2025,7 @@ public class FileDataStorageManager {
|
|||
cv.put(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_TEMPLATES, capability.getRichDocumentsTemplatesAvailable()
|
||||
.getValue());
|
||||
cv.put(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_PRODUCT_NAME, capability.getRichDocumentsProductName());
|
||||
|
||||
if (capabilityExists(account.name)) {
|
||||
if (getContentResolver() != null) {
|
||||
getContentResolver().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv,
|
||||
ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
|
||||
new String[]{account.name});
|
||||
} else {
|
||||
try {
|
||||
getContentProviderClient().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES,
|
||||
cv, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
|
||||
new String[]{account.name});
|
||||
} catch (RemoteException e) {
|
||||
Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Uri result_uri = null;
|
||||
if (getContentResolver() != null) {
|
||||
result_uri = getContentResolver().insert(
|
||||
ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv);
|
||||
} else {
|
||||
try {
|
||||
result_uri = getContentProviderClient().insert(
|
||||
ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv);
|
||||
} catch (RemoteException e) {
|
||||
Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
if (result_uri != null) {
|
||||
long new_id = Long.parseLong(result_uri.getPathSegments()
|
||||
.get(1));
|
||||
capability.setId(new_id);
|
||||
capability.setAccountName(account.name);
|
||||
}
|
||||
}
|
||||
|
||||
return capability;
|
||||
return cv;
|
||||
}
|
||||
|
||||
private boolean capabilityExists(String accountName) {
|
||||
|
|
|
@ -39,7 +39,7 @@ import com.owncloud.android.lib.resources.shares.ShareeUser;
|
|||
import com.owncloud.android.utils.MimeType;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
@ -90,7 +90,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
|
|||
@Getter @Setter private String ownerId;
|
||||
@Getter @Setter private String ownerDisplayName;
|
||||
@Getter @Setter String note;
|
||||
@Getter @Setter private ArrayList<ShareeUser> sharees;
|
||||
@Getter @Setter private List<ShareeUser> sharees;
|
||||
|
||||
/**
|
||||
* URI to the local path of the file contents, if stored in the device; cached after first call
|
||||
|
|
|
@ -78,8 +78,6 @@ public class ContactsBackupJob extends Job {
|
|||
protected Result onRunJob(@NonNull Params params) {
|
||||
PersistableBundleCompat bundle = params.getExtras();
|
||||
|
||||
boolean force = bundle.getBoolean(FORCE, false);
|
||||
|
||||
final Account account = accountManager.getAccountByName(bundle.getString(ACCOUNT, ""));
|
||||
|
||||
if (account == null) {
|
||||
|
@ -87,9 +85,9 @@ public class ContactsBackupJob extends Job {
|
|||
}
|
||||
|
||||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContext().getContentResolver());
|
||||
Long lastExecution = arbitraryDataProvider.getLongValue(account,
|
||||
PREFERENCE_CONTACTS_LAST_BACKUP);
|
||||
Long lastExecution = arbitraryDataProvider.getLongValue(account, PREFERENCE_CONTACTS_LAST_BACKUP);
|
||||
|
||||
boolean force = bundle.getBoolean(FORCE, false);
|
||||
if (force || (lastExecution + 24 * 60 * 60 * 1000) < Calendar.getInstance().getTimeInMillis()) {
|
||||
Log_OC.d(TAG, "start contacts backup job");
|
||||
|
||||
|
|
|
@ -675,24 +675,7 @@ public class UploadFileOperation extends SyncOperation {
|
|||
result = new RemoteOperationResult(ResultCode.UNKNOWN_ERROR);
|
||||
}
|
||||
|
||||
if (result.isSuccess()) {
|
||||
Log_OC.i(TAG, "Upload of " + mFile.getStoragePath() + " to " + mFile.getRemotePath() + ": " +
|
||||
result.getLogMessage());
|
||||
} else {
|
||||
if (result.getException() != null) {
|
||||
if (result.isCancelled()) {
|
||||
Log_OC.w(TAG, "Upload of " + mFile.getStoragePath() + " to " + mFile.getRemotePath() +
|
||||
": " + result.getLogMessage());
|
||||
} else {
|
||||
Log_OC.e(TAG, "Upload of " + mFile.getStoragePath() + " to " + mFile.getRemotePath() +
|
||||
": " + result.getLogMessage(), result.getException());
|
||||
}
|
||||
|
||||
} else {
|
||||
Log_OC.e(TAG, "Upload of " + mFile.getStoragePath() + " to " + mFile.getRemotePath() +
|
||||
": " + result.getLogMessage());
|
||||
}
|
||||
}
|
||||
logResult(result, mFile.getStoragePath(), mFile.getRemotePath());
|
||||
}
|
||||
|
||||
if (result.isSuccess()) {
|
||||
|
@ -886,23 +869,7 @@ public class UploadFileOperation extends SyncOperation {
|
|||
result = new RemoteOperationResult(ResultCode.UNKNOWN_ERROR);
|
||||
}
|
||||
|
||||
if (result.isSuccess()) {
|
||||
Log_OC.i(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " +
|
||||
result.getLogMessage());
|
||||
} else {
|
||||
if (result.getException() != null) {
|
||||
if (result.isCancelled()) {
|
||||
Log_OC.w(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath +
|
||||
": " + result.getLogMessage());
|
||||
} else {
|
||||
Log_OC.e(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath +
|
||||
": " + result.getLogMessage(), result.getException());
|
||||
}
|
||||
} else {
|
||||
Log_OC.e(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath +
|
||||
": " + result.getLogMessage());
|
||||
}
|
||||
}
|
||||
logResult(result, mOriginalStoragePath, mRemotePath);
|
||||
}
|
||||
|
||||
if (result.isSuccess()) {
|
||||
|
@ -919,6 +886,24 @@ public class UploadFileOperation extends SyncOperation {
|
|||
return result;
|
||||
}
|
||||
|
||||
private void logResult(RemoteOperationResult result, String sourcePath, String targetPath) {
|
||||
if (result.isSuccess()) {
|
||||
Log_OC.i(TAG, "Upload of " + sourcePath + " to " + targetPath + ": " + result.getLogMessage());
|
||||
} else {
|
||||
if (result.getException() != null) {
|
||||
if (result.isCancelled()) {
|
||||
Log_OC.w(TAG, "Upload of " + sourcePath + " to " + targetPath + ": "
|
||||
+ result.getLogMessage());
|
||||
} else {
|
||||
Log_OC.e(TAG, "Upload of " + sourcePath + " to " + targetPath + ": "
|
||||
+ result.getLogMessage(), result.getException());
|
||||
}
|
||||
} else {
|
||||
Log_OC.e(TAG, "Upload of " + sourcePath + " to " + targetPath + ": " + result.getLogMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private RemoteOperationResult copyFile(File originalFile, String expectedPath) throws OperationCancelledException,
|
||||
IOException {
|
||||
if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_COPY && !mOriginalStoragePath.equals(expectedPath)) {
|
||||
|
|
|
@ -29,6 +29,7 @@ package com.owncloud.android.ui.activity;
|
|||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.accounts.AccountManagerFuture;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
|
@ -396,30 +397,7 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
setDrawerMenuItemChecked(menuItem.getItemId());
|
||||
|
||||
if (menuItem.getGroupId() == R.id.drawer_menu_accounts) {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.drawer_menu_account_add:
|
||||
boolean isProviderOrOwnInstallationVisible = getResources()
|
||||
.getBoolean(R.bool.show_provider_or_own_installation);
|
||||
|
||||
if (isProviderOrOwnInstallationVisible) {
|
||||
Intent firstRunIntent = new Intent(getApplicationContext(), FirstRunActivity.class);
|
||||
firstRunIntent.putExtra(FirstRunActivity.EXTRA_ALLOW_CLOSE, true);
|
||||
startActivity(firstRunIntent);
|
||||
} else {
|
||||
createAccount(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.drawer_menu_account_manage:
|
||||
Intent manageAccountsIntent = new Intent(getApplicationContext(), ManageAccountsActivity.class);
|
||||
startActivityForResult(manageAccountsIntent, ACTION_MANAGE_ACCOUNTS);
|
||||
break;
|
||||
|
||||
default:
|
||||
accountClicked(menuItem.getItemId());
|
||||
break;
|
||||
}
|
||||
|
||||
handleAccountItemClick(menuItem);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -459,39 +437,28 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
showFiles(true);
|
||||
break;
|
||||
case R.id.nav_uploads:
|
||||
Intent uploadListIntent = new Intent(getApplicationContext(), UploadListActivity.class);
|
||||
uploadListIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(uploadListIntent);
|
||||
startActivity(UploadListActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
break;
|
||||
case R.id.nav_trashbin:
|
||||
Intent trashbinIntent = new Intent(getApplicationContext(), TrashbinActivity.class);
|
||||
trashbinIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(trashbinIntent);
|
||||
startActivity(TrashbinActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
break;
|
||||
case R.id.nav_activity:
|
||||
Intent activityIntent = new Intent(getApplicationContext(), ActivitiesActivity.class);
|
||||
activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(activityIntent);
|
||||
startActivity(ActivitiesActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
break;
|
||||
case R.id.nav_notifications:
|
||||
Intent notificationsIntent = new Intent(getApplicationContext(), NotificationsActivity.class);
|
||||
startActivity(notificationsIntent);
|
||||
startActivity(NotificationsActivity.class);
|
||||
break;
|
||||
case R.id.nav_synced_folders:
|
||||
Intent syncedFoldersIntent = new Intent(getApplicationContext(), SyncedFoldersActivity.class);
|
||||
startActivity(syncedFoldersIntent);
|
||||
startActivity(SyncedFoldersActivity.class);
|
||||
break;
|
||||
case R.id.nav_contacts:
|
||||
Intent contactsIntent = new Intent(getApplicationContext(), ContactsPreferenceActivity.class);
|
||||
startActivity(contactsIntent);
|
||||
startActivity(ContactsPreferenceActivity.class);
|
||||
break;
|
||||
case R.id.nav_settings:
|
||||
Intent settingsIntent = new Intent(getApplicationContext(), SettingsActivity.class);
|
||||
startActivity(settingsIntent);
|
||||
startActivity(SettingsActivity.class);
|
||||
break;
|
||||
case R.id.nav_participate:
|
||||
Intent participateIntent = new Intent(getApplicationContext(), ParticipateActivity.class);
|
||||
startActivity(participateIntent);
|
||||
startActivity(ParticipateActivity.class);
|
||||
break;
|
||||
case R.id.nav_logout:
|
||||
mCheckedMenuItem = -1;
|
||||
|
@ -522,6 +489,42 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
}
|
||||
}
|
||||
|
||||
private void startActivity(Class<? extends Activity> activity) {
|
||||
startActivity(new Intent(getApplicationContext(), activity));
|
||||
}
|
||||
|
||||
private void startActivity(Class<? extends Activity> activity, int flags) {
|
||||
Intent intent = new Intent(getApplicationContext(), activity);
|
||||
intent.setFlags(flags);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void handleAccountItemClick(MenuItem menuItem) {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.drawer_menu_account_add:
|
||||
boolean isProviderOrOwnInstallationVisible = getResources()
|
||||
.getBoolean(R.bool.show_provider_or_own_installation);
|
||||
|
||||
if (isProviderOrOwnInstallationVisible) {
|
||||
Intent firstRunIntent = new Intent(getApplicationContext(), FirstRunActivity.class);
|
||||
firstRunIntent.putExtra(FirstRunActivity.EXTRA_ALLOW_CLOSE, true);
|
||||
startActivity(firstRunIntent);
|
||||
} else {
|
||||
createAccount(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.drawer_menu_account_manage:
|
||||
Intent manageAccountsIntent = new Intent(getApplicationContext(), ManageAccountsActivity.class);
|
||||
startActivityForResult(manageAccountsIntent, ACTION_MANAGE_ACCOUNTS);
|
||||
break;
|
||||
|
||||
default:
|
||||
accountClicked(menuItem.getItemId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void startPhotoSearch(MenuItem menuItem) {
|
||||
SearchEvent searchEvent = new SearchEvent("image/%",
|
||||
SearchRemoteOperation.SearchType.PHOTO_SEARCH,
|
||||
|
|
|
@ -363,7 +363,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
itemViewHolder.sharedAvatars.removeAllViews();
|
||||
|
||||
String fileOwner = file.getOwnerId();
|
||||
ArrayList<ShareeUser> sharees = file.getSharees();
|
||||
List<ShareeUser> sharees = file.getSharees();
|
||||
|
||||
// use fileOwner if not oneself, then add at first
|
||||
ShareeUser fileOwnerSharee = new ShareeUser(fileOwner, file.getOwnerDisplayName(), ShareType.USER);
|
||||
|
|
|
@ -218,11 +218,10 @@ public class ExtendedListFragment extends Fragment implements
|
|||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (getActivity() != null && !(getActivity() instanceof FolderPickerActivity)) {
|
||||
|
||||
if (!(getActivity() instanceof UploadFilesActivity)) {
|
||||
if (getActivity() != null && !(getActivity() instanceof FolderPickerActivity)
|
||||
&& !(getActivity() instanceof UploadFilesActivity)) {
|
||||
setFabVisible(!hasFocus);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
|
|
|
@ -170,13 +170,12 @@ public class PhotoFragment extends OCFileListFragment {
|
|||
int totalItemCount = gridLayoutManager.getItemCount();
|
||||
int firstVisibleItem = gridLayoutManager.findFirstCompletelyVisibleItemPosition();
|
||||
|
||||
if ((totalItemCount - visibleItemCount) <= (firstVisibleItem + MAX_ITEMS_PER_ROW)) {
|
||||
if ((totalItemCount - visibleItemCount) <= (firstVisibleItem + MAX_ITEMS_PER_ROW)
|
||||
&& (totalItemCount - visibleItemCount) > 0) {
|
||||
// Almost reached the end, continue to load new photos
|
||||
if ((totalItemCount - visibleItemCount) > 0) {
|
||||
searchAndDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -636,7 +636,7 @@ public final class ThemeUtils {
|
|||
public static void setEditTextCursorColor(EditText editText, int color) {
|
||||
try {
|
||||
// Get the cursor resource id
|
||||
if (Build.VERSION.SDK_INT >= 28) {//set differently in Android P (API 28)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//set differently in Android P (API 28)
|
||||
Field field = TextView.class.getDeclaredField("mCursorDrawableRes");
|
||||
field.setAccessible(true);
|
||||
int drawableResId = field.getInt(editText);
|
||||
|
|
Loading…
Reference in a new issue