Java Code Examples for android.widget.RelativeLayout

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 Airports, under directory /src/com/nadmm/airports/aeronav/.

Source file: DtppActivity.java

  18 
vote

protected void showOtherCharts(LinearLayout layout){
  RelativeLayout item=(RelativeLayout)inflate(R.layout.grouped_detail_item);
  TextView tv=(TextView)item.findViewById(R.id.group_name);
  LinearLayout group=(LinearLayout)item.findViewById(R.id.group_details);
  tv.setText("Other");
  addChartRow(group,"","Airport Diagram Legend","legendAD.pdf","","",R.drawable.row_selector_top);
  addChartRow(group,"","Legends & General Information","frntmatter.pdf","","",R.drawable.row_selector_bottom);
  layout.addView(item,new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
}
 

Example 2

From project andlytics, under directory /src/com/github/andlyticsproject/chart/.

Source file: ChartTextSwitcher.java

  18 
vote

/** 
 * Sets the text of the text view that is currently showing.  This does not perform the animations.
 * @param text the new text to display
 */
public void setCurrentText(CharSequence text,Drawable image){
  RelativeLayout r=(RelativeLayout)getCurrentView();
  r=(RelativeLayout)r.getChildAt(0);
  ImageView i=(ImageView)r.getChildAt(0);
  if (image == null) {
    i.setVisibility(View.GONE);
  }
 else {
    i.setVisibility(View.VISIBLE);
    i.setImageDrawable(image);
  }
  TextView t=(TextView)r.getChildAt(1);
  t.setText(text);
}
 

Example 3

From project Android-automation, under directory /Tmts_Java/src/com/taobao/tmts/framework/.

Source file: Tmts.java

  18 
vote

/** 
 * Return a  {@link TmtsRelativeLayout} by the given name.
 * @param name String name of view id, the string after @+id/ defined in layout files.
 * @return {@link TmtsRelativeLayout} with the given name.
 * @throws Exception Exception
 */
TmtsRelativeLayout getTmtsRelativeLayout(String name) throws Exception {
  Log.i(LOG_TAG,"getTmtsRelativeLayout: " + name);
  RelativeLayout relativeLayout=(RelativeLayout)getView(name,RelativeLayout.class);
  printLog(relativeLayout,name,"getTmtsRelativeLayout");
  TmtsRelativeLayout tmtsRelativeLayout=new TmtsRelativeLayout(inst,relativeLayout);
  return tmtsRelativeLayout;
}
 

Example 4

From project androidquery, under directory /auth/com/androidquery/.

Source file: WebDialog.java

  18 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  RelativeLayout layout=new RelativeLayout(getContext());
  layout.setBackgroundColor(0xFFFFFFFF);
  setupWebView(layout);
  setupProgress(layout);
  FrameLayout.LayoutParams FILL=new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT);
  addContentView(layout,FILL);
}
 

Example 5

From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/activities/.

Source file: Friends.java

  18 
vote

private void initFromMessage(){
  setContentView(R.layout.friendlist);
  RelativeLayout beintooBar=(RelativeLayout)findViewById(R.id.beintoobarsmall);
  beintooBar.setBackgroundDrawable(new BDrawableGradient(0,(int)(ratio * 40),BDrawableGradient.LIGHT_GRAY_GRADIENT));
  TextView title=(TextView)findViewById(R.id.dialogTitle);
  title.setTextColor(Color.BLACK);
  title.setText(current.getContext().getString(R.string.friendSel));
  startLoading();
}
 

Example 6

From project connectbot, under directory /src/sk/vx/connectbot/.

Source file: ConsoleActivity.java

  18 
vote

/** 
 * Adds a new TerminalBridge to the current set of views in our ViewFlipper.
 * @param bridge TerminalBridge to add to our ViewFlipper
 * @return the child index of the new view in the ViewFlipper
 */
private int addNewTerminalView(TerminalBridge bridge){
  bridge.promptHelper.setHandler(promptHandler);
  RelativeLayout view=(RelativeLayout)inflater.inflate(R.layout.item_terminal,flip,false);
  TextView overlay=(TextView)view.findViewById(R.id.terminal_overlay);
  overlay.setText(bridge.host.getNickname());
  TerminalView terminal=new TerminalView(ConsoleActivity.this,bridge);
  terminal.setId(R.id.console_flip);
  view.addView(terminal,0);
synchronized (flip) {
    flip.addView(view);
    return flip.getChildCount() - 1;
  }
}
 

Example 7

From project danbo, under directory /src/us/donmai/danbooru/danbo/activity/.

Source file: SinglePostActivity.java

  18 
vote

@Override protected void onPostExecute(Void result){
  RelativeLayout rl=(RelativeLayout)findViewById(R.id.RelativeLayout01);
  rl.removeAllViews();
  ImageView postImage=new ImageView(SinglePostActivity.this);
  postImage.setImageBitmap(SinglePostActivity.this._postBitmap);
  rl.addView(postImage);
  try {
    _progress.dismiss();
  }
 catch (  Exception e) {
  }
}
 

Example 8

From project evodroid, under directory /src/com/sonorth/evodroid/.

Source file: ViewComments.java

  18 
vote

public void hideModerationBar(){
  AnimationSet set=new AnimationSet(true);
  Animation animation=new AlphaAnimation(1.0f,0.0f);
  animation.setDuration(500);
  set.addAnimation(animation);
  animation=new TranslateAnimation(Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,1.0f);
  animation.setDuration(500);
  set.addAnimation(animation);
  RelativeLayout moderationBar=(RelativeLayout)getActivity().findViewById(R.id.moderationBar);
  moderationBar.clearAnimation();
  moderationBar.startAnimation(set);
  moderationBar.setVisibility(View.INVISIBLE);
}
 

Example 9

From project finch, under directory /src/com/bourke/finch/fragments/.

Source file: BaseTimelineFragment.java

  18 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  Log.d(TAG,"onCreateView()");
  RelativeLayout layout=(RelativeLayout)inflater.inflate(R.layout.standard_list_fragment,container,false);
  initMainList(layout);
  return layout;
}
 

Example 10

From project gh4a, under directory /src/com/gh4a/fragment/.

Source file: PullRequestFragment.java

  18 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  BaseSherlockFragmentActivity activity=(BaseSherlockFragmentActivity)getSherlockActivity();
  RelativeLayout rlComment=(RelativeLayout)getView().findViewById(R.id.rl_comment);
  if (!activity.isAuthorized()) {
    rlComment.setVisibility(View.GONE);
  }
  getLoaderManager().initLoader(0,null,this);
  getLoaderManager().getLoader(0).forceLoad();
  getLoaderManager().initLoader(1,null,this);
}
 

Example 11

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/app/.

Source file: NotificationDisplay.java

  18 
vote

/** 
 * Initialization of the Activity after it is first created.  Must at least call  {@link android.app.Activity#setContentView setContentView()} todescribe what is to be displayed in the screen.
 */
@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  RelativeLayout container=new RelativeLayout(this);
  ImageButton button=new ImageButton(this);
  button.setImageResource(getIntent().getIntExtra("moodimg",0));
  button.setOnClickListener(this);
  RelativeLayout.LayoutParams lp=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
  lp.addRule(RelativeLayout.CENTER_IN_PARENT);
  container.addView(button,lp);
  setContentView(container);
}
 

Example 12

From project mediaphone, under directory /src/ac/robinson/mediaphone/provider/.

Source file: NarrativeAdapter.java

  18 
vote

public View newView(Context context,Cursor cursor,ViewGroup parent){
  final RelativeLayout view=(RelativeLayout)mInflater.inflate(R.layout.frame_browser,parent,false);
  NarrativeViewHolder holder=new NarrativeViewHolder();
  holder.frameList=(HorizontalListView)view.findViewById(R.id.narrative_list_view);
  view.setTag(holder);
  holder.frameList.setOnItemClickListener(mActivity.getFrameClickListener());
  holder.frameList.setOnItemLongClickListener(mActivity.getFrameLongClickListener());
  return view;
}
 

Example 13

From project mobilis, under directory /MobilisXHunt/MobilisXHunt_Android/src/de/tudresden/inf/rn/mobilis/android/xhunt/ui/.

Source file: SeekBarPreference.java

  18 
vote

@Override protected View onCreateView(ViewGroup parent){
  RelativeLayout layout=null;
  try {
    LayoutInflater mInflater=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    layout=(RelativeLayout)mInflater.inflate(R.layout.seek_bar_preference,parent,false);
  }
 catch (  Exception e) {
    Log.e(TAG,"Error creating seekbar preference",e);
  }
  return layout;
}
 

Example 14

From project Monetizing-Android-Demo-Project, under directory /src/com/adwhirl/.

Source file: AdWhirlLayout.java

  18 
vote

public void pushSubView(ViewGroup subView){
  RelativeLayout superView=superViewReference.get();
  if (superView == null) {
    return;
  }
  superView.removeAllViews();
  RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
  layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
  superView.addView(subView,layoutParams);
  Logger.d(AdWhirlUtil.ADWHIRL,"Added subview");
  this.activeRation=nextRation;
  countImpression();
}
 

Example 15

From project nantes-mobi-parkings, under directory /android/src/main/java/fr/ippon/android/opendata/android/.

Source file: AbstractParkingListFragment.java

  18 
vote

/** 
 * {@inheritDoc}
 */
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  Log.d(TAG,"onCreateView");
  RelativeLayout r=(RelativeLayout)inflater.inflate(R.layout.list,null);
  emptyText=(TextView)r.findViewById(android.R.id.empty);
  headerView=inflater.inflate(R.layout.items_parkings_header,null);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getActivity());
  prefs.registerOnSharedPreferenceChangeListener(spChanged);
  configureSearchField(r);
  locationDispatcher.addListener(locationListener);
  return r;
}
 

Example 16

From project OAK, under directory /oak-demos/src/oak/demo/.

Source file: ResizedTextViewActivity.java

  18 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.resized_textview_demo);
  RelativeLayout attr=(RelativeLayout)findViewById(R.id.attribution);
  attr.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      Intent i=new Intent(Intent.ACTION_VIEW);
      i.setData(Uri.parse("http://www.willowtreeapps.com"));
      startActivity(i);
    }
  }
);
}
 

Example 17

From project onebusaway-android, under directory /src/com/joulespersecond/seattlebusbot/map/.

Source file: BaseMapActivity.java

  18 
vote

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 18

From project Sage-Mobile-Calc, under directory /src/org/connectbot/.

Source file: ConsoleActivity.java

  18 
vote

/** 
 * Adds a new TerminalBridge to the current set of views in our ViewFlipper.
 * @param bridge TerminalBridge to add to our ViewFlipper
 * @return the child index of the new view in the ViewFlipper
 */
private int addNewTerminalView(TerminalBridge bridge){
  bridge.promptHelper.setHandler(promptHandler);
  RelativeLayout view=(RelativeLayout)inflater.inflate(R.layout.item_terminal,flip,false);
  TextView overlay=(TextView)view.findViewById(R.id.terminal_overlay);
  overlay.setText(bridge.host.getNickname());
  TerminalView terminal=new TerminalView(ConsoleActivity.this,bridge);
  terminal.setId(R.id.console_flip);
  view.addView(terminal,0);
synchronized (flip) {
    flip.addView(view);
    return flip.getChildCount() - 1;
  }
}
 

Example 19

From project Synodroid, under directory /src/com/bigpupdev/synodroid/adapter/.

Source file: FileDetailAdapter.java

  18 
vote

/** 
 * Return the view used for the item at position indexP. Always try to reuse an old view
 */
public View getView(int positionP,View convertViewP,ViewGroup parentP){
  TaskFile file=files.get(positionP);
  RelativeLayout view=null;
  if (convertViewP != null) {
    view=(RelativeLayout)convertViewP;
  }
 else {
    view=(RelativeLayout)inflater.inflate(R.layout.file_template,parentP,false);
  }
  bindData(view,file);
  return view;
}
 

Example 20

From project titanium_modules, under directory /beintoosdk/mobile/android/src/com/beintoo/activities/.

Source file: Friends.java

  18 
vote

private void initFromMessage(){
  setContentView(current.getContext().getResources().getIdentifier("friendlist","layout",current.getContext().getPackageName()));
  RelativeLayout beintooBar=(RelativeLayout)findViewById(current.getContext().getResources().getIdentifier("beintoobarsmall","id",current.getContext().getPackageName()));
  beintooBar.setBackgroundDrawable(new BDrawableGradient(0,(int)(ratio * 40),BDrawableGradient.LIGHT_GRAY_GRADIENT));
  TextView title=(TextView)findViewById(current.getContext().getResources().getIdentifier("dialogTitle","id",current.getContext().getPackageName()));
  title.setTextColor(Color.BLACK);
  title.setText(current.getContext().getString(current.getContext().getResources().getIdentifier("friendSel","string",current.getContext().getPackageName())));
  startLoading();
}
 

Example 21

From project actionbar, under directory /src/com/kamalan/widget/.

Source file: ActionBar.java

  17 
vote

public void init(){
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  RelativeLayout barView=(RelativeLayout)mInflater.inflate(R.layout.actionbar,null);
  addView(barView);
  mProgress=(ProgressBar)barView.findViewById(R.id.actionbar_progress);
  mTitleView=(TextView)barView.findViewById(R.id.actionbar_title);
  mImageView=(ImageView)barView.findViewById(R.id.actionbar_menu);
  mImageView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      actionbarClickedListener.eventOccured(v.getId());
    }
  }
);
  ibStage=(ImageButton)barView.findViewById(R.id.actionbar_stage);
  ibStage.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      actionbarClickedListener.eventOccured(v.getId());
    }
  }
);
}
 

Example 22

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

Source file: FrameLayoutCompatUtils.java

  17 
vote

public static ViewGroup getPlacer(ViewGroup container){
  if (NEEDS_FRAME_LAYOUT_HACK) {
    final ViewGroup placer=new RelativeLayout(container.getContext());
    container.addView(placer);
    return placer;
  }
 else {
    return container;
  }
}
 

Example 23

From project android_packages_apps_FileManager, under directory /src/org/openintents/filemanager/.

Source file: SaveAsActivity.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(new RelativeLayout(this));
  Intent receivedIntent=getIntent();
  if (receivedIntent != null) {
    Uri uri=receivedIntent.getData();
    source=uri;
    if (uri.getScheme().equals("file"))     processFile(uri);
 else     if (uri.getScheme().equals("content"))     processContent(uri);
  }
 else {
    Toast.makeText(this,R.string.saveas_no_file_picked,Toast.LENGTH_SHORT).show();
  }
}
 

Example 24

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/compat/.

Source file: FrameLayoutCompatUtils.java

  17 
vote

public static ViewGroup getPlacer(ViewGroup container){
  if (NEEDS_FRAME_LAYOUT_HACK) {
    final ViewGroup placer=new RelativeLayout(container.getContext());
    container.addView(placer);
    return placer;
  }
 else {
    return container;
  }
}
 

Example 25

From project Backyard-Brains-Android-App, under directory /src/com/backyardbrains/view/.

Source file: UIFactory.java

  17 
vote

public static void setupMsLineView(BackyardAndroidActivity context){
  ImageView msLineView=new ImageView(context);
  Bitmap bmp=BitmapFactory.decodeResource(context.getResources(),R.drawable.msline);
  int width=context.getWindowManager().getDefaultDisplay().getWidth() / 3;
  int height=2;
  Bitmap resizedbitmap=Bitmap.createScaledBitmap(bmp,width,height,false);
  msLineView.setImageBitmap(resizedbitmap);
  msLineView.setBackgroundColor(Color.BLACK);
  msLineView.setScaleType(ScaleType.CENTER);
  LayoutParams rl=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  rl.setMargins(0,0,0,20);
  rl.addRule(RelativeLayout.ABOVE,R.id.millisecondsView);
  rl.addRule(RelativeLayout.CENTER_HORIZONTAL);
  RelativeLayout parentLayout=(RelativeLayout)context.findViewById(R.id.parentLayout);
  parentLayout.addView(msLineView,rl);
}
 

Example 26

From project buzzwords, under directory /src/com/buzzwords/.

Source file: Turn.java

  17 
vote

/** 
 * OnTimeExpired defines what happens when the player's turn timer runs out
 */
protected void onTimeExpired(){
  if (BuzzWordsApplication.DEBUG) {
    Log.d(TAG,"onTimeExpired()");
  }
  mResultsDelay=new PauseTimer(1500){
    @Override public void onFinish(){
      Turn.this.onTurnEnd();
    }
    @Override public void onTick(){
    }
  }
;
  mResultsDelay.start();
  ImageView timerFill=(ImageView)this.findViewById(R.id.Turn_TimerFill);
  timerFill.setVisibility(View.INVISIBLE);
  RelativeLayout timerGroup=(RelativeLayout)this.findViewById(R.id.Turn_TimerBar);
  timerGroup.startAnimation(this.showTimerAnim(false));
  RelativeLayout buttonGroup=(RelativeLayout)this.findViewById(R.id.Turn_LowBar);
  buttonGroup.startAnimation(this.showButtonsAnim(false));
  if (!mMusicEnabled) {
    SoundManager sm=SoundManager.getInstance(this.getBaseContext());
    sm.playSound(SoundManager.Sound.GONG);
  }
  TextView timer=(TextView)this.findViewById(R.id.Turn_Timer);
  timer.setVisibility(View.INVISIBLE);
  this.setActiveCard();
  mViewFlipper.setVisibility(View.INVISIBLE);
  mBuzzerButton.setEnabled(false);
  mSkipButton.setEnabled(false);
  mNextButton.setEnabled(false);
  TextView timesUpView=(TextView)this.findViewById(R.id.Turn_TimesUp);
  timesUpView.setVisibility(View.VISIBLE);
}
 

Example 27

From project CineShowTime-Android, under directory /Libraries/CineShowTime/src/com/binomed/showtime/android/layout/view/.

Source file: AutoCompleteTextWithSpeech.java

  17 
vote

private void init(Context context,AttributeSet attrs){
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.view_auto_complete_with_speech,this);
  PackageManager pm=context.getPackageManager();
  List<ResolveInfo> activities=pm.queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),0);
  RelativeLayout layoutWithSpeech=(RelativeLayout)findViewById(R.id.layoutWithSpeech);
  AutoCompleteTextView autoCompleteTextWithSpeech=(AutoCompleteTextView)findViewById(R.id.searchWithSpeech);
  ImageButton btnSpeech=(ImageButton)findViewById(R.id.btnSpeech);
  AutoCompleteTextView autoCompleteTextWithoutSpeech=(AutoCompleteTextView)findViewById(R.id.searchWithoutSpeech);
  if (activities.size() == 0) {
    layoutWithSpeech.setVisibility(View.GONE);
    autoCompleteText=autoCompleteTextWithoutSpeech;
  }
 else {
    autoCompleteTextWithoutSpeech.setVisibility(View.GONE);
    autoCompleteText=autoCompleteTextWithSpeech;
    btnSpeech.setOnClickListener(this);
  }
  autoCompleteText.setOnEditorActionListener(this);
}
 

Example 28

From project Cloud-Shout, under directory /ckdgcloudshout-Android/src/com/cloudshout/.

Source file: Video.java

  17 
vote

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 29

From project cmsandroid, under directory /src/com/zia/freshdocs/widget/.

Source file: HostAdapter.java

  17 
vote

public void toggleProgress(View view,boolean active){
  RelativeLayout container=(RelativeLayout)view;
  int childIndex=container.indexOfChild(_hostProgressBar);
  if (active && childIndex == -1) {
    _hostProgressBar=new ProgressBar(getContext());
    _hostProgressBar.setIndeterminate(true);
    LayoutParams params=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    params.alignWithParent=true;
    params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    container.addView(_hostProgressBar,params);
  }
 else   if (!active && childIndex > -1) {
    container.removeView(_hostProgressBar);
  }
}
 

Example 30

From project Common-Sense-Net-2, under directory /RealFarm/src/com/commonsensenet/realfarm/.

Source file: AdviceActivity.java

  17 
vote

public void copyView(AggregateItem aggregate,View destination){
  destination.setBackgroundColor(Color.LTGRAY);
  TextView tw=(TextView)destination.findViewById(R.id.label_news);
  tw.setText(aggregate.getNewsText());
  tw.setBackgroundColor(Color.parseColor("#FFFFCC"));
  tw=(TextView)destination.findViewById(R.id.label_left);
  tw.setText(aggregate.getLeftText());
  RelativeLayout rl=(RelativeLayout)destination.findViewById(R.id.relative_layout_left);
  if (aggregate.getLeftBackground() != -1) {
    rl.setBackgroundResource(aggregate.getLeftBackground());
  }
 else {
    tw.setTextColor(Color.BLACK);
  }
  tw=(TextView)destination.findViewById(R.id.label_center);
  tw.setText(aggregate.getCenterText());
  rl=(RelativeLayout)destination.findViewById(R.id.relative_layout_center);
  if (aggregate.getCenterBackground() != -1)   rl.setBackgroundResource(aggregate.getCenterBackground());
 else {
    tw.setTextColor(Color.BLACK);
    if (!aggregate.getCenterText().equals("")) {
      rl.getLayoutParams().width=200;
      tw.setTextSize(20);
    }
 else {
      rl.getLayoutParams().width=20;
      rl=(RelativeLayout)destination.findViewById(R.id.relative_layout_right);
      rl.getLayoutParams().width=300;
    }
  }
  ImageView iw=(ImageView)destination.findViewById(R.id.image_center);
  if (aggregate.getCenterImage() != -1)   iw.setImageResource(aggregate.getCenterImage());
  tw=(TextView)destination.findViewById(R.id.label_right);
  tw.setText(aggregate.getRightText());
}
 

Example 31

From project droid-comic-viewer, under directory /src/net/robotmedia/acv/ui/settings/.

Source file: BrightnessPreference.java

  17 
vote

@Override protected View onCreateDialogView(){
  LayoutInflater inflater=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  RelativeLayout layout=(RelativeLayout)inflater.inflate(R.layout.brightness_preference,null);
  mSeekBar=(SeekBar)layout.findViewById(R.id.brightness_seekbar);
  mSeekBar.setOnSeekBarChangeListener(this);
  mCheckBox=(CheckBox)layout.findViewById(R.id.brightness_checkbox);
  mCheckBox.setOnCheckedChangeListener(this);
  if (shouldPersist()) {
    mValue=getPersistedInt(mDefault);
  }
  if (mValue < 0) {
    mCheckBox.setChecked(true);
    mSeekBar.setEnabled(false);
  }
 else {
    mCheckBox.setChecked(false);
    mSeekBar.setEnabled(true);
    mSeekBar.setProgress(mValue);
  }
  return layout;
}
 

Example 32

From project dungbeetle, under directory /src/edu/stanford/mobisocial/dungbeetle/ui/wizard/.

Source file: SetProfileInstructionsActivity.java

  17 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.wizard_base);
  RelativeLayout layout=(RelativeLayout)findViewById(R.id.content);
  LayoutInflater layoutInflater=(LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  layout.addView(layoutInflater.inflate(R.layout.wizard_set_profile,null,false),0);
  ((Button)findViewById(R.id.back_button)).setOnClickListener(new Button.OnClickListener(){
    @Override public void onClick(    View v){
      SetProfileInstructionsActivity.this.finish();
    }
  }
);
  ((Button)findViewById(R.id.next_button)).setOnClickListener(new Button.OnClickListener(){
    @Override public void onClick(    View v){
      Intent setProfile=new Intent(SetProfileInstructionsActivity.this,SetProfileActivity.class);
      SetProfileInstructionsActivity.this.startActivity(setProfile);
    }
  }
);
}
 

Example 33

From project FBReaderJ, under directory /src/org/geometerplus/android/fbreader/.

Source file: FBReader.java

  17 
vote

@Override public void onStart(){
  super.onStart();
  initPluginActions();
  final ZLAndroidLibrary zlibrary=(ZLAndroidLibrary)ZLibrary.Instance();
  final int fullScreenFlag=zlibrary.ShowStatusBarOption.getValue() ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN;
  if (fullScreenFlag != myFullScreenFlag) {
    finish();
    startActivity(new Intent(this,getClass()));
  }
  SetScreenOrientationAction.setOrientation(this,zlibrary.OrientationOption.getValue());
  final FBReaderApp fbReader=(FBReaderApp)FBReaderApp.Instance();
  final RelativeLayout root=(RelativeLayout)findViewById(R.id.root_view);
  ((PopupPanel)fbReader.getPopupById(TextSearchPopup.ID)).setPanelInfo(this,root);
  ((PopupPanel)fbReader.getPopupById(NavigationPopup.ID)).setPanelInfo(this,root);
  ((PopupPanel)fbReader.getPopupById(SelectionPopup.ID)).setPanelInfo(this,root);
}
 

Example 34

From project filemanager, under directory /FileManager/src/org/openintents/filemanager/.

Source file: SaveAsActivity.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(new RelativeLayout(this));
  Intent receivedIntent=getIntent();
  if (receivedIntent != null) {
    Uri uri=receivedIntent.getData();
    source=uri;
    if (uri.getScheme().equals("file"))     processFile(uri);
 else     if (uri.getScheme().equals("content"))     processContent(uri);
  }
 else {
    Toast.makeText(this,R.string.saveas_no_file_picked,Toast.LENGTH_SHORT).show();
  }
}
 

Example 35

From project ICS_LatinIME_QHD, under directory /java/src/com/android/inputmethod/compat/.

Source file: FrameLayoutCompatUtils.java

  17 
vote

public static ViewGroup getPlacer(ViewGroup container){
  if (NEEDS_FRAME_LAYOUT_HACK) {
    final ViewGroup placer=new RelativeLayout(container.getContext());
    container.addView(placer);
    return placer;
  }
 else {
    return container;
  }
}
 

Example 36

From project MIT-Mobile-for-Android, under directory /src/edu/mit/mitmobile2/.

Source file: TitleBar.java

  17 
vote

public TitleBar(final Context context,AttributeSet attributeSet){
  super(context,attributeSet);
  LayoutInflater inflator=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflator.inflate(R.layout.title_bar,this);
  mTextView=(TextView)findViewById(R.id.titleBarTV);
  mLeftArrow=findViewById(R.id.titleBarLeftArrow);
  mRightArrow=findViewById(R.id.titleBarRightArrow);
  mBackButton=findViewById(R.id.titleBarBackButton);
  mSubtitleLeftArrow=findViewById(R.id.titleBarSubtitleLeftArrow);
  mSubtitleRightArrow=findViewById(R.id.titleBarSubtitleRightArrow);
  mSubtitleTextView=(TextView)findViewById(R.id.titleBarSubtitleTV);
  mSubtitleTitleBar=findViewById(R.id.titleBarSubtitleBar);
  ImageView backgroundView=(ImageView)findViewById(R.id.titleBarBackgrooundIV);
  int height=backgroundView.getDrawable().getIntrinsicHeight();
  LayoutParams params=new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,height);
  RelativeLayout titleWrapper=(RelativeLayout)findViewById(R.id.titleWrapper);
  titleWrapper.setLayoutParams(params);
  String initialText=attributeSet.getAttributeValue("http://schemas.android.com/apk/res/android","text");
  if (initialText != null) {
    setTitle(initialText);
  }
  findViewById(R.id.titleBarHomeButton).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      MITNewsWidgetActivity.goHome(context);
    }
  }
);
}
 

Example 37

From project openpomo, under directory /src/it/unibz/pomodroid/.

Source file: TodoTodaySheet.java

  17 
vote

@Override public void onResume(){
  super.onResume();
  RelativeLayout arlGoToPomodoro=(RelativeLayout)findViewById(R.id.arlGoToPomodoro);
  arlGoToPomodoro.setVisibility(View.VISIBLE);
  Button abGoToPomodoro=(Button)findViewById(R.id.abGoToPomodoro);
  if (super.getUser().isUnderPomodoro()) {
    abGoToPomodoro.setEnabled(true);
  }
 else {
    abGoToPomodoro.setEnabled(false);
  }
  if (super.getUser().isQuickInsertActivity()) {
    RelativeLayout activityList=(RelativeLayout)findViewById(R.id.arlActivityList);
    RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(0,75,0,75);
    activityList.setLayoutParams(layoutParams);
    RelativeLayout quickActivityInsert=(RelativeLayout)findViewById(R.id.arlQuickInsertActivity);
    quickActivityInsert.setVisibility(View.VISIBLE);
  }
 else {
    RelativeLayout activityList=(RelativeLayout)findViewById(R.id.arlActivityList);
    RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(0,0,0,75);
    activityList.setLayoutParams(layoutParams);
    RelativeLayout quickActivityInsert=(RelativeLayout)findViewById(R.id.arlQuickInsertActivity);
    quickActivityInsert.setVisibility(View.GONE);
  }
}
 

Example 38

From project packages_apps_God_Mode, under directory /src/com/t3hh4xx0r/addons/alerts/.

Source file: OMFGBAlertsActivity.java

  17 
vote

/** 
 * 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 39

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/widget/.

Source file: PullToRefreshListView.java

  15 
vote

private void init(Context context){
  mFlipAnimation=new RotateAnimation(0,-180,RotateAnimation.RELATIVE_TO_SELF,0.5f,RotateAnimation.RELATIVE_TO_SELF,0.5f);
  mFlipAnimation.setInterpolator(new LinearInterpolator());
  mFlipAnimation.setDuration(250);
  mFlipAnimation.setFillAfter(true);
  mReverseFlipAnimation=new RotateAnimation(-180,0,RotateAnimation.RELATIVE_TO_SELF,0.5f,RotateAnimation.RELATIVE_TO_SELF,0.5f);
  mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
  mReverseFlipAnimation.setDuration(250);
  mReverseFlipAnimation.setFillAfter(true);
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mRefreshView=(RelativeLayout)mInflater.inflate(R.layout.pull_to_refresh_header,this,false);
  mRefreshViewText=(TextView)mRefreshView.findViewById(R.id.pull_to_refresh_text);
  mRefreshViewImage=(ImageView)mRefreshView.findViewById(R.id.pull_to_refresh_image);
  mRefreshViewProgress=(ProgressBar)mRefreshView.findViewById(R.id.pull_to_refresh_progress);
  mRefreshViewLastUpdated=(TextView)mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);
  mRefreshViewImage.setMinimumHeight(50);
  mRefreshView.setOnClickListener(new OnClickRefreshListener());
  mRefreshOriginalTopPadding=mRefreshView.getPaddingTop();
  mRefreshState=TAP_TO_REFRESH;
  addHeaderView(mRefreshView);
  super.setOnScrollListener(this);
  measureView(mRefreshView);
  mRefreshViewHeight=mRefreshView.getMeasuredHeight();
}
 

Example 40

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

Source file: GifFramesAdapter.java

  15 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  if (convertView == null)   convertView=this.mInflater.inflate(R.layout.view_frame_thumb,null);
  int desiredSize=convertView.getResources().getDimensionPixelSize(R.dimen.create_list_thumb_size);
  String imagePath=this.mImageIds.get(position);
  ImageView thumbImage=(ImageView)convertView.findViewById(R.id.img_item_icon);
  TextView itemTitle=(TextView)convertView.findViewById(R.id.tv_item_title);
  itemTitle.setText("" + (position + 1));
  int outWidth=desiredSize;
  int outHeight=desiredSize;
  thumbImage.setLayoutParams(new RelativeLayout.LayoutParams(outWidth,outHeight));
  convertView.setLayoutParams(new Gallery.LayoutParams(outWidth,outHeight));
  Bitmap bitmap=ImageHelper.getDesirableBitmap(imagePath,desiredSize);
  if (bitmap != null) {
    thumbImage.setImageBitmap(bitmap);
    if (bitmap.getHeight() > bitmap.getWidth()) {
      outWidth=(int)(desiredSize * ((float)bitmap.getWidth() / bitmap.getHeight()));
    }
 else {
      outHeight=(int)(desiredSize * ((float)bitmap.getHeight() / bitmap.getWidth()));
    }
    thumbImage.setLayoutParams(new RelativeLayout.LayoutParams(outWidth,outHeight));
    convertView.setLayoutParams(new Gallery.LayoutParams(outWidth,outHeight));
  }
  return convertView;
}
 

Example 41

From project android-pulltorefresh, under directory /pulltorefresh/src/com/markupartist/android/widget/.

Source file: PullToRefreshListView.java

  15 
vote

private void init(Context context){
  mFlipAnimation=new RotateAnimation(0,-180,RotateAnimation.RELATIVE_TO_SELF,0.5f,RotateAnimation.RELATIVE_TO_SELF,0.5f);
  mFlipAnimation.setInterpolator(new LinearInterpolator());
  mFlipAnimation.setDuration(250);
  mFlipAnimation.setFillAfter(true);
  mReverseFlipAnimation=new RotateAnimation(-180,0,RotateAnimation.RELATIVE_TO_SELF,0.5f,RotateAnimation.RELATIVE_TO_SELF,0.5f);
  mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
  mReverseFlipAnimation.setDuration(250);
  mReverseFlipAnimation.setFillAfter(true);
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mRefreshView=(RelativeLayout)mInflater.inflate(R.layout.pull_to_refresh_header,this,false);
  mRefreshViewText=(TextView)mRefreshView.findViewById(R.id.pull_to_refresh_text);
  mRefreshViewImage=(ImageView)mRefreshView.findViewById(R.id.pull_to_refresh_image);
  mRefreshViewProgress=(ProgressBar)mRefreshView.findViewById(R.id.pull_to_refresh_progress);
  mRefreshViewLastUpdated=(TextView)mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);
  mRefreshViewImage.setMinimumHeight(50);
  mRefreshView.setOnClickListener(new OnClickRefreshListener());
  mRefreshOriginalTopPadding=mRefreshView.getPaddingTop();
  mRefreshState=TAP_TO_REFRESH;
  addHeaderView(mRefreshView);
  super.setOnScrollListener(this);
  measureView(mRefreshView);
  mRefreshViewHeight=mRefreshView.getMeasuredHeight();
}
 

Example 42

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

Source file: ImmoscoutPlacesOverlay.java

  15 
vote

@Override protected boolean onTap(int index){
  if (bubble != null)   bubble.detach();
  if (tmpItems == null || index >= tmpItems.size()) {
    if (mMapFragment instanceof MapFragment)     ((MapFragment)mMapFragment).showCompass();
    return false;
  }
  final ClusterItem item=tmpItems.get(index);
  final RelativeLayout.LayoutParams relLayoutParams=new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,210);
  relLayoutParams.addRule(RelativeLayout.BELOW,R.id.header);
  bubble=new TeaserView(mMapFragment,mMapView,item.flats,isPortfolio);
  if (mMapFragment instanceof MapFragment)   ((MapFragment)mMapFragment).hideCompass();
  itemTapTime=System.currentTimeMillis();
  return true;
}
 

Example 43

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

Source file: ApnPreference.java

  15 
vote

@Override public View getView(View convertView,ViewGroup parent){
  View view=super.getView(convertView,parent);
  View widget=view.findViewById(R.id.apn_radiobutton);
  if ((widget != null) && widget instanceof RadioButton) {
    RadioButton rb=(RadioButton)widget;
    if (mSelectable) {
      rb.setOnCheckedChangeListener(this);
      boolean isChecked=getKey().equals(mSelectedKey);
      if (isChecked) {
        mCurrentChecked=rb;
        mSelectedKey=getKey();
      }
      mProtectFromCheckedChange=true;
      rb.setChecked(isChecked);
      mProtectFromCheckedChange=false;
    }
 else {
      rb.setVisibility(View.GONE);
    }
  }
  View textLayout=view.findViewById(R.id.text_layout);
  if ((textLayout != null) && textLayout instanceof RelativeLayout) {
    textLayout.setOnClickListener(this);
  }
  return view;
}
 

Example 44

From project Barcamp-Bangalore-Android-App, under directory /actionbar/src/com/markupartist/android/widget/.

Source file: ActionBar.java

  15 
vote

public ActionBar(Context context,AttributeSet attrs){
  super(context,attrs);
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mBarView=(RelativeLayout)mInflater.inflate(R.layout.actionbar,null);
  addView(mBarView);
  mLogoView=(ImageView)mBarView.findViewById(R.id.actionbar_home_logo);
  mHomeLayout=(RelativeLayout)mBarView.findViewById(R.id.actionbar_home_bg);
  mHomeBtn=(ImageButton)mBarView.findViewById(R.id.actionbar_home_btn);
  mBackIndicator=mBarView.findViewById(R.id.actionbar_home_is_back);
  mTitleView=(TextView)mBarView.findViewById(R.id.actionbar_title);
  mActionsView=(LinearLayout)mBarView.findViewById(R.id.actionbar_actions);
  mProgress=(ProgressBar)mBarView.findViewById(R.id.actionbar_progress);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.ActionBar);
  CharSequence title=a.getString(R.styleable.ActionBar_title);
  if (title != null) {
    setTitle(title);
  }
  a.recycle();
}
 

Example 45

From project BF3-Battlelog, under directory /src/com/ninetwozero/battlelog/activity/forum/.

Source file: ForumSavedActivity.java

  15 
vote

@Override public boolean onContextItemSelected(MenuItem item){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
  }
 catch (  ClassCastException e) {
    e.printStackTrace();
    return false;
  }
  SavedForumThreadData thread=(SavedForumThreadData)info.targetView.getTag();
  if (item.getItemId() == 0) {
    new AsyncUpdate(this).execute(thread);
    startActivity(new Intent(this,ForumActivity.class).putExtra("savedThread",thread));
  }
 else   if (item.getItemId() == 1) {
    new AsyncRefresh(this,(RelativeLayout)info.targetView).execute(thread);
  }
 else   if (item.getItemId() == 2) {
    new AsyncSavedThreadDelete(this).execute(thread);
  }
  return true;
}
 

Example 46

From project com.juick.android, under directory /src/com/juick/android/.

Source file: MessagesFragment.java

  15 
vote

@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  LayoutInflater li=(LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  viewLoading=li.inflate(R.layout.listitem_loading,null);
  mRefreshView=(RelativeLayout)li.inflate(R.layout.pull_to_refresh_header,null);
  mRefreshViewText=(TextView)mRefreshView.findViewById(R.id.pull_to_refresh_text);
  mRefreshViewImage=(ImageView)mRefreshView.findViewById(R.id.pull_to_refresh_image);
  mRefreshViewProgress=(ProgressBar)mRefreshView.findViewById(R.id.pull_to_refresh_progress);
  mRefreshViewImage.setMinimumHeight(50);
  mRefreshView.setOnClickListener(this);
  mRefreshOriginalTopPadding=mRefreshView.getPaddingTop();
  mRefreshState=TAP_TO_REFRESH;
  getListView().setOnTouchListener(this);
  getListView().setOnScrollListener(this);
  getListView().setOnItemClickListener(this);
  getListView().setOnItemLongClickListener(new JuickMessageMenu(getActivity()));
  listAdapter=new JuickMessagesAdapter(getActivity(),0);
  init();
}
 

Example 47

From project creamed_glacier_app_settings, under directory /src/com/android/settings/.

Source file: ApnPreference.java

  15 
vote

@Override public View getView(View convertView,ViewGroup parent){
  View view=super.getView(convertView,parent);
  View widget=view.findViewById(R.id.apn_radiobutton);
  if ((widget != null) && widget instanceof RadioButton) {
    RadioButton rb=(RadioButton)widget;
    if (mSelectable) {
      rb.setOnCheckedChangeListener(this);
      boolean isChecked=getKey().equals(mSelectedKey);
      if (isChecked) {
        mCurrentChecked=rb;
        mSelectedKey=getKey();
      }
      mProtectFromCheckedChange=true;
      rb.setChecked(isChecked);
      mProtectFromCheckedChange=false;
    }
 else {
      rb.setVisibility(View.GONE);
    }
  }
  View textLayout=view.findViewById(R.id.text_layout);
  if ((textLayout != null) && textLayout instanceof RelativeLayout) {
    textLayout.setOnClickListener(this);
  }
  return view;
}
 

Example 48

From project cw-advandroid, under directory /Maps/EvenNooerYawk/src/com/commonsware/android/nooer/.

Source file: NooYawk.java

  15 
vote

void show(boolean alignTop){
  RelativeLayout.LayoutParams lp=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
  if (alignTop) {
    lp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    lp.setMargins(0,20,0,0);
  }
 else {
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.setMargins(0,0,0,60);
  }
  hide();
  ((ViewGroup)map.getParent()).addView(popup,lp);
  isVisible=true;
}
 

Example 49

From project cw-omnibus, under directory /Maps/EvenNooerYawk/src/com/commonsware/android/nooer/.

Source file: NooYawk.java

  15 
vote

void show(boolean alignTop){
  RelativeLayout.LayoutParams lp=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
  if (alignTop) {
    lp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    lp.setMargins(0,20,0,0);
  }
 else {
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.setMargins(0,0,0,60);
  }
  hide();
  ((ViewGroup)map.getParent()).addView(popup,lp);
  isVisible=true;
}
 

Example 50

From project danbooru-gallery-android, under directory /src/tw/idv/palatis/danboorugallery/.

Source file: ViewImageActivity.java

  15 
vote

public void init(ViewImageActivity a){
  activity=a;
  image=(ImageViewTouch)activity.findViewById(R.id.view_image_image);
  progress_indicator=(RelativeLayout)activity.findViewById(R.id.view_image_progress_indicator);
  progress_message=(TextView)activity.findViewById(R.id.view_image_progress_message);
  progress_progressbar=(ProgressBar)activity.findViewById(R.id.view_image_progress_progressbar);
}
 

Example 51

From project dcnyc10-android, under directory /android/src/com/lullabot/android/apps/iosched/ui/.

Source file: TracksAdapter.java

  15 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  if (mHasAllItem && position == 0) {
    if (convertView == null) {
      convertView=mActivity.getLayoutInflater().inflate(R.layout.list_item_track,parent,false);
    }
    ((TextView)convertView.findViewById(android.R.id.text1)).setText(mActivity.getResources().getString(mIsSessions ? R.string.all_sessions_title : R.string.all_sandbox_title));
    convertView.findViewById(android.R.id.icon1).setVisibility(View.VISIBLE);
    RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.RIGHT_OF,android.R.id.icon1);
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    convertView.findViewById(android.R.id.text1).setLayoutParams(params);
    return convertView;
  }
  return super.getView(position - mPositionDisplacement,convertView,parent);
}
 

Example 52

From project DownloadProvider, under directory /src/com/mozillaonline/providers/downloads/ui/.

Source file: DateSortedDownloadAdapter.java

  15 
vote

@Override public View getChildView(int groupPosition,int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  if (null == convertView || !(convertView instanceof RelativeLayout)) {
    convertView=mDelegate.newView();
  }
  if (!moveCursorToChildPosition(groupPosition,childPosition)) {
    return convertView;
  }
  mDelegate.bindView(convertView);
  return convertView;
}
 

Example 53

From project fauxclock, under directory /src/com/teamkang/fauxclock/factories/.

Source file: GpuFactory.java

  15 
vote

public void createGpuView(){
  LayoutInflater inf=LayoutInflater.from(mContext);
  me=inf.inflate(R.layout.gpu_control,null);
  gpuLayout=(RelativeLayout)me.findViewById(R.id.gpuControl);
  gpuGovSpinner=(Spinner)me.findViewById(R.id.gpu_gov_spinner);
  gpuIOFracSeek=(SeekBar)me.findViewById(R.id.seekbar_gpu_io_frac);
  gpuIOFracValue=(TextView)me.findViewById(R.id.gpu_io_frac_value);
  if (PhoneManager.supportsGpu()) {
    gpu=new GpuController(mContext);
    ArrayAdapter<String> gpuGovSpinnerAdapter=new ArrayAdapter<String>(mContext,android.R.layout.simple_spinner_item,gpu.govs);
    gpuGovSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    gpuGovSpinner.setAdapter(gpuGovSpinnerAdapter);
    gpuGovSpinner.setSelection(gpuGovSpinnerAdapter.getPosition(gpu.getCurrentActiveGov()));
    gpuGovSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
      public void onItemSelected(      AdapterView<?> parent,      View view,      int position,      long id){
        String selectedGov=(String)parent.getSelectedItem();
        gpu.setGpuGoverner(selectedGov);
      }
      public void onNothingSelected(      AdapterView<?> parent){
      }
    }
);
    gpuIOFracSeek.setMax(100);
    gpuIOFracSeek.setProgress(gpu.getGpuIOFraction());
    gpuIOFracSeek.setOnSeekBarChangeListener(this);
    gpuIOFracValue.setText(gpu.getGpuIOFraction() + "");
  }
 else {
    gpuLayout.setVisibility(View.GONE);
    gpuGovSpinner.setVisibility(View.GONE);
    gpuIOFracSeek.setVisibility(View.GONE);
    gpuIOFracValue.setVisibility(View.GONE);
  }
  tabTitle=(TextView)me.findViewById(R.id.tab_title);
  tabTitle.setText("GPU Control");
}
 

Example 54

From project flexymind-alpha, under directory /src/com/flexymind/alpha/.

Source file: StartGameScreen.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.start);
  StaticResources.res=getResources();
  startScreen=(RelativeLayout)findViewById(R.id.startScreen);
  startButton=(StartButton)findViewById(R.id.startbutton);
  startButton.setOnClickListener(this);
  settingsButton=new ImageButton(this);
  settingsButton.setId(SETTINGS_BUTTON);
  startScreen.addView(settingsButton);
  settingsButton.setOnClickListener(this);
  setSettingsButtonSize();
}
 

Example 55

From project FlipDroid, under directory /app/src/com/goal98/flipdroid2/view/.

Source file: FirstPageViewContainer.java

  15 
vote

protected void setDynamicLayout(Context context){
  LayoutInflater inflater=LayoutInflater.from(this.getContext());
  this.frame=(RelativeLayout)inflater.inflate(R.layout.first_page_view_no_tip,null);
  TextView textView=(TextView)this.frame.findViewById(R.id.sourceName);
  textView.setText(sourceName);
  imageView=(WebImageView)this.frame.findViewById(R.id.portrait);
  imageView.setImageUrl(sourceImageURL);
  this.addView(frame,new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
}
 

Example 56

From project galaxyCar, under directory /galaxyCar/src/org/psywerx/car/.

Source file: GalaxyCarActivity.java

  15 
vote

/** 
 * Switches from full screen opengl/graph views to the normal "all in one" view
 */
private void toNormalView(){
  D.dbgv("switching to normal view");
switch (mViewMode) {
case 1:
    mGlViewLayout.removeView(mGlView);
  mNormalViewLayout.addView(mGlView);
findViewById(R.id.backGroundOkvir).bringToFront();
findViewById(R.id.expandGlButton).bringToFront();
findViewById(R.id.expandGraphButton).bringToFront();
findViewById(R.id.alphaBar).bringToFront();
findViewById(R.id.averageButton).bringToFront();
mPospeskiView.bringToFront();
mNormalViewLayout.setVisibility(View.VISIBLE);
mGlViewLayout.setVisibility(View.INVISIBLE);
RelativeLayout.LayoutParams l=new RelativeLayout.LayoutParams(720,400);
l.setMargins(530,40,0,0);
mGlView.setLayoutParams(l);
break;
case 2:
mNormalViewLayout.setVisibility(View.VISIBLE);
mGlViewLayout.setVisibility(View.INVISIBLE);
break;
}
mGraphViewLayout.setVisibility(View.INVISIBLE);
mViewMode=0;
}
 

Example 57

From project keepassdroid, under directory /src/com/keepassdroid/view/.

Source file: FileNameView.java

  15 
vote

public void updateExternalStorageWarning(){
  int warning=-1;
  String state=Environment.getExternalStorageState();
  if (state.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
    warning=R.string.warning_read_only;
  }
 else   if (!state.equals(Environment.MEDIA_MOUNTED)) {
    warning=R.string.warning_unmounted;
  }
  TextView tv=(TextView)findViewById(R.id.label_warning);
  TextView label=(TextView)findViewById(R.id.label_open_by_filename);
  RelativeLayout.LayoutParams lp=new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
  if (warning != -1) {
    tv.setText(warning);
    tv.setVisibility(VISIBLE);
    lp.addRule(RelativeLayout.BELOW,R.id.label_warning);
  }
 else {
    tv.setVisibility(INVISIBLE);
  }
  label.setLayoutParams(lp);
}
 

Example 58

From project KeyboardTerm, under directory /src/tw/kenshinn/keyboardTerm/.

Source file: AddressBookActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  Log.i(TAG,"onCreate");
  super.onCreate(savedInstanceState);
  setContentView(R.layout.act_addressbook);
  ((TextView)findViewById(R.id.quickConnect)).setOnEditorActionListener(new OnEditorActionListener(){
    public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (event != null)       quickConnect();
      return false;
    }
  }
);
  findViewById(R.id.quickConnect_button).setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      quickConnect();
    }
  }
);
  String keyAdWhirl="c7bce28b019a4e8dbcf33091bce6b542";
  SharedPreferences adWhirlPrefs=this.getSharedPreferences(keyAdWhirl,Context.MODE_PRIVATE);
  String jsonString=adWhirlPrefs.getString("config",null);
  if (jsonString != null && jsonString.trim().equals("[]")) {
    SharedPreferences.Editor editor=adWhirlPrefs.edit();
    editor.remove("config");
    editor.commit();
  }
  AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);
  AdWhirlLayout adWhirlLayout=new AdWhirlLayout(this,keyAdWhirl);
  adonContainerView=(RelativeLayout)findViewById(R.id.ad);
  adonContainerView.addView(adWhirlLayout);
}
 

Example 59

From project LitHub, under directory /LitHub-Android/src/com/markupartist/android/widget/.

Source file: ActionBar.java

  15 
vote

public ActionBar(Context context,AttributeSet attrs){
  super(context,attrs);
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mBarView=(RelativeLayout)mInflater.inflate(R.layout.actionbar,null);
  addView(mBarView);
  mLogoView=(ImageView)mBarView.findViewById(R.id.actionbar_home_logo);
  mHomeLayout=(RelativeLayout)mBarView.findViewById(R.id.actionbar_home_bg);
  mHomeBtn=(ImageButton)mBarView.findViewById(R.id.actionbar_home_btn);
  mBackIndicator=mBarView.findViewById(R.id.actionbar_home_is_back);
  mTitleView=(TextView)mBarView.findViewById(R.id.actionbar_title);
  mActionsView=(LinearLayout)mBarView.findViewById(R.id.actionbar_actions);
  mProgress=(ProgressBar)mBarView.findViewById(R.id.actionbar_progress);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.ActionBar);
  CharSequence title=a.getString(R.styleable.ActionBar_title);
  if (title != null) {
    setTitle(title);
  }
  a.recycle();
}
 

Example 60

From project MyHeath-Android, under directory /src/com/buaa/shortytall/view/fragment/.

Source file: CheckFragment.java

  15 
vote

@Override protected void onInflated(){
  mHumanView=(ImageView)contentView.findViewById(R.id.human_page);
  mInflater=LayoutInflater.from(context);
  mBaseView=(RelativeLayout)contentView;
  loadData();
}
 

Example 61

From project nuxeo-android, under directory /nuxeo-android/src/org/nuxeo/android/simpleclient/docviews/.

Source file: DocumentViewActivity.java

  15 
vote

@Override public void onRetrieveDisplayObjects(){
  setContentView(R.layout.document_view_layout);
  layout=(RelativeLayout)findViewById(R.id.documentLayout);
  linearLayout=(LinearLayout)findViewById(R.id.linearDocumentLayout);
  title=(TextView)findViewById(R.id.title);
  pdfAction=(ImageButton)findViewById(R.id.pdfBtn);
  downloadAction=(ImageButton)findViewById(R.id.downloadBtn);
  historyAction=(ImageButton)findViewById(R.id.historyBtn);
  icon=(ImageView)findViewById(R.id.icon);
  addClipboardAction=(ImageButton)findViewById(R.id.clipboardAddBtn);
}
 

Example 62

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

Source file: FocusManager.java

  15 
vote

public boolean onTouch(MotionEvent e){
  if (!mInitialized || mState == STATE_FOCUSING_SNAP_ON_FINISH)   return false;
  if ((mFocusArea != null) && (mState == STATE_FOCUSING || mState == STATE_SUCCESS || mState == STATE_FAIL)) {
    cancelAutoFocus();
  }
  int x=Math.round(e.getX());
  int y=Math.round(e.getY());
  int focusWidth=mFocusIndicatorRotateLayout.getWidth();
  int focusHeight=mFocusIndicatorRotateLayout.getHeight();
  int previewWidth=mPreviewFrame.getWidth();
  int previewHeight=mPreviewFrame.getHeight();
  if (mFocusArea == null) {
    mFocusArea=new ArrayList<Area>();
    mFocusArea.add(new Area(new Rect(),1));
    mMeteringArea=new ArrayList<Area>();
    mMeteringArea.add(new Area(new Rect(),1));
  }
  calculateTapArea(focusWidth,focusHeight,1f,x,y,previewWidth,previewHeight,mFocusArea.get(0).rect);
  calculateTapArea(focusWidth,focusHeight,1.5f,x,y,previewWidth,previewHeight,mMeteringArea.get(0).rect);
  RelativeLayout.LayoutParams p=(RelativeLayout.LayoutParams)mFocusIndicatorRotateLayout.getLayoutParams();
  int left=Util.clamp(x - focusWidth / 2,0,previewWidth - focusWidth);
  int top=Util.clamp(y - focusHeight / 2,0,previewHeight - focusHeight);
  p.setMargins(left,top,0,0);
  int[] rules=p.getRules();
  rules[RelativeLayout.CENTER_IN_PARENT]=0;
  mFocusIndicatorRotateLayout.requestLayout();
  mListener.stopFaceDetection();
  mListener.setFocusParameters();
  if (mFocusAreaSupported && (e.getAction() == MotionEvent.ACTION_UP)) {
    autoFocus();
  }
 else {
    updateFocusUI();
    mHandler.removeMessages(RESET_TOUCH_FOCUS);
    mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS,RESET_TOUCH_FOCUS_DELAY);
  }
  return true;
}
 

Example 63

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

Source file: FocusManager.java

  15 
vote

public boolean onTouch(MotionEvent e){
  if (!mInitialized || mState == STATE_FOCUSING_SNAP_ON_FINISH)   return false;
  if ((mFocusArea != null) && (mState == STATE_FOCUSING || mState == STATE_SUCCESS || mState == STATE_FAIL)) {
    cancelAutoFocus();
  }
  int x=Math.round(e.getX());
  int y=Math.round(e.getY());
  int focusWidth=mFocusIndicatorRotateLayout.getWidth();
  int focusHeight=mFocusIndicatorRotateLayout.getHeight();
  int previewWidth=mPreviewFrame.getWidth();
  int previewHeight=mPreviewFrame.getHeight();
  if (mFocusArea == null) {
    mFocusArea=new ArrayList<Area>();
    mFocusArea.add(new Area(new Rect(),1));
    mMeteringArea=new ArrayList<Area>();
    mMeteringArea.add(new Area(new Rect(),1));
  }
  calculateTapArea(focusWidth,focusHeight,1f,x,y,previewWidth,previewHeight,mFocusArea.get(0).rect);
  calculateTapArea(focusWidth,focusHeight,1.5f,x,y,previewWidth,previewHeight,mMeteringArea.get(0).rect);
  RelativeLayout.LayoutParams p=(RelativeLayout.LayoutParams)mFocusIndicatorRotateLayout.getLayoutParams();
  int left=Util.clamp(x - focusWidth / 2,0,previewWidth - focusWidth);
  int top=Util.clamp(y - focusHeight / 2,0,previewHeight - focusHeight);
  p.setMargins(left,top,0,0);
  int[] rules=p.getRules();
  rules[RelativeLayout.CENTER_IN_PARENT]=0;
  mFocusIndicatorRotateLayout.requestLayout();
  mListener.stopFaceDetection();
  mListener.setFocusParameters();
  if (mFocusAreaSupported && (e.getAction() == MotionEvent.ACTION_UP)) {
    autoFocus();
  }
 else {
    updateFocusUI();
    mHandler.removeMessages(RESET_TOUCH_FOCUS);
    mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS,RESET_TOUCH_FOCUS_DELAY);
  }
  return true;
}
 

Example 64

From project PageTurner, under directory /src/main/java/yuku/ambilwarna/.

Source file: AmbilWarnaDialog.java

  15 
vote

protected void moveCursor(){
  float y=viewHue.getMeasuredHeight() - (getHue() * viewHue.getMeasuredHeight() / 360.f);
  if (y == viewHue.getMeasuredHeight())   y=0.f;
  RelativeLayout.LayoutParams layoutParams=(RelativeLayout.LayoutParams)viewCursor.getLayoutParams();
  layoutParams.leftMargin=(int)(viewHue.getLeft() - Math.floor(viewCursor.getMeasuredWidth() / 2) - viewContainer.getPaddingLeft());
  ;
  layoutParams.topMargin=(int)(viewHue.getTop() + y - Math.floor(viewCursor.getMeasuredHeight() / 2) - viewContainer.getPaddingTop());
  ;
  viewCursor.setLayoutParams(layoutParams);
}
 

Example 65

From project Pixelesque, under directory /src/com/rj/pixelesque/.

Source file: PixelArtEditor.java

  15 
vote

@Override public void onCreate(final Bundle savedinstance){
  setIsHorizontal(this);
  super.onCreate(savedinstance);
  figureOutOrientation();
  bbbar=(RelativeLayout)getLayoutInflater().inflate(com.rj.pixelesque.R.layout.buttonbar,null);
  this.setContentView(bbbar,new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
  buttonbar=(PixelArtStateView)bbbar.findViewById(com.rj.pixelesque.R.id.buttonbarz);
  ViewGroup g=(ViewGroup)bbbar.findViewById(com.rj.pixelesque.R.id.surfaceholder);
  g.addView(surfaceView);
}
 

Example 66

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

Source file: FocusManager.java

  15 
vote

public void onSingleTapUp(int x,int y){
  if (!mInitialized || mState == STATE_FOCUSING_SNAP_ON_FINISH)   return;
  if ((mFocusArea != null) && (mState == STATE_FOCUSING || mState == STATE_SUCCESS || mState == STATE_FAIL)) {
    cancelAutoFocus();
  }
  int focusWidth=mFocusIndicatorRotateLayout.getWidth();
  int focusHeight=mFocusIndicatorRotateLayout.getHeight();
  int previewWidth=mPreviewWidth;
  int previewHeight=mPreviewHeight;
  if (mFocusArea == null) {
    mFocusArea=new ArrayList<Area>();
    mFocusArea.add(new Area(new Rect(),1));
    mMeteringArea=new ArrayList<Area>();
    mMeteringArea.add(new Area(new Rect(),1));
  }
  calculateTapArea(focusWidth,focusHeight,1f,x,y,previewWidth,previewHeight,mFocusArea.get(0).rect);
  calculateTapArea(focusWidth,focusHeight,1.5f,x,y,previewWidth,previewHeight,mMeteringArea.get(0).rect);
  RelativeLayout.LayoutParams p=(RelativeLayout.LayoutParams)mFocusIndicatorRotateLayout.getLayoutParams();
  int left=Util.clamp(x - focusWidth / 2,0,previewWidth - focusWidth);
  int top=Util.clamp(y - focusHeight / 2,0,previewHeight - focusHeight);
  p.setMargins(left,top,0,0);
  int[] rules=p.getRules();
  rules[RelativeLayout.CENTER_IN_PARENT]=0;
  mFocusIndicatorRotateLayout.requestLayout();
  mListener.stopFaceDetection();
  mListener.setFocusParameters();
  if (mFocusAreaSupported) {
    autoFocus();
  }
 else {
    updateFocusUI();
    mHandler.removeMessages(RESET_TOUCH_FOCUS);
    mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS,RESET_TOUCH_FOCUS_DELAY);
  }
}
 

Example 67

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/quickcontact/.

Source file: QuickContactActivity.java

  15 
vote

@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  final RelativeLayout.LayoutParams layoutParams=(RelativeLayout.LayoutParams)mSelectedTabRectangle.getLayoutParams();
  final int width=mSelectedTabRectangle.getWidth();
  layoutParams.leftMargin=(int)((position + positionOffset) * width);
  mSelectedTabRectangle.setLayoutParams(layoutParams);
}
 

Example 68

From project platform_packages_apps_mms, under directory /src/com/android/mms/ui/.

Source file: ConversationListItem.java

  15 
vote

public final void bind(Context context,final Conversation conversation){
  mConversation=conversation;
  updateBackground();
  LayoutParams attachmentLayout=(LayoutParams)mAttachmentView.getLayoutParams();
  boolean hasError=conversation.hasError();
  if (hasError) {
    attachmentLayout.addRule(RelativeLayout.LEFT_OF,R.id.error);
  }
 else {
    attachmentLayout.addRule(RelativeLayout.LEFT_OF,R.id.date);
  }
  boolean hasAttachment=conversation.hasAttachment();
  mAttachmentView.setVisibility(hasAttachment ? VISIBLE : GONE);
  mDateView.setText(MessageUtils.formatTimeStampString(context,conversation.getDate()));
  mFromView.setText(formatMessage());
  ContactList contacts=conversation.getRecipients();
  if (Log.isLoggable(LogTag.CONTACT,Log.DEBUG)) {
    Log.v(TAG,"bind: contacts.addListeners " + this);
  }
  Contact.addListener(this);
  SmileyParser parser=SmileyParser.getInstance();
  mSubjectView.setText(parser.addSmileySpans(conversation.getSnippet()));
  LayoutParams subjectLayout=(LayoutParams)mSubjectView.getLayoutParams();
  subjectLayout.addRule(RelativeLayout.LEFT_OF,hasAttachment ? R.id.attachment : (hasError ? R.id.error : R.id.date));
  mErrorIndicator.setVisibility(hasError ? VISIBLE : GONE);
  updateAvatarView();
}
 

Example 69

From project platform_packages_apps_settings, under directory /src/com/android/settings/.

Source file: ApnPreference.java

  15 
vote

@Override public View getView(View convertView,ViewGroup parent){
  View view=super.getView(convertView,parent);
  View widget=view.findViewById(R.id.apn_radiobutton);
  if ((widget != null) && widget instanceof RadioButton) {
    RadioButton rb=(RadioButton)widget;
    if (mSelectable) {
      rb.setOnCheckedChangeListener(this);
      boolean isChecked=getKey().equals(mSelectedKey);
      if (isChecked) {
        mCurrentChecked=rb;
        mSelectedKey=getKey();
      }
      mProtectFromCheckedChange=true;
      rb.setChecked(isChecked);
      mProtectFromCheckedChange=false;
    }
 else {
      rb.setVisibility(View.GONE);
    }
  }
  View textLayout=view.findViewById(R.id.text_layout);
  if ((textLayout != null) && textLayout instanceof RelativeLayout) {
    textLayout.setOnClickListener(this);
  }
  return view;
}
 

Example 70

From project platform_packages_providers_downloadprovider, under directory /ui/src/com/android/providers/downloads/ui/.

Source file: DateSortedDownloadAdapter.java

  15 
vote

@Override public View getChildView(int groupPosition,int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  if (null == convertView || !(convertView instanceof RelativeLayout)) {
    convertView=mDelegate.newView();
  }
  if (!moveCursorToChildPosition(groupPosition,childPosition)) {
    return convertView;
  }
  int pos=mDownloadList.getExpandableListView().getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition,childPosition));
  mDelegate.bindView(convertView,pos);
  return convertView;
}
 

Example 71

From project QuotaForAndroid, under directory /android-actionbar/actionbar/src/com/markupartist/android/widget/.

Source file: ActionBar.java

  15 
vote

public ActionBar(Context context,AttributeSet attrs){
  super(context,attrs);
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mBarView=(RelativeLayout)mInflater.inflate(R.layout.actionbar,null);
  addView(mBarView);
  mLogoView=(ImageView)mBarView.findViewById(R.id.actionbar_home_logo);
  mHomeLayout=(RelativeLayout)mBarView.findViewById(R.id.actionbar_home_bg);
  mHomeBtn=(ImageButton)mBarView.findViewById(R.id.actionbar_home_btn);
  mBackIndicator=mBarView.findViewById(R.id.actionbar_home_is_back);
  mTitleView=(TextView)mBarView.findViewById(R.id.actionbar_title);
  mActionsView=(LinearLayout)mBarView.findViewById(R.id.actionbar_actions);
  mProgress=(ProgressBar)mBarView.findViewById(R.id.actionbar_progress);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.ActionBar);
  CharSequence title=a.getString(R.styleable.ActionBar_title);
  if (title != null) {
    setTitle(title);
  }
  a.recycle();
}
 

Example 72

From project Schedule, under directory /libs/android/SlideMenu/src/com/slidingmenu/lib/.

Source file: SlidingMenu.java

  15 
vote

/** 
 * @param i The margin on the right of the screen that the behind view scrolls to
 */
public void setBehindOffset(int i){
  RelativeLayout.LayoutParams params=((RelativeLayout.LayoutParams)mViewBehind.getLayoutParams());
  int bottom=params.bottomMargin;
  int top=params.topMargin;
  int left=params.leftMargin;
  params.setMargins(left,top,i,bottom);
}
 

Example 73

From project SchoolPlanner4Untis, under directory /src/edu/htl3r/schoolplanner/gui/timetable/baactionbar/.

Source file: BAAction.java

  15 
vote

public void setIcon(Drawable drawable){
  icon=new ImageView(getContext());
  icon.setImageDrawable(drawable);
  RelativeLayout.LayoutParams layout=new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
  layout.addRule(CENTER_VERTICAL);
  layout.addRule(CENTER_HORIZONTAL);
  addView(icon,layout);
}
 

Example 74

From project Something-Awful-Android, under directory /libraries/pulltorefresh/src/com/markupartist/android/widget/.

Source file: PullToRefreshListView.java

  15 
vote

private void init(Context context){
  mFlipAnimation=new RotateAnimation(0,180,RotateAnimation.RELATIVE_TO_SELF,0.5f,RotateAnimation.RELATIVE_TO_SELF,0.5f);
  mFlipAnimation.setInterpolator(new LinearInterpolator());
  mFlipAnimation.setDuration(250);
  mFlipAnimation.setFillAfter(true);
  mReverseFlipAnimation=new RotateAnimation(180,0,RotateAnimation.RELATIVE_TO_SELF,0.5f,RotateAnimation.RELATIVE_TO_SELF,0.5f);
  mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
  mReverseFlipAnimation.setDuration(250);
  mReverseFlipAnimation.setFillAfter(true);
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mRefreshView=(RelativeLayout)mInflater.inflate(R.layout.pull_to_refresh_header,this,false);
  mRefreshViewText=(TextView)mRefreshView.findViewById(R.id.pull_to_refresh_text);
  mRefreshViewImage=(ImageView)mRefreshView.findViewById(R.id.pull_to_refresh_image);
  mRefreshViewProgress=(ProgressBar)mRefreshView.findViewById(R.id.pull_to_refresh_progress);
  mRefreshViewLastUpdated=(TextView)mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);
  mRefreshViewImage.setMinimumHeight(50);
  mRefreshView.setOnClickListener(new OnClickRefreshListener());
  mRefreshOriginalTopPadding=mRefreshView.getPaddingTop();
  mRefreshState=TAP_TO_REFRESH;
  addHeaderView(mRefreshView);
  super.setOnScrollListener(this);
  measureView(mRefreshView);
  mRefreshViewHeight=mRefreshView.getMeasuredHeight();
}
 

Example 75

From project sonet, under directory /core/src/com/piusvelte/sonet/core/.

Source file: SelectFriends.java

  15 
vote

@Override protected void onListItemClick(ListView list,final View view,int position,final long id){
  super.onListItemClick(list,view,position,id);
  if (mFriends.size() > position) {
    HashMap<String,String> friend=mFriends.get(position);
    String esid=friend.get(Entities.ESID);
    boolean checked=false;
    if (mSelectedFriends.contains(esid))     mSelectedFriends.remove(esid);
 else {
      mSelectedFriends.add(esid);
      checked=true;
    }
    ((CheckBox)((RelativeLayout)view).getChildAt(0)).setChecked(checked);
    String[] friends=new String[mSelectedFriends.size()];
    for (int i=0, l=friends.length; i < l; i++)     friends[i]=mSelectedFriends.get(i);
    Intent i=new Intent();
    i.putExtra(Accounts.SID,mAccountId);
    i.putExtra(Stags,friends);
    setResult(RESULT_OK,i);
  }
}
 

Example 76

From project SpeakBird, under directory /src/com/lorenzobraghetto/speakbird/View/.

Source file: Main.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  prefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  String lastTweetUser=prefs.getString("lastTweetUser","");
  if (lastTweetUser.length() > 0) {
    ((RelativeLayout)findViewById(R.id.relativeLayout2)).setVisibility(0);
    ((TextView)findViewById(R.id.user)).setText("@" + lastTweetUser);
  }
  Button button1=(Button)findViewById(R.id.button1);
  button1.setOnClickListener(new OnClickListener(){
    public void onClick(    View arg0){
      Intent mentions=new Intent(getBaseContext(),Tweet.class);
      startActivity(mentions);
    }
  }
);
  Button button2=(Button)findViewById(R.id.button2);
  button2.setOnClickListener(new OnClickListener(){
    public void onClick(    View arg0){
      Intent messages=new Intent(getBaseContext(),Tweet.class);
      messages.putExtra("messages",true);
      startActivity(messages);
    }
  }
);
  Button button3=(Button)findViewById(R.id.button3);
  button3.setOnClickListener(new OnClickListener(){
    public void onClick(    View arg0){
      Intent settings=new Intent(getBaseContext(),Settings.class);
      startActivity(settings);
    }
  }
);
}
 

Example 77

From project SVQCOM, under directory /Core/src/com/ushahidi/android/app/.

Source file: ImageCapture.java

  15 
vote

@Override public void onCreate(Bundle bundle){
  super.onCreate(bundle);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  setContentView(R.layout.take_picture);
  mSurfaceView=(SurfaceView)findViewById(R.id.sur_camera);
  mShutterButton=(ShutterButton)findViewById(R.id.shutter_button);
  mRelativeLayout=(RelativeLayout)findViewById(R.id.snap_photo);
  mSurfaceHolder=mSurfaceView.getHolder();
  mSurfaceHolder.addCallback(this);
  mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  mBundle=new Bundle();
  mIntent=new Intent();
  mShutterButton.setOnShutterButtonListener(new ShutterButton.OnShutterButtonListener(){
    public void onShutterButtonClick(    ShutterButton b){
      if (b.getId() == R.id.shutter_button) {
        onSnap();
      }
    }
    public void onShutterButtonFocus(    ShutterButton b,    boolean pressed){
    }
  }
);
  mRelativeLayout.setOnClickListener(new RelativeLayout.OnClickListener(){
    public void onClick(    View v){
      mShutterButton.setEnabled(false);
    }
  }
);
}
 

Example 78

From project tagin, under directory /experimental/apps/android-demo/src/com/komodo/tagin/.

Source file: TagCloudView.java

  15 
vote

public void addTag(Tag newTag){
  mTagCloud.add(newTag);
  int i=mTextView.size();
  newTag.setParamNo(i);
  mTextView.add(new TextView(this.mContext));
  mTextView.get(i).setText(newTag.getText());
  mParams.add(new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
  mParams.get(i).addRule(RelativeLayout.ALIGN_PARENT_LEFT);
  mParams.get(i).addRule(RelativeLayout.ALIGN_PARENT_TOP);
  mParams.get(i).setMargins((int)(centerX - shiftLeft + newTag.getLoc2DX()),(int)(centerY + newTag.getLoc2DY()),0,0);
  mTextView.get(i).setLayoutParams(mParams.get(i));
  mTextView.get(i).setSingleLine(true);
  int mergedColor=Color.argb((int)(newTag.getAlpha() * 255),(int)(newTag.getColorR() * 255),(int)(newTag.getColorG() * 255),(int)(newTag.getColorB() * 255));
  mTextView.get(i).setTextColor(mergedColor);
  mTextView.get(i).setTextSize((int)(newTag.getTextSize() * newTag.getScale()));
  addView(mTextView.get(i));
  mTextView.get(i).setOnClickListener(OnTagClickListener(newTag.getUrl()));
}
 

Example 79

From project titanium-barcode, under directory /src/com/mwaysolutions/barcode/views/.

Source file: CaptureView.java

  15 
vote

public CaptureView(final Context context){
  super(context);
  LayoutParams captureParams=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
  setLayoutParams(captureParams);
  mPreviewView=new SurfaceView(getContext());
  RelativeLayout.LayoutParams previewParams=new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
  previewParams.getRules()[RelativeLayout.CENTER_IN_PARENT]=RelativeLayout.TRUE;
  mPreviewView.setLayoutParams(previewParams);
  addView(mPreviewView);
  mViewfinderView=new ViewfinderView(getContext());
  LayoutParams viewfinderParams=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
  mViewfinderView.setLayoutParams(viewfinderParams);
  mViewfinderView.setBackgroundColor(Color.TRANSPARENT);
  addView(mViewfinderView);
}