use of android.widget.RelativeLayout in project cuddly-octo-fortnight by prpr894.
the class AdvancedPlayActivity method initOtherUI.
private void initOtherUI() {
// header
final ImageButton ibBack = this.findViewById(R.id.ibtn_back);
ibBack.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
RelativeLayout rlback = this.findViewById(R.id.rl_back);
rlback.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ibBack.performClick();
}
});
TextView tvTitle = this.findViewById(R.id.tv_top_title);
tvTitle.setText(mLiveRoomItemDataBean.getNickname());
final ImageButton ibScreen = this.findViewById(R.id.ibtn_screen_control);
ibScreen.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (isFullScreen) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
FullScreenUtils.toggleHideyBar(AdvancedPlayActivity.this);
// to mini size, to portrait
fullHeaderRl.removeAllViews();
fullControllerRl.removeAllViews();
normalHeaderRl.addView(headerBar);
normalControllerRl.addView(mediaController);
isFullScreen = false;
ibScreen.setBackgroundResource(R.drawable.btn_to_fullscreen);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
FullScreenUtils.toggleHideyBar(AdvancedPlayActivity.this);
normalHeaderRl.removeAllViews();
normalControllerRl.removeAllViews();
fullHeaderRl.addView(headerBar);
fullControllerRl.addView(mediaController);
isFullScreen = true;
ibScreen.setBackgroundResource(R.drawable.btn_to_mini);
hideOuterAfterFiveSeconds();
}
}
});
if (!SharedPrefsStore.isDefaultPortrait(this)) {
ibScreen.performClick();
}
}
use of android.widget.RelativeLayout in project NetGuard by M66B.
the class ActivityMain method enableAds.
private void enableAds() {
RelativeLayout rlAd = findViewById(R.id.rlAd);
LinearLayout llAd = findViewById(R.id.llAd);
final AdView adView = findViewById(R.id.adView);
rlAd.setVisibility(View.VISIBLE);
llAd.setVisibility(View.VISIBLE);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
try {
AdRequest adRequest = new AdRequest.Builder().addTestDevice(getString(R.string.ad_test_device_id)).build();
adView.loadAd(adRequest);
} catch (Throwable ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
}
}, 1000);
}
use of android.widget.RelativeLayout in project platform_packages_apps_Settings by BlissRoms.
the class DashboardAdapterTest method setupSuggestions.
private void setupSuggestions(List<Tile> suggestions) {
mDashboardAdapter.setCategoriesAndSuggestions(null, /* category */
suggestions);
final Context context = RuntimeEnvironment.application;
mSuggestionHolder = new DashboardAdapter.SuggestionAndConditionHeaderHolder(LayoutInflater.from(context).inflate(R.layout.suggestion_condition_header, new RelativeLayout(context), true));
}
use of android.widget.RelativeLayout in project Stylish-Widget-for-Android by shiburagi.
the class MessageBox method init.
public void init(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.propertiesAttr);
RelativeLayout layout = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.layout_messagebox, null);
int background;
try {
background = a.getColor(R.styleable.propertiesAttr_sw_boxBackground, getResources().getColor(R.color.colorAccent));
} catch (Exception e) {
background = getResources().getColor(R.color.colorAccent);
}
setBackgroundColor(background);
String message;
try {
message = a.getString(R.styleable.propertiesAttr_sw_message);
} catch (Exception e) {
message = "";
}
int padding, topPadding, bottomPadding, leftPadding, rightPadding;
try {
padding = a.getDimensionPixelSize(R.styleable.propertiesAttr_sw_innerPadding, layout.getPaddingBottom());
} catch (Exception e) {
padding = layout.getPaddingBottom();
}
try {
leftPadding = a.getDimensionPixelSize(R.styleable.propertiesAttr_sw_innerLeftPadding, padding);
} catch (Exception e) {
leftPadding = padding;
}
try {
rightPadding = a.getDimensionPixelSize(R.styleable.propertiesAttr_sw_innerRightPadding, padding);
} catch (Exception e) {
rightPadding = padding;
}
try {
topPadding = a.getDimensionPixelSize(R.styleable.propertiesAttr_sw_innerTopPadding, padding);
} catch (Exception e) {
topPadding = padding;
}
try {
bottomPadding = a.getDimensionPixelSize(R.styleable.propertiesAttr_sw_innerBottomPadding, padding);
} catch (Exception e) {
bottomPadding = padding;
}
int drawablePadding;
try {
drawablePadding = a.getDimensionPixelSize(R.styleable.propertiesAttr_sw_innerBottomPadding, padding);
} catch (Exception e) {
drawablePadding = padding;
}
Drawable drawable;
try {
drawable = a.getDrawable(R.styleable.propertiesAttr_sw_drawable);
} catch (Exception e) {
drawable = null;
}
a.recycle();
layout.setPadding(leftPadding, topPadding, rightPadding, bottomPadding);
a = getContext().obtainStyledAttributes(attrs, R.styleable.textAttr);
int textStyle;
try {
textStyle = a.getInt(R.styleable.textAttr_sw_textStyle, Typeface.NORMAL);
} catch (Exception e) {
textStyle = Typeface.NORMAL;
}
a.recycle();
try {
textView = (ATextView) layout.findViewById(R.id.textView_message);
textView.setText(message);
textView.setTextStyle(textStyle);
if (drawable != null) {
textView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
textView.setCompoundDrawablePadding(drawablePadding);
}
} catch (Exception e) {
}
button = (Button) layout.findViewById(R.id.button_action);
imageView = (ImageView) layout.findViewById(R.id.imageView_close);
addView(layout);
setCloseButton(new OnClickListener() {
@Override
public void onClick(View view) {
}
});
}
use of android.widget.RelativeLayout in project edx-app-android by edx.
the class CourseUnitNavigationActivity method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RelativeLayout insertPoint = (RelativeLayout) findViewById(R.id.fragment_container);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.view_course_unit_pager, null);
insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
pager = (DisableableViewPager) findViewById(R.id.pager);
pagerAdapter = new CourseUnitPagerAdapter(getSupportFragmentManager(), environment.getConfig(), unitList, courseData, this);
pager.setAdapter(pagerAdapter);
pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
}
@Override
public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_DRAGGING) {
int curIndex = pager.getCurrentItem();
PageViewStateCallback curView = (PageViewStateCallback) pagerAdapter.instantiateItem(pager, curIndex);
if (curView != null)
curView.onPageDisappear();
}
if (state == ViewPager.SCROLL_STATE_IDLE) {
int curIndex = pager.getCurrentItem();
PageViewStateCallback curView = (PageViewStateCallback) pagerAdapter.instantiateItem(pager, curIndex);
if (curView != null)
curView.onPageShow();
tryToUpdateForEndOfSequential();
}
}
});
findViewById(R.id.course_unit_nav_bar).setVisibility(View.VISIBLE);
mPreviousBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
navigatePreviousComponent();
}
});
mNextBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
navigateNextComponent();
}
});
}
Aggregations