Fix code formatting

This commit is contained in:
TobiGr 2019-11-23 20:04:40 +01:00
parent afef8d8d0b
commit 0fb7eab2f9
3 changed files with 17 additions and 17 deletions

View File

@ -99,7 +99,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
@Override @Override
public void setUserVisibleHint(boolean isVisibleToUser) { public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser); super.setUserVisibleHint(isVisibleToUser);
if(activity != null if (activity != null
&& useAsFrontPage && useAsFrontPage
&& isVisibleToUser) { && isVisibleToUser) {
setTitle(currentInfo != null ? currentInfo.getName() : name); setTitle(currentInfo != null ? currentInfo.getName() : name);
@ -153,7 +153,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
ActionBar supportActionBar = activity.getSupportActionBar(); ActionBar supportActionBar = activity.getSupportActionBar();
if(useAsFrontPage && supportActionBar != null) { if (useAsFrontPage && supportActionBar != null) {
supportActionBar.setDisplayHomeAsUpEnabled(false); supportActionBar.setDisplayHomeAsUpEnabled(false);
} else { } else {
inflater.inflate(R.menu.menu_channel, menu); inflater.inflate(R.menu.menu_channel, menu);
@ -166,7 +166,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
private void openRssFeed() { private void openRssFeed() {
final ChannelInfo info = currentInfo; final ChannelInfo info = currentInfo;
if(info != null) { if (info != null) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(info.getFeedUrl())); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(info.getFeedUrl()));
startActivity(intent); startActivity(intent);
} }
@ -219,7 +219,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
.debounce(100, TimeUnit.MILLISECONDS) .debounce(100, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe((List<SubscriptionEntity> subscriptionEntities) -> .subscribe((List<SubscriptionEntity> subscriptionEntities) ->
updateSubscribeButton(!subscriptionEntities.isEmpty()) updateSubscribeButton(!subscriptionEntities.isEmpty())
, onError)); , onError));
} }
@ -360,9 +360,9 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
headerRootLayout.setVisibility(View.VISIBLE); headerRootLayout.setVisibility(View.VISIBLE);
imageLoader.displayImage(result.getBannerUrl(), headerChannelBanner, imageLoader.displayImage(result.getBannerUrl(), headerChannelBanner,
ImageDisplayConstants.DISPLAY_BANNER_OPTIONS); ImageDisplayConstants.DISPLAY_BANNER_OPTIONS);
imageLoader.displayImage(result.getAvatarUrl(), headerAvatarView, imageLoader.displayImage(result.getAvatarUrl(), headerAvatarView,
ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS);
headerSubscribersTextView.setVisibility(View.VISIBLE); headerSubscribersTextView.setVisibility(View.VISIBLE);
if (result.getSubscriberCount() >= 0) { if (result.getSubscriberCount() >= 0) {
@ -398,8 +398,8 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
private PlayQueue getPlayQueue(final int index) { private PlayQueue getPlayQueue(final int index) {
final List<StreamInfoItem> streamItems = new ArrayList<>(); final List<StreamInfoItem> streamItems = new ArrayList<>();
for(InfoItem i : infoListAdapter.getItemsList()) { for (InfoItem i : infoListAdapter.getItemsList()) {
if(i instanceof StreamInfoItem) { if (i instanceof StreamInfoItem) {
streamItems.add((StreamInfoItem) i); streamItems.add((StreamInfoItem) i);
} }
} }
@ -433,9 +433,9 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
protected boolean onError(Throwable exception) { protected boolean onError(Throwable exception) {
if (super.onError(exception)) return true; if (super.onError(exception)) return true;
if(exception instanceof ContentNotAvailableException){ if (exception instanceof ContentNotAvailableException) {
showError(getString(R.string.content_not_available), false); showError(getString(R.string.content_not_available), false);
}else{ } else {
int errorId = exception instanceof ExtractionException ? R.string.parsing_error : R.string.general_error; int errorId = exception instanceof ExtractionException ? R.string.parsing_error : R.string.general_error;
onUnrecoverableError(exception, onUnrecoverableError(exception,
UserAction.REQUESTED_CHANNEL, UserAction.REQUESTED_CHANNEL,

View File

@ -37,7 +37,7 @@ public class ServiceHelper {
} }
public static String getTranslatedFilterString(String filter, Context c) { public static String getTranslatedFilterString(String filter, Context c) {
switch(filter) { switch (filter) {
case "all": return c.getString(R.string.all); case "all": return c.getString(R.string.all);
case "videos": return c.getString(R.string.videos); case "videos": return c.getString(R.string.videos);
case "channels": return c.getString(R.string.channels); case "channels": return c.getString(R.string.channels);
@ -130,14 +130,14 @@ public class ServiceHelper {
} }
public static boolean isBeta(final StreamingService s) { public static boolean isBeta(final StreamingService s) {
switch(s.getServiceInfo().getName()) { switch (s.getServiceInfo().getName()) {
case "YouTube": return false; case "YouTube": return false;
default: return true; default: return true;
} }
} }
public static void initService(Context context, int serviceId) { public static void initService(Context context, int serviceId) {
if(serviceId == ServiceList.PeerTube.getServiceId()){ if (serviceId == ServiceList.PeerTube.getServiceId()) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
String peerTubeInstanceUrl = sharedPreferences.getString(context.getString(R.string.peertube_instance_url_key), ServiceList.PeerTube.getBaseUrl()); String peerTubeInstanceUrl = sharedPreferences.getString(context.getString(R.string.peertube_instance_url_key), ServiceList.PeerTube.getBaseUrl());
String peerTubeInstanceName = sharedPreferences.getString(context.getString(R.string.peertube_instance_name_key), ServiceList.PeerTube.getServiceInfo().getName()); String peerTubeInstanceName = sharedPreferences.getString(context.getString(R.string.peertube_instance_name_key), ServiceList.PeerTube.getServiceInfo().getName());
@ -146,8 +146,8 @@ public class ServiceHelper {
} }
} }
public static void initServices(Context context){ public static void initServices(Context context) {
for(StreamingService s : ServiceList.all()){ for (StreamingService s : ServiceList.all()) {
initService(context, s.getServiceId()); initService(context, s.getServiceId());
} }
} }

View File

@ -137,10 +137,10 @@ public class ThemeHelper {
else if (selectedTheme.equals(blackTheme)) themeName = "BlackTheme"; else if (selectedTheme.equals(blackTheme)) themeName = "BlackTheme";
else if (selectedTheme.equals(darkTheme)) themeName = "DarkTheme"; else if (selectedTheme.equals(darkTheme)) themeName = "DarkTheme";
if(serviceId == ServiceList.PeerTube.getServiceId()){ if (serviceId == ServiceList.PeerTube.getServiceId()) {
//service name for peertube depends on the instance //service name for peertube depends on the instance
themeName += ".PeerTube"; themeName += ".PeerTube";
}else{ } else {
themeName += "." + service.getServiceInfo().getName(); themeName += "." + service.getServiceInfo().getName();
} }