use of android.support.v7.app.ActionBar.LayoutParams in project Tusky by tuskyapp.
the class ComposeActivity method addMediaToQueue.
private void addMediaToQueue(QueuedMedia.Type type, Bitmap preview, Uri uri, long mediaSize, QueuedMedia.ReadyStage readyStage, @Nullable String description) {
final QueuedMedia item = new QueuedMedia(type, uri, new ProgressImageView(this), mediaSize, description);
item.readyStage = readyStage;
ImageView view = item.preview;
Resources resources = getResources();
int side = resources.getDimensionPixelSize(R.dimen.compose_media_preview_side);
int margin = resources.getDimensionPixelSize(R.dimen.compose_media_preview_margin);
int marginBottom = resources.getDimensionPixelSize(R.dimen.compose_media_preview_margin_bottom);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(side, side);
layoutParams.setMargins(margin, 0, margin, marginBottom);
view.setLayoutParams(layoutParams);
view.setScaleType(ImageView.ScaleType.CENTER_CROP);
view.setImageBitmap(preview);
view.setOnClickListener(v -> onMediaClick(item, v));
view.setContentDescription(getString(R.string.action_delete));
mediaPreviewBar.addView(view);
mediaQueued.add(item);
int queuedCount = mediaQueued.size();
if (queuedCount == 1) {
/* The media preview bar is actually not inset in the EditText, it just overlays it and
* is aligned to the bottom. But, so that text doesn't get hidden under it, extra
* padding is added at the bottom of the EditText. */
int totalHeight = side + margin + marginBottom;
textEditor.setPadding(textEditor.getPaddingLeft(), textEditor.getPaddingTop(), textEditor.getPaddingRight(), totalHeight);
// If there's one video in the queue it is full, so disable the button to queue more.
if (item.type == QueuedMedia.Type.VIDEO) {
disableMediaButtons();
}
} else if (queuedCount >= Status.MAX_MEDIA_ATTACHMENTS) {
// Limit the total media attachments, also.
disableMediaButtons();
}
if (queuedCount >= 1) {
showMarkSensitive(true);
}
if (item.readyStage != QueuedMedia.ReadyStage.UPLOADED) {
waitForMediaLatch.countUp();
if (mediaSize > STATUS_MEDIA_SIZE_LIMIT && type == QueuedMedia.Type.IMAGE) {
downsizeMedia(item);
} else {
uploadMedia(item);
}
}
}
use of android.support.v7.app.ActionBar.LayoutParams in project lzc_app_lib by httplzc.
the class DragScrollRecycleView method init.
private void init(Context context) {
recyclerView = new RecyclerView(context);
runnable = new Runnable() {
@Override
public void run() {
if (choiceWrapper == null || choiceWrapper.dragView == null)
return;
FrameLayout.LayoutParams lp = (LayoutParams) choiceWrapper.dragView.getLayoutParams();
if (lp.topMargin < 0) {
recyclerView.scrollBy(0, -autoScrollRatio);
recyclerView.postDelayed(runnable, autoScrollTime);
} else if (lp.topMargin > recyclerView.getHeight() - lp.height) {
recyclerView.scrollBy(0, autoScrollRatio);
recyclerView.postDelayed(runnable, autoScrollTime);
}
}
};
}
use of android.support.v7.app.ActionBar.LayoutParams in project lzc_app_lib by httplzc.
the class DragScrollRecycleView method doBackAnim.
private void doBackAnim() {
Log.i("lzc", "backAnim" + choiceWrapper.choicePosition + "---" + choiceWrapper.moveToPosition + "--" + choiceWrapper.choiceView);
View endView = null;
if (choiceWrapper.choiceView != null) {
endView = choiceWrapper.choiceView;
} else {
endView = recyclerView.getLayoutManager().findViewByPosition(choiceWrapper.moveToPosition);
}
PropertyValuesHolder propertyValuesHolder1 = PropertyValuesHolder.ofFloat("marginLeft", choiceWrapper.dragView.getLeft(), endView.getLeft());
PropertyValuesHolder propertyValuesHolder2 = PropertyValuesHolder.ofFloat("marginTop", choiceWrapper.dragView.getTop(), endView.getTop());
PropertyValuesHolder propertyValuesHolder3 = PropertyValuesHolder.ofFloat("scale", scale, 1);
ValueAnimator valueAnimator = ValueAnimator.ofPropertyValuesHolder(propertyValuesHolder1, propertyValuesHolder2, propertyValuesHolder3);
valueAnimator.setDuration(200);
final View finalEndView = endView;
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float marginLeft = (float) animation.getAnimatedValue("marginLeft");
float marginTop = (float) animation.getAnimatedValue("marginTop");
float scale = (float) animation.getAnimatedValue("scale");
FrameLayout.LayoutParams layoutParams = (LayoutParams) choiceWrapper.dragView.getLayoutParams();
layoutParams.width = (int) (finalEndView.getWidth() * scale);
layoutParams.height = (int) (finalEndView.getHeight() * scale);
layoutParams.leftMargin = (int) marginLeft;
layoutParams.topMargin = (int) marginTop;
choiceWrapper.dragView.setLayoutParams(layoutParams);
}
});
valueAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
onBackAnimFinish();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
valueAnimator.start();
}
use of android.support.v7.app.ActionBar.LayoutParams in project lzc_app_lib by httplzc.
the class RefreshRecycleViewParentView method addExtraView.
@Override
protected void addExtraView() {
// 加载更多 失败刷新
refreshFoot.getFootView().setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (reFreshFootStatus == ReFreshFootStatus.Failure) {
reFreshFootStatus = ReFreshFootStatus.OnRefresh;
refreshFoot.changeState(reFreshFootStatus);
refreshFoot.getFootView().postDelayed(new Runnable() {
@Override
public void run() {
if (loaddingMoreListener != null)
loaddingMoreListener.loadMore();
}
}, 500);
}
}
});
LinearLayout linearLayout = new LinearLayout(context);
RecycleView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
linearLayout.setLayoutParams(lp);
linearLayout.addView(refreshHead.getHeadView());
scrollView.addHeadView(linearLayout, 0, null);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) refreshHead.getHeadView().getLayoutParams();
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
refreshHead.getHeadView().setLayoutParams(layoutParams);
linearLayout.setPadding(linearLayout.getPaddingLeft(), (int) (-refreshHeadHeight), linearLayout.getPaddingRight(), linearLayout.getPaddingBottom());
scrollView.addOnScrollListener(new RecyclerView.OnScrollListener() {
private int scrollState;
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
this.scrollState = newState;
if (scrollState == RecyclerView.SCROLL_STATE_IDLE && isInEnd()) {
scrollView.scrollToPosition(scrollView.getItemCount() - 1);
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
checkOnScroll(stickyTagHelper.groupViews);
if (enableFreshFoot && isReadyForPullEnd() && scrollState != RecyclerView.SCROLL_STATE_IDLE) {
if (reFreshFootStatus == ReFreshFootStatus.OnRefresh || reFreshFootStatus == ReFreshFootStatus.Finish || reFreshStatus != ReFreshStatus.Normal || reFreshFootStatus == ReFreshFootStatus.Failure) {
if (reFreshFootStatus == ReFreshFootStatus.Finish && scrollView.getFootCount() != footcount) {
scrollView.addFootView(refreshFoot.getFootView(), null);
}
return;
}
reFreshFootStatus = ReFreshFootStatus.OnRefresh;
refreshFoot.changeState(reFreshFootStatus);
scrollView.addFootView(refreshFoot.getFootView(), null);
loaddingMoreListener.loadMore();
}
}
});
}
use of android.support.v7.app.ActionBar.LayoutParams in project vlc-android by GeoffreyMetais.
the class VideoPlayerActivity method initOverlay.
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void initOverlay() {
final ViewStubCompat vsc = findViewById(R.id.player_hud_stub);
if (vsc != null) {
mSeekButtons = mSettings.getBoolean("enable_seek_buttons", false);
vsc.inflate();
mHudBinding = DataBindingUtil.bind(findViewById(R.id.progress_overlay));
mHudBinding.setPlayer(this);
updateTimeValues();
mHudBinding.setProgress(mProgress);
mHudBinding.setLength(mMediaLength);
final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mHudBinding.progressOverlay.getLayoutParams();
if (AndroidDevices.isPhone || !AndroidDevices.hasNavBar)
layoutParams.width = LayoutParams.MATCH_PARENT;
else
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
mHudBinding.progressOverlay.setLayoutParams(layoutParams);
mOverlayBackground = findViewById(R.id.player_overlay_background);
mNavMenu = findViewById(R.id.player_overlay_navmenu);
if (!AndroidDevices.isChromeBook && AndroidUtil.isJellyBeanMR1OrLater) {
mRendererBtn = findViewById(R.id.video_renderer);
RendererDelegate.INSTANCE.getSelectedRenderer().observe(this, new Observer<RendererItem>() {
@Override
public void onChanged(@android.support.annotation.Nullable RendererItem rendererItem) {
if (mRendererBtn != null)
mRendererBtn.setImageResource(rendererItem == null ? R.drawable.ic_renderer_circle : R.drawable.ic_renderer_on_circle);
}
});
RendererDelegate.INSTANCE.getRenderers().observe(this, new Observer<List<RendererItem>>() {
@Override
public void onChanged(@Nullable List<RendererItem> rendererItems) {
UiTools.setViewVisibility(mRendererBtn, Util.isListEmpty(rendererItems) ? View.GONE : View.VISIBLE);
}
});
}
if (mSeekButtons)
initSeekButton();
resetHudLayout();
updateOverlayPausePlay();
updateSeekable(mService.isSeekable());
updatePausable(mService.isPausable());
updateNavStatus();
setListeners(true);
initPlaylistUi();
if (!mDisplayManager.isPrimary()) {
mHudBinding.lockOverlayButton.setVisibility(View.GONE);
mHudBinding.playerOverlaySize.setVisibility(View.GONE);
}
}
}
Aggregations