1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-26 10:00:39 +00:00

Tab icons now work correctly in bright theme

This commit is contained in:
Somethingweirdhere 2018-06-11 21:10:51 +02:00
parent dc1896e3f5
commit f1c9dcfb10

View File

@ -1,5 +1,6 @@
package org.schabi.newpipe.fragments; package org.schabi.newpipe.fragments;
import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -167,8 +168,9 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
String tabNumber = tabs.get(i); String tabNumber = tabs.get(i);
TabLayout.Tab tabToSet = tabLayout.getTabAt(i); TabLayout.Tab tabToSet = tabLayout.getTabAt(i);
Context c = getContext();
if (tabToSet != null) { if (tabToSet != null && c != null) {
if (tabNumber.startsWith("1\t")) { if (tabNumber.startsWith("1\t")) {
String kiosk[] = tabNumber.split("\t"); String kiosk[] = tabNumber.split("\t");
@ -180,23 +182,23 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
} }
} }
} else if (tabNumber.startsWith("6\t")) { } else if (tabNumber.startsWith("6\t")) {
tabToSet.setIcon(R.drawable.ic_channel_white_24dp); tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_channel));
} else { } else {
switch (tabNumber) { switch (tabNumber) {
case "0": case "0":
tabToSet.setIcon(R.drawable.ic_whatshot_white_24dp); tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_hot));
break; break;
case "2": case "2":
tabToSet.setIcon(R.drawable.ic_channel_white_24dp); tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_channel));
break; break;
case "3": case "3":
tabToSet.setIcon(R.drawable.ic_rss_feed_white_24dp); tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.rss));
break; break;
case "4": case "4":
tabToSet.setIcon(R.drawable.ic_bookmark_white_24dp); tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_bookmark));
break; break;
case "5": case "5":
tabToSet.setIcon(R.drawable.ic_history_white_24dp); tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.history));
break; break;
} }
} }