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.GridLayoutManager;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@ -198,12 +199,20 @@ public class MissionsFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
private int getDrawableFromAttribute(@AttrRes int ic) {
|
private int getDrawableFromAttribute(@AttrRes int attr) {
|
||||||
TypedArray styledAttributes = mContext.obtainStyledAttributes(new int[]{ic});
|
TypedArray styledAttributes = mContext.getTheme().obtainStyledAttributes(new int[]{attr});
|
||||||
int resId = styledAttributes.getResourceId(0, -1);
|
int resId = styledAttributes.getResourceId(0, 0);
|
||||||
styledAttributes.recycle();
|
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
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user