small bugfix

This commit is contained in:
NudeDude 2018-08-01 17:29:22 +02:00
parent 78a605a498
commit 37fe57444e
4 changed files with 22 additions and 7 deletions

View File

@ -190,7 +190,7 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
@Override
protected void onPostExecute(Long mode) {
TweetDetail connect = ui.get();
final TweetDetail connect = ui.get();
if(connect == null)
return;
@ -251,7 +251,7 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
mediaButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new ImagePopup(ui.get()).execute(medialinks);
connect.onMediaClicked(medialinks);
}
});
}
@ -401,4 +401,8 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
else
retweetButton.setBackgroundResource(R.drawable.retweet);
}
public interface OnMediaClick {
void onMediaClicked(String medialinks[]);
}
}

View File

@ -87,7 +87,7 @@ public class SearchPage extends AppCompatActivity implements UserRecycler.OnItem
@Override
protected void onPause() {
if (mSearch != null && mSearch.isCancelled()) {
if (mSearch != null && !mSearch.isCancelled()) {
mSearch.cancel(true);
tweetReload.setRefreshing(false);
}

View File

@ -21,6 +21,7 @@ import android.widget.Toast;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.GlobalSettings;
import org.nuclearfog.twidda.backend.ImagePopup;
import org.nuclearfog.twidda.backend.StatusLoader;
import org.nuclearfog.twidda.backend.listitems.Tweet;
import org.nuclearfog.twidda.viewadapter.TimelineRecycler;
@ -34,10 +35,11 @@ import static android.content.DialogInterface.BUTTON_POSITIVE;
* @see StatusLoader
*/
public class TweetDetail extends AppCompatActivity implements OnClickListener,
OnItemClicked, DialogInterface.OnClickListener, OnRefreshListener {
OnItemClicked, DialogInterface.OnClickListener, OnRefreshListener, StatusLoader.OnMediaClick {
private RecyclerView answer_list;
private StatusLoader mStat, mReply;
private ImagePopup mediaContent;
private SwipeRefreshLayout answerReload;
private ConnectivityManager mConnect;
private GlobalSettings settings;
@ -89,13 +91,16 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
@Override
protected void onPause() {
if (mStat != null && mStat.isCancelled()) {
if (mStat != null && !mStat.isCancelled()) {
mStat.cancel(true);
}
if (mReply != null && mReply.isCancelled()) {
if (mReply != null && !mReply.isCancelled()) {
mReply.cancel(true);
answerReload.setRefreshing(false);
}
if (mediaContent != null && !mediaContent.isCancelled()) {
mediaContent.cancel(true);
}
super.onPause();
}
@ -202,6 +207,12 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
mReply.execute(tweetID, StatusLoader.LOAD_REPLY);
}
@Override
public void onMediaClicked(String mediaLinks[]) {
mediaContent = new ImagePopup(this);
mediaContent.execute(mediaLinks);
}
private void setContent() {
int backgroundColor = settings.getBackgroundColor();
int fontColor = settings.getFontColor();

View File

@ -51,7 +51,7 @@ public class UserDetail extends AppCompatActivity implements OnItemClicked {
@Override
protected void onPause() {
if (uList != null && uList.isCancelled()) {
if (uList != null && !uList.isCancelled()) {
uList.cancel(true);
}
super.onPause();