mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 06:15:12 +00:00
More refactoring
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
507f9909fa
commit
89352e902d
@ -43,7 +43,7 @@ import com.nextcloud.talk.controllers.base.BaseController;
|
|||||||
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
||||||
import com.nextcloud.talk.persistence.entities.UserEntity;
|
import com.nextcloud.talk.persistence.entities.UserEntity;
|
||||||
import com.nextcloud.talk.utils.ApplicationWideMessageHolder;
|
import com.nextcloud.talk.utils.ApplicationWideMessageHolder;
|
||||||
import com.nextcloud.talk.utils.ColorUtils;
|
import com.nextcloud.talk.utils.DisplayUtils;
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||||
|
|
||||||
@ -199,10 +199,10 @@ public class OperationsMenuController extends BaseController {
|
|||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (everythingOK) {
|
if (everythingOK) {
|
||||||
resultImageView.setImageDrawable(ColorUtils.getTintedDrawable(getResources(), R.drawable
|
resultImageView.setImageDrawable(DisplayUtils.getTintedDrawable(getResources(), R.drawable
|
||||||
.ic_check_circle_black_24dp, R.color.nc_darkGreen));
|
.ic_check_circle_black_24dp, R.color.nc_darkGreen));
|
||||||
} else {
|
} else {
|
||||||
resultImageView.setImageDrawable(ColorUtils.getTintedDrawable(getResources(), R.drawable
|
resultImageView.setImageDrawable(DisplayUtils.getTintedDrawable(getResources(), R.drawable
|
||||||
.ic_cancel_black_24dp, R.color.nc_darkRed));
|
.ic_cancel_black_24dp, R.color.nc_darkRed));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ public class OperationsMenuController extends BaseController {
|
|||||||
if (everythingOK) {
|
if (everythingOK) {
|
||||||
eventBus.post(new BottomSheetLockEvent(true, 2500, true, true));
|
eventBus.post(new BottomSheetLockEvent(true, 2500, true, true));
|
||||||
} else {
|
} else {
|
||||||
resultImageView.setImageDrawable(ColorUtils.getTintedDrawable(getResources(), R.drawable
|
resultImageView.setImageDrawable(DisplayUtils.getTintedDrawable(getResources(), R.drawable
|
||||||
.ic_cancel_black_24dp, R.color.nc_darkRed));
|
.ic_cancel_black_24dp, R.color.nc_darkRed));
|
||||||
okButton.setOnClickListener(v -> eventBus.post(new BottomSheetLockEvent(true, 0, operationCode != 99,
|
okButton.setOnClickListener(v -> eventBus.post(new BottomSheetLockEvent(true, 0, operationCode != 99,
|
||||||
true)));
|
true)));
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Nextcloud Talk application
|
|
||||||
*
|
|
||||||
* @author Mario Danic
|
|
||||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.nextcloud.talk.utils;
|
|
||||||
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.support.annotation.ColorRes;
|
|
||||||
import android.support.annotation.DrawableRes;
|
|
||||||
|
|
||||||
public class ColorUtils {
|
|
||||||
public static Drawable getTintedDrawable(Resources res, @DrawableRes int drawableResId, @ColorRes int colorResId) {
|
|
||||||
Drawable drawable = res.getDrawable(drawableResId);
|
|
||||||
int color = res.getColor(colorResId);
|
|
||||||
drawable.setTint(color);
|
|
||||||
return drawable;
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,7 +23,10 @@ package com.nextcloud.talk.utils;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.support.annotation.ColorRes;
|
||||||
|
import android.support.annotation.DrawableRes;
|
||||||
import android.support.v7.widget.AppCompatDrawableManager;
|
import android.support.v7.widget.AppCompatDrawableManager;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -66,4 +69,10 @@ public class DisplayUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Drawable getTintedDrawable(Resources res, @DrawableRes int drawableResId, @ColorRes int colorResId) {
|
||||||
|
Drawable drawable = res.getDrawable(drawableResId);
|
||||||
|
int color = res.getColor(colorResId);
|
||||||
|
drawable.setTint(color);
|
||||||
|
return drawable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ public class UserUtils {
|
|||||||
|
|
||||||
UserUtils(ReactiveEntityStore<Persistable> dataStore) {
|
UserUtils(ReactiveEntityStore<Persistable> dataStore) {
|
||||||
this.dataStore = dataStore;
|
this.dataStore = dataStore;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean anyUserExists() {
|
public boolean anyUserExists() {
|
||||||
|
Loading…
Reference in New Issue
Block a user