mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-10 17:03:22 +01:00
bug fix
This commit is contained in:
parent
66cdcec840
commit
bb4c51b64a
@ -32,6 +32,8 @@ public abstract class ListFragment extends Fragment implements OnRefreshListener
|
||||
private SwipeRefreshLayout reload;
|
||||
private GlobalSettings settings;
|
||||
|
||||
private boolean isRefreshing = false;
|
||||
|
||||
|
||||
@Override
|
||||
public final View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle param) {
|
||||
@ -56,11 +58,12 @@ public abstract class ListFragment extends Fragment implements OnRefreshListener
|
||||
* @param enable true to enable swipe view delayed, false to stop immediately
|
||||
*/
|
||||
protected void setRefresh(boolean enable) {
|
||||
isRefreshing = enable;
|
||||
if (enable) {
|
||||
reload.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!reload.isRefreshing()) {
|
||||
if (isRefreshing) {
|
||||
reload.setRefreshing(true);
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ public class MessageFragment extends ListFragment implements OnRefreshListener,
|
||||
|
||||
@Override
|
||||
public void onConfirm(DialogBuilder.DialogType type) {
|
||||
messageTask = new MessageListLoader(MessageFragment.this, MessageListLoader.Action.DEL);
|
||||
messageTask = new MessageListLoader(this, MessageListLoader.Action.DEL);
|
||||
messageTask.execute(deleteId);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class TrendFragment extends ListFragment implements OnRefreshListener, Tr
|
||||
@Override
|
||||
public void onTrendClick(TwitterTrend trend) {
|
||||
if (!isRefreshing()) {
|
||||
Intent intent = new Intent(getContext(), SearchPage.class);
|
||||
Intent intent = new Intent(requireContext(), SearchPage.class);
|
||||
intent.putExtra(KEY_SEARCH_QUERY, trend.getSearchString());
|
||||
startActivity(intent);
|
||||
}
|
||||
@ -108,8 +108,8 @@ public class TrendFragment extends ListFragment implements OnRefreshListener, Tr
|
||||
* @param error Twitter exception
|
||||
*/
|
||||
public void onError(EngineException error) {
|
||||
if (getContext() != null)
|
||||
ErrorHandler.handleFailure(getContext(), error);
|
||||
if (error != null)
|
||||
ErrorHandler.handleFailure(requireContext(), error);
|
||||
setRefresh(false);
|
||||
}
|
||||
|
||||
|
@ -128,10 +128,10 @@ public class TweetFragment extends ListFragment implements OnRefreshListener, Tw
|
||||
|
||||
@Override
|
||||
public void onTweetClick(Tweet tweet) {
|
||||
if (getContext() != null && !isRefreshing()) {
|
||||
if (!isRefreshing()) {
|
||||
if (tweet.getEmbeddedTweet() != null)
|
||||
tweet = tweet.getEmbeddedTweet();
|
||||
Intent tweetIntent = new Intent(getContext(), TweetActivity.class);
|
||||
Intent tweetIntent = new Intent(requireContext(), TweetActivity.class);
|
||||
tweetIntent.putExtra(KEY_TWEET_ID, tweet.getId());
|
||||
tweetIntent.putExtra(KEY_TWEET_NAME, tweet.getUser().getScreenname());
|
||||
startActivityForResult(tweetIntent, REQUEST_TWEET_CHANGED);
|
||||
@ -169,8 +169,8 @@ public class TweetFragment extends ListFragment implements OnRefreshListener, Tw
|
||||
* @param error Twitter exception
|
||||
*/
|
||||
public void onError(@Nullable EngineException error) {
|
||||
if (getContext() != null && error != null)
|
||||
ErrorHandler.handleFailure(getContext(), error);
|
||||
if (error != null)
|
||||
ErrorHandler.handleFailure(requireContext(), error);
|
||||
adapter.disableLoading();
|
||||
setRefresh(false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user