fix: compilation problems
This commit is contained in:
parent
14175a9140
commit
1d445b8b27
|
@ -1,12 +1,14 @@
|
|||
package org.joinmastodon.android.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.joinmastodon.android.DomainManager;
|
||||
import org.joinmastodon.android.MainActivity;
|
||||
import org.joinmastodon.android.api.requests.timelines.GetPublicTimeline;
|
||||
import org.joinmastodon.android.model.Filter;
|
||||
import org.joinmastodon.android.model.Status;
|
||||
import org.joinmastodon.android.utils.ProvidesAssistContent;
|
||||
import org.joinmastodon.android.utils.StatusFilterPredicate;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,7 +16,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import me.grishka.appkit.api.SimpleCallback;
|
||||
|
||||
public class CustomLocalTimelineFragment extends StatusListFragment {
|
||||
public class CustomLocalTimelineFragment extends StatusListFragment implements ProvidesAssistContent.ProvidesWebUri {
|
||||
// private String name;
|
||||
private String domain;
|
||||
|
||||
|
@ -76,4 +78,9 @@ public class CustomLocalTimelineFragment extends StatusListFragment {
|
|||
protected Filter.FilterContext getFilterContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri getWebUri(Uri.Builder base) {
|
||||
return base.path("").build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,11 @@ public class FollowRequestsListFragment extends RecyclerFragment<FollowRequestsL
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollToTop(){
|
||||
smoothScrollRecyclerViewToTop(list);
|
||||
|
|
|
@ -72,6 +72,11 @@ public class FollowedHashtagsFragment extends RecyclerFragment<Hashtag> implemen
|
|||
return new HashtagsAdapter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollToTop() {
|
||||
smoothScrollRecyclerViewToTop(list);
|
||||
|
|
|
@ -21,6 +21,8 @@ import android.widget.LinearLayout;
|
|||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.joinmastodon.android.DomainManager;
|
||||
import org.joinmastodon.android.GlobalUserPreferences;
|
||||
import org.joinmastodon.android.MainActivity;
|
||||
|
|
|
@ -196,6 +196,11 @@ public class ListsFragment extends RecyclerFragment<ListTimeline> implements Scr
|
|||
return adapter = new ListsAdapter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollToTop() {
|
||||
smoothScrollRecyclerViewToTop(list);
|
||||
|
|
|
@ -1200,6 +1200,11 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollToTop(){
|
||||
getScrollableRecyclerView().scrollToPosition(0);
|
||||
|
|
|
@ -128,16 +128,16 @@ public class SettingsFragment extends MastodonToolbarFragment implements Provide
|
|||
popupMenu.setOnMenuItemClickListener(SettingsFragment.this::onColorPreferenceClick);
|
||||
b.setOnTouchListener(popupMenu.getDragToOpenListener());
|
||||
b.setOnClickListener(v->popupMenu.show());
|
||||
b.setText(switch(GlobalUserPreferences.color){
|
||||
case MATERIAL3 -> R.string.sk_color_palette_material3;
|
||||
case PINK -> R.string.sk_color_palette_pink;
|
||||
case PURPLE -> R.string.sk_color_palette_purple;
|
||||
case GREEN -> R.string.sk_color_palette_green;
|
||||
case BLUE -> R.string.sk_color_palette_blue;
|
||||
case BROWN -> R.string.sk_color_palette_brown;
|
||||
case RED -> R.string.sk_color_palette_red;
|
||||
case YELLOW -> R.string.sk_color_palette_yellow;
|
||||
});
|
||||
// b.setText(switch(GlobalUserPreferences.color){
|
||||
// case MATERIAL3 -> R.string.sk_color_palette_material3;
|
||||
// case PINK -> R.string.sk_color_palette_pink;
|
||||
// case PURPLE -> R.string.sk_color_palette_purple;
|
||||
// case GREEN -> R.string.sk_color_palette_green;
|
||||
// case BLUE -> R.string.sk_color_palette_blue;
|
||||
// case BROWN -> R.string.sk_color_palette_brown;
|
||||
// case RED -> R.string.sk_color_palette_red;
|
||||
// case YELLOW -> R.string.sk_color_palette_yellow;
|
||||
// });
|
||||
}));
|
||||
items.add(new ButtonItem(R.string.sk_settings_publish_button_text, R.drawable.ic_fluent_send_24_regular, b->{
|
||||
updatePublishText(b);
|
||||
|
@ -255,7 +255,7 @@ public class SettingsFragment extends MastodonToolbarFragment implements Provide
|
|||
if (list.findViewHolderForAdapterPosition(items.indexOf(showNewPostsItem)) instanceof SwitchViewHolder svh) svh.rebind();
|
||||
GlobalUserPreferences.save();
|
||||
}));
|
||||
items.add(showNewPostsItem = new SwitchItem(R.string.sk_settings_see_new_posts_button, R.drawable.ic_fluent_arrow_up_24_regular, GlobalUserPreferences.showNewPostsButton, i->{
|
||||
items.add(showNewPostsItem = new SwitchItem(R.string.sk_settings_show_new_posts_button, R.drawable.ic_fluent_arrow_up_24_regular, GlobalUserPreferences.showNewPostsButton, i->{
|
||||
GlobalUserPreferences.showNewPostsButton=i.checked;
|
||||
GlobalUserPreferences.save();
|
||||
}));
|
||||
|
@ -296,11 +296,11 @@ public class SettingsFragment extends MastodonToolbarFragment implements Provide
|
|||
needAppRestart=true;
|
||||
}));
|
||||
compactReblogReplyLineItem.enabled=GlobalUserPreferences.replyLineAboveHeader;
|
||||
items.add(new SwitchItem(R.string.sk_settings_translate_only_opened, R.drawable.ic_fluent_translate_24_regular, GlobalUserPreferences.translateButtonOpenedOnly, i->{
|
||||
GlobalUserPreferences.translateButtonOpenedOnly=i.checked;
|
||||
GlobalUserPreferences.save();
|
||||
needAppRestart=true;
|
||||
}));
|
||||
// items.add(new SwitchItem(R.string.sk_settings_translate_only_opened, R.drawable.ic_fluent_translate_24_regular, GlobalUserPreferences.translateButtonOpenedOnly, i->{
|
||||
//// GlobalUserPreferences.translateButtonOpenedOnly=i.checked;
|
||||
// GlobalUserPreferences.save();
|
||||
// needAppRestart=true;
|
||||
// }));
|
||||
boolean translationAvailable = instance
|
||||
.map(i -> i.v2 != null && i.v2.configuration.translation != null && i.v2.configuration.translation.enabled)
|
||||
.orElse(false);
|
||||
|
@ -722,7 +722,7 @@ public class SettingsFragment extends MastodonToolbarFragment implements Provide
|
|||
public void onSelfUpdateStateChanged(SelfUpdateStateChangedEvent ev){
|
||||
checkForUpdateItem.loading = ev.state == GithubSelfUpdater.UpdateState.CHECKING;
|
||||
if (list.findViewHolderForAdapterPosition(items.indexOf(checkForUpdateItem)) instanceof TextViewHolder tvh) tvh.rebind();
|
||||
|
||||
|
||||
UpdateItem updateItem = null;
|
||||
if(items.get(0) instanceof UpdateItem item0) {
|
||||
updateItem = item0;
|
||||
|
|
|
@ -119,7 +119,7 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist
|
|||
}
|
||||
for (int deleteThisItem : deleteTheseItems) itemsToModify.remove(deleteThisItem);
|
||||
if(s.id.equals(mainStatus.id)) {
|
||||
items.add(new ExtendedFooterStatusDisplayItem(s.id, this, s.getContentStatus()));
|
||||
items.add(new ExtendedFooterStatusDisplayItem(s.id, this, accountID, s.getContentStatus()));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,11 @@ public class FollowerListFragment extends AccountRelatedAccountListFragment{
|
|||
return new GetAccountFollowers(account.id, maxID, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HeaderPaginationRequest<Account> onCreateRemoteRequest(String id, String maxID, int count) {
|
||||
return new GetAccountFollowers(id, maxID, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri getWebUri(Uri.Builder base) {
|
||||
return super.getWebUri(base).buildUpon()
|
||||
|
|
|
@ -21,6 +21,11 @@ public class FollowingListFragment extends AccountRelatedAccountListFragment{
|
|||
return new GetAccountFollowing(account.id, maxID, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HeaderPaginationRequest<Account> onCreateRemoteRequest(String id, String maxID, int count) {
|
||||
return new GetAccountFollowing(id, maxID, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri getWebUri(Uri.Builder base) {
|
||||
return super.getWebUri(base).buildUpon()
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.joinmastodon.android.R;
|
|||
import org.joinmastodon.android.fragments.HomeFragment;
|
||||
import org.joinmastodon.android.fragments.IsOnTop;
|
||||
import org.joinmastodon.android.fragments.ScrollableToTop;
|
||||
import org.joinmastodon.android.fragments.ListTimelinesFragment;
|
||||
import org.joinmastodon.android.ui.SimpleViewHolder;
|
||||
import org.joinmastodon.android.ui.tabs.TabLayout;
|
||||
import org.joinmastodon.android.ui.tabs.TabLayoutMediator;
|
||||
|
@ -225,6 +224,15 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop,
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
if(!searchActive){
|
||||
return ((ScrollableToTop)getFragmentForPage(pager.getCurrentItem())).isScrolledToTop();
|
||||
}else{
|
||||
return searchFragment.isScrolledToTop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollToTop(){
|
||||
if(!searchActive){
|
||||
|
@ -334,34 +342,29 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop,
|
|||
: getFragmentForPage(pager.getCurrentItem()), assistContent);
|
||||
}
|
||||
|
||||
private class DiscoverPagerAdapter extends RecyclerView.Adapter<SimpleViewHolder>{
|
||||
private class DiscoverPagerAdapter extends RecyclerView.Adapter<SimpleViewHolder> {
|
||||
@NonNull
|
||||
@Override
|
||||
public SimpleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){
|
||||
FrameLayout view=tabViews[viewType];
|
||||
((ViewGroup)view.getParent()).removeView(view);
|
||||
public SimpleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
FrameLayout view = tabViews[viewType];
|
||||
((ViewGroup) view.getParent()).removeView(view);
|
||||
view.setVisibility(View.VISIBLE);
|
||||
view.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
return new SimpleViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull SimpleViewHolder holder, int position){}
|
||||
public void onBindViewHolder(@NonNull SimpleViewHolder holder, int position) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount(){
|
||||
public int getItemCount() {
|
||||
return tabViews.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position){
|
||||
public int getItemViewType(int position) {
|
||||
return position;
|
||||
}
|
||||
}
|
||||
|
||||
public void selectSearch(){
|
||||
searchEdit.requestFocus();
|
||||
onSearchEditFocusChanged(searchEdit, true);
|
||||
getActivity().getSystemService(InputMethodManager.class).showSoftInput(searchEdit, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,11 @@ public class DiscoverHashtagsFragment extends RecyclerFragment<Hashtag> implemen
|
|||
bannerHelper.maybeAddBanner(contentWrap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollToTop(){
|
||||
smoothScrollRecyclerViewToTop(list);
|
||||
|
|
|
@ -80,6 +80,11 @@ public class DiscoverNewsFragment extends RecyclerFragment<Card> implements Scro
|
|||
bannerHelper.maybeAddBanner(contentWrap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollToTop(){
|
||||
smoothScrollRecyclerViewToTop(list);
|
||||
|
|
|
@ -1367,14 +1367,6 @@ public class UiUtils {
|
|||
return !TextUtils.isEmpty(getSystemProperty("ro.build.version.emui"));
|
||||
}
|
||||
|
||||
public static int alphaBlendColors(int color1, int color2, float alpha) {
|
||||
float alpha0 = 1f - alpha;
|
||||
int r = Math.round(((color1 >> 16) & 0xFF) * alpha0 + ((color2 >> 16) & 0xFF) * alpha);
|
||||
int g = Math.round(((color1 >> 8) & 0xFF) * alpha0 + ((color2 >> 8) & 0xFF) * alpha);
|
||||
int b = Math.round((color1 & 0xFF) * alpha0 + (color2 & 0xFF) * alpha);
|
||||
return 0xFF000000 | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
public static boolean pickAccountForCompose(Activity activity, String accountID, String prefilledText) {
|
||||
Bundle args = new Bundle();
|
||||
if (prefilledText != null) args.putString("prefilledText", prefilledText);
|
||||
|
|
Loading…
Reference in New Issue