Merge branch 'working' into 'develop'

add polls category to notification tab

See merge request tom79/mastalab!2153
This commit is contained in:
Thomas 2019-04-19 14:44:45 +00:00
commit 22df7fedec
3 changed files with 35 additions and 1 deletions

View File

@ -2426,15 +2426,25 @@ public class API {
parameters.append("exclude_types[]=").append("follow").append("&"); parameters.append("exclude_types[]=").append("follow").append("&");
parameters.append("exclude_types[]=").append("favourite").append("&"); parameters.append("exclude_types[]=").append("favourite").append("&");
parameters.append("exclude_types[]=").append("reblog").append("&"); parameters.append("exclude_types[]=").append("reblog").append("&");
parameters.append("exclude_types[]=").append("poll").append("&");
parameters = new StringBuilder(parameters.substring(0, parameters.length() - 1).substring(16)); parameters = new StringBuilder(parameters.substring(0, parameters.length() - 1).substring(16));
params.put("exclude_types[]", parameters.toString()); params.put("exclude_types[]", parameters.toString());
}else if(type == DisplayNotificationsFragment.Type.FAVORITE){ }else if(type == DisplayNotificationsFragment.Type.FAVORITE){
parameters.append("exclude_types[]=").append("follow").append("&"); parameters.append("exclude_types[]=").append("follow").append("&");
parameters.append("exclude_types[]=").append("mention").append("&"); parameters.append("exclude_types[]=").append("mention").append("&");
parameters.append("exclude_types[]=").append("reblog").append("&"); parameters.append("exclude_types[]=").append("reblog").append("&");
parameters.append("exclude_types[]=").append("poll").append("&");
parameters = new StringBuilder(parameters.substring(0, parameters.length() - 1).substring(16)); parameters = new StringBuilder(parameters.substring(0, parameters.length() - 1).substring(16));
params.put("exclude_types[]", parameters.toString()); params.put("exclude_types[]", parameters.toString());
}else if(type == DisplayNotificationsFragment.Type.BOOST){ }else if(type == DisplayNotificationsFragment.Type.BOOST){
parameters.append("exclude_types[]=").append("follow").append("&");
parameters.append("exclude_types[]=").append("mention").append("&");
parameters.append("exclude_types[]=").append("favourite").append("&");
parameters.append("exclude_types[]=").append("poll").append("&");
parameters = new StringBuilder(parameters.substring(0, parameters.length() - 1).substring(16));
params.put("exclude_types[]", parameters.toString());
}else if(type == DisplayNotificationsFragment.Type.POOL){
parameters.append("exclude_types[]=").append("reblog").append("&");
parameters.append("exclude_types[]=").append("follow").append("&"); parameters.append("exclude_types[]=").append("follow").append("&");
parameters.append("exclude_types[]=").append("mention").append("&"); parameters.append("exclude_types[]=").append("mention").append("&");
parameters.append("exclude_types[]=").append("favourite").append("&"); parameters.append("exclude_types[]=").append("favourite").append("&");
@ -2444,6 +2454,7 @@ public class API {
parameters.append("exclude_types[]=").append("reblog").append("&"); parameters.append("exclude_types[]=").append("reblog").append("&");
parameters.append("exclude_types[]=").append("mention").append("&"); parameters.append("exclude_types[]=").append("mention").append("&");
parameters.append("exclude_types[]=").append("favourite").append("&"); parameters.append("exclude_types[]=").append("favourite").append("&");
parameters.append("exclude_types[]=").append("poll").append("&");
parameters = new StringBuilder(parameters.substring(0, parameters.length() - 1).substring(16)); parameters = new StringBuilder(parameters.substring(0, parameters.length() - 1).substring(16));
params.put("exclude_types[]", parameters.toString()); params.put("exclude_types[]", parameters.toString());
} }

View File

@ -90,6 +90,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
MENTION, MENTION,
FAVORITE, FAVORITE,
BOOST, BOOST,
POOL,
FOLLOW FOLLOW
} }

View File

@ -65,6 +65,7 @@ public class TabLayoutNotificationsFragment extends Fragment {
TabLayout.Tab tabMention = tabLayout.newTab(); TabLayout.Tab tabMention = tabLayout.newTab();
TabLayout.Tab tabFav = tabLayout.newTab(); TabLayout.Tab tabFav = tabLayout.newTab();
TabLayout.Tab tabBoost = tabLayout.newTab(); TabLayout.Tab tabBoost = tabLayout.newTab();
TabLayout.Tab tabPoll = tabLayout.newTab();
TabLayout.Tab tabFollow = tabLayout.newTab(); TabLayout.Tab tabFollow = tabLayout.newTab();
tabMention.setCustomView(R.layout.tab_badge); tabMention.setCustomView(R.layout.tab_badge);
@ -72,6 +73,8 @@ public class TabLayoutNotificationsFragment extends Fragment {
tabFav.setCustomView(R.layout.tab_badge); tabFav.setCustomView(R.layout.tab_badge);
if(MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) if(MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
tabBoost.setCustomView(R.layout.tab_badge); tabBoost.setCustomView(R.layout.tab_badge);
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
tabPoll.setCustomView(R.layout.tab_badge);
tabFollow.setCustomView(R.layout.tab_badge); tabFollow.setCustomView(R.layout.tab_badge);
@ -96,6 +99,13 @@ public class TabLayoutNotificationsFragment extends Fragment {
iconBoost = tabBoost.getCustomView().findViewById(R.id.tab_icon); iconBoost = tabBoost.getCustomView().findViewById(R.id.tab_icon);
iconBoost.setImageResource(R.drawable.ic_repeat_notif_tab); iconBoost.setImageResource(R.drawable.ic_repeat_notif_tab);
} }
ImageView iconPoll =null;
if( tabPoll.getCustomView() != null) {
iconPoll = tabPoll.getCustomView().findViewById(R.id.tab_icon);
iconPoll.setImageResource(R.drawable.ic_view_list_poll_notif);
}
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId") @SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
ImageView iconFollow = tabFollow.getCustomView().findViewById(R.id.tab_icon); ImageView iconFollow = tabFollow.getCustomView().findViewById(R.id.tab_icon);
iconFollow.setImageResource(R.drawable.ic_follow_notif_tab); iconFollow.setImageResource(R.drawable.ic_follow_notif_tab);
@ -107,6 +117,8 @@ public class TabLayoutNotificationsFragment extends Fragment {
tabLayout.addTab(tabFav); tabLayout.addTab(tabFav);
if( tabBoost.getCustomView() != null) if( tabBoost.getCustomView() != null)
tabLayout.addTab(tabBoost); tabLayout.addTab(tabBoost);
if( tabPoll.getCustomView() != null)
tabLayout.addTab(tabPoll);
tabLayout.addTab(tabFollow); tabLayout.addTab(tabFollow);
if (theme == THEME_BLACK) if (theme == THEME_BLACK)
@ -120,6 +132,8 @@ public class TabLayoutNotificationsFragment extends Fragment {
iconFav.setColorFilter(ContextCompat.getColor(context, R.color.action_light_header), PorterDuff.Mode.SRC_IN); iconFav.setColorFilter(ContextCompat.getColor(context, R.color.action_light_header), PorterDuff.Mode.SRC_IN);
if( iconBoost != null) if( iconBoost != null)
iconBoost.setColorFilter(ContextCompat.getColor(context, R.color.action_light_header), PorterDuff.Mode.SRC_IN); iconBoost.setColorFilter(ContextCompat.getColor(context, R.color.action_light_header), PorterDuff.Mode.SRC_IN);
if( iconPoll != null)
iconPoll.setColorFilter(ContextCompat.getColor(context, R.color.action_light_header), PorterDuff.Mode.SRC_IN);
iconFollow.setColorFilter(ContextCompat.getColor(context, R.color.action_light_header), PorterDuff.Mode.SRC_IN); iconFollow.setColorFilter(ContextCompat.getColor(context, R.color.action_light_header), PorterDuff.Mode.SRC_IN);
} else { } else {
iconMention.setColorFilter(ContextCompat.getColor(context, R.color.dark_text), PorterDuff.Mode.SRC_IN); iconMention.setColorFilter(ContextCompat.getColor(context, R.color.dark_text), PorterDuff.Mode.SRC_IN);
@ -127,6 +141,8 @@ public class TabLayoutNotificationsFragment extends Fragment {
iconFav.setColorFilter(ContextCompat.getColor(context, R.color.dark_text), PorterDuff.Mode.SRC_IN); iconFav.setColorFilter(ContextCompat.getColor(context, R.color.dark_text), PorterDuff.Mode.SRC_IN);
if( iconBoost != null) if( iconBoost != null)
iconBoost.setColorFilter(ContextCompat.getColor(context, R.color.dark_text), PorterDuff.Mode.SRC_IN); iconBoost.setColorFilter(ContextCompat.getColor(context, R.color.dark_text), PorterDuff.Mode.SRC_IN);
if( iconPoll != null)
iconPoll.setColorFilter(ContextCompat.getColor(context, R.color.dark_text), PorterDuff.Mode.SRC_IN);
iconFollow.setColorFilter(ContextCompat.getColor(context, R.color.dark_text), PorterDuff.Mode.SRC_IN); iconFollow.setColorFilter(ContextCompat.getColor(context, R.color.dark_text), PorterDuff.Mode.SRC_IN);
} }
@ -207,8 +223,14 @@ public class TabLayoutNotificationsFragment extends Fragment {
type = DisplayNotificationsFragment.Type.BOOST; type = DisplayNotificationsFragment.Type.BOOST;
break; break;
case 4: case 4:
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
type = DisplayNotificationsFragment.Type.POOL;
else
type = DisplayNotificationsFragment.Type.FOLLOW; type = DisplayNotificationsFragment.Type.FOLLOW;
break; break;
case 5:
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
type = DisplayNotificationsFragment.Type.FOLLOW;
default: default:
break; break;