bugfix
This commit is contained in:
parent
256470be16
commit
bf12ae189a
|
@ -27,7 +27,6 @@ public class ImagePopup extends AsyncTask<String, Void, Boolean> {
|
|||
private Dialog popup;
|
||||
private Bitmap imgArray[];
|
||||
private LayoutInflater inf;
|
||||
private int index = 0;
|
||||
private int position = 0;
|
||||
|
||||
public ImagePopup(Context c) {
|
||||
|
@ -60,15 +59,13 @@ public class ImagePopup extends AsyncTask<String, Void, Boolean> {
|
|||
return false;
|
||||
imgArray = new Bitmap[size];
|
||||
if(links[0].startsWith("/")) {
|
||||
for(String link : links) {
|
||||
if(link != null)
|
||||
imgArray[index++] = BitmapFactory.decodeFile(link);
|
||||
for(int index = 0 ; index < size ; index++) {
|
||||
imgArray[index] = BitmapFactory.decodeFile(links[index]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(String link : links) {
|
||||
InputStream mediaStream = new URL(link).openStream();
|
||||
imgArray[index++] = BitmapFactory.decodeStream(mediaStream);
|
||||
} else {
|
||||
for(int index = 0 ; index < size ; index++) {
|
||||
InputStream mediaStream = new URL(links[index]).openStream();
|
||||
imgArray[index] = BitmapFactory.decodeStream(mediaStream);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -85,13 +82,14 @@ public class ImagePopup extends AsyncTask<String, Void, Boolean> {
|
|||
protected void onPostExecute(Boolean result) {
|
||||
if(result) {
|
||||
View content = inf.inflate(R.layout.imagepreview,null,false);
|
||||
ImageView mImg = content.findViewById(R.id.fullSizeImage);
|
||||
final ImageView mImg = content.findViewById(R.id.fullSizeImage);
|
||||
setImage(imgArray[position], mImg);
|
||||
popup.setContentView(content);
|
||||
if(index > 0) {
|
||||
final int size = imgArray.length;
|
||||
if(size > 0) {
|
||||
final Button left = content.findViewById(R.id.image_left);
|
||||
final Button right = content.findViewById(R.id.image_right);
|
||||
if(index > 1) {
|
||||
if(size > 1) {
|
||||
left.setVisibility(View.INVISIBLE);
|
||||
right.setVisibility(View.VISIBLE);
|
||||
left.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -100,16 +98,16 @@ public class ImagePopup extends AsyncTask<String, Void, Boolean> {
|
|||
if(position == 1)
|
||||
left.setVisibility(View.INVISIBLE);
|
||||
right.setVisibility(View.VISIBLE);
|
||||
position--;
|
||||
setImage(imgArray[--position], mImg);
|
||||
}
|
||||
});
|
||||
right.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(position == index-2)
|
||||
if(position == size-2)
|
||||
right.setVisibility(View.INVISIBLE);
|
||||
left.setVisibility(View.VISIBLE);
|
||||
position++;
|
||||
setImage(imgArray[++position], mImg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import twitter4j.conf.ConfigurationBuilder;
|
|||
public class TwitterEngine {
|
||||
|
||||
private final String TWITTER_CONSUMER_KEY = "0EKRHWYcakpCkl8Lr4OcBFMZb";
|
||||
private final String TWITTER_CONSUMER_SECRET = "x x x";
|
||||
private final String TWITTER_CONSUMER_SECRET = "RQrf0uQus5v7IMuYgdlVeBuLw1ApRJhxcAMM8MyUVRh1nKSxnR";
|
||||
|
||||
private static TwitterEngine mTwitter;
|
||||
private static long twitterID = -1L;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/tweet_popup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -40,21 +39,10 @@
|
|||
android:gravity="end"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/imgcount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@android:color/holo_red_dark"
|
||||
android:textSize="14sp" />
|
||||
<FrameLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginEnd="20dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/img_preview"
|
||||
|
@ -64,14 +52,22 @@
|
|||
android:background="@drawable/preview"
|
||||
android:visibility="invisible" />
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/imgcount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/holo_red_dark"
|
||||
android:textSize="24sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/image"
|
||||
style="@style/Widget.AppCompat.Button"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/image" />
|
||||
|
||||
<Button
|
||||
|
@ -79,7 +75,7 @@
|
|||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/tweet" />
|
||||
|
||||
<Button
|
||||
|
|
Loading…
Reference in New Issue