1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-25 17:40:33 +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;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.NonNull;
@ -167,8 +168,9 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
String tabNumber = tabs.get(i);
TabLayout.Tab tabToSet = tabLayout.getTabAt(i);
Context c = getContext();
if (tabToSet != null) {
if (tabToSet != null && c != null) {
if (tabNumber.startsWith("1\t")) {
String kiosk[] = tabNumber.split("\t");
@ -180,23 +182,23 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
}
}
} else if (tabNumber.startsWith("6\t")) {
tabToSet.setIcon(R.drawable.ic_channel_white_24dp);
tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_channel));
} else {
switch (tabNumber) {
case "0":
tabToSet.setIcon(R.drawable.ic_whatshot_white_24dp);
tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_hot));
break;
case "2":
tabToSet.setIcon(R.drawable.ic_channel_white_24dp);
tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_channel));
break;
case "3":
tabToSet.setIcon(R.drawable.ic_rss_feed_white_24dp);
tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.rss));
break;
case "4":
tabToSet.setIcon(R.drawable.ic_bookmark_white_24dp);
tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.ic_bookmark));
break;
case "5":
tabToSet.setIcon(R.drawable.ic_history_white_24dp);
tabToSet.setIcon(ThemeHelper.resolveResourceIdFromAttr(getContext(), R.attr.history));
break;
}
}