mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Fix some spotbugs stuff
Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
56584c06e6
commit
3ff35d46e6
7 changed files with 27 additions and 65 deletions
|
@ -97,18 +97,14 @@ class MediaFoldersDetectionWork constructor(
|
|||
1,
|
||||
null,
|
||||
true,
|
||||
themeColorUtils,
|
||||
themeSnackbarUtils,
|
||||
themeButtonUtils
|
||||
themeSnackbarUtils
|
||||
)
|
||||
val videoMediaFolders = MediaProvider.getVideoFolders(
|
||||
contentResolver,
|
||||
1,
|
||||
null,
|
||||
true,
|
||||
themeColorUtils,
|
||||
themeSnackbarUtils,
|
||||
themeButtonUtils
|
||||
themeSnackbarUtils
|
||||
)
|
||||
val imageMediaFolderPaths: MutableList<String> = ArrayList()
|
||||
val videoMediaFolderPaths: MutableList<String> = ArrayList()
|
||||
|
|
|
@ -77,8 +77,6 @@ import com.owncloud.android.utils.FilesSyncHelper;
|
|||
import com.owncloud.android.utils.PermissionUtil;
|
||||
import com.owncloud.android.utils.ReceiversHelper;
|
||||
import com.owncloud.android.utils.SecurityUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeButtonUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
|
||||
|
||||
import org.conscrypt.Conscrypt;
|
||||
|
@ -175,10 +173,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
@Inject
|
||||
PassCodeManager passCodeManager;
|
||||
|
||||
@Inject ThemeColorUtils themeColorUtils;
|
||||
|
||||
@Inject ThemeSnackbarUtils themeSnackbarUtils;
|
||||
@Inject ThemeButtonUtils themeButtonUtils;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private boolean mBound;
|
||||
|
@ -299,9 +294,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
powerManagementService,
|
||||
backgroundJobManager,
|
||||
clock,
|
||||
themeColorUtils,
|
||||
themeSnackbarUtils,
|
||||
themeButtonUtils);
|
||||
themeSnackbarUtils);
|
||||
initContactsBackup(accountManager, backgroundJobManager);
|
||||
notificationChannels();
|
||||
|
||||
|
@ -460,9 +453,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
final PowerManagementService powerManagementService,
|
||||
final BackgroundJobManager backgroundJobManager,
|
||||
final Clock clock,
|
||||
final ThemeColorUtils themeColorUtils,
|
||||
final ThemeSnackbarUtils themeSnackbarUtils,
|
||||
final ThemeButtonUtils themeButtonUtils
|
||||
final ThemeSnackbarUtils themeSnackbarUtils
|
||||
) {
|
||||
updateToAutoUpload();
|
||||
cleanOldEntries(clock);
|
||||
|
@ -470,7 +461,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
|
||||
if (getAppContext() != null) {
|
||||
if (PermissionUtil.checkExternalStoragePermission(getAppContext())) {
|
||||
splitOutAutoUploadEntries(clock, themeColorUtils, themeSnackbarUtils, themeButtonUtils);
|
||||
splitOutAutoUploadEntries(clock, themeSnackbarUtils);
|
||||
} else {
|
||||
preferences.setAutoUploadSplitEntriesEnabled(true);
|
||||
}
|
||||
|
@ -693,9 +684,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
}
|
||||
|
||||
private static void splitOutAutoUploadEntries(Clock clock,
|
||||
ThemeColorUtils themeColorUtils,
|
||||
ThemeSnackbarUtils themeSnackbarUtils,
|
||||
ThemeButtonUtils themeButtonUtils) {
|
||||
ThemeSnackbarUtils themeSnackbarUtils) {
|
||||
Context context = getAppContext();
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
if (!preferences.isAutoUploadSplitEntriesEnabled()) {
|
||||
|
@ -710,16 +699,12 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
1,
|
||||
null,
|
||||
true,
|
||||
themeColorUtils,
|
||||
themeSnackbarUtils,
|
||||
themeButtonUtils);
|
||||
themeSnackbarUtils);
|
||||
final List<MediaFolder> videoMediaFolders = MediaProvider.getVideoFolders(contentResolver,
|
||||
1,
|
||||
null,
|
||||
true,
|
||||
themeColorUtils,
|
||||
themeSnackbarUtils,
|
||||
themeButtonUtils);
|
||||
themeSnackbarUtils);
|
||||
|
||||
ArrayList<Long> idsToDelete = new ArrayList<>();
|
||||
List<SyncedFolder> syncedFolders = syncedFolderProvider.getSyncedFolders();
|
||||
|
|
|
@ -76,11 +76,9 @@ public final class MediaProvider {
|
|||
int itemLimit,
|
||||
@Nullable final AppCompatActivity activity,
|
||||
boolean getWithoutActivity,
|
||||
ThemeColorUtils themeColorUtils,
|
||||
ThemeSnackbarUtils themeSnackbarUtils,
|
||||
ThemeButtonUtils themeButtonUtils) {
|
||||
ThemeSnackbarUtils themeSnackbarUtils) {
|
||||
// check permissions
|
||||
checkPermissions(activity, themeColorUtils, themeSnackbarUtils, themeButtonUtils);
|
||||
checkPermissions(activity, themeSnackbarUtils);
|
||||
|
||||
// query media/image folders
|
||||
Cursor cursorFolders = null;
|
||||
|
@ -178,9 +176,7 @@ public final class MediaProvider {
|
|||
}
|
||||
|
||||
private static void checkPermissions(@Nullable AppCompatActivity activity,
|
||||
ThemeColorUtils themeColorUtils,
|
||||
ThemeSnackbarUtils themeSnackbarUtils,
|
||||
ThemeButtonUtils themeButtonUtils) {
|
||||
ThemeSnackbarUtils themeSnackbarUtils) {
|
||||
if (activity != null &&
|
||||
!PermissionUtil.checkExternalStoragePermission(activity.getApplicationContext())) {
|
||||
PermissionUtil.requestExternalStoragePermission(activity, themeSnackbarUtils, true);
|
||||
|
@ -191,11 +187,9 @@ public final class MediaProvider {
|
|||
int itemLimit,
|
||||
@Nullable final AppCompatActivity activity,
|
||||
boolean getWithoutActivity,
|
||||
ThemeColorUtils themeColorUtils,
|
||||
ThemeSnackbarUtils themeSnackbarUtils,
|
||||
ThemeButtonUtils themeButtonUtils) {
|
||||
ThemeSnackbarUtils themeSnackbarUtils) {
|
||||
// check permissions
|
||||
checkPermissions(activity, themeColorUtils, themeSnackbarUtils, themeButtonUtils);
|
||||
checkPermissions(activity, themeSnackbarUtils);
|
||||
|
||||
// query media/image folders
|
||||
Cursor cursorFolders = null;
|
||||
|
|
|
@ -60,9 +60,7 @@ public class BootupBroadcastReceiver extends BroadcastReceiver {
|
|||
@Inject PowerManagementService powerManagementService;
|
||||
@Inject BackgroundJobManager backgroundJobManager;
|
||||
@Inject Clock clock;
|
||||
@Inject ThemeColorUtils themeColorUtils;
|
||||
@Inject ThemeSnackbarUtils themeSnackbarUtils;
|
||||
@Inject ThemeButtonUtils themeButtonUtils;
|
||||
|
||||
/**
|
||||
* Receives broadcast intent reporting that the system was just boot up. *
|
||||
|
@ -82,9 +80,7 @@ public class BootupBroadcastReceiver extends BroadcastReceiver {
|
|||
powerManagementService,
|
||||
backgroundJobManager,
|
||||
clock,
|
||||
themeColorUtils,
|
||||
themeSnackbarUtils,
|
||||
themeButtonUtils);
|
||||
themeSnackbarUtils);
|
||||
MainApp.initContactsBackup(accountManager, backgroundJobManager);
|
||||
} else {
|
||||
Log_OC.d(TAG, "Getting wrong intent: " + intent.getAction());
|
||||
|
|
|
@ -290,9 +290,7 @@ class SyncedFoldersActivity :
|
|||
perFolderMediaItemLimit,
|
||||
this@SyncedFoldersActivity,
|
||||
false,
|
||||
themeColorUtils,
|
||||
themeSnackbarUtils,
|
||||
themeButtonUtils
|
||||
themeSnackbarUtils
|
||||
)
|
||||
mediaFolders.addAll(
|
||||
MediaProvider.getVideoFolders(
|
||||
|
@ -300,9 +298,7 @@ class SyncedFoldersActivity :
|
|||
perFolderMediaItemLimit,
|
||||
this@SyncedFoldersActivity,
|
||||
false,
|
||||
themeColorUtils,
|
||||
themeSnackbarUtils,
|
||||
themeButtonUtils
|
||||
themeSnackbarUtils
|
||||
)
|
||||
)
|
||||
val syncedFolderArrayList = syncedFolderProvider.syncedFolders
|
||||
|
|
|
@ -19,25 +19,19 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.fragment.contactsbackup
|
||||
|
||||
package com.owncloud.android.ui.fragment.contactsbackup;
|
||||
import android.view.View
|
||||
import com.afollestad.sectionedrecyclerview.SectionedViewHolder
|
||||
import com.owncloud.android.databinding.ContactlistListItemBinding
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.afollestad.sectionedrecyclerview.SectionedViewHolder;
|
||||
import com.owncloud.android.databinding.ContactlistListItemBinding;
|
||||
|
||||
public class ContactItemViewHolder extends SectionedViewHolder {
|
||||
public ContactlistListItemBinding binding;
|
||||
|
||||
ContactItemViewHolder(ContactlistListItemBinding binding) {
|
||||
super(binding.getRoot());
|
||||
|
||||
this.binding = binding;
|
||||
binding.getRoot().setTag(this);
|
||||
class ContactItemViewHolder internal constructor(var binding: ContactlistListItemBinding) :
|
||||
SectionedViewHolder(binding.root) {
|
||||
init {
|
||||
binding.root.tag = this
|
||||
}
|
||||
|
||||
public void setVCardListener(View.OnClickListener onClickListener) {
|
||||
itemView.setOnClickListener(onClickListener);
|
||||
fun setVCardListener(onClickListener: View.OnClickListener?) {
|
||||
itemView.setOnClickListener(onClickListener)
|
||||
}
|
||||
}
|
|
@ -170,6 +170,7 @@ object PermissionUtil {
|
|||
.setAction(R.string.common_ok) {
|
||||
doRequest()
|
||||
}
|
||||
.also { themeSnackbarUtils.colorSnackbar(activity, it) }
|
||||
.show()
|
||||
} else {
|
||||
// No explanation needed, request the permission.
|
||||
|
|
Loading…
Reference in a new issue