Java Code Examples for android.util.AttributeSet

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 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/view/.

Source file: MenuInflater.java

  17 
vote

/** 
 * Inflate a menu hierarchy from the specified XML resource. Throws {@link InflateException} if there is an error.
 * @param menuRes Resource ID for an XML layout resource to load (e.g.,<code>R.menu.main_activity</code>)
 * @param menu The Menu to inflate into. The items and submenus will beadded to this Menu.
 */
public void inflate(int menuRes,Menu menu){
  XmlResourceParser parser=null;
  try {
    parser=mContext.getResources().getLayout(menuRes);
    AttributeSet attrs=Xml.asAttributeSet(parser);
    parseMenu(parser,attrs,menu);
  }
 catch (  XmlPullParserException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
catch (  IOException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
 finally {
    if (parser != null)     parser.close();
  }
}
 

Example 2

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/view/.

Source file: MenuInflater.java

  17 
vote

/** 
 * Inflate a menu hierarchy from the specified XML resource. Throws {@link InflateException} if there is an error.
 * @param menuRes Resource ID for an XML layout resource to load (e.g.,<code>R.menu.main_activity</code>)
 * @param menu The Menu to inflate into. The items and submenus will beadded to this Menu.
 */
public void inflate(int menuRes,Menu menu){
  XmlResourceParser parser=null;
  try {
    parser=mContext.getResources().getLayout(menuRes);
    AttributeSet attrs=Xml.asAttributeSet(parser);
    parseMenu(parser,attrs,menu);
  }
 catch (  XmlPullParserException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
catch (  IOException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
 finally {
    if (parser != null)     parser.close();
  }
}
 

Example 3

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/view/.

Source file: MenuInflater.java

  17 
vote

/** 
 * Inflate a menu hierarchy from the specified XML resource. Throws {@link InflateException} if there is an error.
 * @param menuRes Resource ID for an XML layout resource to load (e.g.,<code>R.menu.main_activity</code>)
 * @param menu The Menu to inflate into. The items and submenus will beadded to this Menu.
 */
public void inflate(int menuRes,Menu menu){
  XmlResourceParser parser=null;
  try {
    parser=mContext.getResources().getLayout(menuRes);
    AttributeSet attrs=Xml.asAttributeSet(parser);
    parseMenu(parser,attrs,menu);
  }
 catch (  XmlPullParserException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
catch (  IOException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
 finally {
    if (parser != null)     parser.close();
  }
}
 

Example 4

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/view/.

Source file: MenuInflater.java

  17 
vote

/** 
 * Inflate a menu hierarchy from the specified XML resource. Throws {@link InflateException} if there is an error.
 * @param menuRes Resource ID for an XML layout resource to load (e.g.,<code>R.menu.main_activity</code>)
 * @param menu The Menu to inflate into. The items and submenus will beadded to this Menu.
 */
public void inflate(int menuRes,Menu menu){
  XmlResourceParser parser=null;
  try {
    parser=mContext.getResources().getLayout(menuRes);
    AttributeSet attrs=Xml.asAttributeSet(parser);
    parseMenu(parser,attrs,menu);
  }
 catch (  XmlPullParserException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
catch (  IOException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
 finally {
    if (parser != null)     parser.close();
  }
}
 

Example 5

From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/view/.

Source file: MenuInflater.java

  17 
vote

/** 
 * Inflate a menu hierarchy from the specified XML resource. Throws {@link InflateException} if there is an error.
 * @param menuRes Resource ID for an XML layout resource to load (e.g.,<code>R.menu.main_activity</code>)
 * @param menu The Menu to inflate into. The items and submenus will beadded to this Menu.
 */
public void inflate(int menuRes,Menu menu){
  XmlResourceParser parser=null;
  try {
    parser=mContext.getResources().getLayout(menuRes);
    AttributeSet attrs=Xml.asAttributeSet(parser);
    parseMenu(parser,attrs,menu);
  }
 catch (  XmlPullParserException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
catch (  IOException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
 finally {
    if (parser != null)     parser.close();
  }
}
 

Example 6

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/provider/.

Source file: BookStoreFactory.java

  17 
vote

private static void inflate(Context context,XmlResourceParser parser,HashMap<String,BooksStore> stores) throws IOException, XmlPullParserException {
  final AttributeSet attrs=Xml.asAttributeSet(parser);
  int type;
  while ((type=parser.next()) != START_TAG && type != END_DOCUMENT) {
  }
  if (type != START_TAG) {
    throw new InflateException(parser.getPositionDescription() + ": No start tag found!");
  }
  final String name=parser.getName();
  if (TAG_STORES.equals(name)) {
    parseStores(context,parser,attrs,stores);
  }
 else {
    throw new InflateException(parser.getPositionDescription() + ": The root tag must be " + TAG_STORES);
  }
}
 

Example 7

From project androidZenWriter, under directory /library/src/com/actionbarsherlock/view/.

Source file: MenuInflater.java

  17 
vote

/** 
 * Inflate a menu hierarchy from the specified XML resource. Throws {@link InflateException} if there is an error.
 * @param menuRes Resource ID for an XML layout resource to load (e.g.,<code>R.menu.main_activity</code>)
 * @param menu The Menu to inflate into. The items and submenus will beadded to this Menu.
 */
public void inflate(int menuRes,Menu menu){
  XmlResourceParser parser=null;
  try {
    parser=mContext.getResources().getLayout(menuRes);
    AttributeSet attrs=Xml.asAttributeSet(parser);
    parseMenu(parser,attrs,menu);
  }
 catch (  XmlPullParserException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
catch (  IOException e) {
    throw new InflateException("Error inflating menu XML",e);
  }
 finally {
    if (parser != null)     parser.close();
  }
}
 

Example 8

From project actionbar, under directory /actionbar-library/src/main/java/com/github/erd/actionbar/widget/.

Source file: Actionbar.java

  15 
vote

/** 
 * Class constructor.
 * @param context Current context.
 * @param attrs XML attributes.
 * @param style Style definition.
 */
public Actionbar(Context context,AttributeSet attrs,int style){
  super(context,attrs);
  final TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.Actionbar,style,0);
  data=a.getString(R.styleable.Actionbar_title);
  draw=a.getDrawable(R.styleable.Actionbar_logo);
  back=a.getDrawable(R.styleable.Actionbar_background);
  type=a.getInt(R.styleable.Actionbar_type,TYPE_STANDARD);
  back=a.getDrawable(R.styleable.Actionbar_background);
  a.recycle();
  setId(R.id.action_bar);
  View.inflate(context,R.layout.actionbar,this);
}
 

Example 9

From project adg-android, under directory /src/com/analysedesgeeks/android/view/.

Source file: EllipsizingTextView.java

  15 
vote

public EllipsizingTextView(final Context context,final AttributeSet attrs){
  super(context,attrs);
  if (maxLinesHolder == null) {
    maxLinesHolder=new MaxLinesHolder();
  }
}
 

Example 10

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: CommitNavigationView.java

  15 
vote

public CommitNavigationView(Context context,AttributeSet attrs){
  super(context,attrs);
  layoutInflater=LayoutInflater.from(context);
  layoutInflater.inflate(R.layout.commit_navigation_view,this);
  buttonGroups.put(PARENT,(ViewGroup)findViewById(R.id.commit_parent_navigation));
  buttonGroups.put(CHILD,(ViewGroup)findViewById(R.id.commit_child_navigation));
}
 

Example 11

From project Airports, under directory /src/com/nadmm/airports/views/.

Source file: ImageZoomView.java

  15 
vote

/** 
 * Constructor
 */
public ImageZoomView(Context context,AttributeSet attrs){
  super(context,attrs);
  mZoomControl=new DynamicZoomControl();
  mPinchZoomListener=new PinchZoomListener(getContext().getApplicationContext());
  mPinchZoomListener.setZoomControl(mZoomControl);
  setZoomState(mZoomControl.getZoomState());
  mZoomControl.setAspectQuotient(getAspectQuotient());
  resetZoomState();
  setOnTouchListener(mPinchZoomListener);
}
 

Example 12

From project aksunai, under directory /src/org/androidnerds/app/aksunai/preferences/.

Source file: AkRingtonePreference.java

  15 
vote

public AkRingtonePreference(Context context,AttributeSet attrs){
  super(context,attrs);
  Intent intent=((Activity)context).getIntent();
  mProviderId=intent.getLongExtra("providerId",-1);
  if (mProviderId < 0) {
    Log.e("Aksunai","RingtonePreference needs a provider id.");
  }
}
 

Example 13

From project and-bible, under directory /AndBible/src/net/bible/android/view/util/buttongrid/.

Source file: ButtonGrid.java

  15 
vote

public ButtonGrid(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  this.mContext=context;
  setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
  setStretchAllColumns(true);
}
 

Example 14

From project android-animation-backport, under directory /animation-backport/src/backports/animation/.

Source file: AccelerateInterpolator.java

  15 
vote

public AccelerateInterpolator(Context context,AttributeSet attrs){
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.AccelerateInterpolator);
  mFactor=a.getFloat(R.styleable.AccelerateInterpolator_factor,1.0f);
  mDoubleFactor=2 * mFactor;
  a.recycle();
}
 

Example 15

From project android-bankdroid, under directory /src/com/liato/bankdroid/lockpattern/.

Source file: LockPatternView.java

  15 
vote

public LockPatternView(Context context,AttributeSet attrs){
  super(context,attrs);
  vibe=(Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
  setClickable(true);
  mPathPaint.setAntiAlias(true);
  mPathPaint.setDither(true);
  mPathPaint.setColor(Color.WHITE);
  mPathPaint.setAlpha(128);
  mPathPaint.setStyle(Paint.Style.STROKE);
  mPathPaint.setStrokeJoin(Paint.Join.ROUND);
  mPathPaint.setStrokeCap(Paint.Cap.ROUND);
  mBitmapBtnDefault=getBitmapFor(R.drawable.btn_code_lock_default);
  mBitmapBtnTouched=getBitmapFor(R.drawable.btn_code_lock_touched);
  mBitmapCircleDefault=getBitmapFor(R.drawable.indicator_code_lock_point_area_default);
  mBitmapCircleGreen=getBitmapFor(R.drawable.indicator_code_lock_point_area_green);
  mBitmapCircleRed=getBitmapFor(R.drawable.indicator_code_lock_point_area_red);
  mBitmapArrowGreenUp=getBitmapFor(R.drawable.indicator_code_lock_drag_direction_green_up);
  mBitmapArrowRedUp=getBitmapFor(R.drawable.indicator_code_lock_drag_direction_red_up);
  mBitmapWidth=mBitmapBtnDefault.getWidth();
  mBitmapHeight=mBitmapBtnDefault.getHeight();
}
 

Example 16

From project android-client, under directory /xwiki-android-components/src/org/xwiki/android/components/classviewer/.

Source file: ClassViewer.java

  15 
vote

public ClassViewer(Context context,AttributeSet attrs,Class classobj){
  super(context,attrs);
  this.context=context;
  this.classObject=classobj;
  initClassEditor();
}
 

Example 17

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: AtmaListView.java

  15 
vote

public AtmaListView(Context context,AttributeSet attrs){
  super(context,attrs);
  mOrderBy=null;
  mFilter="";
  mFilterID=-1;
}
 

Example 18

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/views/.

Source file: CameraSurface.java

  15 
vote

public CameraSurface(Context context,AttributeSet attrs){
  super(context,attrs);
  this.mActivity=(Activity)context;
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.view_camerasurface,this);
  this.initializeScreenBrightness();
  this.mSurfaceView=(SurfaceView)this.findViewById(R.id.camera_preview);
  this.mSurfaceHolder=mSurfaceView.getHolder();
  this.mSurfaceHolder.addCallback(this);
  this.mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  this.startPreview();
}
 

Example 19

From project android-joedayz, under directory /Proyectos/GreenDroid/src/greendroid/widget/.

Source file: ActionBar.java

  15 
vote

public ActionBar(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  initActionBar();
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.ActionBar,defStyle,0);
  mTitle=a.getString(R.styleable.ActionBar_title);
  mDividerDrawable=a.getDrawable(R.styleable.ActionBar_dividerDrawable);
  mDividerWidth=a.getDimensionPixelSize(R.styleable.ActionBar_dividerWidth,-1);
  mHomeDrawable=a.getDrawable(R.styleable.ActionBar_homeDrawable);
  mMaxItemsCount=a.getInt(R.styleable.ActionBar_maxItems,3);
  if (mHomeDrawable == null) {
    mHomeDrawable=new ActionBarDrawable(context,R.drawable.gd_action_bar_home);
  }
  int layoutID;
  int type=a.getInteger(R.styleable.ActionBar_type,-1);
switch (type) {
case 2:
    mType=Type.Empty;
  layoutID=R.layout.gd_action_bar_empty;
break;
case 1:
mType=Type.Dashboard;
layoutID=R.layout.gd_action_bar_dashboard;
break;
case 0:
default :
mType=Type.Normal;
layoutID=R.layout.gd_action_bar_normal;
break;
}
mMerging=true;
LayoutInflater.from(context).inflate(layoutID,this);
mMerging=false;
a.recycle();
}
 

Example 20

From project android-ocr, under directory /android/src/edu/sfsu/cs/orange/ocr/.

Source file: ViewfinderView.java

  15 
vote

public ViewfinderView(Context context,AttributeSet attrs){
  super(context,attrs);
  paint=new Paint(Paint.ANTI_ALIAS_FLAG);
  Resources resources=getResources();
  maskColor=resources.getColor(R.color.viewfinder_mask);
  frameColor=resources.getColor(R.color.viewfinder_frame);
  cornerColor=resources.getColor(R.color.viewfinder_corners);
  previewFrame=new Rect();
  rect=new Rect();
}
 

Example 21

From project android-pulltorefresh, under directory /library/src/com/handmark/pulltorefresh/library/.

Source file: PullToRefreshBase.java

  15 
vote

@SuppressWarnings("deprecation") private void init(Context context,AttributeSet attrs){
  setOrientation(LinearLayout.VERTICAL);
  ViewConfiguration config=ViewConfiguration.get(context);
  mTouchSlop=config.getScaledTouchSlop();
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.PullToRefresh);
  if (a.hasValue(R.styleable.PullToRefresh_ptrMode)) {
    mMode=Mode.mapIntToMode(a.getInteger(R.styleable.PullToRefresh_ptrMode,0));
  }
  mRefreshableView=createRefreshableView(context,attrs);
  addRefreshableView(context,mRefreshableView);
  mHeaderLayout=createLoadingLayout(context,Mode.PULL_DOWN_TO_REFRESH,a);
  mFooterLayout=createLoadingLayout(context,Mode.PULL_UP_TO_REFRESH,a);
  if (a.hasValue(R.styleable.PullToRefresh_ptrHeaderBackground)) {
    Drawable background=a.getDrawable(R.styleable.PullToRefresh_ptrHeaderBackground);
    if (null != background) {
      setBackgroundDrawable(background);
    }
  }
  if (a.hasValue(R.styleable.PullToRefresh_ptrAdapterViewBackground)) {
    Drawable background=a.getDrawable(R.styleable.PullToRefresh_ptrAdapterViewBackground);
    if (null != background) {
      mRefreshableView.setBackgroundDrawable(background);
    }
  }
  if (a.hasValue(R.styleable.PullToRefresh_ptrOverScroll)) {
    mOverScrollEnabled=a.getBoolean(R.styleable.PullToRefresh_ptrOverScroll,true);
  }
  handleStyledAttributes(a);
  a.recycle();
  updateUIForMode();
}
 

Example 22

From project android-tether, under directory /android-misc-widgets/src/org/miscwidgets/widget/.

Source file: Panel.java

  15 
vote

public Panel(Context context,AttributeSet attrs){
  super(context,attrs);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.Panel);
  mDuration=a.getInteger(R.styleable.Panel_animationDuration,750);
  mPosition=a.getInteger(R.styleable.Panel_position,BOTTOM);
  mLinearFlying=a.getBoolean(R.styleable.Panel_linearFlying,false);
  mWeight=a.getFraction(R.styleable.Panel_weight,0,1,0.0f);
  if (mWeight < 0 || mWeight > 1) {
    mWeight=0.0f;
    Log.w(TAG,a.getPositionDescription() + ": weight must be > 0 and <= 1");
  }
  mOpenedHandle=a.getDrawable(R.styleable.Panel_openedHandle);
  mClosedHandle=a.getDrawable(R.styleable.Panel_closedHandle);
  RuntimeException e=null;
  mHandleId=a.getResourceId(R.styleable.Panel_handle,0);
  if (mHandleId == 0) {
    e=new IllegalArgumentException(a.getPositionDescription() + ": The handle attribute is required and must refer to a valid child.");
  }
  mContentId=a.getResourceId(R.styleable.Panel_content,0);
  if (mContentId == 0) {
    e=new IllegalArgumentException(a.getPositionDescription() + ": The content attribute is required and must refer to a valid child.");
  }
  a.recycle();
  if (e != null) {
    throw e;
  }
  mOrientation=(mPosition == TOP || mPosition == BOTTOM) ? VERTICAL : HORIZONTAL;
  setOrientation(mOrientation);
  mState=State.READY;
  mGestureListener=new PanelOnGestureListener();
  mGestureDetector=new GestureDetector(mGestureListener);
  mGestureDetector.setIsLongpressEnabled(false);
  setBaselineAligned(false);
}
 

Example 23

From project android-thaiime, under directory /latinime/src/com/android/inputmethod/deprecated/voice/.

Source file: SoundIndicator.java

  15 
vote

public SoundIndicator(Context context,AttributeSet attrs){
  super(context,attrs);
  mFrontDrawable=getDrawable();
  BitmapDrawable edgeDrawable=(BitmapDrawable)context.getResources().getDrawable(R.drawable.vs_popup_mic_edge);
  mEdgeBitmap=edgeDrawable.getBitmap();
  mEdgeBitmapOffset=mEdgeBitmap.getHeight() / 2;
  mDrawingBuffer=Bitmap.createBitmap(mFrontDrawable.getIntrinsicWidth(),mFrontDrawable.getIntrinsicHeight(),Config.ARGB_8888);
  mBufferCanvas=new Canvas(mDrawingBuffer);
  mClearPaint=new Paint();
  mClearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
  mMultPaint=new Paint();
  mMultPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
  mHandler=new Handler();
}
 

Example 24

From project android-viewflow, under directory /viewflow/src/org/taptwo/android/widget/.

Source file: CircleFlowIndicator.java

  15 
vote

/** 
 * The contructor used with an inflater
 * @param context
 * @param attrs
 */
public CircleFlowIndicator(Context context,AttributeSet attrs){
  super(context,attrs);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.CircleFlowIndicator);
  int activeType=a.getInt(R.styleable.CircleFlowIndicator_activeType,STYLE_FILL);
  int activeDefaultColor=0xFFFFFFFF;
  int activeColor=a.getColor(R.styleable.CircleFlowIndicator_activeColor,activeDefaultColor);
  int inactiveType=a.getInt(R.styleable.CircleFlowIndicator_inactiveType,STYLE_STROKE);
  int inactiveDefaultColor=0x44FFFFFF;
  int inactiveColor=a.getColor(R.styleable.CircleFlowIndicator_inactiveColor,inactiveDefaultColor);
  radius=a.getDimension(R.styleable.CircleFlowIndicator_radius,4.0f);
  fadeOutTime=a.getInt(R.styleable.CircleFlowIndicator_fadeOut,0);
  mCentered=a.getBoolean(R.styleable.CircleFlowIndicator_centered,false);
  initColors(activeColor,inactiveColor,activeType,inactiveType);
}
 

Example 25

From project android-voip-service, under directory /src/main/java/org/linphone/ui/.

Source file: ToggleImageButton.java

  15 
vote

public ToggleImageButton(Context context,AttributeSet attrs){
  super(context,attrs);
  stateChecked=getResources().getDrawable(attrs.getAttributeResourceValue(ns,"checked",-1));
  stateUnChecked=getResources().getDrawable(attrs.getAttributeResourceValue(ns,"unchecked",-1));
  setBackgroundColor(Color.TRANSPARENT);
  setOnClickListener(this);
  handleCheckChanged();
}
 

Example 26

From project android-wheel-datetime-picker, under directory /src/kankan/wheel/widget/.

Source file: DateTimeWheel.java

  15 
vote

public DateTimeWheel(Context context,AttributeSet attrs){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.date_time_wheel,this,true);
  final WheelView hours=(WheelView)findViewById(R.id.hour);
  NumericWheelAdapter hourAdapter=new NumericWheelAdapter(context,0,23,"%2d ?");
  hourAdapter.setItemResource(R.layout.wheel_text_item);
  hourAdapter.setItemTextResource(R.id.text);
  hours.setViewAdapter(hourAdapter);
  hours.setCyclic(true);
  final WheelView mins=(WheelView)findViewById(R.id.mins);
  NumericWheelAdapter minAdapter=new NumericWheelAdapter(context,0,59,"%02d ?");
  minAdapter.setItemResource(R.layout.wheel_text_item);
  minAdapter.setItemTextResource(R.id.text);
  mins.setViewAdapter(minAdapter);
  mins.setCyclic(true);
  mins.addChangingListener(new OnWheelChangedListener(){
    @Override public void onChanged(    WheelView wheel,    int oldValue,    int newValue){
      calendar.add(Calendar.MINUTE,newValue - oldValue);
      fireTimeChanged(calendar.getTimeInMillis());
    }
  }
);
  hours.setCurrentItem(calendar.get(Calendar.HOUR));
  mins.setCurrentItem(calendar.get(Calendar.MINUTE));
  final WheelView day=(WheelView)findViewById(R.id.day);
  day.setViewAdapter(new DayArrayAdapter(context,calendar));
  day.setCyclic(true);
}
 

Example 27

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: HostPreference.java

  15 
vote

public HostPreference(Context context,AttributeSet attrs){
  super(context,attrs);
  mContext=context;
  setDialogLayoutResource(R.layout.preference_host);
  setDialogTitle("Add new host");
  setDialogIcon(R.drawable.bubble_add);
}
 

Example 28

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/remotesandbox/ui/tablet/.

Source file: DashboardBoxLayout.java

  15 
vote

public DashboardBoxLayout(Context context,AttributeSet attrs){
  super(context,attrs);
  String service=Context.LAYOUT_INFLATER_SERVICE;
  LayoutInflater li=(LayoutInflater)getContext().getSystemService(service);
  li.inflate(R.layout.dashboard_box,this,true);
  final TextView title=(TextView)findViewById(R.id.dashboardbox_title);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.DashboardBoxLayout);
  CharSequence s=a.getString(R.styleable.DashboardBoxLayout_title);
  if (s != null) {
    title.setText(s);
  }
  final ImageView icon=(ImageView)findViewById(R.id.dashboardbox_icon);
  icon.setImageResource(a.getResourceId(R.styleable.DashboardBoxLayout_icon,R.drawable.ic_dashboard_movies));
  findViewById(R.id.dashboardbox_titlebar).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (mOnTitleClickListener != null) {
        mOnTitleClickListener.onClick(v);
      }
    }
  }
);
}
 

Example 29

From project Android_1, under directory /LeftNavBarExample/LeftNavBarLibrary/src/com/example/google/tv/leftnavbar/.

Source file: LeftNavView.java

  15 
vote

public LeftNavView(Context context,AttributeSet attrs){
  super(context,attrs);
  mVisibilityController=new VisibilityController(this);
  LayoutInflater.from(context).inflate(R.layout.left_nav,this,true);
  setOrientation(VERTICAL);
  mHome=new HomeDisplay(context,this,null).setVisible(false);
  mTabs=new TabDisplay(context,this,null).setVisible(false);
  mOptions=new OptionsDisplay(context,this,null).setVisible(false);
  mSpinner=new SpinnerDisplay(context,this,null).setVisible(false);
  Resources res=context.getResources();
  mWidthCollapsed=res.getDimensionPixelSize(R.dimen.left_nav_collapsed_width);
  mWidthExpanded=res.getDimensionPixelSize((R.dimen.left_nav_expanded_width));
  mApparentWidthCollapsed=res.getDimensionPixelSize(R.dimen.left_nav_collapsed_apparent_width);
  mApparentWidthExpanded=res.getDimensionPixelSize(R.dimen.left_nav_expanded_apparent_width);
  mAnimationDuration=res.getInteger(android.R.integer.config_shortAnimTime);
  mNavigationMode=ActionBar.NAVIGATION_MODE_STANDARD;
  setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
 

Example 30

From project android_7, under directory /src/org/immopoly/android/widget/.

Source file: ViewPager.java

  15 
vote

public LayoutParams(Context context,AttributeSet attrs){
  super(context,attrs);
  final TypedArray a=context.obtainStyledAttributes(attrs,LAYOUT_ATTRS);
  gravity=a.getInteger(0,Gravity.NO_GRAVITY);
  a.recycle();
}
 

Example 31

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/applications/.

Source file: LinearColorBar.java

  15 
vote

public LinearColorBar(Context context,AttributeSet attrs){
  super(context,attrs);
  setWillNotDraw(false);
  mPaint.setStyle(Paint.Style.FILL);
  mColorGradientPaint.setStyle(Paint.Style.FILL);
  mColorGradientPaint.setAntiAlias(true);
  mEdgeGradientPaint.setStyle(Paint.Style.STROKE);
  mLineWidth=getResources().getDisplayMetrics().densityDpi >= DisplayMetrics.DENSITY_HIGH ? 2 : 1;
  mEdgeGradientPaint.setStrokeWidth(mLineWidth);
  mEdgeGradientPaint.setAntiAlias(true);
}
 

Example 32

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/widgets/.

Source file: TouchInterceptor.java

  15 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 33

From project android_packages_apps_CMSettings, under directory /src/com/cyanogenmod/settings/widgets/.

Source file: TouchInterceptor.java

  15 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 34

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: BooleanListPreference.java

  15 
vote

public BooleanListPreference(Context context,AttributeSet attrs){
  super(context,attrs);
  CharSequence values[]=getEntryValues();
  if (values.length == 2) {
    boolean x=Boolean.valueOf(values[0].toString());
    boolean y=Boolean.valueOf(values[1].toString());
    if (x != y)     return;
  }
  throw new IllegalStateException("EntryValues should be boolean strings");
}
 

Example 35

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/photoeditor/actions/.

Source file: ColorSeekBar.java

  15 
vote

public ColorSeekBar(Context context,AttributeSet attrs){
  super(context,attrs);
  TypedArray a=getResources().obtainTypedArray(R.array.color_picker_colors);
  colors=new int[a.length()];
  for (int i=0; i < a.length(); i++) {
    colors[i]=a.getColor(i,0x000000);
  }
  a.recycle();
  setMax(colors.length - 1);
}