mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 02:53:09 +01:00
Update MissionsFragment.java
work-around for reading the current theme icons
This commit is contained in:
parent
9db272f30e
commit
684cb81974
@ -16,6 +16,7 @@ import android.support.annotation.DrawableRes;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -198,12 +199,20 @@ public class MissionsFragment extends Fragment {
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
private int getDrawableFromAttribute(@AttrRes int ic) {
|
||||
TypedArray styledAttributes = mContext.obtainStyledAttributes(new int[]{ic});
|
||||
int resId = styledAttributes.getResourceId(0, -1);
|
||||
private int getDrawableFromAttribute(@AttrRes int attr) {
|
||||
TypedArray styledAttributes = mContext.getTheme().obtainStyledAttributes(new int[]{attr});
|
||||
int resId = styledAttributes.getResourceId(0, 0);
|
||||
styledAttributes.recycle();
|
||||
|
||||
return resId;
|
||||
if (resId != 0) {
|
||||
return resId;
|
||||
} else {
|
||||
// work-around
|
||||
styledAttributes = mContext.obtainStyledAttributes(new int[]{attr});
|
||||
resId = styledAttributes.getResourceId(0, 0);
|
||||
styledAttributes.recycle();
|
||||
return resId;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user