some bug fixes
This commit is contained in:
parent
a429df0604
commit
e19cf92a79
|
|
@ -104,12 +104,12 @@ public abstract class AbstractBaseFragment<TViewController extends AbstractBaseF
|
|||
|
||||
/* Raises when device back button pressed */
|
||||
public boolean onBackPressed() {
|
||||
return UiUtils.tryForeachFragment(getFragmentManager(), AbstractBaseFragment::onBackPressed);
|
||||
return UiUtils.tryForeachFragment(getChildFragmentManager(), AbstractBaseFragment::onBackPressed);
|
||||
}
|
||||
|
||||
/* Raises when ActionBar home button pressed */
|
||||
public boolean onHomePressed() {
|
||||
return UiUtils.tryForeachFragment(getFragmentManager(), AbstractBaseFragment::onHomePressed);
|
||||
return UiUtils.tryForeachFragment(getChildFragmentManager(), AbstractBaseFragment::onHomePressed);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
package org.roboswag.components.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
|
@ -40,6 +45,24 @@ public final class UiUtils {
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static int getColor(@NonNull final Context context, @ColorRes final int colorResId) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
return context.getResources().getColor(colorResId, context.getTheme());
|
||||
} else {
|
||||
return context.getResources().getColor(colorResId);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Drawable getDrawable(@NonNull final Context context, @DrawableRes final int drawableResId) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
return context.getResources().getDrawable(drawableResId, context.getTheme());
|
||||
} else {
|
||||
return context.getResources().getDrawable(drawableResId);
|
||||
}
|
||||
}
|
||||
|
||||
private UiUtils() {
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue