diff options
Diffstat (limited to 'app/src/main/java/ml')
4 files changed, 21 insertions, 3 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java index a2efbda0..ce53e892 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java @@ -16,6 +16,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Environment; +import android.text.Html; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; @@ -65,6 +66,7 @@ public class ViewGIFActivity extends AppCompatActivity { public static final String IMAGE_URL_KEY = "IUK"; public static final String FILE_NAME_KEY = "FNK"; + public static final String POST_TITLE_KEY = "PTK"; private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0; @BindView(R.id.parent_relative_layout_view_gif_activity) RelativeLayout mRelativeLayout; @@ -88,6 +90,7 @@ public class ViewGIFActivity extends AppCompatActivity { private float touchY = -1.0f; private float zoom = 1.0f; private boolean isSwiping = false; + private String postTitle; @Override protected void onCreate(Bundle savedInstanceState) { @@ -113,13 +116,15 @@ public class ViewGIFActivity extends AppCompatActivity { Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp); actionBar.setHomeAsUpIndicator(upArrow); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor))); - setTitle(""); glide = Glide.with(this); Intent intent = getIntent(); mImageUrl = intent.getStringExtra(IMAGE_URL_KEY); mImageFileName = intent.getStringExtra(FILE_NAME_KEY); + postTitle = intent.getStringExtra(POST_TITLE_KEY); + + setTitle(Html.fromHtml(String.format("<small>%s</small>", postTitle))); mLoadErrorLinearLayout.setOnClickListener(view -> { if (!isSwiping) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java index 40ffb2eb..6b0e0c7d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java @@ -17,6 +17,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Environment; +import android.text.Html; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; @@ -69,6 +70,7 @@ public class ViewImageActivity extends AppCompatActivity { public static final String IMAGE_URL_KEY = "IUK"; public static final String FILE_NAME_KEY = "FNK"; + public static final String POST_TITLE_KEY = "PTK"; private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0; @BindView(R.id.parent_relative_layout_view_image_activity) RelativeLayout mRelativeLayout; @@ -92,6 +94,7 @@ public class ViewImageActivity extends AppCompatActivity { private float zoom = 1.0f; private boolean isSwiping = false; private RequestManager glide; + private String postTitle; @Override protected void onCreate(Bundle savedInstanceState) { @@ -118,13 +121,15 @@ public class ViewImageActivity extends AppCompatActivity { Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp); actionBar.setHomeAsUpIndicator(upArrow); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor))); - setTitle(""); glide = Glide.with(this); Intent intent = getIntent(); mImageUrl = intent.getStringExtra(IMAGE_URL_KEY); mImageFileName = intent.getStringExtra(FILE_NAME_KEY); + postTitle = intent.getStringExtra(POST_TITLE_KEY); + + setTitle(Html.fromHtml(String.format("<small>%s</small>", postTitle))); mLoadErrorLinearLayout.setOnClickListener(view -> { if (!isSwiping) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java index a3694352..2bb35763 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java @@ -18,6 +18,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Environment; +import android.text.Html; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; @@ -67,6 +68,7 @@ public class ViewVideoActivity extends AppCompatActivity { public static final String EXTRA_VIDEO_DOWNLOAD_URL = "EVDU"; public static final String EXTRA_SUBREDDIT = "ES"; public static final String EXTRA_ID = "EI"; + public static final String EXTRA_POST_TITLE = "EPT"; private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0; private static final String IS_MUTE_STATE = "IMS"; @BindView(R.id.relative_layout_view_video_activity) @@ -90,6 +92,7 @@ public class ViewVideoActivity extends AppCompatActivity { private boolean isMute = false; private float totalLengthY = 0.0f; private float touchY = -1.0f; + private String postTitle; @Inject @Named("default") @@ -111,7 +114,6 @@ public class ViewVideoActivity extends AppCompatActivity { Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp); actionBar.setHomeAsUpIndicator(upArrow); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor))); - setTitle(""); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || getResources().getBoolean(R.bool.isTablet)) { //Set player controller bottom margin in order to display it above the navbar @@ -131,6 +133,9 @@ public class ViewVideoActivity extends AppCompatActivity { mVideoUri = intent.getData(); videoDownloadUrl = intent.getStringExtra(EXTRA_VIDEO_DOWNLOAD_URL); videoFileName = intent.getStringExtra(EXTRA_SUBREDDIT) + "-" + intent.getStringExtra(EXTRA_ID) + ".mp4"; + postTitle = intent.getStringExtra(EXTRA_POST_TITLE); + + setTitle(Html.fromHtml(String.format("<small>%s</small>", postTitle))); final float pxHeight = getResources().getDisplayMetrics().heightPixels; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index e6203992..e8db17ee 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -511,6 +511,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, imageUrl); intent.putExtra(ViewImageActivity.FILE_NAME_KEY, subredditName + "-" + id + ".jpg"); + intent.putExtra(ViewImageActivity.POST_TITLE_KEY, post.getTitle()); mActivity.startActivity(intent); }); @@ -547,6 +548,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, subredditName + "-" + id + ".gif"); intent.putExtra(ViewGIFActivity.IMAGE_URL_KEY, post.getVideoUrl()); + intent.putExtra(ViewGIFActivity.POST_TITLE_KEY, post.getTitle()); mActivity.startActivity(intent); }); @@ -562,6 +564,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_DOWNLOAD_URL, post.getVideoDownloadUrl()); intent.putExtra(ViewVideoActivity.EXTRA_SUBREDDIT, subredditName); intent.putExtra(ViewVideoActivity.EXTRA_ID, fullName); + intent.putExtra(ViewVideoActivity.EXTRA_POST_TITLE, post.getTitle()); mActivity.startActivity(intent); }); |