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