List of usage examples for android.widget RelativeLayout RelativeLayout
public RelativeLayout(Context context)
From source file:ru.jango.j0widget.camera.fragment.AbstractCameraFragment.java
private RelativeLayout createRelativeLayout() { final RelativeLayout layout = new RelativeLayout(getActivity()); layout.setLayoutParams(/*from ww w . ja v a2s .co m*/ new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); layout.setBackgroundColor(Color.BLACK); return layout; }
From source file:net.wequick.small.webkit.WebActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int theme = Small.getWebActivityTheme(); if (theme != 0) setTheme(theme);// w w w .j a v a 2 s . c o m boolean fullscreen = false; CharSequence queryTitle; Uri uri = Small.getUri(this); if (uri != null) { String param = uri.getQueryParameter("_fullscreen"); if (param != null) { fullscreen = param.equals("1"); } queryTitle = uri.getQueryParameter("_title"); if (queryTitle != null) { super.setTitle(queryTitle); mCanSetTitle = false; } } // Init actionBar ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { if (fullscreen) { actionBar.hide(); } else { actionBar.show(); Activity parent = getParent(); if (parent == null) { // If is created by a LocalActivityManager, parent is not null actionBar.setDisplayHomeAsUpEnabled(true); } } } mFullscreen = fullscreen; // Initialize content wrapper RelativeLayout wrapper = new RelativeLayout(this); wrapper.setGravity(Gravity.CENTER); setContentView(wrapper); // Initialize webView mWebView = new WebView(this); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); wrapper.addView(mWebView, 0, layoutParams); // Try to load title from cache mUrl = getIntent().getStringExtra("url"); if (mCanSetTitle) { CharSequence title = getCacheTitle(mUrl); if (title != null) { super.setTitle(title); } } }
From source file:com.cloudkick.NodeViewActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); NodeViewState previousState = (NodeViewState) getLastNonConfigurationInstance(); if (previousState != null) { node = previousState.node;// w ww . j a v a 2s .c om checks = previousState.checks; } else { Bundle data = this.getIntent().getExtras(); checks = new ArrayList<CKListItem>(); checks.add(new CKListLoadingSpinner()); node = (Node) data.getSerializable("node"); } String inflater = Context.LAYOUT_INFLATER_SERVICE; LayoutInflater li = (LayoutInflater) getSystemService(inflater); nodeView = new RelativeLayout(this); li.inflate(R.layout.node_view, nodeView, true); setContentView(nodeView); adapter = new CheckAdapter(this, checks); ((ListView) findViewById(R.id.node_detail_list)).setAdapter(adapter); ((ListView) findViewById(R.id.node_detail_list)).setOnItemClickListener(checkClickListener); redrawHeader(); // If the name of the node changes we can't exactly refresh it anyway setTitle("Node: " + node.name); ((ImageView) findViewById(R.id.node_detail_separator)).bringToFront(); reloadAPI(); }
From source file:de.Maxr1998.xposed.maxlock.ui.settings.appslist.AppsListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = new RelativeLayout(getActivity()); if (finalList == null || finalList.isEmpty()) { progressDialog = new ProgressDialog(getActivity()); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setCancelable(true); progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override//from w w w . j a v a 2 s . c om public void onCancel(DialogInterface dialogInterface) { task.cancel(true); } }); progressDialog.show(); if (task == null) task = new SetupAppList(); if (!task.getStatus().equals(AsyncTask.Status.RUNNING)) task.execute(); } else { setup(); } return rootView; }
From source file:com.qs.qswlw.view.Mypager.UltraViewPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { int realPosition = position; //TODO/*ww w . ja v a 2s. c o m*/ if (enableLoop && adapter.getCount() != 0) { realPosition = position % adapter.getCount(); } Object item = adapter.instantiateItem(container, realPosition); //TODO View childView = null; if (item instanceof View) childView = (View) item; // if (item instanceof RecyclerView.ViewHolder) // childView = ((RecyclerView.ViewHolder) item).itemView; ViewPager viewPager = (ViewPager) container; int childCount = viewPager.getChildCount(); for (int i = 0; i < childCount; i++) { View child = viewPager.getChildAt(i); if (isViewFromObject(child, item)) { viewArray.put(realPosition, child); break; } } if (isEnableMultiScr()) { if (scrWidth == 0) { scrWidth = container.getResources().getDisplayMetrics().widthPixels; } RelativeLayout relativeLayout = new RelativeLayout(container.getContext()); if (childView.getLayoutParams() != null) { RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( (int) (scrWidth * multiScrRatio), ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); childView.setLayoutParams(layoutParams); } container.removeView(childView); relativeLayout.addView(childView); container.addView(relativeLayout); return relativeLayout; } return item; }
From source file:com.mindorks.framework.mvp.ui.base.BaseDialog.java
@NonNull @Override/*w w w . j ava2s. c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { // the content final RelativeLayout root = new RelativeLayout(getActivity()); root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // creating the fullscreen dialog final Dialog dialog = new Dialog(getContext()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(root); if (dialog.getWindow() != null) { dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } dialog.setCanceledOnTouchOutside(false); return dialog; }
From source file:com.mllrsohn.videodialog.VideoDialogPlugin.java
private void playVideo(JSONObject params, final CallbackContext callbackContext) throws JSONException { loopVideo = params.optBoolean("loop", true); path = params.optString("url"); uri = Uri.parse(path);/*from ww w . j av a2 s.c o m*/ if (path.contains(ASSETS)) { try { String filepath = path.replace(ASSETS, ""); String filename = filepath.substring(filepath.lastIndexOf("/") + 1, filepath.length()); File fp = new File(this.cordova.getActivity().getFilesDir() + "/" + filename); if (!fp.exists()) { this.copy(filepath, filename); } uri = Uri.parse("file://" + this.cordova.getActivity().getFilesDir() + "/" + filename); } catch (IOException e) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.IO_EXCEPTION)); } } // Create dialog in new thread cordova.getActivity().runOnUiThread(new Runnable() { public void run() { // Set Basic Dialog dialog = new Dialog((Context) cordova.getActivity(), android.R.style.Theme_NoTitleBar_Fullscreen); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); // Layout View RelativeLayout main = new RelativeLayout((Context) cordova.getActivity()); main.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); // Video View mVideoView = new VideoView((Context) cordova.getActivity()); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); mVideoView.setLayoutParams(lp); mVideoView.setVideoPath(uri.toString()); mVideoView.start(); main.addView(mVideoView); dialog.setContentView(main); dialog.getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN); dialog.show(); // Close on touch mVideoView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "stopped")); dialog.dismiss(); return true; } }); // Set Looping mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.setLooping(loopVideo); } }); // On Completion mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaplayer) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, "Done")); dialog.dismiss(); } }); } }); }
From source file:com.tmall.ultraviewpager.UltraViewPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { int realPosition = position; //TODO/* www .ja va2s.c o m*/ if (enableLoop && adapter.getCount() != 0) { realPosition = position % adapter.getCount(); } Object item = adapter.instantiateItem(container, realPosition); //TODO View childView = null; if (item instanceof View) childView = (View) item; if (item instanceof RecyclerView.ViewHolder) childView = ((RecyclerView.ViewHolder) item).itemView; ViewPager viewPager = (ViewPager) container; int childCount = viewPager.getChildCount(); for (int i = 0; i < childCount; i++) { View child = viewPager.getChildAt(i); if (isViewFromObject(child, item)) { viewArray.put(realPosition, child); break; } } if (isEnableMultiScr()) { if (scrWidth == 0) { scrWidth = container.getResources().getDisplayMetrics().widthPixels; } RelativeLayout relativeLayout = new RelativeLayout(container.getContext()); if (childView.getLayoutParams() != null) { RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( (int) (scrWidth * multiScrRatio), ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); childView.setLayoutParams(layoutParams); } container.removeView(childView); relativeLayout.addView(childView); container.addView(relativeLayout); return relativeLayout; } return item; }
From source file:io.imoji.sdk.grid.ui.ResultView.java
public ResultView(Context context, @ResultViewSize int viewSize) { super(context); this.context = context; this.viewSize = viewSize; int resultWidth = getDimension(0); int resultHeight = getDimension(1); setLayoutParams(new StaggeredGridLayoutManager.LayoutParams(resultWidth, resultHeight)); placeholder = new ImageView(context); int placeholderSide = getDimension(4); RelativeLayout.LayoutParams placeholderParams = new LayoutParams(placeholderSide, placeholderSide); placeholderParams.addRule(RelativeLayout.CENTER_IN_PARENT); placeholder.setLayoutParams(placeholderParams); addView(placeholder);/* ww w.ja v a 2 s.com*/ container = new RelativeLayout(context); addView(container, new LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)); final Animation pressedAnimation = AnimationUtils.loadAnimation(context, R.anim.search_result_pressed); final Animation releasedAnimation = AnimationUtils.loadAnimation(context, R.anim.search_result_released); imageView = new GifImageView(context) { @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (searchResult != null && !searchResult.isCategory()) { imageView.startAnimation(pressedAnimation); } break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: if (searchResult != null && !searchResult.isCategory()) { imageView.startAnimation(releasedAnimation); } break; } return super.onTouchEvent(event); } }; RelativeLayout.LayoutParams imageParams = new LayoutParams(resultWidth, resultWidth); imageParams.addRule(RelativeLayout.CENTER_IN_PARENT); imageView.setLayoutParams(imageParams); container.addView(imageView); textView = new TextView(context); int titleHeight = getDimension(2); RelativeLayout.LayoutParams titleParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, titleHeight); titleParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); textView.setLayoutParams(titleParams); textView.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Montserrat-Light.otf")); textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getDimension(3)); //TODO // FIXME: 5/2/16 textView.setTextColor(getResources().getColor(R.color.search_result_category_title)); textView.setGravity(Gravity.CENTER); container.addView(textView); imageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { listener.onTap(searchResult); } }); }
From source file:com.bangqu.eshow.view.sliding.ESSlidingPlayView.java
/** * ???View.// w ww . j a v a 2 s . com * * @param context the context */ public void initView(Context context) { this.context = context; navLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); this.setOrientation(LinearLayout.VERTICAL); RelativeLayout mRelativeLayout = new RelativeLayout(context); mViewPager = new ESInnerViewPager(context); //ViewPager,fragmentsetId()id mViewPager.setId(1985); // mNavLayoutParent = new LinearLayout(context); mNavLayoutParent.setPadding(0, 5, 0, 5); navLinearLayout = new LinearLayout(context); navLinearLayout.setPadding(15, 1, 15, 1); navLinearLayout.setVisibility(View.INVISIBLE); mNavLayoutParent.addView(navLinearLayout, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mRelativeLayout.addView(mViewPager, lp1); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mRelativeLayout.addView(mNavLayoutParent, lp2); addView(mRelativeLayout, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); mListViews = new ArrayList<View>(); mAbViewPagerAdapter = new ESViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { makesurePosition(); onPageSelectedCallBack(position); } @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { onPageScrolledCallBack(position); } }); }