mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-02 20:26:53 +01:00
bug fix
This commit is contained in:
parent
171ada0abf
commit
f21a1cee64
@ -14,6 +14,7 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
@ -70,25 +71,24 @@ public class ProfileEditor extends AsyncTask<Void, Void, TwitterUser> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
if (popup.get() == null || ui.get() == null) return;
|
if (popup.get() != null && ui.get() != null) {
|
||||||
|
Dialog window = popup.get();
|
||||||
Dialog window = popup.get();
|
window.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
window.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
window.setCanceledOnTouchOutside(false);
|
||||||
window.setCanceledOnTouchOutside(false);
|
window.setContentView(new ProgressBar(ui.get()));
|
||||||
window.setContentView(new ProgressBar(ui.get()));
|
if (window.getWindow() != null)
|
||||||
if (window.getWindow() != null)
|
window.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||||
window.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
window.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||||
|
@Override
|
||||||
window.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
@Override
|
if (getStatus() == Status.RUNNING) {
|
||||||
public void onDismiss(DialogInterface dialog) {
|
cancel(true);
|
||||||
if (getStatus() == Status.RUNNING) {
|
ui.get().finish();
|
||||||
cancel(true);
|
}
|
||||||
ui.get().finish();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
window.show();
|
||||||
window.show();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ public class ProfileEditor extends AsyncTask<Void, Void, TwitterUser> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(TwitterUser user) {
|
protected void onPostExecute(@Nullable TwitterUser user) {
|
||||||
if (ui.get() != null && popup.get() != null) {
|
if (ui.get() != null && popup.get() != null) {
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
@ -10,6 +10,7 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
@ -137,7 +138,7 @@ public class ProfileLoader extends AsyncTask<Long, TwitterUser, TwitterUser> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onProgressUpdate(TwitterUser[] users) {
|
protected void onProgressUpdate(@NonNull TwitterUser[] users) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
final TwitterUser user = users[0];
|
final TwitterUser user = users[0];
|
||||||
|
|
||||||
@ -217,7 +218,7 @@ public class ProfileLoader extends AsyncTask<Long, TwitterUser, TwitterUser> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(TwitterUser user) {
|
protected void onPostExecute(@Nullable TwitterUser user) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
@ -12,6 +12,7 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
@ -124,7 +125,7 @@ public class StatusLoader extends AsyncTask<Long, Tweet, Tweet> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onProgressUpdate(Tweet[] tweets) {
|
protected void onProgressUpdate(@NonNull Tweet[] tweets) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
TextView username = ui.get().findViewById(R.id.usernamedetail);
|
TextView username = ui.get().findViewById(R.id.usernamedetail);
|
||||||
TextView scrName = ui.get().findViewById(R.id.scrnamedetail);
|
TextView scrName = ui.get().findViewById(R.id.scrnamedetail);
|
||||||
@ -273,7 +274,7 @@ public class StatusLoader extends AsyncTask<Long, Tweet, Tweet> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Tweet tweet) {
|
protected void onPostExecute(@Nullable Tweet tweet) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
if (tweet != null) {
|
if (tweet != null) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
@ -39,34 +39,34 @@ public class StatusUploader extends AsyncTask<Void, Void, Boolean> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
if (popup.get() == null || ui.get() == null) return;
|
if (popup.get() != null && ui.get() != null) {
|
||||||
|
final Dialog window = popup.get();
|
||||||
|
window.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
window.setCanceledOnTouchOutside(false);
|
||||||
|
if (window.getWindow() != null)
|
||||||
|
window.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(ui.get());
|
||||||
|
View load = inflater.inflate(R.layout.item_load, null, false);
|
||||||
|
View cancelButton = load.findViewById(R.id.kill_button);
|
||||||
|
window.setContentView(load);
|
||||||
|
|
||||||
final Dialog window = popup.get();
|
cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||||
window.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
@Override
|
||||||
window.setCanceledOnTouchOutside(false);
|
public void onClick(View v) {
|
||||||
if (window.getWindow() != null)
|
window.dismiss();
|
||||||
window.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(ui.get());
|
|
||||||
View load = inflater.inflate(R.layout.item_load, null, false);
|
|
||||||
View cancelButton = load.findViewById(R.id.kill_button);
|
|
||||||
window.setContentView(load);
|
|
||||||
|
|
||||||
cancelButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
window.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
window.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
|
||||||
@Override
|
|
||||||
public void onDismiss(DialogInterface dialog) {
|
|
||||||
if (getStatus() == Status.RUNNING) {
|
|
||||||
Toast.makeText(ui.get(), R.string.abort, Toast.LENGTH_SHORT).show();
|
|
||||||
cancel(true);
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
window.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||||
window.show();
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
if (getStatus() == Status.RUNNING) {
|
||||||
|
Toast.makeText(ui.get(), R.string.abort, Toast.LENGTH_SHORT).show();
|
||||||
|
cancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import android.os.AsyncTask;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ public class MessageLoader extends AsyncTask<Long, Void, List<Message>> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(List<Message> messages) {
|
protected void onPostExecute(@Nullable List<Message> messages) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
if (messages != null) {
|
if (messages != null) {
|
||||||
adapter.setData(messages);
|
adapter.setData(messages);
|
||||||
@ -122,7 +123,7 @@ public class MessageLoader extends AsyncTask<Long, Void, List<Message>> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCancelled(List<Message> messages) {
|
protected void onCancelled(@Nullable List<Message> messages) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
if (messages != null) {
|
if (messages != null) {
|
||||||
adapter.setData(messages);
|
adapter.setData(messages);
|
||||||
|
@ -4,6 +4,7 @@ import android.os.AsyncTask;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
@ -81,18 +82,18 @@ public class TrendLoader extends AsyncTask<Void, Void, List<Trend>> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(List<Trend> trends) {
|
protected void onPostExecute(@Nullable List<Trend> trends) {
|
||||||
if (ui.get() == null)
|
if (ui.get() != null) {
|
||||||
return;
|
if (trends != null) {
|
||||||
if (trends != null) {
|
adapter.setData(trends);
|
||||||
adapter.setData(trends);
|
adapter.notifyDataSetChanged();
|
||||||
adapter.notifyDataSetChanged();
|
} else {
|
||||||
} else {
|
if (err != null)
|
||||||
if (err != null)
|
ErrorHandler.printError(ui.get().getContext(), err);
|
||||||
ErrorHandler.printError(ui.get().getContext(), err);
|
}
|
||||||
|
SwipeRefreshLayout reload = ui.get().findViewById(R.id.fragment_reload);
|
||||||
|
reload.setRefreshing(false);
|
||||||
}
|
}
|
||||||
SwipeRefreshLayout reload = ui.get().findViewById(R.id.fragment_reload);
|
|
||||||
reload.setRefreshing(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ public class TrendLoader extends AsyncTask<Void, Void, List<Trend>> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCancelled(List<Trend> trends) {
|
protected void onCancelled(@Nullable List<Trend> trends) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
if (trends != null) {
|
if (trends != null) {
|
||||||
adapter.setData(trends);
|
adapter.setData(trends);
|
||||||
|
@ -4,6 +4,7 @@ import android.os.AsyncTask;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
@ -176,7 +177,7 @@ public class TweetLoader extends AsyncTask<Object, Void, List<Tweet>> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(List<Tweet> tweets) {
|
protected void onPostExecute(@Nullable List<Tweet> tweets) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
if (tweets != null) {
|
if (tweets != null) {
|
||||||
adapter.setData(tweets);
|
adapter.setData(tweets);
|
||||||
@ -201,7 +202,7 @@ public class TweetLoader extends AsyncTask<Object, Void, List<Tweet>> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCancelled(List<Tweet> tweets) {
|
protected void onCancelled(@Nullable List<Tweet> tweets) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
if (tweets != null) {
|
if (tweets != null) {
|
||||||
adapter.setData(tweets);
|
adapter.setData(tweets);
|
||||||
|
@ -4,6 +4,7 @@ import android.os.AsyncTask;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ public class UserLoader extends AsyncTask<Object, Void, List<TwitterUser>> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(List<TwitterUser> users) {
|
protected void onPostExecute(@Nullable List<TwitterUser> users) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
if (users != null) {
|
if (users != null) {
|
||||||
adapter.setData(users);
|
adapter.setData(users);
|
||||||
@ -119,7 +120,7 @@ public class UserLoader extends AsyncTask<Object, Void, List<TwitterUser>> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCancelled(List<TwitterUser> users) {
|
protected void onCancelled(@Nullable List<TwitterUser> users) {
|
||||||
if (ui.get() != null) {
|
if (ui.get() != null) {
|
||||||
if (users != null) {
|
if (users != null) {
|
||||||
adapter.setData(users);
|
adapter.setData(users);
|
||||||
|
@ -155,7 +155,6 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
|
|||||||
case VIDEO:
|
case VIDEO:
|
||||||
case ANGIF:
|
case ANGIF:
|
||||||
case VIDEO_STORAGE:
|
case VIDEO_STORAGE:
|
||||||
video_progress.setVisibility(VISIBLE);
|
|
||||||
videoView.start();
|
videoView.start();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -215,21 +214,21 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
|
|||||||
|
|
||||||
case VIDEO:
|
case VIDEO:
|
||||||
case VIDEO_STORAGE:
|
case VIDEO_STORAGE:
|
||||||
mp.setOnInfoListener(new OnInfoListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onInfo(MediaPlayer mp, int what, int extra) {
|
|
||||||
if (what == MEDIA_INFO_VIDEO_RENDERING_START) {
|
|
||||||
video_progress.setVisibility(INVISIBLE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
videoController.show(0);
|
videoController.show(0);
|
||||||
mp.seekTo(lastPos);
|
mp.seekTo(lastPos);
|
||||||
mp.start();
|
mp.start();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
mp.setOnInfoListener(new OnInfoListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onInfo(MediaPlayer mp, int what, int extra) {
|
||||||
|
if (what == MEDIA_INFO_VIDEO_RENDERING_START) {
|
||||||
|
video_progress.setVisibility(INVISIBLE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,8 +50,7 @@
|
|||||||
android:id="@+id/video_load"
|
android:id="@+id/video_load"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center" />
|
||||||
android:visibility="invisible" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user