use of android.widget.RelativeLayout in project nmid-headline by miao1007.
the class EditPage method initView.
private void initView() {
if (!dialogMode) {
RelativeLayout mainRelLayout = (RelativeLayout) findViewByResName("mainRelLayout");
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mainRelLayout.getLayoutParams();
lp.setMargins(0, 0, 0, 0);
lp.height = RelativeLayout.LayoutParams.MATCH_PARENT;
mainRelLayout.setLayoutParams(lp);
}
initTitleView();
initBodyView();
initImageListView();
}
use of android.widget.RelativeLayout in project Context-Menu.Android by Yalantis.
the class Utils method getImageWrapper.
public static RelativeLayout getImageWrapper(Context context, MenuObject menuItem, int menuItemSize, View.OnClickListener onCLick, View.OnLongClickListener onLongClick, boolean showDivider) {
RelativeLayout imageWrapper = new RelativeLayout(context);
LinearLayout.LayoutParams imageWrapperLayoutParams = new LinearLayout.LayoutParams(menuItemSize, menuItemSize);
imageWrapper.setLayoutParams(imageWrapperLayoutParams);
imageWrapper.setOnClickListener(onCLick);
imageWrapper.setOnLongClickListener(onLongClick);
imageWrapper.addView(Utils.getItemImageButton(context, menuItem));
if (showDivider) {
imageWrapper.addView(getDivider(context, menuItem));
}
if (menuItem.getBgColor() != 0) {
imageWrapper.setBackgroundColor(menuItem.getBgColor());
} else if (menuItem.getBgDrawable() != null) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
imageWrapper.setBackgroundDrawable(menuItem.getBgDrawable());
} else {
imageWrapper.setBackground(menuItem.getBgDrawable());
}
} else if (menuItem.getBgResource() != 0) {
imageWrapper.setBackgroundResource(menuItem.getBgResource());
} else {
imageWrapper.setBackgroundColor(context.getResources().getColor(R.color.menu_item_background));
}
return imageWrapper;
}
use of android.widget.RelativeLayout in project NewPipe by TeamNewPipe.
the class VideoItemDetailFragment method updateInfo.
private void updateInfo(final StreamInfo info) {
Activity a = getActivity();
RelativeLayout textContentLayout = (RelativeLayout) activity.findViewById(R.id.detail_text_content_layout);
final TextView videoTitleView = (TextView) activity.findViewById(R.id.detail_video_title_view);
TextView uploaderView = (TextView) activity.findViewById(R.id.detail_uploader_view);
TextView viewCountView = (TextView) activity.findViewById(R.id.detail_view_count_view);
TextView thumbsUpView = (TextView) activity.findViewById(R.id.detail_thumbs_up_count_view);
TextView thumbsDownView = (TextView) activity.findViewById(R.id.detail_thumbs_down_count_view);
TextView uploadDateView = (TextView) activity.findViewById(R.id.detail_upload_date_view);
TextView descriptionView = (TextView) activity.findViewById(R.id.detail_description_view);
RecyclerView nextStreamView = (RecyclerView) activity.findViewById(R.id.detail_next_stream_content);
RelativeLayout nextVideoRootFrame = (RelativeLayout) activity.findViewById(R.id.detail_next_stream_root_layout);
TextView similarTitle = (TextView) activity.findViewById(R.id.detail_similar_title);
Button backgroundButton = (Button) activity.findViewById(R.id.detail_stream_thumbnail_window_background_button);
View thumbnailView = activity.findViewById(R.id.detail_thumbnail_view);
View topView = activity.findViewById(R.id.detailTopView);
Button channelButton = (Button) activity.findViewById(R.id.channel_button);
// prevents a crash if the activity/fragment was already left when the response came
if (channelButton != null) {
progressBar.setVisibility(View.GONE);
if (info.next_video != null) {
// todo: activate this function or remove it
nextStreamView.setVisibility(View.GONE);
} else {
nextStreamView.setVisibility(View.GONE);
activity.findViewById(R.id.detail_similar_title).setVisibility(View.GONE);
}
textContentLayout.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT < 18) {
playVideoButton.setVisibility(View.VISIBLE);
} else {
ImageView playArrowView = (ImageView) activity.findViewById(R.id.play_arrow_view);
playArrowView.setVisibility(View.VISIBLE);
}
if (!showNextStreamItem) {
nextVideoRootFrame.setVisibility(View.GONE);
similarTitle.setVisibility(View.GONE);
}
videoTitleView.setText(info.title);
topView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == android.view.MotionEvent.ACTION_UP) {
ImageView arrow = (ImageView) activity.findViewById(R.id.toggle_description_view);
View extra = activity.findViewById(R.id.detailExtraView);
if (extra.getVisibility() == View.VISIBLE) {
extra.setVisibility(View.GONE);
arrow.setImageResource(R.drawable.arrow_down);
} else {
extra.setVisibility(View.VISIBLE);
arrow.setImageResource(R.drawable.arrow_up);
}
}
return true;
}
});
// Since newpipe is designed to work even if certain information is not available,
// the UI has to react on missing information.
videoTitleView.setText(info.title);
if (!info.uploader.isEmpty()) {
uploaderView.setText(info.uploader);
} else {
activity.findViewById(R.id.detail_uploader_view).setVisibility(View.GONE);
}
if (info.view_count >= 0) {
viewCountView.setText(Localization.localizeViewCount(info.view_count, a));
} else {
viewCountView.setVisibility(View.GONE);
}
if (info.dislike_count >= 0) {
thumbsDownView.setText(Localization.localizeNumber(info.dislike_count, a));
} else {
thumbsDownView.setVisibility(View.INVISIBLE);
activity.findViewById(R.id.detail_thumbs_down_count_view).setVisibility(View.GONE);
}
if (info.like_count >= 0) {
thumbsUpView.setText(Localization.localizeNumber(info.like_count, a));
} else {
thumbsUpView.setVisibility(View.GONE);
activity.findViewById(R.id.detail_thumbs_up_img_view).setVisibility(View.GONE);
thumbsDownView.setVisibility(View.GONE);
activity.findViewById(R.id.detail_thumbs_down_img_view).setVisibility(View.GONE);
}
if (!info.upload_date.isEmpty()) {
uploadDateView.setText(Localization.localizeDate(info.upload_date, a));
} else {
uploadDateView.setVisibility(View.GONE);
}
if (!info.description.isEmpty()) {
descriptionView.setText(Html.fromHtml(info.description));
} else {
descriptionView.setVisibility(View.GONE);
}
descriptionView.setMovementMethod(LinkMovementMethod.getInstance());
// parse streams
Vector<VideoStream> streamsToUse = new Vector<>();
for (VideoStream i : info.video_streams) {
if (useStream(i, streamsToUse)) {
streamsToUse.add(i);
}
}
textContentLayout.setVisibility(View.VISIBLE);
if (info.next_video == null) {
activity.findViewById(R.id.detail_next_stream_title).setVisibility(View.GONE);
}
if (info.related_streams != null && !info.related_streams.isEmpty()) {
initSimilarVideos(info);
} else {
activity.findViewById(R.id.detail_similar_title).setVisibility(View.GONE);
activity.findViewById(R.id.similar_streams_view).setVisibility(View.GONE);
}
setupActionBarHandler(info);
if (autoPlayEnabled) {
playVideo(info);
}
if (android.os.Build.VERSION.SDK_INT < 18) {
playVideoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
playVideo(info);
}
});
}
backgroundButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
playVideo(info);
}
});
//todo: make backgroundButton handle this
thumbnailView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
playVideo(info);
}
});
if (info.channel_url != null && info.channel_url != "") {
channelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavStack.getInstance().openChannelActivity(getActivity(), info.channel_url, info.service_id);
}
});
} else {
channelButton.setVisibility(Button.GONE);
}
initThumbnailViews(info);
}
}
use of android.widget.RelativeLayout in project CoCoin by Nightonke.
the class ShowActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show);
mContext = this;
title = (TextView) findViewById(R.id.title);
CoCoinUtil.init(mContext);
title.setTypeface(CoCoinUtil.typefaceLatoLight);
title.setText(mContext.getResources().getString(R.string.app_name));
mViewPager = (SCViewPager) findViewById(R.id.viewpager_main_activity);
mDotsView = (DotsView) findViewById(R.id.dotsview_main);
mDotsView.setDotRessource(R.drawable.dot_selected, R.drawable.dot_unselected);
mDotsView.setNumberOfPage(NUM_PAGES);
mPageAdapter = new SCViewPagerAdapter(getSupportFragmentManager());
mPageAdapter.setNumberOfPage(NUM_PAGES);
mPageAdapter.setFragmentBackgroundColor(R.color.my_blue);
mViewPager.setAdapter(mPageAdapter);
mViewPager.setOverScrollMode(View.OVER_SCROLL_NEVER);
mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
mDotsView.selectDot(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
final Point size = SCViewAnimationUtil.getDisplaySize(this);
int iconOffsetX = CoCoinUtil.getInstance().dpToPx(28);
int iconOffsetY = CoCoinUtil.getInstance().dpToPx(28);
SCViewAnimation sc0 = new SCViewAnimation(findViewById(R.id.icon_4));
sc0.startToPosition(size.x / 4 - iconOffsetX, size.y * 2 / 7 - iconOffsetY);
sc0.addPageAnimation(new SCPositionAnimation(this, 0, 0, size.y));
mViewPager.addAnimation(sc0);
SCViewAnimation sc1 = new SCViewAnimation(findViewById(R.id.icon_11));
sc1.startToPosition(size.x * 3 / 4 - iconOffsetX, size.y * 3 / 7 - iconOffsetY);
sc1.addPageAnimation(new SCPositionAnimation(this, 0, -size.x, 0));
mViewPager.addAnimation(sc1);
SCViewAnimation sc2 = new SCViewAnimation(findViewById(R.id.icon_12));
sc2.startToPosition(size.x / 4 - iconOffsetX, size.y * 4 / 7 - iconOffsetY);
sc2.addPageAnimation(new SCPositionAnimation(this, 0, size.x, 0));
mViewPager.addAnimation(sc2);
SCViewAnimation sc3 = new SCViewAnimation(findViewById(R.id.icon_19));
sc3.startToPosition(size.x * 3 / 4 - iconOffsetX, size.y * 5 / 7 - iconOffsetY);
sc3.addPageAnimation(new SCPositionAnimation(this, 0, 0, -size.y));
mViewPager.addAnimation(sc3);
((TextView) findViewById(R.id.text_0)).setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
SCViewAnimation sc4 = new SCViewAnimation(findViewById(R.id.text_0));
sc4.addPageAnimation(new SCPositionAnimation(this, 0, -size.x, 0));
mViewPager.addAnimation(sc4);
PieChartView pie = (PieChartView) findViewById(R.id.pie);
List<SliceValue> values = new ArrayList<SliceValue>();
for (int i = 0; i < 5; ++i) {
SliceValue sliceValue = new SliceValue((float) Math.random() * 30 + 15, ContextCompat.getColor(CoCoinApplication.getAppContext(), R.color.white));
values.add(sliceValue);
}
PieChartData pieData = new PieChartData(values);
pieData.setHasLabels(false);
pieData.setHasLabelsOnlyForSelected(false);
pieData.setHasLabelsOutside(false);
pieData.setHasCenterCircle(true);
pie.setPieChartData(pieData);
pie.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
SCViewAnimation sc5 = new SCViewAnimation(pie);
sc5.startToPosition(size.x / 2, size.y / 9 - size.y);
sc5.addPageAnimation(new SCPositionAnimation(this, 0, 0, size.y));
sc5.addPageAnimation(new SCPositionAnimation(this, 1, 0, size.y));
mViewPager.addAnimation(sc5);
LineChartView line = (LineChartView) findViewById(R.id.line);
List<Line> lines = new ArrayList<Line>();
for (int i = 0; i < 1; ++i) {
List<PointValue> pointValues = new ArrayList<PointValue>();
pointValues.add(new PointValue(0, 50));
pointValues.add(new PointValue(1, 100));
pointValues.add(new PointValue(2, 20));
pointValues.add(new PointValue(3, 0));
pointValues.add(new PointValue(4, 10));
pointValues.add(new PointValue(5, 15));
pointValues.add(new PointValue(6, 40));
pointValues.add(new PointValue(7, 60));
pointValues.add(new PointValue(8, 100));
Line aLine = new Line(pointValues);
aLine.setColor(ContextCompat.getColor(CoCoinApplication.getAppContext(), R.color.white));
aLine.setShape(ValueShape.CIRCLE);
aLine.setCubic(false);
aLine.setFilled(false);
aLine.setHasLabels(false);
aLine.setHasLabelsOnlyForSelected(false);
aLine.setHasLines(true);
aLine.setHasPoints(true);
lines.add(aLine);
}
LineChartData linedata = new LineChartData(lines);
linedata.setBaseValue(Float.NEGATIVE_INFINITY);
line.setLineChartData(linedata);
line.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
SCViewAnimation sc6 = new SCViewAnimation(line);
sc6.startToPosition(-size.x, null);
sc6.addPageAnimation(new SCPositionAnimation(this, 0, size.x, 0));
sc6.addPageAnimation(new SCPositionAnimation(this, 1, size.x, 0));
mViewPager.addAnimation(sc6);
ColumnChartView histogram = (ColumnChartView) findViewById(R.id.histogram);
List<Column> columns = new ArrayList<Column>();
List<SubcolumnValue> subcolumnValues;
for (int i = 0; i < 5; ++i) {
subcolumnValues = new ArrayList<SubcolumnValue>();
for (int j = 0; j < 1; ++j) {
subcolumnValues.add(new SubcolumnValue((float) Math.random() * 50f + 5, ContextCompat.getColor(CoCoinApplication.getAppContext(), R.color.white)));
}
Column column = new Column(subcolumnValues);
column.setHasLabels(false);
column.setHasLabelsOnlyForSelected(false);
columns.add(column);
}
ColumnChartData histogramData = new ColumnChartData(columns);
histogram.setColumnChartData(histogramData);
histogram.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
SCViewAnimation sc7 = new SCViewAnimation(histogram);
sc7.startToPosition(size.x / 2 - CoCoinUtil.getInstance().dpToPx(140), size.y * 8 / 9 - CoCoinUtil.getInstance().dpToPx(140) + size.y);
sc7.addPageAnimation(new SCPositionAnimation(this, 0, 0, -size.y));
sc7.addPageAnimation(new SCPositionAnimation(this, 1, 0, size.y));
mViewPager.addAnimation(sc7);
((TextView) findViewById(R.id.text_1)).setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
SCViewAnimation sc8 = new SCViewAnimation(findViewById(R.id.text_1));
sc8.startToPosition(size.x, null);
sc8.addPageAnimation(new SCPositionAnimation(this, 0, -size.x, 0));
sc8.addPageAnimation(new SCPositionAnimation(this, 1, -size.x, 0));
mViewPager.addAnimation(sc8);
SCViewAnimation sc9 = new SCViewAnimation(findViewById(R.id.cloud));
sc9.startToPosition(size.x / 2 - CoCoinUtil.getInstance().dpToPx(100) + size.x, size.y / 7);
sc9.addPageAnimation(new SCPositionAnimation(this, 1, -size.x, 0));
sc9.addPageAnimation(new SCPositionAnimation(this, 2, 0, size.y));
mViewPager.addAnimation(sc9);
SCViewAnimation sc10 = new SCViewAnimation(findViewById(R.id.mobile));
sc10.startToPosition(size.x / 2 - size.x, size.y * 6 / 7 - CoCoinUtil.getInstance().dpToPx(100));
sc10.addPageAnimation(new SCPositionAnimation(this, 1, size.x, 0));
sc10.addPageAnimation(new SCPositionAnimation(this, 2, 0, -size.y));
mViewPager.addAnimation(sc10);
((TextView) findViewById(R.id.text_2)).setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
SCViewAnimation sc11 = new SCViewAnimation(findViewById(R.id.text_2));
sc11.startToPosition(size.x, null);
sc11.addPageAnimation(new SCPositionAnimation(this, 1, -size.x, 0));
sc11.addPageAnimation(new SCPositionAnimation(this, 2, -size.x, 0));
mViewPager.addAnimation(sc11);
ImageView remind1 = (ImageView) findViewById(R.id.remind_1);
remind1.getLayoutParams().width = size.x / 3;
remind1.getLayoutParams().height = size.x / 3 * 653 / 320;
SCViewAnimation sc12 = new SCViewAnimation(findViewById(R.id.remind_1));
sc12.startToPosition(size.x / 2 - size.x, size.y / 11);
sc12.addPageAnimation(new SCPositionAnimation(this, 2, size.x, 0));
sc12.addPageAnimation(new SCPositionAnimation(this, 3, size.x, 0));
mViewPager.addAnimation(sc12);
ImageView remind2 = (ImageView) findViewById(R.id.remind_2);
remind2.getLayoutParams().width = size.x / 3;
remind2.getLayoutParams().height = size.x / 3 * 653 / 320;
SCViewAnimation sc13 = new SCViewAnimation(findViewById(R.id.remind_2));
sc13.startToPosition(size.x / 2 + size.x - size.x / 3, size.y * 10 / 11 - remind1.getLayoutParams().height);
sc13.addPageAnimation(new SCPositionAnimation(this, 2, -size.x, 0));
sc13.addPageAnimation(new SCPositionAnimation(this, 3, -size.x, 0));
mViewPager.addAnimation(sc13);
((TextView) findViewById(R.id.text_3)).setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
SCViewAnimation sc14 = new SCViewAnimation(findViewById(R.id.text_3));
sc14.startToPosition(size.x, null);
sc14.addPageAnimation(new SCPositionAnimation(this, 2, -size.x, 0));
sc14.addPageAnimation(new SCPositionAnimation(this, 3, -size.x, 0));
mViewPager.addAnimation(sc14);
View statusBar = findViewById(R.id.status_bar);
statusBar.setLayoutParams(new RelativeLayout.LayoutParams(statusBar.getLayoutParams().width, getStatusBarHeight()));
SCViewAnimation statusBarAnimation = new SCViewAnimation(statusBar);
statusBarAnimation.startToPosition(null, -getStatusBarHeight());
statusBarAnimation.addPageAnimation(new SCPositionAnimation(this, 3, 0, getStatusBarHeight()));
mViewPager.addAnimation(statusBarAnimation);
toolbarLayout = findViewById(R.id.toolbar_layout);
SCViewAnimation toolbarLayoutAnimation = new SCViewAnimation(toolbarLayout);
toolbarLayoutAnimation.startToPosition(null, -size.y / 2);
toolbarLayoutAnimation.addPageAnimation(new SCPositionAnimation(this, 3, 0, size.y / 2));
mViewPager.addAnimation(toolbarLayoutAnimation);
passwordAdapter = new PasswordChangeFragmentAdapter(getSupportFragmentManager());
viewPager = (ViewPager) findViewById(R.id.viewpager);
viewPager.setScrollBarFadeDuration(700);
viewPager.setAdapter(passwordAdapter);
myGridView = (MyGridView) findViewById(R.id.gridview);
myGridViewAdapter = new PasswordChangeButtonGridViewAdapter(this);
myGridView.setAdapter(myGridViewAdapter);
myGridView.setOnItemClickListener(gridViewClickListener);
myGridView.setOnItemLongClickListener(gridViewLongClickListener);
myGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
myGridView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
View lastChild = myGridView.getChildAt(myGridView.getChildCount() - 1);
RelativeLayout.LayoutParams relativeLayout = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, lastChild.getBottom());
relativeLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
myGridView.setLayoutParams(relativeLayout);
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels;
RelativeLayout.LayoutParams viewPagerLayoutParams = new RelativeLayout.LayoutParams(viewPager.getLayoutParams().width, 800);
viewPagerLayoutParams.topMargin = getStatusBarHeight() + CoCoinUtil.getToolBarHeight(mContext) / 2;
viewPager.setLayoutParams(viewPagerLayoutParams);
}
});
superToast = new SuperToast(this);
SCViewAnimation gridViewAnimation = new SCViewAnimation(myGridView);
gridViewAnimation.startToPosition(null, size.y);
gridViewAnimation.addPageAnimation(new SCPositionAnimation(this, 3, 0, -size.y));
mViewPager.addAnimation(gridViewAnimation);
SCViewAnimation viewpagerAnimation = new SCViewAnimation(viewPager);
viewpagerAnimation.startToPosition(null, -size.y);
viewpagerAnimation.addPageAnimation(new SCPositionAnimation(this, 3, 0, size.y));
mViewPager.addAnimation(viewpagerAnimation);
View background = findViewById(R.id.background);
SCViewAnimation backgroundAnimation = new SCViewAnimation(background);
backgroundAnimation.startToPosition(null, -size.y - 100);
backgroundAnimation.addPageAnimation(new SCPositionAnimation(this, 3, 0, size.y + 100));
mViewPager.addAnimation(backgroundAnimation);
}
use of android.widget.RelativeLayout in project WoWoViewPager by Nightonke.
the class AppIntroExampleActivity method onWindowFocusChanged.
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
screenW = WoWoUtil.getScreenWidth(this);
screenH = WoWoUtil.getScreenHeight(this);
circleR = (int) Math.sqrt(screenW * screenW + screenH * screenH) + 10;
RelativeLayout base = (RelativeLayout) findViewById(R.id.base);
ViewGroup.LayoutParams layoutParams = base.getLayoutParams();
layoutParams.height = circleR * 2;
layoutParams.width = circleR * 2;
base.setLayoutParams(layoutParams);
RelativeLayout subBase = (RelativeLayout) findViewById(R.id.sub_base);
layoutParams = subBase.getLayoutParams();
layoutParams.height = screenH;
layoutParams.width = screenW;
subBase.setLayoutParams(layoutParams);
setCircleAnimation();
setNightonkeAnimation();
setPresentsAnimation();
setBlueStickAnimation();
setOrangeStickAnimation();
setWoWoAnimation();
setViewPagerAnimation();
setMusicStand();
setMusicNotes();
setBigCloud();
setLittleCloud();
setPath();
setOptimized();
setSun();
setFree();
setNightonkeCloud();
}
Aggregations