remove all traces of theme helper library
This commit is contained in:
parent
7fbb5b85f8
commit
6daf166172
20 changed files with 62 additions and 50 deletions
|
|
@ -6,6 +6,7 @@ import android.content.res.TypedArray;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import androidx.annotation.AttrRes;
|
||||
|
|
@ -13,10 +14,9 @@ import androidx.annotation.ColorInt;
|
|||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.kabouzeid.appthemehelper.util.TintHelper;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public class ImageUtil {
|
||||
|
|
@ -90,12 +90,13 @@ public class ImageUtil {
|
|||
return ResourcesCompat.getDrawable(res, resId, theme);
|
||||
}
|
||||
|
||||
public static Drawable getTintedVectorDrawable(@NonNull Resources res, @DrawableRes int resId, @Nullable Resources.Theme theme, @ColorInt int color) {
|
||||
return TintHelper.createTintedDrawable(getVectorDrawable(res, resId, theme), color);
|
||||
}
|
||||
|
||||
public static Drawable getTintedVectorDrawable(@NonNull Context context, @DrawableRes int resId, @ColorInt int color) {
|
||||
return TintHelper.createTintedDrawable(getVectorDrawable(context.getResources(), resId, context.getTheme()), color);
|
||||
Drawable drawable = getVectorDrawable(context.getResources(), resId, context.getTheme());
|
||||
|
||||
DrawableCompat.setTintMode(drawable, PorterDuff.Mode.SRC_IN);
|
||||
DrawableCompat.setTint(drawable, color);
|
||||
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public static Drawable getVectorDrawable(@NonNull Context context, @DrawableRes int resId) {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,15 @@ public class NavigationUtil {
|
|||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
// TODO investigate why the normal recreate method wont work
|
||||
// initial recreate is fine but subsequent runs will incorrectly apply the light theme on main
|
||||
public static void recreateMain(Activity activity) {
|
||||
NavigationUtil.startMain(activity);
|
||||
|
||||
activity.overridePendingTransition(0, android.R.anim.fade_out);
|
||||
activity.finish();
|
||||
}
|
||||
|
||||
public static void startLogin(Context context) {
|
||||
final Intent intent = new Intent(context, LoginActivity.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,11 @@ public class ThemeUtil {
|
|||
return getSecondaryTextColor(context, MaterialColors.isColorLight(color));
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public static int getColorResource(Context context, int resource) {
|
||||
return getColorResource(context, resource, 255);
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public static int getColorResource(Context context, int resource, int alpha) {
|
||||
TypedArray array = context.obtainStyledAttributes(new int[]{resource});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue