refactor: fix compilation problems by refactoring old code
This commit is contained in:
@@ -3,6 +3,7 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:8.0.0'
|
classpath 'com.android.tools.build:gradle:8.0.0'
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class ExternalShareActivity extends FragmentStackActivity{
|
|||||||
|
|
||||||
Optional<String> text = Optional.ofNullable(getIntent().getStringExtra(Intent.EXTRA_TEXT));
|
Optional<String> text = Optional.ofNullable(getIntent().getStringExtra(Intent.EXTRA_TEXT));
|
||||||
Optional<Pair<String, Optional<String>>> fediHandle = text.flatMap(UiUtils::parseFediverseHandle);
|
Optional<Pair<String, Optional<String>>> fediHandle = text.flatMap(UiUtils::parseFediverseHandle);
|
||||||
boolean isFediUrl = text.map(UiUtils::looksLikeFediverseUrl).orElse(false);
|
boolean isFediUrl = text.map(UiUtils::looksLikeMastodonUrl).orElse(false);
|
||||||
boolean isOpenable = isFediUrl || fediHandle.isPresent();
|
boolean isOpenable = isFediUrl || fediHandle.isPresent();
|
||||||
|
|
||||||
List<AccountSession> sessions=AccountSessionManager.getInstance().getLoggedInAccounts();
|
List<AccountSession> sessions=AccountSessionManager.getInstance().getLoggedInAccounts();
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public class GlobalUserPreferences{
|
|||||||
public static boolean enableDeleteNotifications;
|
public static boolean enableDeleteNotifications;
|
||||||
public static boolean translateButtonOpenedOnly;
|
public static boolean translateButtonOpenedOnly;
|
||||||
public static boolean uniformNotificationIcon;
|
public static boolean uniformNotificationIcon;
|
||||||
public static boolean enableDeleteNotifications;
|
|
||||||
public static boolean relocatePublishButton;
|
public static boolean relocatePublishButton;
|
||||||
public static boolean reduceMotion;
|
public static boolean reduceMotion;
|
||||||
public static boolean keepOnlyLatestNotification;
|
public static boolean keepOnlyLatestNotification;
|
||||||
@@ -81,7 +80,7 @@ public class GlobalUserPreferences{
|
|||||||
*/
|
*/
|
||||||
public static String replyVisibility;
|
public static String replyVisibility;
|
||||||
|
|
||||||
private static SharedPreferences getPrefs(){
|
public static SharedPreferences getPrefs(){
|
||||||
return MastodonApp.context.getSharedPreferences("global", Context.MODE_PRIVATE);
|
return MastodonApp.context.getSharedPreferences("global", Context.MODE_PRIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -239,11 +239,6 @@ public class EditTimelinesFragment extends RecyclerFragment<TimelineDefinition>
|
|||||||
smoothScrollRecyclerViewToTop(list);
|
smoothScrollRecyclerViewToTop(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isScrolledToTop() {
|
|
||||||
return list.getChildAt(0).getTop() == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|||||||
@@ -145,11 +145,6 @@ 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,10 +72,6 @@ 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() {
|
||||||
|
|||||||
@@ -510,7 +510,7 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scrollToTop(){
|
public void scrollToTop(){
|
||||||
if (((ScrollableToTop) fragments[pager.getCurrentItem()]).isScrolledToTop() &&
|
if (((IsOnTop) fragments[pager.getCurrentItem()]).isOnTop() &&
|
||||||
GlobalUserPreferences.doubleTapToSwipe && !newPostsBtnShown) {
|
GlobalUserPreferences.doubleTapToSwipe && !newPostsBtnShown) {
|
||||||
int nextPage = (pager.getCurrentItem() + 1) % count;
|
int nextPage = (pager.getCurrentItem() + 1) % count;
|
||||||
navigateTo(nextPage);
|
navigateTo(nextPage);
|
||||||
@@ -519,11 +519,6 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||||||
((ScrollableToTop) fragments[pager.getCurrentItem()]).scrollToTop();
|
((ScrollableToTop) fragments[pager.getCurrentItem()]).scrollToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isScrolledToTop() {
|
|
||||||
return ((ScrollableToTop) fragments[pager.getCurrentItem()]).isScrolledToTop();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hideNewPostsButton(){
|
public void hideNewPostsButton(){
|
||||||
if(!newPostsBtnShown)
|
if(!newPostsBtnShown)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -196,11 +196,6 @@ 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);
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ public class NotificationsFragment extends MastodonToolbarFragment implements Sc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scrollToTop(){
|
public void scrollToTop(){
|
||||||
if (getFragmentForPage(pager.getCurrentItem()).isScrolledToTop() && GlobalUserPreferences.doubleTapToSwipe) {
|
if (getFragmentForPage(pager.getCurrentItem()).isOnTop() && GlobalUserPreferences.doubleTapToSwipe) {
|
||||||
int nextPage = (pager.getCurrentItem() + 1) % tabViews.length;
|
int nextPage = (pager.getCurrentItem() + 1) % tabViews.length;
|
||||||
pager.setCurrentItem(nextPage, true);
|
pager.setCurrentItem(nextPage, true);
|
||||||
return;
|
return;
|
||||||
@@ -220,11 +220,6 @@ public class NotificationsFragment extends MastodonToolbarFragment implements Sc
|
|||||||
getFragmentForPage(pager.getCurrentItem()).scrollToTop();
|
getFragmentForPage(pager.getCurrentItem()).scrollToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isScrolledToTop() {
|
|
||||||
return getFragmentForPage(pager.getCurrentItem()).isScrolledToTop();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadData(){
|
public void loadData(){
|
||||||
refreshFollowRequestsBadge();
|
refreshFollowRequestsBadge();
|
||||||
if(allNotificationsFragment!=null && !allNotificationsFragment.loaded && !allNotificationsFragment.dataLoading)
|
if(allNotificationsFragment!=null && !allNotificationsFragment.loaded && !allNotificationsFragment.dataLoading)
|
||||||
|
|||||||
@@ -448,6 +448,25 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
|||||||
V.setVisibilityAnimated(fab, View.VISIBLE);
|
V.setVisibilityAnimated(fab, View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNote(String note){
|
||||||
|
this.note=note;
|
||||||
|
noteWrap.setVisibility(View.VISIBLE);
|
||||||
|
noteEdit.setVisibility(View.VISIBLE);
|
||||||
|
noteEdit.setText(note);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void savePrivateNote(){
|
||||||
|
new SetPrivateNote(profileAccountID, noteEdit.getText().toString()).setCallback(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Relationship result) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(ErrorResponse error) {
|
||||||
|
error.showToast(getActivity());
|
||||||
|
}
|
||||||
|
}).exec(accountID);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doLoadData(){
|
protected void doLoadData(){
|
||||||
if (remoteAccount != null) {
|
if (remoteAccount != null) {
|
||||||
|
|||||||
@@ -107,7 +107,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, getAccountID(), s.getContentStatus()));
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,9 +33,4 @@ public class StatusFavoritesListFragment extends StatusRelatedAccountListFragmen
|
|||||||
? statusUri
|
? statusUri
|
||||||
: statusUri.buildUpon().appendPath("favourites").build();
|
: statusUri.buildUpon().appendPath("favourites").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public HeaderPaginationRequest<Account> onCreateRemoteRequest(String id, String maxID, int count) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,9 +33,4 @@ public class StatusReblogsListFragment extends StatusRelatedAccountListFragment{
|
|||||||
? statusUri
|
? statusUri
|
||||||
: statusUri.buildUpon().appendPath("reblogs").build();
|
: statusUri.buildUpon().appendPath("reblogs").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public HeaderPaginationRequest<Account> onCreateRemoteRequest(String id, String maxID, int count) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,11 +143,6 @@ public class DiscoverAccountsFragment extends RecyclerFragment<DiscoverAccountsF
|
|||||||
smoothScrollRecyclerViewToTop(list);
|
smoothScrollRecyclerViewToTop(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isScrolledToTop() {
|
|
||||||
return list.getChildAt(0).getTop() == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnTop() {
|
public boolean isOnTop() {
|
||||||
return isRecyclerViewOnTop(list);
|
return isRecyclerViewOnTop(list);
|
||||||
|
|||||||
@@ -224,15 +224,6 @@ 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){
|
||||||
|
|||||||
@@ -68,11 +68,6 @@ 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,11 +80,6 @@ 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);
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||||||
} else {
|
} else {
|
||||||
v.startAnimation(opacityIn);
|
v.startAnimation(opacityIn);
|
||||||
}
|
}
|
||||||
bindButton(favorite, r.favouritesCount);
|
bindText(favorites, r.favouritesCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -383,7 +383,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||||||
} else {
|
} else {
|
||||||
v.startAnimation(opacityIn);
|
v.startAnimation(opacityIn);
|
||||||
}
|
}
|
||||||
bindButton(favorite, r.favouritesCount);
|
bindText(favorites, r.favouritesCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ import java.lang.reflect.Method;
|
|||||||
import java.net.IDN;
|
import java.net.IDN;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
@@ -809,7 +810,6 @@ public class UiUtils {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.exec(accountID);
|
.exec(accountID);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1282,7 +1282,7 @@ public class UiUtils {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.exec(accountID));
|
.exec(accountID));
|
||||||
} else if (looksLikeFediverseUrl(url)) {
|
} else if (looksLikeMastodonUrl(url)) {
|
||||||
return Optional.of(new GetSearchResults(url, null, true)
|
return Optional.of(new GetSearchResults(url, null, true)
|
||||||
.setCallback(new Callback<>() {
|
.setCallback(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user