summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortom79 <tschneider.ac@gmail.com>2019-05-31 14:46:05 +0200
committertom79 <tschneider.ac@gmail.com>2019-05-31 14:46:05 +0200
commite1a6ea51a1cc13358757a19fca4959f22e81237e (patch)
tree2f201cd712a68c354d2f6fd5951496f8fc498178
parent8fcc6f958b096a6265dbdfb5eb5f7ccd4b4081ab (diff)
-rw-r--r--app/src/main/java/app/fedilab/android/activities/TootActivity.java323
-rw-r--r--app/src/main/java/app/fedilab/android/client/API.java2
-rw-r--r--app/src/main/java/app/fedilab/android/client/Entities/Attachment.java89
-rw-r--r--app/src/main/res/drawable/ic_arrow_back.xml9
-rw-r--r--app/src/main/res/drawable/ic_arrow_forward.xml9
-rw-r--r--app/src/main/res/layout/activity_toot.xml6
-rw-r--r--app/src/main/res/layout/toot_media.xml37
-rw-r--r--app/src/main/res/values/strings.xml2
8 files changed, 224 insertions, 253 deletions
diff --git a/app/src/main/java/app/fedilab/android/activities/TootActivity.java b/app/src/main/java/app/fedilab/android/activities/TootActivity.java
index a309b1661..c054df0c3 100644
--- a/app/src/main/java/app/fedilab/android/activities/TootActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/TootActivity.java
@@ -52,6 +52,7 @@ import android.text.Html;
import android.text.InputFilter;
import android.text.InputType;
import android.text.TextWatcher;
+import android.util.Log;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -102,6 +103,7 @@ import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
@@ -234,6 +236,7 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
private String newContent;
private TextWatcher textWatcher;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -346,8 +349,8 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
toot_picture_container.setLayoutParams(params);
} else {
ViewGroup.LayoutParams params = toot_picture_container.getLayoutParams();
- params.height = (int) Helper.convertDpToPixel(100, getApplicationContext());
- params.width = (int) Helper.convertDpToPixel(100, getApplicationContext());
+ params.height = (int) Helper.convertDpToPixel(200, getApplicationContext());
+ params.width = (int) Helper.convertDpToPixel(200, getApplicationContext());
toot_picture_container.setLayoutParams(params);
}
}
@@ -978,56 +981,6 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
intent.putExtra("imageUri", data.getData().toString());
intent.putExtras(b);
startActivity(intent);
-
- /* AlertDialog.Builder alertMedia = new AlertDialog.Builder(TootActivity.this, style);
- alertMedia.setTitle(R.string.edit_media);
- View view = getLayoutInflater().inflate(R.layout.popup_picture, null);
- alertMedia.setView(view);
- PhotoEditorView mPhotoEditorView = view.findViewById(R.id.photoEditorView);
-
- mPhotoEditorView.getSource().setImageURI(data.getData());
-
- PhotoEditor mPhotoEditor = new PhotoEditor.Builder(this, mPhotoEditorView)
- .setPinchTextScalable(true)
- .build();
-
- if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
- return;
- }
- SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
- String myDir = sharedpreferences.getString(Helper.SET_FOLDER_RECORD, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath());
- filename = Helper.getFileName(TootActivity.this, data.getData());
-
- mPhotoEditor.saveAsFile(myDir + "/"+ filename, new PhotoEditor.OnSaveListener() {
- @Override
- public void onSuccess(@NonNull String imagePath) {
- new asyncPicture(TootActivity.this, account, Uri.fromFile(new File(imagePath))).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- }
- @Override
- public void onFailure(@NonNull Exception exception) {
-
- }
- });
-
- alertMedia.setNeutralButton(R.string.delete, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- if( poll != null)
- poll = null;
- poll_action.setVisibility(View.GONE);
- toot_picture.setVisibility(View.VISIBLE);
- if( attachments != null && attachments.size() > 0)
- picture_scrollview.setVisibility(View.VISIBLE);
- dialog.dismiss();
- }
- });
-
- alertMedia.setPositiveButton(R.string.done, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
-
-
- }
- });
- alertMedia.show();*/
}else {
Toasty.error(getApplicationContext(),getString(R.string.toot_select_image_error),Toast.LENGTH_LONG).show();
}
@@ -1683,6 +1636,8 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
if( poll != null) {
toot.setPoll(poll);
}else{
+ for(Attachment a: attachments)
+ Log.v(Helper.TAG,"--> getId: " + a.getId());
toot.setMedia_attachments(attachments);
}
if( timestamp == null)
@@ -1823,48 +1778,110 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
}
if( !alreadyAdded){
toot_picture_container.setVisibility(View.VISIBLE);
- String url = attachment.getPreview_url();
- if (url == null || url.trim().equals(""))
- url = attachment.getUrl();
+ attachment.setFile_name(fileName);
+ attachments.add(attachment);
+ redrawAttachment();
+ if (attachments.size() < max_media_count)
+ toot_picture.setEnabled(true);
+ toot_it.setEnabled(true);
+ toot_sensitive.setVisibility(View.VISIBLE);
+ if( account.isSensitive()){
+ toot_sensitive.setChecked(true);
+ }
+ picture_scrollview.setVisibility(View.VISIBLE);
+ }else {
+ if( attachments.size() > index && attachment.getDescription() != null) {
+ attachments.get(index).setDescription(attachment.getDescription());
+ }
+ }
+ }
+
+ private void redrawAttachment(){
+ toot_picture_container.removeAllViews();
+ for(Attachment attachment : attachments){
+ Log.v(Helper.TAG,attachment.getUrl());
+ View media = getLayoutInflater().inflate(R.layout.toot_media, null);
+
+ ImageView imgmedia = media.findViewById(R.id.media_img);
+ ImageView back = media.findViewById(R.id.move_left);
+ ImageView next = media.findViewById(R.id.move_right);
+
+ final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
+ int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
+ if( theme == Helper.THEME_DARK || theme == Helper.THEME_BLACK) {
+ Helper.changeDrawableColor(TootActivity.this, back, R.color.dark_text);
+ Helper.changeDrawableColor(TootActivity.this, next, R.color.dark_text);
+ }else {
+ Helper.changeDrawableColor(TootActivity.this, back, R.color.black);
+ Helper.changeDrawableColor(TootActivity.this, next, R.color.black);
+ }
+ imgmedia.setId(Integer.parseInt(attachment.getId()));
+
+ back.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ int positionAttachment = 0;
+ for(Attachment val: attachments){
+ if( Integer.parseInt(val.getId()) == imgmedia.getId()){
+ break;
+ }
+ positionAttachment++;
+ }
+ if( positionAttachment > 0 ){
+ Collections.swap(attachments, positionAttachment, positionAttachment-1);
+ redrawAttachment();
+ }
- final ImageView imageView = new ImageView(getApplicationContext());
- imageView.setId(Integer.parseInt(attachment.getId()));
+ }
+ });
+ next.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ int positionAttachment = 0;
+ for(Attachment val: attachments){
+ if( Integer.parseInt(val.getId()) == imgmedia.getId()){
+ break;
+ }
+ positionAttachment++;
+ }
+ if( positionAttachment < (attachments.size()-1)){
+ Collections.swap(attachments, positionAttachment, positionAttachment+1);
+ redrawAttachment();
+ }
+ }
+ });
+ for(Attachment a: attachments)
+ Log.v(Helper.TAG,"getId: " + a.getId());
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
- if( fileName != null && filesMap.containsKey(fileName)){
- Uri uri = filesMap.get(fileName);
- Glide.with(imageView.getContext())
+ if( attachment.getFile_name() != null && filesMap.containsKey(attachment.getFile_name())){
+ Uri uri = filesMap.get(attachment.getFile_name());
+ Glide.with(imgmedia.getContext())
.asBitmap()
.load(uri)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
- imageView.setImageBitmap(resource);
+ imgmedia.setImageBitmap(resource);
}
});
}
}else {
- Glide.with(imageView.getContext())
+ Glide.with(imgmedia.getContext())
.asBitmap()
- .load(url)
+ .load(attachment.getUrl())
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
- imageView.setImageBitmap(resource);
+ imgmedia.setImageBitmap(resource);
}
});
}
-
- LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
- imParams.setMargins(20, 5, 20, 5);
- imParams.height = (int) Helper.convertDpToPixel(100, getApplicationContext());
- imageView.setAdjustViewBounds(true);
- imageView.setScaleType(ImageView.ScaleType.FIT_XY);
- final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
boolean show_media_urls = sharedpreferences.getBoolean(Helper.SET_MEDIA_URLS, false);
if (show_media_urls) {
//Adds the shorter text_url of attachment at the end of the toot

@@ -1874,12 +1891,12 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
//Moves the cursor
toot_content.setSelection(selectionBefore);
}
- imageView.setTag(attachment.getId());
- toot_picture_container.addView(imageView, attachments.size(), imParams);
- imageView.setOnLongClickListener(new View.OnLongClickListener() {
+ imgmedia.setTag(attachment.getId());
+ toot_picture_container.addView(media);
+ imgmedia.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
- showRemove(imageView.getId());
+ showRemove(imgmedia.getId());
return false;
}
});
@@ -1888,7 +1905,7 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
Version currentVersion = new Version(instanceVersion);
Version minVersion = new Version("2.0");
if (currentVersion.compareTo(minVersion) == 1 || currentVersion.equals(minVersion)) {
- imageView.setOnClickListener(new View.OnClickListener() {
+ imgmedia.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showAddDescription(attachment);
@@ -1896,20 +1913,7 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
});
}
}
- attachments.add(attachment);
addBorder();
- if (attachments.size() < max_media_count)
- toot_picture.setEnabled(true);
- toot_it.setEnabled(true);
- toot_sensitive.setVisibility(View.VISIBLE);
- if( account.isSensitive()){
- toot_sensitive.setChecked(true);
- }
- picture_scrollview.setVisibility(View.VISIBLE);
- }else {
- if( attachments.size() > index && attachment.getDescription() != null) {
- attachments.get(index).setDescription(attachment.getDescription());
- }
}
}
@@ -2426,63 +2430,10 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
if( attachments != null && attachments.size() > 0){
toot_picture_container.setVisibility(View.VISIBLE);
picture_scrollview.setVisibility(View.VISIBLE);
- int i = 0 ;
- for(final Attachment attachment: attachments){
- String url = attachment.getPreview_url();
- if( url == null || url.trim().equals(""))
- url = attachment.getUrl();
- final ImageView imageView = new ImageView(getApplicationContext());
- imageView.setId(Integer.parseInt(attachment.getId()));
-
- LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
- imParams.setMargins(20, 5, 20, 5);
- imParams.height = (int) Helper.convertDpToPixel(100, getApplicationContext());
- imageView.setAdjustViewBounds(true);
- imageView.setScaleType(ImageView.ScaleType.FIT_XY);
- toot_picture_container.addView(imageView, i, imParams);
-
- Glide.with(imageView.getContext())
- .asBitmap()
- .load(url)
- .into(new SimpleTarget<Bitmap>() {
- @Override
- public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
- imageView.setImageBitmap(resource);
- }
- });
- imageView.setTag(attachment.getId());
- imageView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
- String instanceVersion = sharedpreferences.getString(Helper.INSTANCE_VERSION + userId + instance, null);
- if (instanceVersion != null) {
- Version currentVersion = new Version(instanceVersion);
- Version minVersion = new Version("2.0");
- if (currentVersion.compareTo(minVersion) == 1 || currentVersion.equals(minVersion)) {
- imageView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- showAddDescription(attachment);
- }
- });
- }
- }
- }
- });
- imageView.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View view) {
- showRemove(imageView.getId());
- return false;
- }
- });
- addBorder();
- if( attachments.size() < max_media_count)
- toot_picture.setEnabled(true);
- toot_sensitive.setVisibility(View.VISIBLE);
- i++;
- }
+ redrawAttachment();
+ if( attachments.size() < max_media_count)
+ toot_picture.setEnabled(true);
+ toot_sensitive.setVisibility(View.VISIBLE);
}else {
toot_picture_container.setVisibility(View.GONE);
}
@@ -2576,63 +2527,10 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
if( attachments != null && attachments.size() > 0){
toot_picture_container.setVisibility(View.VISIBLE);
picture_scrollview.setVisibility(View.VISIBLE);
- int i = 0 ;
- for(final Attachment attachment: attachments){
- String url = attachment.getPreview_url();
- if( url == null || url.trim().equals(""))
- url = attachment.getUrl();
- final ImageView imageView = new ImageView(getApplicationContext());
- imageView.setId(Integer.parseInt(attachment.getId()));
-
- LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
- imParams.setMargins(20, 5, 20, 5);
- imParams.height = (int) Helper.convertDpToPixel(100, getApplicationContext());
- imageView.setAdjustViewBounds(true);
- imageView.setScaleType(ImageView.ScaleType.FIT_XY);
- toot_picture_container.addView(imageView, i, imParams);
-
- Glide.with(imageView.getContext())
- .asBitmap()
- .load(url)
- .into(new SimpleTarget<Bitmap>() {
- @Override
- public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
- imageView.setImageBitmap(resource);
- }
- });
- imageView.setTag(attachment.getId());
- imageView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
- String instanceVersion = sharedpreferences.getString(Helper.INSTANCE_VERSION + userId + instance, null);
- if (instanceVersion != null) {
- Version currentVersion = new Version(instanceVersion);
- Version minVersion = new Version("2.0");
- if (currentVersion.compareTo(minVersion) == 1 || currentVersion.equals(minVersion)) {
- imageView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- showAddDescription(attachment);
- }
- });
- }
- }
- }
- });
- imageView.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View view) {
- showRemove(imageView.getId());
- return false;
- }
- });
- addBorder();
- if( attachments.size() < max_media_count)
- toot_picture.setEnabled(true);
- toot_sensitive.setVisibility(View.VISIBLE);
- i++;
- }
+ redrawAttachment();
+ if( attachments.size() < max_media_count)
+ toot_picture.setEnabled(true);
+ toot_sensitive.setVisibility(View.VISIBLE);
}else {
toot_picture_container.setVisibility(View.GONE);
}
@@ -3048,6 +2946,8 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
changeDrawableColor(TootActivity.this, R.drawable.ic_skip_next, R.color.dark_text);
changeDrawableColor(TootActivity.this, R.drawable.ic_check, R.color.dark_text);
changeDrawableColor(TootActivity.this, R.drawable.emoji_one_category_smileysandpeople, R.color.dark_text);
+ Helper.changeDrawableColor(TootActivity.this, R.drawable.ic_arrow_back, R.color.dark_text);
+ Helper.changeDrawableColor(TootActivity.this, R.drawable.ic_arrow_forward, R.color.dark_text);
//bottom action
changeDrawableColor(TootActivity.this, findViewById(R.id.toot_picture), R.color.dark_text);
changeDrawableColor(TootActivity.this, findViewById(R.id.poll_action), R.color.dark_text);
@@ -3055,6 +2955,8 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
changeDrawableColor(TootActivity.this, findViewById(R.id.toot_emoji), R.color.dark_text);
Helper.changeButtonTextColor(TootActivity.this, findViewById(R.id.toot_cw), R.color.dark_text);
+
+
}else {
changeDrawableColor(TootActivity.this, R.drawable.ic_public_toot, R.color.white);
changeDrawableColor(TootActivity.this, R.drawable.ic_lock_open_toot, R.color.white);
@@ -3065,6 +2967,8 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
changeDrawableColor(TootActivity.this, R.drawable.ic_skip_next, R.color.white);
changeDrawableColor(TootActivity.this, R.drawable.ic_check, R.color.white);
changeDrawableColor(TootActivity.this, R.drawable.emoji_one_category_smileysandpeople, R.color.black);
+ Helper.changeDrawableColor(TootActivity.this, R.drawable.ic_arrow_back, R.color.black);
+ Helper.changeDrawableColor(TootActivity.this, R.drawable.ic_arrow_forward, R.color.black);
//bottom action
changeDrawableColor(TootActivity.this, findViewById(R.id.toot_picture), R.color.black);
changeDrawableColor(TootActivity.this, findViewById(R.id.poll_action), R.color.black);
@@ -3119,22 +3023,19 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
}
private void addBorder(){
- for (int i = 0; i < toot_picture_container.getChildCount(); i++) {
- View v = toot_picture_container.getChildAt(i);
+ for (int i = 0; i < attachments.size(); i++) {
+ View v = toot_picture_container.findViewById(Integer.parseInt(attachments.get(i).getId()));
if (v instanceof ImageView) {
- for(Attachment attachment: attachments){
- if(attachment.getType().toLowerCase().equals("image"))
- if( v.getTag().toString().trim().equals(attachment.getId().trim())){
+ if(attachments.get(i).getType().toLowerCase().equals("image"))
+ if( v.getTag().toString().trim().equals(attachments.get(i).getId().trim())){
int borderSize = (int) Helper.convertDpToPixel(1, TootActivity.this);
int borderSizeTop = (int) Helper.convertDpToPixel(6, TootActivity.this);
v.setPadding(borderSize,borderSizeTop,borderSize,borderSizeTop);
- if( attachment.getDescription() == null ||attachment.getDescription().trim().equals("null") || attachment.getDescription().trim().equals("")) {
+ if( attachments.get(i).getDescription() == null ||attachments.get(i).getDescription().trim().equals("null") || attachments.get(i).getDescription().trim().equals("")) {
v.setBackgroundColor( ContextCompat.getColor(TootActivity.this, R.color.red_1));
}else
v.setBackgroundColor(ContextCompat.getColor(TootActivity.this, R.color.green_1));
}
- }
-
}
}
diff --git a/app/src/main/java/app/fedilab/android/client/API.java b/app/src/main/java/app/fedilab/android/client/API.java
index 8242a4575..949d5742b 100644
--- a/app/src/main/java/app/fedilab/android/client/API.java
+++ b/app/src/main/java/app/fedilab/android/client/API.java
@@ -20,6 +20,7 @@ import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
+import android.util.Log;
import com.google.gson.JsonArray;
@@ -2405,6 +2406,7 @@ public class API {
for(Attachment attachment: status.getMedia_attachments())
mediaArray.add(attachment.getId());
jsonObject.add("media_ids", mediaArray);
+ Log.v(Helper.TAG,"jsonObject: " + jsonObject);
}
if( status.getScheduled_at() != null)
jsonObject.addProperty("scheduled_at", status.getScheduled_at());
diff --git a/app/src/main/java/app/fedilab/android/client/Entities/Attachment.java b/app/src/main/java/app/fedilab/android/client/Entities/Attachment.java
index 9e012f7f3..dd20bec05 100644
--- a/app/src/main/java/app/fedilab/android/client/Entities/Attachment.java
+++ b/app/src/main/java/app/fedilab/android/client/Entities/Attachment.java
@@ -32,28 +32,7 @@ public class Attachment implements Parcelable{
private String meta;
private String text_url;
private String description;
-
- public Attachment(Parcel in) {
- id = in.readString();
- type = in.readString();
- url = in.readString();
- remote_url = in.readString();
- preview_url = in.readString();
- text_url = in.readString();
- description = in.readString();
- }
-
- public static final Creator<Attachment> CREATOR = new Creator<Attachment>() {
- @Override
- public Attachment createFromParcel(Parcel in) {
- return new Attachment(in);
- }
-
- @Override
- public Attachment[] newArray(int size) {
- return new Attachment[size];
- }
- };
+ private String file_name;
public Attachment() {
@@ -107,22 +86,6 @@ public class Attachment implements Parcelable{
this.text_url = text_url;
}
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(id);
- dest.writeString(type);
- dest.writeString(url);
- dest.writeString(remote_url);
- dest.writeString(preview_url);
- dest.writeString(text_url);
- dest.writeString(description);
- }
-
public String getDescription() {
return description;
}
@@ -138,4 +101,54 @@ public class Attachment implements Parcelable{
public void setMeta(String meta) {
this.meta = meta;
}
+
+ public String getFile_name() {
+ return file_name;
+ }
+
+ public void setFile_name(String file_name) {
+ this.file_name = file_name;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(this.id);
+ dest.writeString(this.type);
+ dest.writeString(this.url);
+ dest.writeString(this.remote_url);
+ dest.writeString(this.preview_url);
+ dest.writeString(this.meta);
+ dest.writeString(this.text_url);
+ dest.writeString(this.description);
+ dest.writeString(this.file_name);
+ }
+
+ protected Attachment(Parcel in) {
+ this.id = in.readString();
+ this.type = in.readString();
+ this.url = in.readString();
+ this.remote_url = in.readString();
+ this.preview_url = in.readString();
+ this.meta = in.readString();
+ this.text_url = in.readString();
+ this.description = in.readString();
+ this.file_name = in.readString();
+ }
+
+ public static final Creator<Attachment> CREATOR = new Creator<Attachment>() {
+ @Override
+ public Attachment createFromParcel(Parcel source) {
+ return new Attachment(source);
+ }
+
+ @Override
+ public Attachment[] newArray(int size) {
+ return new Attachment[size];
+ }
+ };
}
diff --git a/app/src/main/res/drawable/ic_arrow_back.xml b/app/src/main/res/drawable/ic_arrow_back.xml
new file mode 100644
index 000000000..beafea395
--- /dev/null
+++ b/app/src/main/res/drawable/ic_arrow_back.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
+</vector>
diff --git a/app/src/main/res/drawable/ic_arrow_forward.xml b/app/src/main/res/drawable/ic_arrow_forward.xml
new file mode 100644
index 000000000..cf9e208e6
--- /dev/null
+++ b/app/src/main/res/drawable/ic_arrow_forward.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z"/>
+</vector>
diff --git a/app/src/main/res/layout/activity_toot.xml b/app/src/main/res/layout/activity_toot.xml
index 1584d9f9d..f5de31723 100644
--- a/app/src/main/res/layout/activity_toot.xml
+++ b/app/src/main/res/layout/activity_toot.xml
@@ -84,16 +84,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
-
<LinearLayout
android:id="@+id/toot_picture_container"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
- android:maxHeight="100dp"
android:orientation="horizontal"
- android:padding="5dp"></LinearLayout>
+ android:padding="5dp"/>
</HorizontalScrollView>
<LinearLayout
diff --git a/app/src/main/res/layout/toot_media.xml b/app/src/main/res/layout/toot_media.xml
new file mode 100644
index 000000000..910787586
--- /dev/null
+++ b/app/src/main/res/layout/toot_media.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ >
+ <ImageView
+ android:id="@+id/media_img"
+ android:layout_width="wrap_content"
+ android:scaleType="centerCrop"
+ android:adjustViewBounds="true"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <ImageView
+ android:id="@+id/move_left"
+ android:src="@drawable/ic_arrow_back"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:contentDescription="@string/move_media_left" />
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"/>
+ <ImageView
+ android:id="@+id/move_right"
+ android:src="@drawable/ic_arrow_forward"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:contentDescription="@string/move_media_right"/>
+ </LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d8d4a61d4..6fb4b7807 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -977,6 +977,8 @@
<string name="save_image_failed">Failed to save Image</string>
<string name="opacity">Opacity</string>
<string name="label_crop">Crop</string>
+ <string name="move_media_left">Move the media to the left</string>
+ <string name="move_media_right">Move the media to the right</string>
<plurals name="number_of_vote">
<item quantity="one">%d vote</item>
<item quantity="other">%d votes</item>