Java Code Examples for android.view.ViewGroup.LayoutParams
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project andlytics, under directory /src/com/github/andlyticsproject/.
Source file: MainListAdapter.java

private void changeBackgroundDrawable(final View v,Drawable drawable){ LayoutParams l=v.getLayoutParams(); int paddingBottom=v.getPaddingBottom(); int paddingLeft=v.getPaddingLeft(); int paddingRight=v.getPaddingRight(); int paddingTop=v.getPaddingTop(); v.setBackgroundDrawable(drawable); v.setLayoutParams(l); v.setPadding(paddingLeft,paddingTop,paddingRight,paddingBottom); }
Example 2
From project android-voip-service, under directory /src/main/java/org/linphone/core/tutorials/.
Source file: TestVideoActivity.java

private void changeSurfaceViewLayout(int width,int height){ LayoutParams params=surfaceView.getLayoutParams(); params.height=height; params.width=width; surfaceView.setLayoutParams(params); }
Example 3
From project androidquery, under directory /src/com/androidquery/util/.
Source file: RatioDrawable.java

private int getWidth(ImageView iv){ int width=0; LayoutParams lp=iv.getLayoutParams(); if (lp != null) width=lp.width; if (width <= 0) { width=iv.getWidth(); } if (width > 0) { width=width - iv.getPaddingLeft() - iv.getPaddingRight(); } return width; }
Example 4
From project DigitbooksExamples, under directory /DigitbooksExamples/src/fr/digitbooks/android/examples/chapitre02/.
Source file: ClockActivity.java

@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mTextView=new TextView(this); updateTime(); mTextView.setTextSize(24); LayoutParams params=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT); addContentView(mTextView,params); }
Example 5
From project platform_packages_apps_browser, under directory /src/com/android/browser/.
Source file: PieControl.java

protected void attachToContainer(FrameLayout container){ if (mPie == null) { mPie=new PieMenu(mActivity); LayoutParams lp=new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT); mPie.setLayoutParams(lp); populateMenu(); mPie.setController(this); } container.addView(mPie); }
Example 6
From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.
Source file: SelectZoomDetail.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_LEFT_ICON); setContentView(R.layout.layout_report_picture_zoom); photo=((ImageView)findViewById(R.id.ImageViewPictoBG)); picto=((PictoView)findViewById(R.id.ViewPicto)); setPictureToImageView(ReportDetailsActivity.CAPTURE_FAR,photo); getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.icon_nouveau_rapport); new Handler().postDelayed(new Runnable(){ @Override public void run(){ LayoutParams params=picto.getLayoutParams(); params.width=photo.getWidth(); params.height=photo.getHeight(); picto.setLayoutParams(params); } } ,1000); ((EditText)SelectZoomDetail.this.findViewById(R.id.Comment_img)).setText(getIntent().getStringExtra("comment")); ((EditText)SelectZoomDetail.this.findViewById(R.id.Comment_img)).setVisibility(View.INVISIBLE); ((Button)findViewById(R.id.ButtonViewPicto)).setOnClickListener(new OnClickListener(){ @Override public void onClick( View v){ try { layout_with=picto.getWidth(); layout_height=picto.getHeight(); Log.d(Constants.PROJECT_TAG,"Margin: " + (((photo.getWidth() + layout_with) / 2) - photo.getWidth()) * photo.getWidth() / photo_width + "," + (((photo.getHeight() + layout_height) / 2) - photo.getHeight()) * photo.getHeight() / photo_heigth); if (Constants.DEBUGMODE) Log.d(Constants.PROJECT_TAG,"onClick : Photo widht/height" + photo.getWidth() + "/"+ photo.getHeight()+ " ImageView: "+ photo_width+ "/"+ photo_heigth); picto.setSupport(picture,photo_width,photo_heigth,getApplicationContext()); Intent data=new Intent(); data.putExtra("comment",((EditText)SelectZoomDetail.this.findViewById(R.id.Comment_img)).getText().toString()); setResult(RESULT_OK,data); finish(); } catch ( FileNotFoundException e) { Log.e(Constants.PROJECT_TAG,"Picture save error",e); } } } ); }
Example 7
From project Amantech, under directory /Android/CloudAppStudioAndroid/src/com/cloudappstudio/activities/.
Source file: EntryDetailsActivity.java

public void createImage(String imageUrl){ DisplayMetrics metrics=new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int widthPixels=metrics.widthPixels; int heightPixels=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,200,getResources().getDisplayMetrics()); ImageLoaderView imageView=new ImageLoaderView(getApplicationContext(),imageUrl); imageView.setLayoutParams(new LayoutParams(widthPixels,heightPixels)); scrollViewLayout.addView(imageView); }
Example 8
From project and-bible, under directory /IgnoreAndBibleExperiments/experiments/keygrid/.
Source file: KeyGridFactory.java

public KeyGridViewHolder createKeyGrid(Context context,List<KeyInfo> keys,KeyGridListener keyGridListener){ LayoutParams lop=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT); KeyGridViewHolder keyGridViewHolder=new KeyGridViewHolder(); KeyGridView keyGridView=new KeyGridView(context); keyGridViewHolder.keyGridView=keyGridView; if (keys != null) { if (keys.size() > MAX_KEYS_IN_SINGLE_SCREEN) { ScrollView scrollView=new ScrollView(context,null); scrollView.setLayoutParams(lop); scrollView.addView(keyGridView); keyGridViewHolder.topView=scrollView; } else { keyGridViewHolder.topView=keyGridView; } } keyGridView.setProximityCorrectionEnabled(false); int cols=context.getResources().getInteger(R.integer.key_grid_cols); Keyboard keyboard=new Keyboard(context,R.xml.key_grid_layout,getKeyCharString(keys.size()),cols,0); setKeyValues(keyboard.getKeys(),keys); keyGridView.setKeyboard(keyboard); keyGridView.setOnKeyboardActionListener(new KeyHandler(keyGridListener,keys)); return keyGridViewHolder; }
Example 9
From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/.
Source file: PreviewActivity.java

private void updatePreviewSize(){ DisplayMetrics dm=this.getResources().getDisplayMetrics(); float viewScale=this.getResources().getDimension(R.dimen.gif_view_scale); viewScale=TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,1,dm) * viewScale; int newWidth=(int)(GSSettings.getGifOutputSize().size() * viewScale); int newHeight=newWidth; if (this.mFirstFrameWidth > this.mFirstFrameHeight) newHeight=(int)(this.mFirstFrameHeight * ((double)newWidth / this.mFirstFrameWidth)); else newWidth=(int)(this.mFirstFrameWidth * ((double)newHeight / this.mFirstFrameHeight)); if (this.mPreviewHolder.getWidth() < newWidth) { newHeight=(int)(newHeight * ((double)this.mPreviewHolder.getWidth() / newWidth)); newWidth=this.mPreviewHolder.getWidth(); } if (this.mPreviewHolder.getHeight() < newHeight) { newWidth=(int)(newWidth * ((double)this.mPreviewHolder.getHeight() / newHeight)); newHeight=this.mPreviewHolder.getHeight(); } LayoutParams params=this.mPreviewImage.getLayoutParams(); params.height=newHeight; params.width=newWidth; this.mPreviewImage.setLayoutParams(params); this.mPreviewImage.invalidate(); }
Example 10
From project android-joedayz, under directory /Proyectos/FBConnectTest/src/com/facebook/android/.
Source file: FbDialog.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mSpinner=new ProgressDialog(getContext()); mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE); mSpinner.setMessage("Loading..."); requestWindowFeature(Window.FEATURE_NO_TITLE); mContent=new FrameLayout(getContext()); createCrossImage(); int crossWidth=mCrossImage.getDrawable().getIntrinsicWidth(); setUpWebView(crossWidth / 2); mContent.addView(mCrossImage,new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); addContentView(mContent,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); }
Example 11
From project Android-Simple-Social-Sharing, under directory /SimpleSocialSharing/src/com/nostra13/socialsharing/facebook/extpack/com/facebook/android/.
Source file: FbDialog.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mSpinner=new ProgressDialog(getContext()); mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE); mSpinner.setMessage("Loading..."); mSpinner.setCancelable(false); requestWindowFeature(Window.FEATURE_NO_TITLE); mContent=new FrameLayout(getContext()); setUpWebView(10); addContentView(mContent,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); }
Example 12
From project android-tether, under directory /facebook/src/com/facebook/android/.
Source file: FbDialog.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mSpinner=new ProgressDialog(getContext()); mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE); mSpinner.setMessage("Loading..."); requestWindowFeature(Window.FEATURE_NO_TITLE); mContent=new FrameLayout(getContext()); createCrossImage(); int crossWidth=mCrossImage.getDrawable().getIntrinsicWidth(); setUpWebView(crossWidth / 2); mContent.addView(mCrossImage,new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); addContentView(mContent,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); }
Example 13
From project android_packages_apps_Gallery, under directory /src/com/android/camera/.
Source file: ThumbnailController.java

private void updateThumb(Bitmap original){ if (original == null) { mThumb=null; mThumbs=null; return; } final int PADDING_WIDTH=2; final int PADDING_HEIGHT=2; LayoutParams param=mButton.getLayoutParams(); final int miniThumbWidth=param.width - 2 * PADDING_WIDTH; final int miniThumbHeight=param.height - 2 * PADDING_HEIGHT; mThumb=ThumbnailUtil.extractMiniThumb(original,miniThumbWidth,miniThumbHeight,Util.NO_RECYCLE_INPUT); Drawable drawable; if (mThumbs == null) { mThumbs=new Drawable[2]; mThumbs[1]=new BitmapDrawable(mResources,mThumb); drawable=mThumbs[1]; mShouldAnimateThumb=false; } else { mThumbs[0]=mThumbs[1]; mThumbs[1]=new BitmapDrawable(mResources,mThumb); mThumbTransition=new TransitionDrawable(mThumbs); drawable=mThumbTransition; mShouldAnimateThumb=true; } mButton.setImageDrawable(drawable); }
Example 14
From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/photoeditor/.
Source file: SpinnerProgressDialog.java

public SpinnerProgressDialog(Context context,List<View> tools,OnTouchListener listener){ super(context,R.style.SpinnerProgressDialog); addContentView(new ProgressBar(context),new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); setCancelable(false); for ( View view : tools) { if (view.isEnabled()) { enabledTools.add(view); } } this.listener=listener; }
Example 15
From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/record/.
Source file: SmartPoster.java

@Override public View getView(Activity activity,LayoutInflater inflater,ViewGroup parent,int offset){ if (mTitleRecord != null) { LinearLayout container=new LinearLayout(activity); container.setOrientation(LinearLayout.VERTICAL); container.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT)); container.addView(mTitleRecord.getView(activity,inflater,container,offset)); inflater.inflate(R.layout.tag_divider,container); container.addView(mUriRecord.getView(activity,inflater,container,offset)); return container; } else { return mUriRecord.getView(activity,inflater,parent,offset); } }
Example 16
From project Barcamp-Bangalore-Android-App, under directory /slidingmenu/library/src/com/slidingmenu/lib/.
Source file: CustomPagerAdapter.java

/** * Create the page for the given position. The adapter is responsible for adding the view to the container given here, although it only must ensure this is done by the time it returns from {@link #finishUpdate(ViewGroup)}. * @param container The containing View in which the page will be shown. * @param position The page position to be instantiated. * @return Returns an Object representing the new page. This does notneed to be a View, but can be some other container of the page. */ public Object instantiateItem(ViewGroup container,int position){ View view=null; LayoutParams params=null; switch (position) { case 0: view=mBehind; break; case 1: view=mContent; params=mContentParams; break; } if (container instanceof CustomViewAbove) { CustomViewAbove pager=(CustomViewAbove)container; pager.addView(view,position,params); } else if (container instanceof CustomViewBehind) { CustomViewBehind pager=(CustomViewBehind)container; pager.addView(view,position,params); } return view; }
Example 17
From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/activities/alliances/.
Source file: UserAlliance.java

private View createSpacer(Context activity,int color,int height){ View spacer=new View(activity); spacer.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,height)); if (color == 1) spacer.setBackgroundColor(Color.parseColor("#8F9193")); else if (color == 2) spacer.setBackgroundColor(Color.WHITE); return spacer; }
Example 18
From project CineShowTime-Android, under directory /Libraries/GreenDroid/src/greendroid/widget/.
Source file: QuickActionBar.java

@Override protected void onMeasureAndLayout(Rect anchorRect,View contentView){ contentView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); contentView.measure(MeasureSpec.makeMeasureSpec(getScreenWidth(),MeasureSpec.EXACTLY),LayoutParams.WRAP_CONTENT); int rootHeight=contentView.getMeasuredHeight(); int offsetY=getArrowOffsetY(); int dyTop=anchorRect.top; int dyBottom=getScreenHeight() - anchorRect.bottom; int dxLeft=anchorRect.left; int dxRight=getScreenWidth() - anchorRect.right; boolean onTop=(dyTop > dyBottom); int popupY=(onTop) ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY; boolean alignRight=dxRight < dxLeft; setWidgetSpecs(popupY,onTop,alignRight); }
Example 19
From project Ebento, under directory /src/mobisocial/bento/ebento/ui/quickaction/.
Source file: QuickAction.java

/** * Set root view. * @param id Layout resource id */ public void setRootViewId(int id){ mRootView=(ViewGroup)inflater.inflate(id,null); mTrack=(ViewGroup)mRootView.findViewById(R.id.tracks); mArrowDown=(ImageView)mRootView.findViewById(R.id.arrow_down); mArrowUp=(ImageView)mRootView.findViewById(R.id.arrow_up); mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); setContentView(mRootView); }
Example 20
From project facebook-android-sdk, under directory /examples/Hackbook/src/com/facebook/android/.
Source file: FQLQuery.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mHandler=new Handler(); setContentView(R.layout.fql_query); LayoutParams params=getWindow().getAttributes(); params.width=LayoutParams.FILL_PARENT; params.height=LayoutParams.FILL_PARENT; getWindow().setAttributes((android.view.WindowManager.LayoutParams)params); mFQLQuery=(EditText)findViewById(R.id.fqlquery); mFQLOutput=(TextView)findViewById(R.id.fqlOutput); mSubmitButton=(Button)findViewById(R.id.submit_button); mSubmitButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick( View v){ ((InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(mFQLQuery.getWindowToken(),0); dialog=ProgressDialog.show(FQLQuery.this.activity,"",FQLQuery.this.activity.getString(R.string.please_wait),true,true); String query=mFQLQuery.getText().toString(); Bundle params=new Bundle(); params.putString("method","fql.query"); params.putString("query",query); Utility.mAsyncRunner.request(null,params,new FQLRequestListener()); } } ); }
Example 21
@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); context=getApplicationContext(); AndroidGL20 gl20; if (isHoneycombOrLater() || !AndroidGL20Native.available) { gl20=new AndroidGL20(); } else { gl20=new AndroidGL20Native(); } viewLayout=new AndroidLayoutView(this); gameView=new GameViewGL(gl20,this,context); viewLayout.addView(gameView); if (isHoneycombOrLater()) { int flagHardwareAccelerated=0x1000000; getWindow().setFlags(flagHardwareAccelerated,flagHardwareAccelerated); } getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); LayoutParams params=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT); getWindow().setContentView(viewLayout,params); if (usePortraitOrientation()) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } try { ActivityInfo info=this.getPackageManager().getActivityInfo(new ComponentName(context,this.getPackageName() + "." + this.getLocalClassName()),0); if ((info.configChanges & REQUIRED_CONFIG_CHANGES) != REQUIRED_CONFIG_CHANGES) { new AlertDialog.Builder(this).setMessage("Unable to guarantee application will handle configuration changes. " + "Please add the following line to the Activity manifest: " + " android:configChanges=\"keyboardHidden|orientation\"").show(); } } catch ( NameNotFoundException e) { Log.w("playn","Cannot access game AndroidManifest.xml file."); } }
Example 22
/** * Show. * @param context the context * @param title the title * @param message the message * @param indeterminate the indeterminate * @param cancelable the cancelable * @param cancelListener the cancel listener * @param hideMainView the hide main view * @return the loading dialog */ public static LoadingDialog show(Context context,CharSequence title,CharSequence message,boolean indeterminate,boolean cancelable,OnCancelListener cancelListener,boolean hideMainView,int themeId){ LoadingDialog dialog=new LoadingDialog(context,themeId); dialog.setTitle(title); dialog.setCancelable(cancelable); dialog.setOnCancelListener(cancelListener); dialog.addContentView(new ProgressBar(context),new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); dialog.show(); return dialog; }
Example 23
From project GreenDroid, under directory /GreenDroid/src/greendroid/widget/.
Source file: QuickActionBar.java

@Override protected void onMeasureAndLayout(Rect anchorRect,View contentView){ contentView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); contentView.measure(MeasureSpec.makeMeasureSpec(getScreenWidth(),MeasureSpec.EXACTLY),LayoutParams.WRAP_CONTENT); int rootHeight=contentView.getMeasuredHeight(); int offsetY=getArrowOffsetY(); int dyTop=anchorRect.top; int dyBottom=getScreenHeight() - anchorRect.bottom; boolean onTop=(dyTop > dyBottom); int popupY=(onTop) ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY; setWidgetSpecs(popupY,onTop); }
Example 24
From project GreenDroidQABar, under directory /src/greendroid/widget/.
Source file: QuickActionBar.java

@Override protected void onMeasureAndLayout(Rect anchorRect,View contentView){ contentView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); contentView.measure(MeasureSpec.makeMeasureSpec(getScreenWidth(),MeasureSpec.EXACTLY),LayoutParams.WRAP_CONTENT); int rootHeight=contentView.getMeasuredHeight(); int offsetY=getArrowOffsetY(); int dyTop=anchorRect.top; int dyBottom=getScreenHeight() - anchorRect.bottom; boolean onTop=(dyTop > dyBottom); int popupY=(onTop) ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY; setWidgetSpecs(popupY,onTop); }
Example 25
From project jamendo-android, under directory /src/com/teleca/jamendo/adapter/.
Source file: RadioAdapter.java

@Override public View getView(int position,View convertView,ViewGroup parent){ View row=convertView; ViewHolder holder; if (row == null) { LayoutInflater inflater=mContext.getLayoutInflater(); row=inflater.inflate(R.layout.purple_row,null); holder=new ViewHolder(); holder.image=(RemoteImageView)row.findViewById(R.id.PurpleImageView); LayoutParams lp=holder.image.getLayoutParams(); lp.height=mIconSize; lp.width=mIconSize; holder.image.setLayoutParams(lp); holder.text=(TextView)row.findViewById(R.id.PurpleRowTextView); row.setTag(holder); } else { holder=(ViewHolder)row.getTag(); } if (mList.get(position).getName().length() == 0 || mList.get(position).getName().equals("null")) { holder.text.setText(mList.get(position).getIdstr()); } else { holder.text.setText(mList.get(position).getName()); } holder.image.setDefaultImage(R.drawable.list_radio); holder.image.setImageUrl(mList.get(position).getImage(),position,getListView()); return row; }
Example 26
/** * Show. * @param context the context * @param title the title * @param message the message * @param indeterminate the indeterminate * @param cancelable the cancelable * @param cancelListener the cancel listener * @param hideMainView the hide main view * @param themeId the theme id * @return the loading dialog */ public static LoadingDialog show(Context context,CharSequence title,CharSequence message,boolean indeterminate,boolean cancelable,OnCancelListener cancelListener,boolean hideMainView,int themeId){ if (hideMainView) { Activity activity=(Activity)context; activity.findViewById(R.id.main_content).setVisibility(View.INVISIBLE); } LoadingDialog dialog=new LoadingDialog(context,themeId); dialog.setTitle(title); dialog.setCancelable(cancelable); dialog.setOnCancelListener(cancelListener); dialog.addContentView(new ProgressBar(context),new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); dialog.show(); return dialog; }
Example 27
From project MIT-Mobile-for-Android, under directory /src/edu/mit/mitmobile2/.
Source file: DividerView.java

public DividerView(Context context,AttributeSet attrs){ super(context,attrs); int height=context.getResources().getDimensionPixelSize(R.dimen.dividerHeight); setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,height)); setBackgroundColor(context.getResources().getColor(R.color.dividerColor)); }
Example 28
/** * Checks augScreen, if it does not exist, it creates one. */ private void maintainAugmentR(){ if (augScreen == null) { augScreen=new AugmentedView(this); } addContentView(augScreen,new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); }
Example 29
From project mobilis, under directory /MobilisXHunt/MobilisXHunt_Android/src/de/tudresden/inf/rn/mobilis/android/xhunt/ui/.
Source file: DialogGameDetails.java

/** * Generate a TextView with the specific text. * @param text the text to display * @return the TextView */ private TextView generateTextView(String text){ TextView textView=new TextView(mContext); textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); textView.setText(text); textView.setPadding(0,0,0,10); return textView; }
Example 30
From project NotePad, under directory /NotePad/src/org/openintents/notepad/dialog/.
Source file: ThemeDialog.java

private void init(){ setInverseBackgroundForced(true); LayoutInflater inflate=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflate=inflate.cloneInContext(new ContextThemeWrapper(mContext,android.R.style.Theme_Light)); final View view=inflate.inflate(R.layout.dialog_theme_settings,null); setView(view); mListView=(ListView)view.findViewById(R.id.list1); mListView.setCacheColorHint(0); mListView.setItemsCanFocus(false); mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); Button b=new Button(mContext); b.setText(R.string.get_more_themes); b.setOnClickListener(new View.OnClickListener(){ @Override public void onClick( View v){ Intent i=new Intent(mContext,PreferenceActivity.class); i.putExtra(PreferenceActivity.EXTRA_SHOW_GET_ADD_ONS,true); mContext.startActivity(i); pressCancel(); dismiss(); } } ); LinearLayout ll=new LinearLayout(mContext); LayoutParams lp=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); ll.setPadding(20,10,20,10); ll.addView(b,lp); ll.setGravity(Gravity.CENTER); mListView.addFooterView(ll); mCheckBox=(CheckBox)view.findViewById(R.id.check1); setTitle(R.string.theme_pick); setButton(Dialog.BUTTON_POSITIVE,mContext.getText(R.string.ok),this); setButton(Dialog.BUTTON_NEGATIVE,mContext.getText(R.string.cancel),this); setOnCancelListener(this); prepareDialog(); }
Example 31
From project nuxeo-android, under directory /nuxeo-android-connector/src/main/java/org/nuxeo/android/layout/.
Source file: WidgetDefinition.java

public NuxeoWidget build(LayoutContext context,Document doc,ViewGroup parent,LayoutMode mode){ this.mode=mode; View view=null; LayoutParams labelLayoutParams=new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT,1f); LayoutParams widgetLayoutParams=new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT,1f); if (LayoutMode.VIEW == mode) { labelLayoutParams=new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT,0.6f); widgetLayoutParams=new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT,0.4f); } AndroidWidgetWrapper wrapper=AndroidWidgetMapper.getInstance().getWidgetWrapper(this); if (wrapper != null) { view=wrapper.buildView(context,mode,doc,attributeNames,this); view.setLayoutParams(widgetLayoutParams); view.setPadding(1,1,1,1); if (LayoutMode.VIEW == mode) { view.setBackgroundColor(Color.rgb(240,240,250)); } } if (view != null) { if (label != null) { TextView labelW=new TextView(context.getActivity()); labelW.setText(label + " :"); labelW.setTextColor(Color.rgb(80,80,80)); labelW.setLayoutParams(labelLayoutParams); parent.addView(labelW); if (LayoutMode.VIEW != mode) { labelW.setBackgroundColor(Color.rgb(160,160,170)); labelW.setTextColor(Color.rgb(20,20,40)); labelW.setPadding(5,5,5,5); } } parent.addView(view); return new NuxeoWidget(this,view,wrapper); } return null; }
Example 32
@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); uri=URI.create("http://10.0.2.2:8888"); client=new XMLRPCClient(uri); setContentView(R.layout.main); testResult=(TextSwitcher)findViewById(R.id.text_result); LayoutInflater inflater=LayoutInflater.from(this); View v0=inflater.inflate(R.layout.text_view,null); View v1=inflater.inflate(R.layout.text_view,null); LayoutParams params=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT); testResult.addView(v0,0,params); testResult.addView(v1,1,params); testResult.setText("WARNING, before calling any test make sure server.py is running !!!"); Animation inAnim=AnimationUtils.loadAnimation(this,R.anim.push_left_in); Animation outAnim=AnimationUtils.loadAnimation(this,R.anim.push_left_out); inAnim.setStartOffset(250); testResult.setInAnimation(inAnim); testResult.setOutAnimation(outAnim); errorDrawable=getResources().getDrawable(R.drawable.error); errorDrawable.setBounds(0,0,errorDrawable.getIntrinsicWidth(),errorDrawable.getIntrinsicHeight()); status=(TextView)findViewById(R.id.status); dateFormat=SimpleDateFormat.getDateInstance(SimpleDateFormat.FULL); timeFormat=SimpleDateFormat.getTimeInstance(SimpleDateFormat.DEFAULT); tests=(ListView)findViewById(R.id.tests); ArrayAdapter<String> adapter=new TestAdapter(this,R.layout.test,R.id.title); adapter.add("add 3 to 3.6;in [int, float] out float"); adapter.add("1 day from now;in/out Date"); adapter.add("test string;in/out String"); adapter.add("test struct;in/out Map"); adapter.add("test array;in/out Object[]"); adapter.add("desaturate image;in/out byte[]"); adapter.add("invert random bool;in/out boolean"); adapter.add("get huge string"); adapter.add("get complex 2D array"); tests.setAdapter(adapter); tests.setOnItemClickListener(testListener); }
Example 33
From project open_robot, under directory /Android/SensorGraph/src/org/achartengine/chartdemo/demo/chart/.
Source file: XYChartBuilder.java

@Override protected void onResume(){ super.onResume(); if (mChartView == null) { LinearLayout layout=(LinearLayout)findViewById(R.id.chart); mChartView=ChartFactory.getLineChartView(this,mDataset,mRenderer); layout.addView(mChartView,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); boolean enabled=mDataset.getSeriesCount() > 0; setSeriesEnabled(enabled); } else { mChartView.repaint(); } }
Example 34
From project packages_apps_Camera_1, under directory /src/com/android/camera/ui/.
Source file: RotateImageView.java

public void setBitmap(Bitmap bitmap){ if (bitmap == null) { mThumb=null; mThumbs=null; setImageDrawable(null); setVisibility(GONE); return; } LayoutParams param=getLayoutParams(); final int miniThumbWidth=param.width - getPaddingLeft() - getPaddingRight(); final int miniThumbHeight=param.height - getPaddingTop() - getPaddingBottom(); mThumb=ThumbnailUtils.extractThumbnail(bitmap,miniThumbWidth,miniThumbHeight); Drawable drawable; if (mThumbs == null || !mEnableAnimation) { mThumbs=new Drawable[2]; mThumbs[1]=new BitmapDrawable(getContext().getResources(),mThumb); setImageDrawable(mThumbs[1]); } else { mThumbs[0]=mThumbs[1]; mThumbs[1]=new BitmapDrawable(getContext().getResources(),mThumb); mThumbTransition=new TransitionDrawable(mThumbs); setImageDrawable(mThumbTransition); mThumbTransition.startTransition(500); } setVisibility(VISIBLE); }
Example 35
From project packages_apps_Camera_2, under directory /src/com/android/camera/ui/.
Source file: RotateImageView.java

public void setBitmap(Bitmap bitmap){ if (bitmap == null) { mThumb=null; mThumbs=null; setImageDrawable(null); setVisibility(GONE); return; } LayoutParams param=getLayoutParams(); final int miniThumbWidth=param.width - getPaddingLeft() - getPaddingRight(); final int miniThumbHeight=param.height - getPaddingTop() - getPaddingBottom(); mThumb=ThumbnailUtils.extractThumbnail(bitmap,miniThumbWidth,miniThumbHeight); Drawable drawable; if (mThumbs == null || !mEnableAnimation) { mThumbs=new Drawable[2]; mThumbs[1]=new BitmapDrawable(getContext().getResources(),mThumb); setImageDrawable(mThumbs[1]); } else { mThumbs[0]=mThumbs[1]; mThumbs[1]=new BitmapDrawable(getContext().getResources(),mThumb); mThumbTransition=new TransitionDrawable(mThumbs); setImageDrawable(mThumbTransition); mThumbTransition.startTransition(500); } setVisibility(VISIBLE); }
Example 36
From project packages_apps_God_Mode, under directory /src/com/t3hh4xx0r/addons/alerts/.
Source file: OMFGBAlertsActivity.java

/** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mPreferenceContainer=new RelativeLayout(this); mPreferenceContainer.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); mPreferenceListView=new ListView(this); mPreferenceListView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); mPreferenceListView.setId(android.R.id.list); startUIConstruction(); mProgressDialog=ProgressDialog.show(OMFGBAlertsActivity.this,getString(R.string.please_wait),getString(R.string.retreiving_data),true); }
Example 37
From project platform_packages_apps_camera, under directory /src/com/android/camera/ui/.
Source file: RotateImageView.java

public void setBitmap(Bitmap bitmap){ if (bitmap == null) { mThumb=null; mThumbs=null; setImageDrawable(null); setVisibility(GONE); return; } LayoutParams param=getLayoutParams(); final int miniThumbWidth=param.width - getPaddingLeft() - getPaddingRight(); final int miniThumbHeight=param.height - getPaddingTop() - getPaddingBottom(); mThumb=ThumbnailUtils.extractThumbnail(bitmap,miniThumbWidth,miniThumbHeight); Drawable drawable; if (mThumbs == null || !mEnableAnimation) { mThumbs=new Drawable[2]; mThumbs[1]=new BitmapDrawable(getContext().getResources(),mThumb); setImageDrawable(mThumbs[1]); } else { mThumbs[0]=mThumbs[1]; mThumbs[1]=new BitmapDrawable(getContext().getResources(),mThumb); mThumbTransition=new TransitionDrawable(mThumbs); setImageDrawable(mThumbTransition); mThumbTransition.startTransition(500); } setVisibility(VISIBLE); }
Example 38
From project android-marvin, under directory /marvin-it/src/test/android/de/akquinet/android/marvintest/activities/.
Source file: ActivityC.java

@Override protected void onCreate(Bundle savedInstanceState){ View layout=new LinearLayout(this); layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); layout.setId(CONTENT_VIEW_ID); layout.setOnKeyListener(new OnKeyListener(){ @Override public boolean onKey( View v, int keyCode, KeyEvent event){ keyIdentifier=keyCode; if (event.getAction() == KeyEvent.ACTION_DOWN) actionIdentifierDown=true; else if (event.getAction() == KeyEvent.ACTION_UP) actionIdentifierUp=true; return true; } } ); setContentView(layout); layout.setFocusable(true); layout.setFocusableInTouchMode(true); layout.requestFocus(); super.onCreate(savedInstanceState); }
Example 39
From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.
Source file: CloudActivity.java

protected final void showDialog(){ if (pDialog == null || !pDialog.isShowing()) { isLoading=true; pDialog=new ProgressDialog(this); pDialog.setProgressStyle(R.style.NewDialog); pDialog.setOnCancelListener(new OnCancelListener(){ @Override public void onCancel( DialogInterface dialog){ finish(); } } ); pDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND); pDialog.show(); pDialog.setContentView(new ProgressBar(this),new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); } }
Example 40
From project android-wheel, under directory /wheel/src/kankan/wheel/widget/.
Source file: WheelView.java

/** * Calculates control width and creates text layouts * @param widthSize the input layout width * @param mode the layout mode * @return the calculated control width */ private int calculateLayoutWidth(int widthSize,int mode){ initResourcesIfNecessary(); itemsLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); itemsLayout.measure(MeasureSpec.makeMeasureSpec(widthSize,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); int width=itemsLayout.getMeasuredWidth(); if (mode == MeasureSpec.EXACTLY) { width=widthSize; } else { width+=2 * PADDING; width=Math.max(width,getSuggestedMinimumWidth()); if (mode == MeasureSpec.AT_MOST && widthSize < width) { width=widthSize; } } itemsLayout.measure(MeasureSpec.makeMeasureSpec(width - 2 * PADDING,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); return width; }
Example 41
From project android-wheel-datetime-picker, under directory /src/kankan/wheel/widget/.
Source file: WheelView.java

/** * Calculates control width and creates text layouts * @param widthSize the input layout width * @param mode the layout mode * @return the calculated control width */ private int calculateLayoutWidth(int widthSize,int mode){ initResourcesIfNecessary(); itemsLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); itemsLayout.measure(MeasureSpec.makeMeasureSpec(widthSize,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); int width=itemsLayout.getMeasuredWidth(); if (mode == MeasureSpec.EXACTLY) { width=widthSize; } else { width+=2 * PADDING; width=Math.max(width,getSuggestedMinimumWidth()); if (mode == MeasureSpec.AT_MOST && widthSize < width) { width=widthSize; } } itemsLayout.measure(MeasureSpec.makeMeasureSpec(width - 2 * PADDING,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); return width; }
Example 42
From project android-wheel_1, under directory /wheel/src/kankan/wheel/widget/.
Source file: WheelView.java

/** * Calculates control width and creates text layouts * @param widthSize the input layout width * @param mode the layout mode * @return the calculated control width */ private int calculateLayoutWidth(int widthSize,int mode){ initResourcesIfNecessary(); itemsLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); itemsLayout.measure(MeasureSpec.makeMeasureSpec(widthSize,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); int width=itemsLayout.getMeasuredWidth(); if (mode == MeasureSpec.EXACTLY) { width=widthSize; } else { width+=2 * PADDING; width=Math.max(width,getSuggestedMinimumWidth()); if (mode == MeasureSpec.AT_MOST && widthSize < width) { width=widthSize; } } itemsLayout.measure(MeasureSpec.makeMeasureSpec(width - 2 * PADDING,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); return width; }
Example 43
From project androidTileMapEditor_1, under directory /src/it/sineo/android/tileMapEditor/.
Source file: HomeActivity.java

@Override protected void onCreate(Bundle savedInstanceState){ if (C.DEVELOPER_MODE) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().penaltyDeathOnNetwork().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); } super.onCreate(savedInstanceState); setContentView(R.layout.home); gvPreview=(GridView)findViewById(R.id.home_grid); emptyGrid=getLayoutInflater().inflate(R.layout.home_grid_empty,null); emptyGrid.findViewById(R.id.home_grid_empty).setOnClickListener(new View.OnClickListener(){ @Override public void onClick( View v){ showDialog(C.DIALOG_NEW_MAP); } } ); @SuppressWarnings("deprecation") int emptyGrid_layout_size=LayoutParams.FILL_PARENT; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { emptyGrid_layout_size=LayoutParams.MATCH_PARENT; } addContentView(emptyGrid,new LayoutParams(emptyGrid_layout_size,emptyGrid_layout_size)); gvPreview.setEmptyView(emptyGrid); getSupportLoaderManager().initLoader(0,null,this); String[] cols=new String[]{"_id","_name","_json_data","_last_update"}; adapter=new MySimpleCursorAdapter(getApplicationContext(),R.layout.home_grid_item,null,cols,null,0); gvPreview.setAdapter(adapter); gvPreview.setOnItemClickListener(this); registerForContextMenu(gvPreview); progressDialog=ProgressDialog.show(HomeActivity.this,null,getString(R.string.home_dlg_loading_maps),true); }
Example 44
From project android_ioio_combination_lock, under directory /src/kankan/wheel/widget/.
Source file: WheelView.java

/** * Calculates control width and creates text layouts * @param widthSize the input layout width * @param mode the layout mode * @return the calculated control width */ private int calculateLayoutWidth(int widthSize,int mode){ initResourcesIfNecessary(); itemsLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); itemsLayout.measure(MeasureSpec.makeMeasureSpec(widthSize,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); int width=itemsLayout.getMeasuredWidth(); if (mode == MeasureSpec.EXACTLY) { width=widthSize; } else { width+=2 * PADDING; width=Math.max(width,getSuggestedMinimumWidth()); if (mode == MeasureSpec.AT_MOST && widthSize < width) { width=widthSize; } } itemsLayout.measure(MeasureSpec.makeMeasureSpec(width - 2 * PADDING,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); return width; }
Example 45
From project apps-for-android, under directory /Translate/src/com/beust/android/translate/.
Source file: LanguageDialog.java

protected LanguageDialog(TranslateActivity activity){ super(activity); mActivity=activity; LayoutInflater inflater=(LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); ScrollView scrollView=(ScrollView)inflater.inflate(R.layout.language_dialog,null); setView(scrollView); LinearLayout layout=(LinearLayout)scrollView.findViewById(R.id.languages); LinearLayout current=null; Language[] languages=Language.values(); for (int i=0; i < languages.length; i++) { if (current != null) { layout.addView(current,new LayoutParams(FILL_PARENT,FILL_PARENT)); } current=new LinearLayout(activity); current.setOrientation(LinearLayout.HORIZONTAL); Button button=(Button)inflater.inflate(R.layout.language_entry,current,false); Language language=languages[i]; language.configureButton(mActivity,button); button.setOnClickListener(this); current.addView(button,button.getLayoutParams()); } if (current != null) { layout.addView(current,new LayoutParams(FILL_PARENT,FILL_PARENT)); } setTitle(" "); }
Example 46
From project BSPAN---Bluetooth-Sensor-Processing-for-Android, under directory /AndroidSpineExample/src/com/t2/androidspineexample/.
Source file: AndroidSpineExampleActivity.java

private void generateChart(){ XYMultipleSeriesDataset deviceDataset=new XYMultipleSeriesDataset(); XYMultipleSeriesRenderer deviceRenderer=new XYMultipleSeriesRenderer(); LinearLayout layout=(LinearLayout)findViewById(R.id.deviceChart); if (mDeviceChartView != null) { layout.removeView(mDeviceChartView); } if (true) { mDeviceChartView=ChartFactory.getLineChartView(this,deviceDataset,deviceRenderer); mDeviceChartView.setBackgroundColor(Color.BLACK); layout.addView(mDeviceChartView,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); } deviceRenderer.setShowLabels(false); deviceRenderer.setMargins(new int[]{0,5,5,0}); deviceRenderer.setShowAxes(true); deviceRenderer.setShowLegend(false); deviceRenderer.setZoomEnabled(false,false); deviceRenderer.setPanEnabled(false,false); deviceRenderer.setYAxisMin(0); deviceRenderer.setYAxisMax(8000000); deviceDataset.addSeries(mSeries); XYSeriesRenderer seriesRenderer=new XYSeriesRenderer(); seriesRenderer.setColor(Color.WHITE); seriesRenderer.setPointStyle(PointStyle.CIRCLE); deviceRenderer.addSeriesRenderer(seriesRenderer); }
Example 47
From project CHMI, under directory /src/org/kaldax/app/chmi/.
Source file: StandardLayoutProviderLegacy.java

public void assembleLayoutPortrait(int iImageHeight,int iImageWidth){ layout.setVerticalGravity(Gravity.TOP); iv.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); row2fr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); iv.setScaleType(ImageView.ScaleType.CENTER_INSIDE); layout.setGravity(android.view.Gravity.TOP | android.view.Gravity.LEFT); switch (imgHandler.getStaticFileMode()) { case ImagesHandlerImpl.STATIC_IMAGE_BACKGROUND: row2fr.addView(iv); break; case ImagesHandlerImpl.STATIC_IMAGE_FOREGROUND: row2fr.addView(iv); break; case ImagesHandlerImpl.STATIC_IMAGE_NONE: row2fr.addView(iv); break; default : } row2fr.addView(dateTextView); layout.addView(row2fr); row4.addView(imgProgressText); row4.setGravity(android.view.Gravity.CENTER); layout.addView(row4); row5.addView(statusText); row5.setGravity(android.view.Gravity.CENTER); layout.addView(row5); seekBar.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); seekBar.setPadding(5,5,5,20); row3.addView(btPlay); row3.addView(seekBar); row3.setVerticalGravity(Gravity.BOTTOM); row3.setHorizontalGravity(Gravity.CENTER_HORIZONTAL); row3.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.FILL_PARENT)); layout.addView(row3); row3.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.FILL_PARENT)); chmiActivity.setContentView(layout); }
Example 48
public TerminalView(Context context,TerminalBridge bridge){ super(context); this.context=context; this.bridge=bridge; paint=new Paint(); setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); setFocusable(true); setFocusableInTouchMode(true); cursorPaint=new Paint(); cursorPaint.setColor(bridge.color[bridge.defaultFg]); cursorPaint.setXfermode(new PixelXorXfermode(bridge.color[bridge.defaultBg])); cursorPaint.setAntiAlias(true); cursorStrokePaint=new Paint(cursorPaint); cursorStrokePaint.setStrokeWidth(0.1f); cursorStrokePaint.setStyle(Paint.Style.STROKE); shiftCursor=new Path(); shiftCursor.lineTo(0.5f,0.33f); shiftCursor.lineTo(1.0f,0.0f); altCursor=new Path(); altCursor.moveTo(0.0f,1.0f); altCursor.lineTo(0.5f,0.66f); altCursor.lineTo(1.0f,1.0f); ctrlCursor=new Path(); ctrlCursor.moveTo(0.0f,0.25f); ctrlCursor.lineTo(1.0f,0.5f); ctrlCursor.lineTo(0.0f,0.75f); tempSrc=new RectF(); tempSrc.set(0.0f,0.0f,1.0f,1.0f); tempDst=new RectF(); scaleMatrix=new Matrix(); bridge.addFontSizeChangedListener(this); setOnKeyListener(bridge.getKeyHandler()); mAccessibilityBuffer=new StringBuffer(); new AccessibilityStateTester().execute((Void)null); }
Example 49
From project Cura, under directory /src/com/cura/ServerStats/.
Source file: ServerStatsActivity.java

public void createChartLayout(String s){ String data[]=s.split("--"); try { totalMem=String.format("%.2f GB",Double.parseDouble(data[4].replaceAll("\\s","")) / (1024 * 1024)); usedMem=String.format("%.2f GB",Double.parseDouble(data[5].replaceAll("\\s","")) / (1024 * 1024)); freeMem=String.format("%.2f GB",Double.parseDouble(data[6].replaceAll("\\s","")) / (1024 * 1024)); TextView tv=(TextView)findViewById(R.id.totalMem); tv.setText("Total: " + totalMem); tv=(TextView)findViewById(R.id.usedMem); tv.setText("Used: " + usedMem); tv=(TextView)findViewById(R.id.freeMem); tv.setText("Free: " + freeMem); LinearLayout memoryPieChartView=(LinearLayout)(findViewById(R.id.memoryPieChartView)); memoryPieChartView.removeAllViews(); memoryPieChartView.addView(new MemoryStatsPieChart().execute(this,data),new LayoutParams(300,300)); Log.d("account id","wselet pie"); } catch ( Exception e) { TextView tv=(TextView)findViewById(R.id.totalMem); tv.setText("Total: " + totalMem); tv=(TextView)findViewById(R.id.usedMem); tv.setText("Used: " + usedMem); tv=(TextView)findViewById(R.id.freeMem); tv.setText("Free: " + freeMem); } }
Example 50
From project cw-omnibus, under directory /SmartWatch/WatchAuth/src/com/commonsware/watchauth/.
Source file: AuthSmartWatch.java

@Override public void onResume(){ if (content == null) { LinearLayout root=new LinearLayout(mContext); root.setLayoutParams(new LayoutParams(width,height)); content=(ViewGroup)LayoutInflater.from(mContext).inflate(R.layout.main,root); content.measure(width,height); content.layout(0,0,content.getMeasuredWidth(),content.getMeasuredHeight()); content.findViewById(R.id.confirm).setOnClickListener(this); } Bitmap mBackground=Bitmap.createBitmap(width,height,BITMAP_CONFIG); mBackground.setDensity(DisplayMetrics.DENSITY_DEFAULT); Canvas canvas=new Canvas(mBackground); content.draw(canvas); showBitmap(mBackground); }
Example 51
From project dccsched, under directory /src/com/underhilllabs/dccsched/ui/.
Source file: HomeActivity.java

private void reloadNowPlaying(boolean forceRelocate){ mMessageHandler.removeCallbacks(mCountdownRunnable); final long currentTimeMillis=System.currentTimeMillis(); if (mNowPlayingLoadingView == null) return; ViewGroup homeRoot=(ViewGroup)findViewById(R.id.home_root); View nowPlaying=findViewById(R.id.now_playing); if (nowPlaying != null) { homeRoot.removeView(nowPlaying); nowPlaying=null; } mNowPlayingLoadingView.setVisibility(View.VISIBLE); mState.mNoResults=false; mState.mNowPlayingGotoWifi=false; if (currentTimeMillis < UIUtils.CONFERENCE_START_MILLIS) { nowPlaying=createNowPlayingBeforeView(); } else if (currentTimeMillis > UIUtils.CONFERENCE_END_MILLIS) { nowPlaying=createNowPlayingAfterView(); } else { nowPlaying=createNowPlayingDuringView(forceRelocate); } homeRoot.addView(nowPlaying,new LayoutParams(LayoutParams.FILL_PARENT,(int)getResources().getDimension(R.dimen.now_playing_height))); }
Example 52
From project dungbeetle, under directory /src/edu/stanford/mobisocial/dungbeetle/.
Source file: CustomPopupWindow.java

/** * Displays like a QuickAction from the anchor view. * @param xOffset offset in the X direction * @param yOffset offset in the Y direction */ public void showLikeQuickAction(int xOffset,int yOffset){ preShow(); window.setAnimationStyle(R.style.Animations_PopUpMenu_Center); int[] location=new int[2]; anchor.getLocationOnScreen(location); Rect anchorRect=new Rect(location[0],location[1],location[0] + anchor.getWidth(),location[1] + anchor.getHeight()); root.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); root.measure(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); int rootWidth=root.getMeasuredWidth(); int rootHeight=root.getMeasuredHeight(); int screenWidth=windowManager.getDefaultDisplay().getWidth(); int xPos=((screenWidth - rootWidth) / 2) + xOffset; int yPos=anchorRect.top - rootHeight + yOffset; if (rootHeight > anchorRect.top) { yPos=anchorRect.bottom + yOffset; window.setAnimationStyle(R.style.Animations_PopDownMenu_Center); } window.showAtLocation(anchor,Gravity.NO_GRAVITY,xPos,yPos); }
Example 53
From project galaxyCar, under directory /galaxyCar/src/org/psywerx/car/.
Source file: GalaxyCarActivity.java

/** * Adds the graph renderers to their views */ private void setGraphViews(){ mGraph=new Graph(); LinearLayout graphAll=(LinearLayout)findViewById(R.id.chart); mChartViewAll=ChartFactory.getLineChartView(this,mGraph.getDatasetAll(),mGraph.getRendererAll()); LinearLayout graphTurn=(LinearLayout)findViewById(R.id.chartGL2); mChartViewTurn=ChartFactory.getLineChartView(this,mGraph.getDatasetTurn(),mGraph.getRendererTurn()); LinearLayout graphRevs=(LinearLayout)findViewById(R.id.chartGL3); mChartViewRevs=ChartFactory.getLineChartView(this,mGraph.getDatasetRevs(),mGraph.getRendererRevs()); LinearLayout graphG=(LinearLayout)findViewById(R.id.chartGL4); mChartViewG=ChartFactory.getLineChartView(this,mGraph.getDatasetG(),mGraph.getRendererG()); graphAll.addView((View)mChartViewAll,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); graphTurn.addView((View)mChartViewTurn,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); graphRevs.addView((View)mChartViewRevs,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); graphG.addView((View)mChartViewG,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); }
Example 54
From project GeekAlarm, under directory /android/src/kankan/wheel/widget/.
Source file: WheelView.java

/** * Calculates control width and creates text layouts * @param widthSize the input layout width * @param mode the layout mode * @return the calculated control width */ private int calculateLayoutWidth(int widthSize,int mode){ initResourcesIfNecessary(); itemsLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); itemsLayout.measure(MeasureSpec.makeMeasureSpec(widthSize,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); int width=itemsLayout.getMeasuredWidth(); if (mode == MeasureSpec.EXACTLY) { width=widthSize; } else { width+=2 * PADDING; width=Math.max(width,getSuggestedMinimumWidth()); if (mode == MeasureSpec.AT_MOST && widthSize < width) { width=widthSize; } } itemsLayout.measure(MeasureSpec.makeMeasureSpec(width - 2 * PADDING,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED)); return width; }
Example 55
From project hiofenigma-android, under directory /opendice/src/edu/killerud/diceroll/.
Source file: Main.java

private void addDie(Context context,DieType type){ mDice.add(new Die(type)); final TextView dieView=new TextView(context); dieView.setMinimumWidth(50); dieView.setText("Shake me!"); dieView.setGravity(Gravity.CENTER); dieView.setTextSize(mTextSize); dieView.setBackgroundResource(R.drawable.status_border_white_slim); dieView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); dieView.setOnClickListener(new OnClickListener(){ public void onClick( View view){ Die dice=mDice.get(((ViewGroup)view.getParent()).indexOfChild(view)); if (!dice.isSaved()) { dice.save(); dieView.setBackgroundResource(R.drawable.status_border_grey_slim); } else { dice.discard(); dieView.setBackgroundResource(R.drawable.status_border_white_slim); } } } ); mAppWindow.addView(dieView); }
Example 56
From project iosched_1, under directory /src/com/google/android/apps/iosched/ui/.
Source file: HomeActivity.java

private void reloadNowPlaying(boolean forceRelocate){ mMessageHandler.removeCallbacks(mCountdownRunnable); final long currentTimeMillis=System.currentTimeMillis(); if (mNowPlayingLoadingView == null) return; ViewGroup homeRoot=(ViewGroup)findViewById(R.id.home_root); View nowPlaying=findViewById(R.id.now_playing); if (nowPlaying != null) { homeRoot.removeView(nowPlaying); nowPlaying=null; } mNowPlayingLoadingView.setVisibility(View.VISIBLE); mState.mNoResults=false; mState.mNowPlayingGotoWifi=false; if (currentTimeMillis < UIUtils.CONFERENCE_START_MILLIS) { nowPlaying=createNowPlayingBeforeView(); } else if (currentTimeMillis > UIUtils.CONFERENCE_END_MILLIS) { nowPlaying=createNowPlayingAfterView(); } else { nowPlaying=createNowPlayingDuringView(forceRelocate); } homeRoot.addView(nowPlaying,new LayoutParams(LayoutParams.FILL_PARENT,(int)getResources().getDimension(R.dimen.now_playing_height))); }
Example 57
From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.
Source file: AAWidget.java

/** * Creates the activity; This themes up our activity to look like a dialog Also registers some UI action listeners to the UI elements */ @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); this.setContentView(R.layout.widget_settings); this.setTitle("Widget Settings"); getWindow().setBackgroundDrawableResource(R.drawable.widget_dialog2); Display d=getWindow().getWindowManager().getDefaultDisplay(); getWindow().setLayout(d.getWidth() * 15 / 16,LayoutParams.WRAP_CONTENT); this.setResult(RESULT_CANCELED); settings=this.getSharedPreferences("settings",0); btn_ok=(Button)this.findViewById(R.id.btn_ok); sb_freq=(SeekBar)this.findViewById(R.id.sb_freq); tv_freq=(TextView)this.findViewById(R.id.tv_freq); rg_layoutPicker=(RadioGroup)this.findViewById(R.id.rg_layoutPicker); rb_left=(RadioButton)this.findViewById(R.id.rb_left); rb_center=(RadioButton)this.findViewById(R.id.rb_center); btn_ok.setOnClickListener(new OnClickListener(){ @Override public void onClick( View v){ acceptChanges(); } } ); sb_freq.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){ @Override public void onStopTrackingTouch( SeekBar seekBar){ } @Override public void onStartTrackingTouch( SeekBar seekBar){ } /** * When the user changes the position of the slider bar; display the current progress in the textview below */ @Override public void onProgressChanged( SeekBar seekBar, int progress, boolean fromUser){ tv_freq.setText((progress + 1) + " hour/s"); } } ); sb_freq.setProgress((int)settings.getLong("freq",2) - 1); }
Example 58
From project ActionBarSherlock, under directory /samples/styled/src/com/actionbarsherlock/sample/styled/.
Source file: RoundedColourFragment.java

@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mView=new View(getActivity()); GradientDrawable background=(GradientDrawable)getResources().getDrawable(R.drawable.rounded_rect); background.setColor(mColour); mView.setBackgroundDrawable(background); LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(0,LayoutParams.FILL_PARENT,mWeight); lp.setMargins(marginLeft,marginTop,marginRight,marginBottom); mView.setLayoutParams(lp); }
Example 59
From project Airports, under directory /src/com/nadmm/airports/aeronav/.
Source file: DtppActivity.java

protected void showDtppSummary(Cursor[] result){ LinearLayout topLayout=(LinearLayout)findViewById(R.id.dtpp_detail_layout); Cursor cycle=result[1]; cycle.moveToFirst(); mTppCycle=cycle.getString(cycle.getColumnIndex(DtppCycle.TPP_CYCLE)); String from=cycle.getString(cycle.getColumnIndex(DtppCycle.FROM_DATE)); String to=cycle.getString(cycle.getColumnIndex(DtppCycle.TO_DATE)); SimpleDateFormat df=new SimpleDateFormat("HHmm'Z' MM/dd/yy"); df.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); Date fromDate=null; Date toDate=null; try { fromDate=df.parse(from); toDate=df.parse(to); } catch ( ParseException e1) { } Date now=new Date(); if (now.getTime() > toDate.getTime()) { mExpired=true; } RelativeLayout item=(RelativeLayout)inflate(R.layout.grouped_detail_item); TextView tv=(TextView)item.findViewById(R.id.group_name); LinearLayout layout=(LinearLayout)item.findViewById(R.id.group_details); tv.setText(String.format("Chart Cycle %s",mTppCycle)); Cursor dtpp=result[2]; dtpp.moveToFirst(); String tppVolume=dtpp.getString(0); addRow(layout,"Volume",tppVolume); addRow(layout,"Valid",TimeUtils.formatDateRange(getActivity(),fromDate.getTime(),toDate.getTime())); if (mExpired) { addRow(layout,"WARNING: This chart cycle has expired."); } topLayout.addView(item,new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT)); }
Example 60
From project android-bankdroid, under directory /src/com/liato/bankdroid/.
Source file: BetterPopupWindow.java

private void preShow(){ if (this.root == null) { throw new IllegalStateException("setContentView was not called with a view to display."); } onShow(); if (this.background == null) { this.window.setBackgroundDrawable(new BitmapDrawable()); } else { this.window.setBackgroundDrawable(this.background); } this.window.setWidth(WindowManager.LayoutParams.FILL_PARENT); this.window.setHeight(WindowManager.LayoutParams.WRAP_CONTENT); this.window.setTouchable(true); this.window.setFocusable(true); this.window.setOutsideTouchable(true); this.window.setContentView(this.root); }
Example 61
From project android_7, under directory /src/org/immopoly/android/helper/.
Source file: HudPopupHelper.java

public HudPopupHelper(Activity activity,int type){ switch (type) { case TYPE_FINANCE_POPUP: mLayoutView=(LinearLayout)activity.getLayoutInflater().inflate(R.layout.hud_statistic,null); break; default : mLayoutView=(LinearLayout)activity.getLayoutInflater().inflate(R.layout.hud_statistic,null); break; } if (mLayoutView != null) { mPopupView=new PopupWindow(mLayoutView,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,false); mPopupView.setOutsideTouchable(true); mPopupView.setBackgroundDrawable(new BitmapDrawable()); mPopupView.setTouchable(true); mPopupView.setTouchInterceptor(new View.OnTouchListener(){ @Override public boolean onTouch(View v,MotionEvent event){ new Handler().postDelayed(new Runnable(){ public void run(){ mPopupView.dismiss(); } } ,200); return true; } } ); } }
Example 62
From project android_packages_apps_Superuser, under directory /src/com/noshufou/android/su/widget/.
Source file: BetterPopupWindow.java

private void preShow(){ if (this.root == null) { throw new IllegalStateException("setContentView was not called with a view to display."); } onShow(); if (this.background == null) { this.window.setBackgroundDrawable(new BitmapDrawable()); } else { this.window.setBackgroundDrawable(this.background); } this.window.setWidth(WindowManager.LayoutParams.WRAP_CONTENT); this.window.setHeight(WindowManager.LayoutParams.WRAP_CONTENT); this.window.setTouchable(true); this.window.setFocusable(true); this.window.setOutsideTouchable(true); this.window.setContentView(this.root); }
Example 63
From project blokish, under directory /src/org/scoutant/blokish/.
Source file: EndGameDialog.java

public EndGameDialog(final Context context,boolean redwins,String message,final int level,final int score){ super(context); setContentView(R.layout.endgame); getWindow().setLayout(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT); TextView tv=(TextView)findViewById(R.id.message); tv.setText(message); Button b=(Button)findViewById(R.id.ok); b.setOnClickListener(new android.view.View.OnClickListener(){ public void onClick( View v){ EndGameDialog.this.dismiss(); } } ); findViewById(R.id.icons).setVisibility(redwins ? View.VISIBLE : View.GONE); }
Example 64
From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/ui/dialogs/.
Source file: LoginRegisterDialog.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.dialog_login_register); setTitle(R.string.login_register_dialog_title); setCanceledOnTouchOutside(true); getWindow().setLayout(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT); initializeViews(); initializeListeners(); this.setOnShowListener(new OnShowListener(){ public void onShow( DialogInterface dialog){ InputMethodManager inputManager=(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(usernameEditText,InputMethodManager.SHOW_IMPLICIT); } } ); }
Example 65
From project Cloud-Shout, under directory /ckdgcloudshout-Android/src/com/cloudshout/.
Source file: Video.java

public View createView(Context c){ v=new VideoView(c); v.setOnCompletionListener(this); v.setVideoPath(this.getResource()); this.layout=new RelativeLayout(c); this.layout.setPadding(getLeft(),getTop(),0,0); this.layout.addView(this.v,new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); this.layout.setVisibility(View.GONE); return layout; }
Example 66
From project Common-Sense-Net-2, under directory /RealFarm/src/com/commonsensenet/realfarm/.
Source file: DataFormActivity.java

protected void putBackgrounds(Resource choice,TextView textView,int imageType){ if (choice.getBackgroundImage() != -1) { textView.setBackgroundResource(choice.getBackgroundImage()); } if (imageType == 1 || imageType == 2) { BitmapDrawable bd=(BitmapDrawable)mParentReference.getResources().getDrawable(choice.getImage1()); int width=bd.getBitmap().getWidth(); if (width > 80) { width=80; } LinearLayout.LayoutParams llp=new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); llp.setMargins(10,0,80 - width - 20,0); textView.setLayoutParams(llp); textView.setBackgroundResource(choice.getImage1()); if (imageType == 1) { textView.setTextColor(Color.TRANSPARENT); } else { textView.setGravity(Gravity.TOP); textView.setPadding(0,0,0,0); textView.setTextSize(20); textView.setTextColor(Color.BLACK); } } }
Example 67
From project cow, under directory /libs/ActionBarSherlock/test/app/src/com/actionbarsherlock/tests/app/.
Source file: FeatureCustomView.java

public void setCustomView() throws InterruptedException { final CountDownLatch latch=new CountDownLatch(1); runOnUiThread(new Runnable(){ @Override public void run(){ getSupportActionBar().setDisplayShowCustomEnabled(false); customView=new TextView(FeatureCustomView.this); customView.setText("Custom View!"); customView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); getSupportActionBar().setCustomView(customView); latch.countDown(); } } ); latch.await(); }
Example 68
From project dreamDroid, under directory /src/net/reichholf/dreamdroid/adapter/.
Source file: MultiEpgAdapter.java

private View getItemTextView(Context ctx,ExtendedHashMap item,int width){ LinearLayout ll=new LinearLayout(ctx); ll.setLayoutParams(new LinearLayout.LayoutParams(width,LayoutParams.WRAP_CONTENT)); TextView view=new TextView(ctx); view.setText(item.getString(Event.KEY_EVENT_NAME)); ll.addView(view); return ll; }
Example 69
From project droid-comic-viewer, under directory /src/net/robotmedia/acv/ui/.
Source file: BrowseActivity.java

public View getView(int position,View convertView,ViewGroup parent){ Drawable thumbnail=comic.getThumbnail(position); if (thumbnail == null) { TextView noThumbnail=(TextView)mInflater.inflate(layoutNoThumbnail,null); int screenNumber=isLeftToRight() ? position + 1 : getCount() - position; noThumbnail.setText(Integer.toString(screenNumber)); return noThumbnail; } else { ImageView i=new ImageView(mContext); int screenPosition=isLeftToRight() ? position : getCount() - position - 1; i.setImageDrawable(comic.getThumbnail(screenPosition)); int thumbnailWidth=MathUtils.dipToPixel(mContext,THUMBNAIL_WIDTH_DIP); int thumbnailHeight=MathUtils.dipToPixel(mContext,THUMBNAIL_HEIGTH_DIP); i.setLayoutParams(new Gallery.LayoutParams(thumbnailWidth,thumbnailHeight)); i.setScaleType(ImageView.ScaleType.FIT_CENTER); return i; } }
Example 70
From project ElectricSleep, under directory /src/com/androsz/electricsleepbeta/preference/.
Source file: SeekBarPreference.java

@Override protected void onPrepareDialogBuilder(final Builder builder){ final LinearLayout layout=new LinearLayout(context); layout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT)); layout.setOrientation(LinearLayout.VERTICAL); layout.setMinimumWidth(400); layout.setPadding(20,20,20,20); textView=new TextView(context); textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT)); syncTextViewText(getPersistedFloat(0)); textView.setPadding(5,5,5,5); layout.addView(textView); seekBar=new DecimalSeekBar(context); seekBar.setMax(Math.round(SettingsActivity.MAX_ALARM_SENSITIVITY)); seekBar.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT)); seekBar.setProgress(getPersistedFloat(0)); seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){ @Override public void onProgressChanged( final SeekBar seekBar, final int progress, final boolean fromUser){ syncTextViewText(progress / DecimalSeekBar.PRECISION); } @Override public void onStartTrackingTouch( final SeekBar seekBar){ } @Override public void onStopTrackingTouch( final SeekBar seekBar){ } } ); layout.addView(seekBar); builder.setView(layout); builder.setTitle(getTitle()); super.onPrepareDialogBuilder(builder); }
Example 71
From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/samples/styled/src/com/actionbarsherlock/sample/styled/.
Source file: RoundedColourFragment.java

@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mView=new View(getActivity()); GradientDrawable background=(GradientDrawable)getResources().getDrawable(R.drawable.rounded_rect); background.setColor(mColour); mView.setBackgroundDrawable(background); LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(0,LayoutParams.FILL_PARENT,mWeight); lp.setMargins(marginLeft,marginTop,marginRight,marginBottom); mView.setLayoutParams(lp); }
Example 72
From project FlickrCity, under directory /src/com/FlickrCity/FlickrCityAndroid/Overlays/.
Source file: BalloonItemizedOverlay.java

@Override protected final boolean onTap(int index){ boolean isRecycled; final int thisIndex; GeoPoint point; thisIndex=index; point=createItem(index).getPoint(); if (balloonView == null) { balloonView=new BalloonOverlayView(mapView.getContext(),viewOffset); clickRegion=(View)balloonView.findViewById(R.id.balloon_inner_layout); isRecycled=false; } else { isRecycled=true; } balloonView.setVisibility(View.GONE); List<Overlay> mapOverlays=mapView.getOverlays(); if (mapOverlays.size() > 1) { hideOtherBalloons(mapOverlays); } balloonView.setData(createItem(index)); MapView.LayoutParams params=new MapView.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,point,MapView.LayoutParams.BOTTOM_CENTER); params.mode=MapView.LayoutParams.MODE_MAP; setBalloonTouchListener(thisIndex); balloonView.setVisibility(View.VISIBLE); if (isRecycled) { balloonView.setLayoutParams(params); } else { mapView.addView(balloonView,params); } mc.animateTo(point); return true; }
Example 73
From project gesture-imageview, under directory /main/src/com/polites/android/.
Source file: GestureImageView.java

@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){ if (drawable != null) { int orientation=getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_LANDSCAPE) { displayHeight=MeasureSpec.getSize(heightMeasureSpec); if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) { float ratio=(float)getImageWidth() / (float)getImageHeight(); displayWidth=Math.round((float)displayHeight * ratio); } else { displayWidth=MeasureSpec.getSize(widthMeasureSpec); } } else { displayWidth=MeasureSpec.getSize(widthMeasureSpec); if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { float ratio=(float)getImageHeight() / (float)getImageWidth(); displayHeight=Math.round((float)displayWidth * ratio); } else { displayHeight=MeasureSpec.getSize(heightMeasureSpec); } } } else { displayHeight=MeasureSpec.getSize(heightMeasureSpec); displayWidth=MeasureSpec.getSize(widthMeasureSpec); } setMeasuredDimension(displayWidth,displayHeight); }
Example 74
From project Gingerbread-Keyboard, under directory /src/com/android/inputmethod/latin/.
Source file: CandidateView.java

/** * Construct a CandidateView for showing suggested words for completion. * @param context * @param attrs */ public CandidateView(Context context,AttributeSet attrs){ super(context,attrs); mSelectionHighlight=context.getResources().getDrawable(R.drawable.list_selector_background_pressed); LayoutInflater inflate=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Resources res=context.getResources(); mPreviewPopup=new PopupWindow(context); mPreviewText=(TextView)inflate.inflate(R.layout.candidate_preview,null); mPreviewPopup.setWindowLayoutMode(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); mPreviewPopup.setContentView(mPreviewText); mPreviewPopup.setBackgroundDrawable(null); mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation); mColorNormal=res.getColor(R.color.candidate_normal); mColorRecommended=res.getColor(R.color.candidate_recommended); mColorOther=res.getColor(R.color.candidate_other); mDivider=res.getDrawable(R.drawable.keyboard_suggest_strip_divider); mAddToDictionaryHint=res.getString(R.string.hint_add_to_dictionary); mPaint=new Paint(); mPaint.setColor(mColorNormal); mPaint.setAntiAlias(true); mPaint.setTextSize(mPreviewText.getTextSize()); mPaint.setStrokeWidth(0); mPaint.setTextAlign(Align.CENTER); mDescent=(int)mPaint.descent(); mMinTouchableWidth=(int)res.getDimension(R.dimen.candidate_min_touchable_width); mGestureDetector=new GestureDetector(new CandidateStripGestureListener(mMinTouchableWidth)); setWillNotDraw(false); setHorizontalScrollBarEnabled(false); setVerticalScrollBarEnabled(false); scrollTo(0,getScrollY()); }
Example 75
From project gobandroid, under directory /src/org/ligi/gobandroid_hd/ui/.
Source file: BetterPopupWindow.java

private void preShow(){ if (this.root == null) { throw new IllegalStateException("setContentView was not called with a view to display."); } onShow(); if (this.background == null) { this.window.setBackgroundDrawable(new BitmapDrawable()); } else { this.window.setBackgroundDrawable(this.background); } this.window.setWidth(WindowManager.LayoutParams.WRAP_CONTENT); this.window.setHeight(WindowManager.LayoutParams.WRAP_CONTENT); this.window.setTouchable(true); this.window.setFocusable(true); this.window.setOutsideTouchable(true); this.window.setContentView(this.root); }
Example 76
From project HapiPodcastJ, under directory /src/info/xuluan/podcast/.
Source file: HomeActivity.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); LinearLayout ll=new LinearLayout(this); int orientation=getResources().getConfiguration().orientation; boolean isLandscape=(orientation == Configuration.ORIENTATION_LANDSCAPE); ll.setOrientation(isLandscape ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL); setContentView(ll); LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT); layoutParams.weight=1; LabeledFrameHelper cfh=new LabeledFrameHelper(this,"Channels",orientation); ll.addView(cfh.frame()); cfh.addIntentButton(R.drawable.search_big_pic,R.string.channel_bar_button_search,SearchActivity.class); cfh.addIntentButton(R.drawable.channel_add_big_pic,R.string.channel_bar_button_add,AddChannelActivity.class); cfh.addIntentButton(R.drawable.channel_big_pic,R.string.channel_bar_button_manage,R.string.channel_bar_button_manage_l,ChannelsActivity.class); cfh.addIntentButton(R.drawable.backup_big_pic,R.string.channel_bar_button_backup,BackupChannelsActivity.class); if (isLandscape) cfh.frame().setLayoutParams(layoutParams); LabeledFrameHelper efh=new LabeledFrameHelper(this,"Episodes",orientation); ll.addView(efh.frame()); efh.addIntentButton(R.drawable.playlist_big_pic,R.string.episode_bar_button_library,AllItemActivity.class); efh.addIntentButton(R.drawable.download_big_pic,R.string.episode_bar_button_download,DownloadingActivity.class); efh.addIntentButton(R.drawable.episode_big_pic,R.string.episode_bar_button_channel,ChannelActivity.class); efh.addIntentButton(R.drawable.player3_big_pic,R.string.episode_bar_button_play,PlayerActivity.class); if (isLandscape) efh.frame().setLayoutParams(layoutParams); }
Example 77
From project ihatovgram, under directory /src/client/android/ihatovgram/src/com/ipuweb/ihatovgram/Viewer/.
Source file: PhotoViewerActivity.java

protected void onPostExecute(Drawable draw){ int margin=(int)(width * 0.1); int size=(int)(width * 0.8); LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(size,size); lp.setMargins(margin,margin,margin,margin); view.setLayoutParams(lp); view.setBackgroundDrawable(draw); }
Example 78
From project Jota-Text-Editor, under directory /src/jp/sblo/pandora/jota/.
Source file: ColorPickerDialog.java

@SuppressWarnings("deprecation") protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); OnColorChangedListener l=new OnColorChangedListener(){ public void colorChanged( int fg, int bg){ mListener.colorChanged(fg,bg); dismiss(); } } ; ViewGroup.LayoutParams lp=new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT); setContentView(new ColorPickerView(getContext(),l,mFgColor,mBgColor,mBgMode),lp); setTitle(mTitle); }
Example 79
From project KeyboardTerm, under directory /src/tw/kenshinn/keyboardTerm/.
Source file: TerminalActivity.java

public void showView(long id){ TerminalView view=TerminalManager.getInstance().getView(id); if (view != null) { view.terminalActivity=this; terminalFrame.removeAllViews(); terminalFrame.addView(view,LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT); view.requestFocus(); currentViewId=id; } }
Example 80
From project LunaTerm, under directory /src/tw/loli/lunaTerm/.
Source file: TerminalActivity.java

public void showView(long id){ TerminalView view=TerminalManager.getInstance().getView(id); if (view != null) { view.terminalActivity=this; View osd=findViewById(R.id.terminalOSD); terminalFrame.removeAllViews(); terminalFrame.addView(view,LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT); terminalFrame.addView(osd); view.requestFocus(); currentViewId=id; } }
Example 81
From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/view/.
Source file: List8.java

public View getView(int position,View convertView,ViewGroup parent){ ImageView i=new ImageView(mContext); i.setImageResource(mPhotos.get(position)); i.setAdjustViewBounds(true); i.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); i.setBackgroundResource(R.drawable.picture_frame); return i; }
Example 82
From project mediautilities, under directory /src/com/polites/android/.
Source file: GestureImageView.java

@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){ if (drawable != null) { int orientation=getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_LANDSCAPE) { displayHeight=MeasureSpec.getSize(heightMeasureSpec); if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) { float ratio=(float)getImageWidth() / (float)getImageHeight(); displayWidth=Math.round((float)displayHeight * ratio); } else { displayWidth=MeasureSpec.getSize(widthMeasureSpec); } } else { displayWidth=MeasureSpec.getSize(widthMeasureSpec); if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { float ratio=(float)getImageHeight() / (float)getImageWidth(); displayHeight=Math.round((float)displayWidth * ratio); } else { displayHeight=MeasureSpec.getSize(heightMeasureSpec); } } } else { displayHeight=MeasureSpec.getSize(heightMeasureSpec); displayWidth=MeasureSpec.getSize(widthMeasureSpec); } setMeasuredDimension(displayWidth,displayHeight); }
Example 83
From project MyExpenses, under directory /src/org/example/qberticus/quickactions/.
Source file: BetterPopupWindow.java

private void preShow(){ if (this.root == null) { throw new IllegalStateException("setContentView was not called with a view to display."); } onShow(); if (this.background == null) { this.window.setBackgroundDrawable(new BitmapDrawable()); } else { this.window.setBackgroundDrawable(this.background); } this.window.setWidth(WindowManager.LayoutParams.WRAP_CONTENT); this.window.setHeight(WindowManager.LayoutParams.WRAP_CONTENT); this.window.setTouchable(true); this.window.setFocusable(true); this.window.setOutsideTouchable(true); this.window.setContentView(this.root); }
Example 84
From project npr-android-app, under directory /src/org/npr/android/news/.
Source file: PlayerActivity.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setVolumeControlStream(AudioManager.STREAM_MUSIC); setContentView(R.layout.main); titleText=(TextView)findViewById(R.id.LogoNavText); titleText.setText(getMainTitle()); listenView=new ListenView(this); ((ViewGroup)findViewById(R.id.MediaPlayer)).addView(listenView,new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); }
Example 85
From project Ohmage_Phone, under directory /src/org/ohmage/feedback/visualization/.
Source file: BalloonItemizedOverlay.java

@Override public final boolean onTap(int index){ boolean isRecycled; final int thisIndex; GeoPoint point; thisIndex=index; point=createItem(index).getPoint(); if (balloonView == null) { balloonView=new BalloonOverlayView(mapView.getContext(),viewOffset); clickRegion=(View)balloonView.findViewById(R.id.balloon_inner_layout); isRecycled=false; } else { isRecycled=true; } balloonView.setVisibility(View.GONE); List<Overlay> mapOverlays=mapView.getOverlays(); if (mapOverlays.size() > 1) { hideOtherBalloons(mapOverlays); } balloonView.setData(createItem(index)); MapView.LayoutParams params=new MapView.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,point,MapView.LayoutParams.BOTTOM_CENTER); params.mode=MapView.LayoutParams.MODE_MAP; setBalloonTouchListener(thisIndex); balloonView.setVisibility(View.VISIBLE); if (isRecycled) { balloonView.setLayoutParams(params); } else { mapView.addView(balloonView,params); } mc.animateTo(point); return true; }
Example 86
From project onebusaway-android, under directory /src/com/joulespersecond/seattlebusbot/map/.
Source file: BaseMapActivity.java

private MapView createMap(View view){ MapView map=new MapView(this,getString(API_KEY)); map.setBuiltInZoomControls(false); map.setClickable(true); map.setFocusableInTouchMode(true); RelativeLayout mainLayout=(RelativeLayout)view.findViewById(R.id.mainlayout); RelativeLayout.LayoutParams lp=new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT); mainLayout.addView(map,0,lp); return map; }
Example 87
From project OpenBike, under directory /src/fr/openbike/android/ui/.
Source file: BalloonItemizedOverlay.java

@Override public final boolean onTap(int index){ currentFocussedIndex=index; currentFocussedItem=createItem(index); boolean isRecycled; if (balloonView == null) { balloonView=createBalloonOverlayView(); clickRegion=(View)balloonView.findViewById(R.id.balloon_main_layout); clickRegion.setOnTouchListener(createBalloonTouchListener()); isRecycled=false; } else { isRecycled=true; } balloonView.setVisibility(View.GONE); List<Overlay> mapOverlays=mapView.getOverlays(); if (mapOverlays.size() > 1) { } balloonView.setData(currentFocussedItem,mLocation); GeoPoint point=currentFocussedItem.getPoint(); MapView.LayoutParams params=new MapView.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,point,MapView.LayoutParams.BOTTOM_CENTER); params.mode=MapView.LayoutParams.MODE_MAP; balloonView.setVisibility(View.VISIBLE); if (isRecycled) { balloonView.setLayoutParams(params); balloonView.measure(View.MeasureSpec.EXACTLY,View.MeasureSpec.EXACTLY); } else { mapView.addView(balloonView,params); setFocus(currentFocussedItem); } mc.animateTo(point); return true; }
Example 88
From project packages_apps_Calendar, under directory /src/com/android/calendar/.
Source file: DayFragment.java

public View makeView(){ mTZUpdater.run(); DayView view=new DayView(getActivity(),CalendarController.getInstance(getActivity()),mViewSwitcher,mEventLoader,mNumDays); view.setId(VIEW_ID); view.setLayoutParams(new ViewSwitcher.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); view.setSelected(mSelectedDay,false,false); return view; }
Example 89
From project PartyWare, under directory /android/src/edu/stanford/junction/sample/partyware/.
Source file: ContactsAutoCompleteCursorAdapter.java

@Override public View newView(Context context,Cursor cursor,ViewGroup parent){ final LinearLayout ret=new LinearLayout(context); final LayoutInflater inflater=LayoutInflater.from(context); mName=(TextView)inflater.inflate(android.R.layout.simple_dropdown_item_1line,parent,false); ret.setOrientation(LinearLayout.VERTICAL); LinearLayout horizontal=new LinearLayout(context); horizontal.setOrientation(LinearLayout.HORIZONTAL); ImageView icon=new ImageView(context); int nameIdx=cursor.getColumnIndexOrThrow(Contacts.DISPLAY_NAME); String name=cursor.getString(nameIdx); mName.setText(name); horizontal.addView(icon,new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); ret.addView(mName,new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); ret.addView(horizontal,new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); return ret; }
Example 90
From project PinyinIME, under directory /src/com/android/inputmethod/pinyin/.
Source file: ComposingView.java

/** * Set the composing string to show. If the IME status is {@link PinyinIME.ImeState#STATE_INPUT}, the composing view's status will be set to {@link ComposingStatus#SHOW_PINYIN}, otherwise the composing view will set its status to {@link ComposingStatus#SHOW_STRING_LOWERCASE}or {@link ComposingStatus#EDIT_PINYIN} automatically. */ public void setDecodingInfo(PinyinIME.DecodingInfo decInfo,PinyinIME.ImeState imeStatus){ mDecInfo=decInfo; if (PinyinIME.ImeState.STATE_INPUT == imeStatus) { mComposingStatus=ComposingStatus.SHOW_PINYIN; mDecInfo.moveCursorToEdge(false); } else { if (decInfo.getFixedLen() != 0 || ComposingStatus.EDIT_PINYIN == mComposingStatus) { mComposingStatus=ComposingStatus.EDIT_PINYIN; } else { mComposingStatus=ComposingStatus.SHOW_STRING_LOWERCASE; } mDecInfo.moveCursor(0); } measure(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); requestLayout(); invalidate(); }
Example 91
From project platform_packages_apps_calendar, under directory /src/com/android/calendar/.
Source file: DayFragment.java

public View makeView(){ mTZUpdater.run(); DayView view=new DayView(getActivity(),CalendarController.getInstance(getActivity()),mViewSwitcher,mEventLoader,mNumDays); view.setId(VIEW_ID); view.setLayoutParams(new ViewSwitcher.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); view.setSelected(mSelectedDay,false,false); return view; }
Example 92
From project Playlist, under directory /src/edu/stanford/junction/sample/partyware/playlist/.
Source file: ContactsAutoCompleteCursorAdapter.java

@Override public View newView(Context context,Cursor cursor,ViewGroup parent){ final LinearLayout ret=new LinearLayout(context); final LayoutInflater inflater=LayoutInflater.from(context); mName=(TextView)inflater.inflate(android.R.layout.simple_dropdown_item_1line,parent,false); ret.setOrientation(LinearLayout.VERTICAL); LinearLayout horizontal=new LinearLayout(context); horizontal.setOrientation(LinearLayout.HORIZONTAL); ImageView icon=new ImageView(context); int nameIdx=cursor.getColumnIndexOrThrow(Contacts.DISPLAY_NAME); String name=cursor.getString(nameIdx); mName.setText(name); horizontal.addView(icon,new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); ret.addView(mName,new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); ret.addView(horizontal,new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); return ret; }