mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-11 18:57:11 +01:00
Bind views using ButterKnife. Let volume controls adjust music stream in ViewVideoActivity.
This commit is contained in:
parent
ae81b23737
commit
86ea4c8982
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@ -64,5 +64,4 @@ dependencies {
|
|||||||
annotationProcessor 'com.google.dagger:dagger-compiler:2.17'
|
annotationProcessor 'com.google.dagger:dagger-compiler:2.17'
|
||||||
implementation 'com.jakewharton:butterknife:8.8.1'
|
implementation 'com.jakewharton:butterknife:8.8.1'
|
||||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ import java.util.List;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
import de.hdodenhof.circleimageview.CircleImageView;
|
import de.hdodenhof.circleimageview.CircleImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
@ -44,6 +46,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
private static final String FETCH_USER_INFO_STATE = "FUIS";
|
private static final String FETCH_USER_INFO_STATE = "FUIS";
|
||||||
private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS";
|
private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS";
|
||||||
|
|
||||||
|
@BindView(R.id.subscribed_subreddit_recycler_view_main_activity) RecyclerView subscribedSubredditRecyclerView;
|
||||||
|
@BindView(R.id.subscriptions_label_main_activity) TextView subscriptionsLabelTextView;
|
||||||
|
@BindView(R.id.subscribed_user_recycler_view_main_activity) RecyclerView subscribedUserRecyclerView;
|
||||||
|
@BindView(R.id.following_label_main_activity) TextView followingLabelTextView;
|
||||||
|
|
||||||
private TextView mNameTextView;
|
private TextView mNameTextView;
|
||||||
private TextView mKarmaTextView;
|
private TextView mKarmaTextView;
|
||||||
private CircleImageView mProfileImageView;
|
private CircleImageView mProfileImageView;
|
||||||
@ -77,6 +84,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
((Infinity) getApplication()).getmNetworkComponent().inject(this);
|
((Infinity) getApplication()).getmNetworkComponent().inject(this);
|
||||||
|
|
||||||
@ -113,15 +121,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
mProfileImageView = header.findViewById(R.id.profile_image_view_nav_header_main);
|
mProfileImageView = header.findViewById(R.id.profile_image_view_nav_header_main);
|
||||||
mBannerImageView = header.findViewById(R.id.banner_image_view_nav_header_main);
|
mBannerImageView = header.findViewById(R.id.banner_image_view_nav_header_main);
|
||||||
|
|
||||||
RecyclerView subscribedSubredditRecyclerView = findViewById(R.id.subscribed_subreddit_recycler_view_main_activity);
|
|
||||||
subscribedSubredditRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
subscribedSubredditRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||||
subscribedSubredditRecyclerView.setNestedScrollingEnabled(false);
|
subscribedSubredditRecyclerView.setNestedScrollingEnabled(false);
|
||||||
final TextView subscriptionsLabelTextView = findViewById(R.id.subscriptions_label_main_activity);
|
|
||||||
|
|
||||||
RecyclerView subscribedUserRecyclerView = findViewById(R.id.subscribed_user_recycler_view_main_activity);
|
|
||||||
subscribedUserRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
subscribedUserRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||||
subscribedUserRecyclerView.setNestedScrollingEnabled(false);
|
subscribedUserRecyclerView.setNestedScrollingEnabled(false);
|
||||||
final TextView followingLabelTextView = findViewById(R.id.following_label_main_activity);
|
|
||||||
|
|
||||||
mName = getSharedPreferences(SharedPreferencesUtils.USER_INFO_FILE_KEY, Context.MODE_PRIVATE).getString(SharedPreferencesUtils.USER_KEY, "");
|
mName = getSharedPreferences(SharedPreferencesUtils.USER_INFO_FILE_KEY, Context.MODE_PRIVATE).getString(SharedPreferencesUtils.USER_KEY, "");
|
||||||
mProfileImageUrl = getSharedPreferences(SharedPreferencesUtils.USER_INFO_FILE_KEY, Context.MODE_PRIVATE).getString(SharedPreferencesUtils.PROFILE_IMAGE_URL_KEY, "");
|
mProfileImageUrl = getSharedPreferences(SharedPreferencesUtils.USER_INFO_FILE_KEY, Context.MODE_PRIVATE).getString(SharedPreferencesUtils.PROFILE_IMAGE_URL_KEY, "");
|
||||||
|
@ -52,6 +52,9 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
public class ViewImageActivity extends AppCompatActivity {
|
public class ViewImageActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
|
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
|
||||||
@ -60,9 +63,10 @@ public class ViewImageActivity extends AppCompatActivity {
|
|||||||
static final String IMAGE_URL_KEY = "IUK";
|
static final String IMAGE_URL_KEY = "IUK";
|
||||||
static final String FILE_NAME_KEY = "FNK";
|
static final String FILE_NAME_KEY = "FNK";
|
||||||
|
|
||||||
private ProgressBar mProgressBar;
|
@BindView(R.id.parent_relative_layout_view_image_activity) RelativeLayout mRelativeLayout;
|
||||||
private GestureImageView mImageView;
|
@BindView(R.id.progress_bar_view_image_activity) ProgressBar mProgressBar;
|
||||||
private LinearLayout mLoadErrorLinearLayout;
|
@BindView(R.id.image_view_view_image_activity) GestureImageView mImageView;
|
||||||
|
@BindView(R.id.load_image_error_linear_layout_view_image_activity) LinearLayout mLoadErrorLinearLayout;
|
||||||
|
|
||||||
private boolean isActionBarHidden = false;
|
private boolean isActionBarHidden = false;
|
||||||
private boolean isDownloading = false;
|
private boolean isDownloading = false;
|
||||||
@ -83,6 +87,8 @@ public class ViewImageActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_view_image);
|
setContentView(R.layout.activity_view_image);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
final ActionBar actionBar = getSupportActionBar();
|
final ActionBar actionBar = getSupportActionBar();
|
||||||
final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
|
final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
|
||||||
actionBar.setHomeAsUpIndicator(upArrow);
|
actionBar.setHomeAsUpIndicator(upArrow);
|
||||||
@ -94,10 +100,10 @@ public class ViewImageActivity extends AppCompatActivity {
|
|||||||
final Spannable text = new SpannableString(title);
|
final Spannable text = new SpannableString(title);
|
||||||
setTitle(text);
|
setTitle(text);
|
||||||
|
|
||||||
final RelativeLayout relativeLayout = findViewById(R.id.parent_relative_layout_view_image_activity);
|
/*final RelativeLayout mRelativeLayout = findViewById(R.id.parent_relative_layout_view_image_activity);
|
||||||
mImageView = findViewById(R.id.image_view_view_image_activity);
|
mImageView = findViewById(R.id.image_view_view_image_activity);
|
||||||
mProgressBar = findViewById(R.id.progress_bar_view_image_activity);
|
mProgressBar = findViewById(R.id.progress_bar_view_image_activity);
|
||||||
mLoadErrorLinearLayout = findViewById(R.id.load_image_error_linear_layout_view_image_activity);
|
mLoadErrorLinearLayout = findViewById(R.id.load_image_error_linear_layout_view_image_activity);*/
|
||||||
|
|
||||||
mLoadErrorLinearLayout.setOnClickListener(new View.OnClickListener() {
|
mLoadErrorLinearLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -128,7 +134,7 @@ public class ViewImageActivity extends AppCompatActivity {
|
|||||||
activityColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
activityColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationUpdate(ValueAnimator valueAnimator) {
|
public void onAnimationUpdate(ValueAnimator valueAnimator) {
|
||||||
relativeLayout.setBackgroundColor((int) valueAnimator.getAnimatedValue());
|
mRelativeLayout.setBackgroundColor((int) valueAnimator.getAnimatedValue());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -41,6 +41,8 @@ import java.util.List;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
import de.hdodenhof.circleimageview.CircleImageView;
|
import de.hdodenhof.circleimageview.CircleImageView;
|
||||||
import jp.wasabeef.glide.transformations.BlurTransformation;
|
import jp.wasabeef.glide.transformations.BlurTransformation;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
@ -56,17 +58,35 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
private int mMoreCommentCount;
|
private int mMoreCommentCount;
|
||||||
private PostData mPostData;
|
private PostData mPostData;
|
||||||
|
|
||||||
private CoordinatorLayout mCoordinatorLayout;
|
@BindView(R.id.coordinator_layout_view_post_detail) CoordinatorLayout mCoordinatorLayout;
|
||||||
private ProgressBar mLoadImageProgressBar;
|
@BindView(R.id.subreddit_icon_circle_image_view_view_post_detail) CircleImageView mSubredditIconCircleImageView;
|
||||||
private ImageView mImageView;
|
@BindView(R.id.post_time_text_view_view_post_detail) TextView mPostTimeTextView;
|
||||||
private RelativeLayout mLoadWrapper;
|
@BindView(R.id.subreddit_text_view_view_post_detail) TextView mSubredditTextView;
|
||||||
private TextView mLoadImageErrorTextView;
|
@BindView(R.id.content_html_text_view_view_post_detail) HtmlTextView mContentTextView;
|
||||||
private ProgressBar mCommentProgressbar;
|
@BindView(R.id.type_text_view_view_post_detail) TextView mTypeTextView;
|
||||||
private CardView mCommentCardView;
|
@BindView(R.id.gilded_image_view_view_post_detail) ImageView mGildedImageView;
|
||||||
private MultiLevelRecyclerView mRecyclerView;
|
@BindView(R.id.gilded_number_text_view_view_post_detail) TextView mGildedNumberTextView;
|
||||||
|
@BindView(R.id.crosspost_image_view_view_post_detail) ImageView mCrosspostImageView;
|
||||||
|
@BindView(R.id.nsfw_text_view_view_post_detail) TextView mNSFWTextView;
|
||||||
|
@BindView(R.id.image_view_wrapper_view_post_detail) RelativeLayout mRelativeLayout;
|
||||||
|
|
||||||
private LinearLayout mNoCommentWrapperLinearLayout;
|
@BindView(R.id.load_wrapper_view_post_detail) RelativeLayout mLoadWrapper;
|
||||||
private ImageView mNoCommentImageView;
|
@BindView(R.id.progress_bar_view_post_detail) ProgressBar mLoadImageProgressBar;
|
||||||
|
@BindView(R.id.load_image_error_text_view_view_post_detail) TextView mLoadImageErrorTextView;
|
||||||
|
@BindView(R.id.image_view_view_post_detail) ImageView mImageView;
|
||||||
|
@BindView(R.id.image_view_no_preview_link_view_post_detail) ImageView mNoPreviewLinkImageView;
|
||||||
|
|
||||||
|
@BindView(R.id.plus_button_view_post_detail) ImageView mUpvoteButton;
|
||||||
|
@BindView(R.id.score_text_view_view_post_detail) TextView mScoreTextView;
|
||||||
|
@BindView(R.id.minus_button_view_post_detail) ImageView mDownvoteButton;
|
||||||
|
@BindView(R.id.share_button_view_post_detail) ImageView mShareButton;
|
||||||
|
|
||||||
|
@BindView(R.id.comment_progress_bar_view_post_detail) ProgressBar mCommentProgressbar;
|
||||||
|
@BindView(R.id.comment_card_view_view_post_detail) CardView mCommentCardView;
|
||||||
|
@BindView(R.id.recycler_view_view_post_detail) MultiLevelRecyclerView mRecyclerView;
|
||||||
|
|
||||||
|
@BindView(R.id.no_comment_wrapper_linear_layout_view_post_detail) LinearLayout mNoCommentWrapperLinearLayout;
|
||||||
|
@BindView(R.id.no_comment_image_view_view_post_detail) ImageView mNoCommentImageView;
|
||||||
|
|
||||||
private LoadSubredditIconAsyncTask mLoadSubredditIconAsyncTask;
|
private LoadSubredditIconAsyncTask mLoadSubredditIconAsyncTask;
|
||||||
|
|
||||||
@ -83,6 +103,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_view_post_detail);
|
setContentView(R.layout.activity_view_post_detail);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
((Infinity) getApplication()).getmNetworkComponent().inject(this);
|
((Infinity) getApplication()).getmNetworkComponent().inject(this);
|
||||||
|
|
||||||
@ -95,36 +116,6 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
TextView titleTextView = findViewById(R.id.title_text_view_view_post_detail);
|
TextView titleTextView = findViewById(R.id.title_text_view_view_post_detail);
|
||||||
titleTextView.setText(mPostData.getTitle());
|
titleTextView.setText(mPostData.getTitle());
|
||||||
|
|
||||||
mCoordinatorLayout = findViewById(R.id.coordinator_layout_view_post_detail);
|
|
||||||
|
|
||||||
final CircleImageView subredditIconCircleImageView = findViewById(R.id.subreddit_icon_circle_image_view_view_post_detail);
|
|
||||||
TextView postTimeTextView = findViewById(R.id.post_time_text_view_view_post_detail);
|
|
||||||
TextView subredditTextView = findViewById(R.id.subreddit_text_view_view_post_detail);
|
|
||||||
HtmlTextView contentTextView = findViewById(R.id.content_html_text_view_view_post_detail);
|
|
||||||
TextView typeTextView = findViewById(R.id.type_text_view_view_post_detail);
|
|
||||||
ImageView gildedImageView = findViewById(R.id.gilded_image_view_view_post_detail);
|
|
||||||
TextView gildedNumberTextView = findViewById(R.id.gilded_number_text_view_view_post_detail);
|
|
||||||
ImageView crosspostImageView = findViewById(R.id.crosspost_image_view_view_post_detail);
|
|
||||||
TextView nsfwTextView = findViewById(R.id.nsfw_text_view_view_post_detail);
|
|
||||||
RelativeLayout relativeLayout = findViewById(R.id.image_view_wrapper_view_post_detail);
|
|
||||||
mLoadWrapper = findViewById(R.id.load_wrapper_view_post_detail);
|
|
||||||
mLoadImageProgressBar = findViewById(R.id.progress_bar_view_post_detail);
|
|
||||||
mLoadImageErrorTextView = findViewById(R.id.load_image_error_text_view_view_post_detail);
|
|
||||||
mImageView = findViewById(R.id.image_view_view_post_detail);
|
|
||||||
ImageView noPreviewLinkImageView = findViewById(R.id.image_view_no_preview_link_view_post_detail);
|
|
||||||
|
|
||||||
final ImageView upvoteButton = findViewById(R.id.plus_button_view_post_detail);
|
|
||||||
final TextView scoreTextView = findViewById(R.id.score_text_view_view_post_detail);
|
|
||||||
final ImageView downvoteButton = findViewById(R.id.minus_button_view_post_detail);
|
|
||||||
ImageView shareButton = findViewById(R.id.share_button_view_post_detail);
|
|
||||||
|
|
||||||
mCommentProgressbar = findViewById(R.id.comment_progress_bar_view_post_detail);
|
|
||||||
mCommentCardView = findViewById(R.id.comment_card_view_view_post_detail);
|
|
||||||
mRecyclerView = findViewById(R.id.recycler_view_view_post_detail);
|
|
||||||
|
|
||||||
mNoCommentWrapperLinearLayout = findViewById(R.id.no_comment_wrapper_linear_layout_view_post_detail);
|
|
||||||
mNoCommentImageView = findViewById(R.id.no_comment_image_view_view_post_detail);
|
|
||||||
|
|
||||||
if(mPostData.getSubredditIconUrl() == null) {
|
if(mPostData.getSubredditIconUrl() == null) {
|
||||||
mLoadSubredditIconAsyncTask = new LoadSubredditIconAsyncTask(
|
mLoadSubredditIconAsyncTask = new LoadSubredditIconAsyncTask(
|
||||||
SubredditRoomDatabase.getDatabase(this).subredditDao(), mPostData.getSubredditNamePrefixed(),
|
SubredditRoomDatabase.getDatabase(this).subredditDao(), mPostData.getSubredditNamePrefixed(),
|
||||||
@ -133,10 +124,10 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
public void loadIconSuccess(String iconImageUrl) {
|
public void loadIconSuccess(String iconImageUrl) {
|
||||||
if(!iconImageUrl.equals("")) {
|
if(!iconImageUrl.equals("")) {
|
||||||
Glide.with(ViewPostDetailActivity.this).load(iconImageUrl)
|
Glide.with(ViewPostDetailActivity.this).load(iconImageUrl)
|
||||||
.into(subredditIconCircleImageView);
|
.into(mSubredditIconCircleImageView);
|
||||||
} else {
|
} else {
|
||||||
Glide.with(ViewPostDetailActivity.this).load(R.drawable.subreddit_default_icon)
|
Glide.with(ViewPostDetailActivity.this).load(R.drawable.subreddit_default_icon)
|
||||||
.into(subredditIconCircleImageView);
|
.into(mSubredditIconCircleImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
mPostData.setSubredditIconUrl(iconImageUrl);
|
mPostData.setSubredditIconUrl(iconImageUrl);
|
||||||
@ -144,12 +135,12 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
mLoadSubredditIconAsyncTask.execute();
|
mLoadSubredditIconAsyncTask.execute();
|
||||||
} else if(!mPostData.getSubredditIconUrl().equals("")) {
|
} else if(!mPostData.getSubredditIconUrl().equals("")) {
|
||||||
Glide.with(this).load(mPostData.getSubredditIconUrl()).into(subredditIconCircleImageView);
|
Glide.with(this).load(mPostData.getSubredditIconUrl()).into(mSubredditIconCircleImageView);
|
||||||
} else {
|
} else {
|
||||||
Glide.with(this).load(R.drawable.subreddit_default_icon).into(subredditIconCircleImageView);
|
Glide.with(this).load(R.drawable.subreddit_default_icon).into(mSubredditIconCircleImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
subredditIconCircleImageView.setOnClickListener(new View.OnClickListener() {
|
mSubredditIconCircleImageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Intent intent = new Intent(ViewPostDetailActivity.this, ViewSubredditDetailActivity.class);
|
Intent intent = new Intent(ViewPostDetailActivity.this, ViewSubredditDetailActivity.class);
|
||||||
@ -165,30 +156,30 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
switch (mPostData.getVoteType()) {
|
switch (mPostData.getVoteType()) {
|
||||||
case 1:
|
case 1:
|
||||||
//Upvote
|
//Upvote
|
||||||
upvoteButton.setColorFilter(ContextCompat.getColor(this, R.color.colorPrimary), android.graphics.PorterDuff.Mode.SRC_IN);
|
mUpvoteButton.setColorFilter(ContextCompat.getColor(this, R.color.colorPrimary), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
//Downvote
|
//Downvote
|
||||||
downvoteButton.setColorFilter(ContextCompat.getColor(this, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
mDownvoteButton.setColorFilter(ContextCompat.getColor(this, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mPostData.getPostType() != PostData.TEXT_TYPE && mPostData.getPostType() != PostData.NO_PREVIEW_LINK_TYPE) {
|
if(mPostData.getPostType() != PostData.TEXT_TYPE && mPostData.getPostType() != PostData.NO_PREVIEW_LINK_TYPE) {
|
||||||
relativeLayout.setVisibility(View.VISIBLE);
|
mRelativeLayout.setVisibility(View.VISIBLE);
|
||||||
mImageView.setVisibility(View.VISIBLE);
|
mImageView.setVisibility(View.VISIBLE);
|
||||||
loadImage();
|
loadImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mPostData.isCrosspost()) {
|
if(mPostData.isCrosspost()) {
|
||||||
crosspostImageView.setVisibility(View.VISIBLE);
|
mCrosspostImageView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
mRecyclerView.setNestedScrollingEnabled(false);
|
mRecyclerView.setNestedScrollingEnabled(false);
|
||||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||||
mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
|
mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
|
||||||
|
|
||||||
subredditTextView.setText(mPostData.getSubredditNamePrefixed());
|
mSubredditTextView.setText(mPostData.getSubredditNamePrefixed());
|
||||||
subredditTextView.setOnClickListener(new View.OnClickListener() {
|
mSubredditTextView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Intent intent = new Intent(ViewPostDetailActivity.this, ViewSubredditDetailActivity.class);
|
Intent intent = new Intent(ViewPostDetailActivity.this, ViewSubredditDetailActivity.class);
|
||||||
@ -201,22 +192,22 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
postTimeTextView.setText(mPostData.getPostTime());
|
mPostTimeTextView.setText(mPostData.getPostTime());
|
||||||
|
|
||||||
if(mPostData.getGilded() > 0) {
|
if(mPostData.getGilded() > 0) {
|
||||||
gildedImageView.setVisibility(View.VISIBLE);
|
mGildedImageView.setVisibility(View.VISIBLE);
|
||||||
Glide.with(this).load(R.drawable.gold).into(gildedImageView);
|
Glide.with(this).load(R.drawable.gold).into(mGildedImageView);
|
||||||
gildedNumberTextView.setVisibility(View.VISIBLE);
|
mGildedNumberTextView.setVisibility(View.VISIBLE);
|
||||||
String gildedNumber = getResources().getString(R.string.gilded, mPostData.getGilded());
|
String gildedNumber = getResources().getString(R.string.gilded, mPostData.getGilded());
|
||||||
gildedNumberTextView.setText(gildedNumber);
|
mGildedNumberTextView.setText(gildedNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mPostData.isNSFW()) {
|
if(mPostData.isNSFW()) {
|
||||||
nsfwTextView.setVisibility(View.VISIBLE);
|
mNSFWTextView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore()));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore()));
|
||||||
|
|
||||||
shareButton.setOnClickListener(new View.OnClickListener() {
|
mShareButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
@ -229,7 +220,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
switch (mPostData.getPostType()) {
|
switch (mPostData.getPostType()) {
|
||||||
case PostData.IMAGE_TYPE:
|
case PostData.IMAGE_TYPE:
|
||||||
typeTextView.setText("IMAGE");
|
mTypeTextView.setText("IMAGE");
|
||||||
mImageView.setOnClickListener(new View.OnClickListener() {
|
mImageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@ -243,10 +234,10 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PostData.LINK_TYPE:
|
case PostData.LINK_TYPE:
|
||||||
typeTextView.setText("LINK");
|
mTypeTextView.setText("LINK");
|
||||||
if(mPostData.getSelfText() != null && !mPostData.getSelfText().equals("")) {
|
if(mPostData.getSelfText() != null && !mPostData.getSelfText().equals("")) {
|
||||||
contentTextView.setVisibility(View.VISIBLE);
|
mContentTextView.setVisibility(View.VISIBLE);
|
||||||
contentTextView.setHtml(mPostData.getSelfText());
|
mContentTextView.setHtml(mPostData.getSelfText());
|
||||||
}
|
}
|
||||||
|
|
||||||
mImageView.setOnClickListener(new View.OnClickListener() {
|
mImageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -262,7 +253,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PostData.GIF_VIDEO_TYPE:
|
case PostData.GIF_VIDEO_TYPE:
|
||||||
typeTextView.setText("GIF");
|
mTypeTextView.setText("GIF");
|
||||||
|
|
||||||
final Uri gifVideoUri = Uri.parse(mPostData.getVideoUrl());
|
final Uri gifVideoUri = Uri.parse(mPostData.getVideoUrl());
|
||||||
mImageView.setOnClickListener(new View.OnClickListener() {
|
mImageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -283,7 +274,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PostData.VIDEO_TYPE:
|
case PostData.VIDEO_TYPE:
|
||||||
typeTextView.setText("VIDEO");
|
mTypeTextView.setText("VIDEO");
|
||||||
|
|
||||||
final Uri videoUri = Uri.parse(mPostData.getVideoUrl());
|
final Uri videoUri = Uri.parse(mPostData.getVideoUrl());
|
||||||
mImageView.setOnClickListener(new View.OnClickListener() {
|
mImageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -304,13 +295,13 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PostData.NO_PREVIEW_LINK_TYPE:
|
case PostData.NO_PREVIEW_LINK_TYPE:
|
||||||
typeTextView.setText("LINK");
|
mTypeTextView.setText("LINK");
|
||||||
if(!mPostData.getSelfText().equals("")) {
|
if(!mPostData.getSelfText().equals("")) {
|
||||||
contentTextView.setVisibility(View.VISIBLE);
|
mContentTextView.setVisibility(View.VISIBLE);
|
||||||
contentTextView.setHtml(mPostData.getSelfText());
|
mContentTextView.setHtml(mPostData.getSelfText());
|
||||||
}
|
}
|
||||||
noPreviewLinkImageView.setVisibility(View.VISIBLE);
|
mNoPreviewLinkImageView.setVisibility(View.VISIBLE);
|
||||||
noPreviewLinkImageView.setOnClickListener(new View.OnClickListener() {
|
mNoPreviewLinkImageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
|
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
|
||||||
@ -323,10 +314,10 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PostData.TEXT_TYPE:
|
case PostData.TEXT_TYPE:
|
||||||
typeTextView.setText("TEXT");
|
mTypeTextView.setText("TEXT");
|
||||||
if(!mPostData.getSelfText().equals("")) {
|
if(!mPostData.getSelfText().equals("")) {
|
||||||
contentTextView.setVisibility(View.VISIBLE);
|
mContentTextView.setVisibility(View.VISIBLE);
|
||||||
contentTextView.setHtml(mPostData.getSelfText());
|
mContentTextView.setHtml(mPostData.getSelfText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
queryComment();
|
queryComment();
|
||||||
@ -365,21 +356,21 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
upvoteButton.setOnClickListener(new View.OnClickListener() {
|
mUpvoteButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
//observable.subscribe(observer);
|
//observable.subscribe(observer);
|
||||||
final boolean isDownvotedBefore = downvoteButton.getColorFilter() != null;
|
final boolean isDownvotedBefore = mDownvoteButton.getColorFilter() != null;
|
||||||
|
|
||||||
final ColorFilter downVoteButtonColorFilter = downvoteButton.getColorFilter();
|
final ColorFilter downVoteButtonColorFilter = mDownvoteButton.getColorFilter();
|
||||||
downvoteButton.clearColorFilter();
|
mDownvoteButton.clearColorFilter();
|
||||||
|
|
||||||
if (upvoteButton.getColorFilter() == null) {
|
if (mUpvoteButton.getColorFilter() == null) {
|
||||||
upvoteButton.setColorFilter(ContextCompat.getColor(ViewPostDetailActivity.this, R.color.colorPrimary), android.graphics.PorterDuff.Mode.SRC_IN);
|
mUpvoteButton.setColorFilter(ContextCompat.getColor(ViewPostDetailActivity.this, R.color.colorPrimary), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
if(isDownvotedBefore) {
|
if(isDownvotedBefore) {
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore() + 2));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore() + 2));
|
||||||
} else {
|
} else {
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore() + 1));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore() + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
VoteThing.voteThing(mOauthRetrofit, mSharedPreferences, new VoteThing.VoteThingWithoutPositionListener() {
|
VoteThing.voteThing(mOauthRetrofit, mSharedPreferences, new VoteThing.VoteThingWithoutPositionListener() {
|
||||||
@ -396,15 +387,15 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onVoteThingFail() {
|
public void onVoteThingFail() {
|
||||||
Toast.makeText(ViewPostDetailActivity.this, "Cannot upvote this post", Toast.LENGTH_SHORT).show();
|
Toast.makeText(ViewPostDetailActivity.this, "Cannot upvote this post", Toast.LENGTH_SHORT).show();
|
||||||
upvoteButton.clearColorFilter();
|
mUpvoteButton.clearColorFilter();
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore()));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore()));
|
||||||
downvoteButton.setColorFilter(downVoteButtonColorFilter);
|
mDownvoteButton.setColorFilter(downVoteButtonColorFilter);
|
||||||
}
|
}
|
||||||
}, mPostData.getFullName(), RedditUtils.DIR_UPVOTE);
|
}, mPostData.getFullName(), RedditUtils.DIR_UPVOTE);
|
||||||
} else {
|
} else {
|
||||||
//Upvoted before
|
//Upvoted before
|
||||||
upvoteButton.clearColorFilter();
|
mUpvoteButton.clearColorFilter();
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore() - 1));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore() - 1));
|
||||||
|
|
||||||
VoteThing.voteThing(mOauthRetrofit, mSharedPreferences, new VoteThing.VoteThingWithoutPositionListener() {
|
VoteThing.voteThing(mOauthRetrofit, mSharedPreferences, new VoteThing.VoteThingWithoutPositionListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -416,8 +407,8 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onVoteThingFail() {
|
public void onVoteThingFail() {
|
||||||
Toast.makeText(ViewPostDetailActivity.this, "Cannot unvote this post", Toast.LENGTH_SHORT).show();
|
Toast.makeText(ViewPostDetailActivity.this, "Cannot unvote this post", Toast.LENGTH_SHORT).show();
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore() + 1));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore() + 1));
|
||||||
upvoteButton.setColorFilter(ContextCompat.getColor(ViewPostDetailActivity.this, R.color.colorPrimary), android.graphics.PorterDuff.Mode.SRC_IN);
|
mUpvoteButton.setColorFilter(ContextCompat.getColor(ViewPostDetailActivity.this, R.color.colorPrimary), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
mPostData.setScore(mPostData.getScore() + 1);
|
mPostData.setScore(mPostData.getScore() + 1);
|
||||||
}
|
}
|
||||||
}, mPostData.getFullName(), RedditUtils.DIR_UNVOTE);
|
}, mPostData.getFullName(), RedditUtils.DIR_UNVOTE);
|
||||||
@ -425,21 +416,21 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
downvoteButton.setOnClickListener(new View.OnClickListener() {
|
mDownvoteButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
//observable.subscribe(observer);
|
//observable.subscribe(observer);
|
||||||
final boolean isUpvotedBefore = upvoteButton.getColorFilter() != null;
|
final boolean isUpvotedBefore = mUpvoteButton.getColorFilter() != null;
|
||||||
|
|
||||||
final ColorFilter upvoteButtonColorFilter = upvoteButton.getColorFilter();
|
final ColorFilter upvoteButtonColorFilter = mUpvoteButton.getColorFilter();
|
||||||
upvoteButton.clearColorFilter();
|
mUpvoteButton.clearColorFilter();
|
||||||
|
|
||||||
if (downvoteButton.getColorFilter() == null) {
|
if (mDownvoteButton.getColorFilter() == null) {
|
||||||
downvoteButton.setColorFilter(ContextCompat.getColor(ViewPostDetailActivity.this, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
mDownvoteButton.setColorFilter(ContextCompat.getColor(ViewPostDetailActivity.this, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
if (isUpvotedBefore) {
|
if (isUpvotedBefore) {
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore() - 2));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore() - 2));
|
||||||
} else {
|
} else {
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore() - 1));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
VoteThing.voteThing(mOauthRetrofit, mSharedPreferences, new VoteThing.VoteThingWithoutPositionListener() {
|
VoteThing.voteThing(mOauthRetrofit, mSharedPreferences, new VoteThing.VoteThingWithoutPositionListener() {
|
||||||
@ -456,15 +447,15 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onVoteThingFail() {
|
public void onVoteThingFail() {
|
||||||
Toast.makeText(ViewPostDetailActivity.this, "Cannot downvote this post", Toast.LENGTH_SHORT).show();
|
Toast.makeText(ViewPostDetailActivity.this, "Cannot downvote this post", Toast.LENGTH_SHORT).show();
|
||||||
downvoteButton.clearColorFilter();
|
mDownvoteButton.clearColorFilter();
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore()));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore()));
|
||||||
upvoteButton.setColorFilter(upvoteButtonColorFilter);
|
mUpvoteButton.setColorFilter(upvoteButtonColorFilter);
|
||||||
}
|
}
|
||||||
}, mPostData.getFullName(), RedditUtils.DIR_DOWNVOTE);
|
}, mPostData.getFullName(), RedditUtils.DIR_DOWNVOTE);
|
||||||
} else {
|
} else {
|
||||||
//Down voted before
|
//Down voted before
|
||||||
downvoteButton.clearColorFilter();
|
mDownvoteButton.clearColorFilter();
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore() + 1));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore() + 1));
|
||||||
|
|
||||||
VoteThing.voteThing(mOauthRetrofit, mSharedPreferences, new VoteThing.VoteThingWithoutPositionListener() {
|
VoteThing.voteThing(mOauthRetrofit, mSharedPreferences, new VoteThing.VoteThingWithoutPositionListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -476,8 +467,8 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onVoteThingFail() {
|
public void onVoteThingFail() {
|
||||||
Toast.makeText(ViewPostDetailActivity.this, "Cannot unvote this post", Toast.LENGTH_SHORT).show();
|
Toast.makeText(ViewPostDetailActivity.this, "Cannot unvote this post", Toast.LENGTH_SHORT).show();
|
||||||
downvoteButton.setColorFilter(ContextCompat.getColor(ViewPostDetailActivity.this, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
mDownvoteButton.setColorFilter(ContextCompat.getColor(ViewPostDetailActivity.this, R.color.minusButtonColor), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
scoreTextView.setText(Integer.toString(mPostData.getScore()));
|
mScoreTextView.setText(Integer.toString(mPostData.getScore()));
|
||||||
mPostData.setScore(mPostData.getScore());
|
mPostData.setScore(mPostData.getScore());
|
||||||
}
|
}
|
||||||
}, mPostData.getFullName(), RedditUtils.DIR_UNVOTE);
|
}, mPostData.getFullName(), RedditUtils.DIR_UNVOTE);
|
||||||
|
@ -25,6 +25,8 @@ import com.bumptech.glide.RequestManager;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
import de.hdodenhof.circleimageview.CircleImageView;
|
import de.hdodenhof.circleimageview.CircleImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
@ -36,6 +38,14 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private static final String FRAGMENT_OUT_STATE_KEY = "FOSK";
|
private static final String FRAGMENT_OUT_STATE_KEY = "FOSK";
|
||||||
|
|
||||||
|
@BindView(R.id.banner_image_view_view_subreddit_detail_activity) ImageView bannerImageView;
|
||||||
|
@BindView(R.id.icon_circle_image_view_view_subreddit_detail_activity) CircleImageView iconCircleImageView;
|
||||||
|
@BindView(R.id.subreddit_name_text_view_view_subreddit_detail_activity) TextView subredditNameTextView;
|
||||||
|
@BindView(R.id.subscriber_count_text_view_view_subreddit_detail_activity) TextView nSubscribersTextView;
|
||||||
|
@BindView(R.id.online_subscriber_count_text_view_view_subreddit_detail_activity) TextView nOnlineSubscribersTextView;
|
||||||
|
@BindView(R.id.description_text_view_view_subreddit_detail_activity) TextView descriptionTextView;
|
||||||
|
|
||||||
|
private RequestManager glide;
|
||||||
private Fragment mFragment;
|
private Fragment mFragment;
|
||||||
|
|
||||||
private SubredditViewModel mSubredditViewModel;
|
private SubredditViewModel mSubredditViewModel;
|
||||||
@ -48,6 +58,7 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_view_subreddit_detail);
|
setContentView(R.layout.activity_view_subreddit_detail);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
((Infinity) getApplication()).getmNetworkComponent().inject(this);
|
((Infinity) getApplication()).getmNetworkComponent().inject(this);
|
||||||
|
|
||||||
@ -95,13 +106,7 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final ImageView bannerImageView = findViewById(R.id.banner_image_view_view_subreddit_detail_activity);
|
glide = Glide.with(ViewSubredditDetailActivity.this);
|
||||||
final CircleImageView iconCircleImageView = findViewById(R.id.icon_circle_image_view_view_subreddit_detail_activity);
|
|
||||||
final TextView subredditNameTextView = findViewById(R.id.subreddit_name_text_view_view_subreddit_detail_activity);
|
|
||||||
final TextView nSubscribersTextView = findViewById(R.id.subscriber_count_text_view_view_subreddit_detail_activity);
|
|
||||||
final TextView nOnlineSubscribersTextView = findViewById(R.id.online_subscriber_count_text_view_view_subreddit_detail_activity);
|
|
||||||
final TextView descriptionTextView = findViewById(R.id.description_text_view_view_subreddit_detail_activity);
|
|
||||||
final RequestManager glide = Glide.with(ViewSubredditDetailActivity.this);
|
|
||||||
|
|
||||||
String value = getIntent().getExtras().getString(EXTRA_SUBREDDIT_VALUE_KEY);
|
String value = getIntent().getExtras().getString(EXTRA_SUBREDDIT_VALUE_KEY);
|
||||||
boolean queryById = getIntent().getExtras().getBoolean(EXTRA_QUERY_BY_ID_KEY);
|
boolean queryById = getIntent().getExtras().getBoolean(EXTRA_QUERY_BY_ID_KEY);
|
||||||
|
@ -11,6 +11,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.media.AudioManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -52,6 +53,9 @@ import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
|
|||||||
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
public class ViewVideoActivity extends AppCompatActivity {
|
public class ViewVideoActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
|
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
|
||||||
@ -63,6 +67,9 @@ public class ViewVideoActivity extends AppCompatActivity {
|
|||||||
static final String SUBREDDIT_KEY = "SK";
|
static final String SUBREDDIT_KEY = "SK";
|
||||||
static final String ID_KEY = "IK";
|
static final String ID_KEY = "IK";
|
||||||
|
|
||||||
|
@BindView(R.id.relative_layout_view_video_activity) RelativeLayout relativeLayout;
|
||||||
|
@BindView(R.id.player_view_view_video_activity) PlayerView videoPlayerView;
|
||||||
|
|
||||||
private Uri mVideoUri;
|
private Uri mVideoUri;
|
||||||
private SimpleExoPlayer player;
|
private SimpleExoPlayer player;
|
||||||
|
|
||||||
@ -81,6 +88,8 @@ public class ViewVideoActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_view_video);
|
setContentView(R.layout.activity_view_video);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||||
|
|
||||||
final ActionBar actionBar = getSupportActionBar();
|
final ActionBar actionBar = getSupportActionBar();
|
||||||
final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
|
final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
|
||||||
@ -106,9 +115,6 @@ public class ViewVideoActivity extends AppCompatActivity {
|
|||||||
mDownloadUrl = intent.getExtras().getString(DOWNLOAD_URL_KEY);
|
mDownloadUrl = intent.getExtras().getString(DOWNLOAD_URL_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
final RelativeLayout relativeLayout = findViewById(R.id.relative_layout_view_video_activity);
|
|
||||||
final PlayerView videoPlayerView = findViewById(R.id.player_view_view_video_activity);
|
|
||||||
|
|
||||||
final float pxHeight = getResources().getDisplayMetrics().heightPixels;
|
final float pxHeight = getResources().getDisplayMetrics().heightPixels;
|
||||||
|
|
||||||
int activityColorFrom = getResources().getColor(android.R.color.black);
|
int activityColorFrom = getResources().getColor(android.R.color.black);
|
||||||
|
@ -7,7 +7,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.1.4'
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Mon May 14 08:13:09 HKT 2018
|
#Fri Oct 19 21:24:28 HKT 2018
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||||
|
Loading…
Reference in New Issue
Block a user