Adds Media description #438 - //TODO: adds a setting entry
This commit is contained in:
parent
2c8314a013
commit
325bbcd69b
|
@ -94,6 +94,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
|
|||
private ProgressBar pbar_inf;
|
||||
private TextView message_ready;
|
||||
private boolean canSwipe;
|
||||
private TextView media_description;
|
||||
|
||||
private enum actionSwipe{
|
||||
RIGHT_TO_LEFT,
|
||||
|
@ -145,6 +146,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
|
|||
}else if( theme == Helper.THEME_DARK){
|
||||
main_container_media.setBackgroundResource(R.color.mastodonC1_);
|
||||
}
|
||||
media_description = findViewById(R.id.media_description);
|
||||
message_ready = findViewById(R.id.message_ready);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
@ -309,6 +311,14 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
|
|||
videoView.stopPlayback();
|
||||
}
|
||||
imageView.setVisibility(View.GONE);
|
||||
|
||||
if( attachment.getDescription() != null && !attachment.getDescription().equals("null")){
|
||||
media_description.setText(attachment.getDescription());
|
||||
media_description.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
media_description.setText("");
|
||||
media_description.setVisibility(View.GONE);
|
||||
}
|
||||
preview_url = attachment.getPreview_url();
|
||||
if( type.equals("unknown")){
|
||||
preview_url = attachment.getRemote_url();
|
||||
|
|
|
@ -1628,6 +1628,9 @@ public class API {
|
|||
attachment.setType(attObj.get("type").toString());
|
||||
attachment.setText_url(attObj.get("text_url").toString());
|
||||
attachment.setUrl(attObj.get("url").toString());
|
||||
try {
|
||||
attachment.setDescription(attObj.get("description").toString());
|
||||
}catch (JSONException ignore){}
|
||||
attachments.add(attachment);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,13 +59,32 @@
|
|||
android:layout_gravity="center"
|
||||
android:layout_height="wrap_content" />
|
||||
</RelativeLayout>
|
||||
<com.github.chrisbanes.photoview.PhotoView
|
||||
android:visibility="gone"
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_centerInParent="true"
|
||||
android:id="@+id/media_picture"
|
||||
android:id="@+id/media_picture_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:layout_height="match_parent">
|
||||
<com.github.chrisbanes.photoview.PhotoView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/media_picture"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:id="@+id/media_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dip"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:padding="12dp"
|
||||
android:background="#AA000000"
|
||||
android:textColor="#ffffffff"
|
||||
/>
|
||||
</FrameLayout>
|
||||
<VideoView
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone"
|
||||
|
@ -136,7 +155,7 @@
|
|||
android:text="@string/media_ready"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
android:layout_alignBottom="@+id/media_picture"
|
||||
android:layout_alignBottom="@+id/media_picture_container"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"/>
|
||||
|
|
Loading…
Reference in New Issue