Java Code Examples for android.widget.ImageButton

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 ActionBarSherlock, under directory /samples/demos/src/com/actionbarsherlock/sample/demos/.

Source file: ActionProviders.java

  18 
vote

/** 
 * {@inheritDoc}
 */
@Override public View onCreateActionView(){
  LayoutInflater layoutInflater=LayoutInflater.from(mContext);
  View view=layoutInflater.inflate(R.layout.settings_action_provider,null);
  ImageButton button=(ImageButton)view.findViewById(R.id.button);
  button.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mContext.startActivity(sSettingsIntent);
    }
  }
);
  return view;
}
 

Example 2

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: PushNotificationsActivity.java

  18 
vote

/** 
 * {@inheritDoc}
 */
@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.a_push_notifications);
  super.initTitleBarViews();
  setTitleBarTitle(R.string.titleBarPushNotifications);
  ImageButton mInfoButton=(ImageButton)findViewById(R.id.footerInfo);
  mInfoButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    final View v){
      showDialog(D_PUSH_NOTIFICATIONS);
    }
  }
);
}
 

Example 3

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

Source file: Tmts.java

  18 
vote

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

Example 4

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

Source file: LockableActivity.java

  18 
vote

protected void addTitleButton(int imageResourceId,String tag,OnClickListener listener){
  View child=mInflater.inflate(R.layout.title_item,mTitlebarButtons,false);
  ImageButton button=(ImageButton)child.findViewById(R.id.imgItemIcon);
  button.setImageResource(imageResourceId);
  button.setTag(tag);
  child.setTag("item_" + tag);
  button.setOnClickListener(listener);
  mTitlebarButtons.addView(child);
}
 

Example 5

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

Source file: ImgBtnAdapter.java

  18 
vote

public View getView(int position,View convertView,ViewGroup parent){
  ImageButton btn;
  if (convertView == null) {
    btn=btns[position];
  }
 else {
    btn=(ImageButton)convertView;
  }
  return btn;
}
 

Example 6

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

Source file: NormalActionBarItem.java

  18 
vote

@Override protected void prepareItemView(){
  super.prepareItemView();
  final ImageButton imageButton=(ImageButton)mItemView.findViewById(R.id.gd_action_bar_item);
  imageButton.setImageDrawable(mDrawable);
  imageButton.setContentDescription(mContentDescription);
}
 

Example 7

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

Source file: ImmopolyActivity.java

  18 
vote

private void addTab(int imageId,String name,Class<?> clss,boolean tabless){
  TabSpec tabSpec=mTabHost.newTabSpec(name);
  if (!tabless) {
    ImageButton tab=(ImageButton)LayoutInflater.from(this).inflate(R.layout.tab_map,null);
    tab.setImageResource(imageId);
    tab.setBackgroundResource(R.drawable.tab_button);
    tabSpec.setIndicator(tab);
  }
  mTabManager.addTab(tabSpec,clss,null,tabless);
}
 

Example 8

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

Source file: UIFactory.java

  18 
vote

public static void hideRecordingButtons(BackyardAndroidActivity context){
  ImageButton mRecordButton=(ImageButton)context.findViewById(R.id.recordButton);
  ImageButton mFileButton=(ImageButton)context.findViewById(R.id.fileButton);
  ImageView recordingBackground=(ImageView)context.findViewById(R.id.recordButtonBackground);
  if (mFileButton != null) {
    mFileButton.setVisibility(View.GONE);
  }
  if (mRecordButton != null) {
    mRecordButton.setVisibility(View.GONE);
  }
  if (recordingBackground != null) {
    recordingBackground.setVisibility(View.GONE);
  }
}
 

Example 9

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

Source file: ActionBar.java

  18 
vote

/** 
 * Inflates a  {@link View} with the given {@link Action}.
 * @param action the action to inflate
 * @return a view
 */
private View inflateAction(Action action){
  View view=mInflater.inflate(R.layout.actionbar_item,mActionsView,false);
  ImageButton labelView=(ImageButton)view.findViewById(R.id.actionbar_item);
  labelView.setImageResource(action.getDrawable());
  view.setTag(action);
  view.setOnClickListener(this);
  return view;
}
 

Example 10

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

Source file: Buzzer.java

  18 
vote

/** 
 * onCreate - initializes a buzzer screen
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (BuzzWordsApplication.DEBUG) {
    Log.d(TAG,"onCreate()");
  }
  setVolumeControlStream(AudioManager.STREAM_MUSIC);
  this.setContentView(R.layout.buzzer);
  ImageButton buzzButton=(ImageButton)this.findViewById(R.id.Buzzer_Button);
  buzzButton.setOnTouchListener(mBuzzTouch);
}
 

Example 11

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

Source file: ProjectionView.java

  18 
vote

public ProjectionView(Context context,OnClickListener clickListener){
  super(context);
  this.context=context;
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.view_projection_group_item,this);
  projectionText=(TextView)this.findViewById(R.id.item_projection_name);
  ImageButton btn=(ImageButton)this.findViewById(R.id.item_projection_button);
  btn.setOnClickListener(clickListener);
}
 

Example 12

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

Source file: AppTitleBar.java

  18 
vote

public void hideDashboardOverlay(){
  ImageButton showDashboardButton=(ImageButton)findViewById(R.id.home_small);
  showDashboardButton.setImageDrawable(getResources().getDrawable(R.drawable.icon_titlebar_home));
  Animation fadeOutAnimation=AnimationUtils.loadAnimation(context,R.anim.dashboard_hide);
  dashboard.startAnimation(fadeOutAnimation);
  dashboard.setVisibility(View.GONE);
  isShowingDashboard=false;
}
 

Example 13

From project fanfoudroid, under directory /test/fanfoudroid-test/src/com/ch_linghu/fanfoudroid/test/.

Source file: StatusActivityTest.java

  18 
vote

public void testIntent() throws Exception {
  TextView tweet_text=(TextView)mActivity.findViewById(com.ch_linghu.fanfoudroid.R.id.tweet_text);
  TextView tweet_created_at=(TextView)mActivity.findViewById(com.ch_linghu.fanfoudroid.R.id.tweet_created_at);
  ImageButton tweet_favorited=(ImageButton)mActivity.findViewById(com.ch_linghu.fanfoudroid.R.id.tweet_fav);
  TextView tweet_screen_name=(TextView)mActivity.findViewById(com.ch_linghu.fanfoudroid.R.id.tweet_screen_name);
  ImageView profile_image=(ImageView)mActivity.findViewById(com.ch_linghu.fanfoudroid.R.id.profile_image);
  TextView tweet_source=(TextView)mActivity.findViewById(com.ch_linghu.fanfoudroid.R.id.tweet_source);
  assertEquals(tweet.text,tweet_text.getText().toString());
  assertEquals(tweet.screenName,tweet_screen_name.getText().toString());
  assertEquals(mActivity.getString(R.string.tweet_source_prefix) + tweet.source,tweet_source.getText().toString());
  assertEquals(tweet.favorited.equals("true"),tweet_favorited.isEnabled());
}
 

Example 14

From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/samples/demos/src/com/actionbarsherlock/sample/demos/.

Source file: ActionProviders.java

  18 
vote

/** 
 * {@inheritDoc}
 */
@Override public View onCreateActionView(){
  LayoutInflater layoutInflater=LayoutInflater.from(mContext);
  View view=layoutInflater.inflate(R.layout.settings_action_provider,null);
  ImageButton button=(ImageButton)view.findViewById(R.id.button);
  button.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mContext.startActivity(sSettingsIntent);
    }
  }
);
  return view;
}
 

Example 15

From project GreenDroid, under directory /GreenDroid/src/greendroid/widget/.

Source file: NormalActionBarItem.java

  18 
vote

@Override protected void prepareItemView(){
  super.prepareItemView();
  final ImageButton imageButton=(ImageButton)mItemView.findViewById(R.id.gd_action_bar_item);
  imageButton.setImageDrawable(mDrawable);
  imageButton.setContentDescription(mContentDescription);
}
 

Example 16

From project GreenDroidQABar, under directory /src/greendroid/widget/.

Source file: NormalActionBarItem.java

  18 
vote

@Override protected void prepareItemView(){
  super.prepareItemView();
  final ImageButton imageButton=(ImageButton)mItemView.findViewById(R.id.gd_action_bar_item);
  imageButton.setImageDrawable(mDrawable);
  imageButton.setContentDescription(mContentDescription);
}
 

Example 17

From project K6nele, under directory /app/src/ee/ioc/phon/android/speak/demo/.

Source file: VoiceSearchDemo.java

  18 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.voice_search_demo);
  ImageButton speakButton=(ImageButton)findViewById(R.id.buttonMicrophone);
  speakButton.setOnClickListener(this);
}
 

Example 18

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

Source file: EntryEditActivity.java

  18 
vote

private void fillData(){
  ImageButton currIconButton=(ImageButton)findViewById(R.id.icon_button);
  App.getDB().drawFactory.assignDrawableTo(currIconButton,getResources(),mEntry.getIcon());
  populateText(R.id.entry_title,mEntry.title);
  populateText(R.id.entry_user_name,mEntry.getUsername());
  populateText(R.id.entry_url,mEntry.url);
  String password=new String(mEntry.getPassword());
  populateText(R.id.entry_password,password);
  populateText(R.id.entry_confpassword,password);
  setPasswordStyle();
  populateText(R.id.entry_comment,mEntry.additional);
}
 

Example 19

From project Krypsis, under directory /Android/src/org/krypsis/android/command/photo/.

Source file: ImagePreviewer.java

  18 
vote

/** 
 * Will be called if the user took a picture and wants to use it. In this case the activity could be finished.
 */
private void onUsePhoto(){
  ImageButton imageButton=(ImageButton)findViewById(R.id.okPreview);
  if (imageButton != null) {
    imageButton.setImageResource(R.drawable.network);
    imageButton.setEnabled(false);
  }
  logger.info("User took photo. Finish activity and pass picture data to the application");
  getIntent().putExtra(Intent.EXTRA_STREAM,this.photoData);
  setResult(RESULT_OK,getIntent());
  finish();
}
 

Example 20

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

Source file: ActionBar.java

  18 
vote

/** 
 * Inflates a  {@link View} with the given {@link Action}.
 * @param action the action to inflate
 * @return a view
 */
private View inflateAction(Action action){
  View view=mInflater.inflate(R.layout.actionbar_item,mActionsView,false);
  ImageButton labelView=(ImageButton)view.findViewById(R.id.actionbar_item);
  labelView.setImageResource(action.getDrawable());
  labelView.setScaleType(ScaleType.CENTER_INSIDE);
  view.setTag(action);
  view.setOnClickListener(this);
  return view;
}
 

Example 21

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 22

From project mWater-Android-App, under directory /android/src/co/mwater/clientapp/ui/.

Source file: DetailActivity.java

  18 
vote

protected void displayImageButton(int imageButtonId,String imageColumn,int defaultImage){
  ImageButton imageButton=(ImageButton)findViewById(imageButtonId);
  String imageUid=rowValues.getAsString(imageColumn);
  if (imageUid == null) {
    imageButton.setImageResource(defaultImage);
    return;
  }
  ImageManager.getDefault(getApplicationContext()).displayThumbnailImage(imageUid,imageButton,defaultImage);
}
 

Example 23

From project ohmagePhone, under directory /src/org/ohmage/controls/.

Source file: ActionBarControl.java

  18 
vote

/** 
 * Adds a command to the action bar, identified in callbacks by buttonID. Note that buttonID will be used as the ID of the ImageButton that this method creates.
 * @param buttonID an id which should uniquely identify this command, up to the caller to create
 * @param description a string which defines this command, used for accessibility
 * @param resid a drawable to render as the icon. should be the same size as the action bar (i.e. 40x40px hdpi)
 */
public void addActionBarCommand(int buttonID,String description,int resID){
  View newSeparator=mActivity.getLayoutInflater().inflate(R.layout.controls_actionbar_separator,this);
  ImageButton newButton=(ImageButton)mActivity.getLayoutInflater().inflate(R.layout.controls_actionbar_button,null);
  newButton.setId(buttonID);
  newButton.setContentDescription(description);
  newButton.setImageResource(resID);
  newButton.setOnClickListener(mActionButtonClickListener);
  mSeparators.add(newSeparator);
  mActionButtons.add(newButton);
  this.addView(newButton,new LayoutParams(dpToPixels(45),LayoutParams.FILL_PARENT));
}
 

Example 24

From project Ohmage_Phone, under directory /src/org/ohmage/controls/.

Source file: ActionBarControl.java

  18 
vote

/** 
 * Adds a command to the action bar, identified in callbacks by buttonID. Note that buttonID will be used as the ID of the ImageButton that this method creates.
 * @param buttonID an id which should uniquely identify this command, up to the caller to create
 * @param description a string which defines this command, used for accessibility
 * @param resid a drawable to render as the icon. should be the same size as the action bar (i.e. 40x40px hdpi)
 */
public void addActionBarCommand(int buttonID,String description,int resID){
  ImageView newSeparator=(ImageView)mActivity.getLayoutInflater().inflate(R.layout.controls_actionbar_separator,null);
  ImageButton newButton=(ImageButton)mActivity.getLayoutInflater().inflate(R.layout.controls_actionbar_button,null);
  newButton.setId(buttonID);
  newButton.setContentDescription(description);
  newButton.setImageResource(resID);
  newButton.setOnClickListener(mActionButtonClickListener);
  mSeparators.add(newSeparator);
  mActionButtons.add(newButton);
  this.addView(newSeparator,new LayoutParams(1,LayoutParams.FILL_PARENT));
  this.addView(newButton,new LayoutParams(dpToPixels(45),LayoutParams.FILL_PARENT));
}
 

Example 25

From project OpenAndroidWeather, under directory /OpenAndroidWeather/src/no/firestorm/ui/.

Source file: Settings.java

  18 
vote

private void setGetWeatherButton(){
  final ImageButton chooseStationButton=(ImageButton)findViewById(R.id.get_weather);
  chooseStationButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      getWeather();
    }
  }
);
}
 

Example 26

From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.

Source file: ActionBarHelperBase.java

  17 
vote

@Override public void updateMenuView(SimpleMenu menu,SimpleMenuItem item,int change){
switch (change) {
case SimpleMenu.ITEM_CHANGED_NEW:
    break;
case SimpleMenu.ITEM_CHANGED_TITLE:
  if (item != null && item.getView() instanceof ImageButton) {
    ImageButton actionButton=(ImageButton)item.getView();
    actionButton.setContentDescription(item.getTitle());
  }
break;
case SimpleMenu.ITEM_CHANGED_ICON:
if (item != null && item.getView() instanceof ImageButton) {
ImageButton actionButton=(ImageButton)item.getView();
actionButton.setImageDrawable(item.getIcon());
}
break;
case SimpleMenu.ITEM_CHANGED_ACTION:
break;
case SimpleMenu.ITEM_CHANGED_ACTION_VIEW:
break;
case SimpleMenu.ITEM_CHANGED_VISIBILITY:
if (item != null && item.getView() != null) {
item.getView().setVisibility(item.isVisible() ? View.VISIBLE : View.GONE);
}
break;
}
}
 

Example 27

From project android-flash-cards, under directory /src/org/thomasamsler/android/flashcards/fragment/.

Source file: AboutFragment.java

  17 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  String version=null;
  try {
    version=getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(),0).versionName;
  }
 catch (  NameNotFoundException e) {
    Log.w(AppConstants.LOG_TAG,"Exception accessing version information",e);
  }
  TextView versionTextView=(TextView)getActivity().findViewById(R.id.textViewAboutVersion);
  versionTextView.append(version);
  ImageButton imageButtonCancel=(ImageButton)getActivity().findViewById(R.id.imageButtonAboutClose);
  imageButtonCancel.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      ((MainApplication)getActivity().getApplication()).doAction(ACTION_SHOW_CARD_SETS,Boolean.TRUE);
    }
  }
);
}
 

Example 28

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/editor/activity/.

Source file: TaskEditorActivity.java

  17 
vote

static boolean addReminder(Activity activity,View.OnClickListener listener,ArrayList<LinearLayout> items,ArrayList<Integer> values,ArrayList<String> labels,int minutes){
  if (items.size() >= MAX_REMINDERS) {
    return false;
  }
  LayoutInflater inflater=activity.getLayoutInflater();
  LinearLayout parent=(LinearLayout)activity.findViewById(R.id.reminder_items_container);
  LinearLayout reminderItem=(LinearLayout)inflater.inflate(R.layout.edit_reminder_item,null);
  parent.addView(reminderItem);
  Spinner spinner=(Spinner)reminderItem.findViewById(R.id.reminder_value);
  Resources res=activity.getResources();
  spinner.setPrompt(res.getString(R.string.reminders_title));
  int resource=android.R.layout.simple_spinner_item;
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(activity,resource,labels);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  ImageButton reminderRemoveButton;
  reminderRemoveButton=(ImageButton)reminderItem.findViewById(R.id.reminder_remove);
  reminderRemoveButton.setOnClickListener(listener);
  int index=findMinutesInReminderList(values,minutes);
  spinner.setSelection(index);
  items.add(reminderItem);
  return true;
}
 

Example 29

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

Source file: EpisodeDetailsActivity.java

  17 
vote

public void updateEpisodeDetails(final TextView plotView,final LinearLayout dataLayout){
  mShowManager.updateEpisodeDetails(new DataResponse<Episode>(){
    public void run(){
      final Episode episode=value;
      plotView.setText(episode.plot.equals("") ? NO_DATA : episode.plot);
      if (episode.actors != null) {
        final LayoutInflater inflater=mActivity.getLayoutInflater();
        for (        Actor actor : episode.actors) {
          final View view=inflater.inflate(R.layout.actor_item,null);
          ((TextView)view.findViewById(R.id.actor_name)).setText(actor.name);
          if (actor.role != null && !actor.role.equals("")) {
            ((TextView)view.findViewById(R.id.actor_role)).setText("as " + actor.role);
          }
 else {
            ((TextView)view.findViewById(R.id.actor_role)).setVisibility(View.GONE);
          }
          ImageButton img=((ImageButton)view.findViewById(R.id.actor_image));
          mShowManager.getCover(new DataResponse<Bitmap>(){
            public void run(){
              if (value != null) {
                ((ImageButton)view.findViewById(R.id.actor_image)).setImageBitmap(value);
              }
            }
          }
,actor,ThumbSize.SMALL,null,mActivity.getApplicationContext(),false);
          img.setTag(actor);
          dataLayout.addView(view);
        }
      }
    }
  }
,mEpisode,mActivity.getApplicationContext());
}
 

Example 30

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

Source file: ActionBarHelperBase.java

  17 
vote

/** 
 * Adds an action button to the compatibility action bar, using menu information from a  {@link android.view.MenuItem}. If the menu item ID is <code>menu_refresh</code>, the menu item's state can be changed to show a loading spinner using {@link com.example.android.actionbarcompat.ActionBarHelperBase#setRefreshActionItemState(boolean)}.
 */
private View addActionItemCompatFromMenuItem(final MenuItem item){
  final int itemId=item.getItemId();
  final ViewGroup actionBar=getActionBarCompat();
  if (actionBar == null) {
    return null;
  }
  ImageButton actionButton=new ImageButton(mActivity,null,itemId == android.R.id.home ? R.attr.actionbarCompatItemHomeStyle : R.attr.actionbarCompatItemStyle);
  actionButton.setLayoutParams(new ViewGroup.LayoutParams((int)mActivity.getResources().getDimension(itemId == android.R.id.home ? R.dimen.actionbar_compat_button_home_width : R.dimen.actionbar_compat_button_width),ViewGroup.LayoutParams.FILL_PARENT));
  if (itemId == R.id.menu_refresh) {
    actionButton.setId(R.id.actionbar_compat_item_refresh);
  }
  if (itemId != android.R.id.home || actionButton.getDrawable() == null) {
    actionButton.setImageDrawable(item.getIcon());
  }
  actionButton.setScaleType(ImageView.ScaleType.CENTER);
  actionButton.setContentDescription(item.getTitle());
  actionButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      mActivity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL,item);
    }
  }
);
  actionBar.addView(actionButton);
  if (item.getItemId() == R.id.menu_refresh) {
    ProgressBar indicator=new ProgressBar(mActivity,null,R.attr.actionbarCompatProgressIndicatorStyle);
    final int buttonWidth=mActivity.getResources().getDimensionPixelSize(R.dimen.actionbar_compat_button_width);
    final int buttonHeight=mActivity.getResources().getDimensionPixelSize(R.dimen.actionbar_compat_height);
    final int progressIndicatorWidth=buttonWidth / 2;
    LinearLayout.LayoutParams indicatorLayoutParams=new LinearLayout.LayoutParams(progressIndicatorWidth,progressIndicatorWidth);
    indicatorLayoutParams.setMargins((buttonWidth - progressIndicatorWidth) / 2,(buttonHeight - progressIndicatorWidth) / 2,(buttonWidth - progressIndicatorWidth) / 2,0);
    indicator.setLayoutParams(indicatorLayoutParams);
    indicator.setVisibility(View.GONE);
    indicator.setId(R.id.actionbar_compat_item_refresh_progress);
    actionBar.addView(indicator);
  }
  return actionButton;
}
 

Example 31

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

Source file: FileManagerActivity.java

  17 
vote

private void checkButtonLayout(){
  int spec=View.MeasureSpec.UNSPECIFIED;
  mDirectoryButtons.measure(spec,spec);
  int count=mDirectoryButtons.getChildCount();
  int requiredwidth=mDirectoryButtons.getMeasuredWidth();
  int width=getWindowManager().getDefaultDisplay().getWidth();
  if (requiredwidth > width) {
    int WRAP_CONTENT=LinearLayout.LayoutParams.WRAP_CONTENT;
    ImageButton ib=new ImageButton(this);
    ib.setImageResource(R.drawable.ic_menu_back_small);
    ib.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT,WRAP_CONTENT));
    ib.setOnClickListener(new View.OnClickListener(){
      public void onClick(      View view){
        upOneLevel();
      }
    }
);
    mDirectoryButtons.addView(ib,0);
    ib.measure(spec,spec);
    requiredwidth+=ib.getMeasuredWidth();
    while (requiredwidth > width && mDirectoryButtons.getChildCount() > 2) {
      View view=mDirectoryButtons.getChildAt(1);
      requiredwidth-=view.getMeasuredWidth();
      mDirectoryButtons.removeViewAt(1);
    }
  }
}
 

Example 32

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: ManageConferenceUtils.java

  17 
vote

/** 
 * Updates a single row of the "Manage conference" UI.  (One row in this UI represents a single caller in the conference.)
 * @param i the row to update
 * @param connection the Connection corresponding to this caller.If null, that means this is an "empty slot" in the conference, so hide this row in the UI.
 * @param canSeparate if true, show a "Separate" (i.e. "Private") buttonon this row in the UI.
 */
public void updateManageConferenceRow(final int i,final Connection connection,boolean canSeparate){
  if (DBG)   log("updateManageConferenceRow(" + i + ")...  connection = "+ connection);
  if (connection != null) {
    mConferenceCallList[i].setVisibility(View.VISIBLE);
    ImageButton endButton=(ImageButton)mConferenceCallList[i].findViewById(R.id.conferenceCallerDisconnect);
    ImageButton separateButton=(ImageButton)mConferenceCallList[i].findViewById(R.id.conferenceCallerSeparate);
    TextView nameTextView=(TextView)mConferenceCallList[i].findViewById(R.id.conferenceCallerName);
    TextView numberTextView=(TextView)mConferenceCallList[i].findViewById(R.id.conferenceCallerNumber);
    TextView numberTypeTextView=(TextView)mConferenceCallList[i].findViewById(R.id.conferenceCallerNumberType);
    if (DBG)     log("- button: " + endButton + ", nameTextView: "+ nameTextView);
    View.OnClickListener endThisConnection=new View.OnClickListener(){
      public void onClick(      View v){
        endConferenceConnection(i,connection);
        PhoneApp.getInstance().pokeUserActivity();
      }
    }
;
    endButton.setOnClickListener(endThisConnection);
    if (canSeparate) {
      View.OnClickListener separateThisConnection=new View.OnClickListener(){
        public void onClick(        View v){
          separateConferenceConnection(i,connection);
          PhoneApp.getInstance().pokeUserActivity();
        }
      }
;
      separateButton.setOnClickListener(separateThisConnection);
      separateButton.setVisibility(View.VISIBLE);
    }
 else {
      separateButton.setVisibility(View.INVISIBLE);
    }
    PhoneUtils.CallerInfoToken info=PhoneUtils.startGetCallerInfo(mInCallScreen,connection,this,mConferenceCallList[i]);
    if (DBG)     log("  - got info from startGetCallerInfo(): " + info);
    displayCallerInfoForConferenceRow(info.currentInfo,nameTextView,numberTypeTextView,numberTextView);
  }
 else {
    mConferenceCallList[i].setVisibility(View.GONE);
  }
}
 

Example 33

From project AquaNotesTest, under directory /src/com/google/android/apps/iosched/util/.

Source file: ActivityHelper.java

  17 
vote

/** 
 * Sets up the action bar with the given title and accent color. If title is null, then the app logo will be shown instead of a title. Otherwise, a home button and title are visible. If color is null, then the default colorstrip is visible.
 */
public void setupActionBar(CharSequence title,int color){
  final ViewGroup actionBarCompat=getActionBarCompat();
  if (actionBarCompat == null) {
    return;
  }
  LinearLayout.LayoutParams springLayoutParams=new LinearLayout.LayoutParams(0,ViewGroup.LayoutParams.FILL_PARENT);
  springLayoutParams.weight=1;
  View.OnClickListener homeClickListener=new View.OnClickListener(){
    public void onClick(    View view){
      goHome();
    }
  }
;
  if (title != null) {
    addActionButtonCompat(R.drawable.ic_title_home,R.string.description_home,homeClickListener,true);
    TextView titleText=new TextView(mActivity,null,R.attr.actionbarCompatTextStyle);
    titleText.setLayoutParams(springLayoutParams);
    titleText.setText(title);
    actionBarCompat.addView(titleText);
  }
 else {
    ImageButton logo=new ImageButton(mActivity,null,R.attr.actionbarCompatLogoStyle);
    logo.setOnClickListener(homeClickListener);
    actionBarCompat.addView(logo);
    View spring=new View(mActivity);
    spring.setLayoutParams(springLayoutParams);
    actionBarCompat.addView(spring);
  }
  setActionBarColor(color);
}
 

Example 34

From project BibleQuote-for-Android, under directory /src/com/BibleQuote/activity/.

Source file: ReaderActivity.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.reader);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  setVolumeControlStream(AudioManager.STREAM_MUSIC);
  getSupportActionBar().setIcon(R.drawable.app_logo);
  getSupportActionBar().setDisplayShowTitleEnabled(false);
  ViewUtils.setActionBarBackground(this);
  BibleQuoteApp app=(BibleQuoteApp)getApplication();
  myLibrarian=app.getLibrarian();
  mAsyncManager=app.getAsyncManager();
  mAsyncManager.handleRetainedTask(getLastNonConfigurationInstance(),this);
  btnChapterNav=(LinearLayout)findViewById(R.id.btn_chapter_nav);
  ImageButton btnChapterPrev=(ImageButton)findViewById(R.id.btn_reader_prev);
  btnChapterPrev.setOnClickListener(onClickChapterPrev);
  ImageButton btnChapterNext=(ImageButton)findViewById(R.id.btn_reader_next);
  btnChapterNext.setOnClickListener(onClickChapterNext);
  ImageButton btnChapterUp=(ImageButton)findViewById(R.id.btn_reader_up);
  btnChapterUp.setOnClickListener(onClickPageUp);
  ImageButton btnChapterDown=(ImageButton)findViewById(R.id.btn_reader_down);
  btnChapterDown.setOnClickListener(onClickPageDown);
  vModuleName=(TextView)findViewById(R.id.moduleName);
  vBookLink=(TextView)findViewById(R.id.linkBook);
  progressMessage=getResources().getString(R.string.messageLoad);
  nightMode=PreferenceHelper.restoreStateBoolean("nightMode");
  vWeb=(ReaderWebView)findViewById(R.id.readerView);
  vWeb.setOnReaderViewListener(this);
  vWeb.setReadingMode(PreferenceHelper.isReadModeByDefault());
  updateActivityMode();
  BibleReference osisLink=new BibleReference(PreferenceHelper.restoreStateString("last_read"));
  if (!myLibrarian.isOSISLinkValid(osisLink)) {
    onChooseChapterClick();
  }
 else {
    mAsyncManager.setupTask(new AsyncOpenChapter(progressMessage,false,myLibrarian,osisLink),this);
  }
}
 

Example 35

From project blokish, under directory /src/org/scoutant/blokish/.

Source file: ButtonsView.java

  17 
vote

private ImageButton button(int src,OnClickListener l,int position){
  ImageButton btn=new ImageButton(context);
  LayoutParams params=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,Gravity.CENTER_VERTICAL);
  Display display=((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
  int margin=Math.min((display.getWidth() - 3 * 128) / 3,80);
  params.leftMargin=margin;
  params.rightMargin=margin;
  if (position == 0)   params.gravity=Gravity.LEFT | Gravity.CENTER_VERTICAL;
  if (position == 1)   params.gravity=Gravity.RIGHT | Gravity.CENTER_VERTICAL;
  btn.setLayoutParams(params);
  btn.setImageDrawable(context.getResources().getDrawable(src));
  btn.setScaleType(ScaleType.CENTER_INSIDE);
  btn.setBackgroundColor(Color.TRANSPARENT);
  btn.setOnClickListener(l);
  return btn;
}
 

Example 36

From project btmidi, under directory /BluetoothMidiDemo/src/com/noisepages/nettoyeur/mididemo/.

Source file: PianoActivity.java

  17 
vote

@Override protected void onCreate(Bundle bundle){
  super.onCreate(bundle);
  setContentView(R.layout.main);
  ImageButton white1=(ImageButton)findViewById(R.id.white1);
  ImageButton white2=(ImageButton)findViewById(R.id.white2);
  ImageButton white3=(ImageButton)findViewById(R.id.white3);
  ImageButton white4=(ImageButton)findViewById(R.id.white4);
  ImageButton white5=(ImageButton)findViewById(R.id.white5);
  ImageButton white6=(ImageButton)findViewById(R.id.white6);
  ImageButton white7=(ImageButton)findViewById(R.id.white7);
  ImageButton white8=(ImageButton)findViewById(R.id.white8);
  ImageButton black1=(ImageButton)findViewById(R.id.black1);
  ImageButton black2=(ImageButton)findViewById(R.id.black2);
  ImageButton black3=(ImageButton)findViewById(R.id.black3);
  ImageButton black4=(ImageButton)findViewById(R.id.black4);
  ImageButton black5=(ImageButton)findViewById(R.id.black5);
  white1.setTag(0);
  white2.setTag(2);
  white3.setTag(4);
  white4.setTag(5);
  white5.setTag(7);
  white6.setTag(9);
  white7.setTag(11);
  white8.setTag(12);
  black1.setTag(1);
  black2.setTag(3);
  black3.setTag(6);
  black4.setTag(8);
  black5.setTag(10);
  keys=new ImageButton[]{white1,black1,white2,black2,white3,white4,black3,white5,black4,white6,black5,white7,white8};
  for (  ImageButton key : keys) {
    key.setOnTouchListener(this);
  }
  bindService(new Intent(this,BluetoothMidiService.class),connection,BIND_AUTO_CREATE);
}
 

Example 37

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/ui/dialogs/.

Source file: AddBrickDialog.java

  17 
vote

public AddBrickDialog(ScriptTabActivity scriptTabActivity,String category){
  super(scriptTabActivity,R.style.brick_dialog);
  this.scriptTabActivity=scriptTabActivity;
  this.category=category;
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.dialog_add_brick);
  getWindow().setLayout(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  ImageButton closeButton=(ImageButton)findViewById(R.id.btn_close_dialog);
  closeButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      abort();
      dismiss();
    }
  }
);
  TextView textView=(TextView)findViewById(R.id.tv_dialog_title);
  textView.setText(category);
}
 

Example 38

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

Source file: SM_enter.java

  17 
vote

public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState,R.layout.smenter_dialog);
  TableRow tr=(TableRow)findViewById(R.id.sm_enter_tr);
  NumberPicker np=new NumberPicker(SM_enter.this,0,100,50,1,0);
  tr.addView(np);
  final TextView tw=(TextView)findViewById(R.id.tw);
  tw.setOnLongClickListener(this);
  ImageButton ok=(ImageButton)findViewById(R.id.ok);
  ImageButton cancel=(ImageButton)findViewById(R.id.cancel);
  ok.setVisibility(View.GONE);
  cancel.setVisibility(View.GONE);
  Button btnNext=(Button)findViewById(R.id.button_ok);
  btnNext.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      String sm_enter_no=String.valueOf(tw.getText().toString());
      Toast.makeText(SM_enter.this,"User enetred " + sm_enter_no + " %",Toast.LENGTH_LONG).show();
      int flag1;
      if (sm_enter_no.equals("0")) {
        flag1=1;
        TableRow tr_feedback=(TableRow)findViewById(R.id.sm_enter_tr);
        tr_feedback.setBackgroundResource(R.drawable.def_img_not);
      }
 else {
        flag1=0;
        TableRow tr_feedback=(TableRow)findViewById(R.id.sm_enter_tr);
        tr_feedback.setBackgroundResource(R.drawable.def_img);
      }
      if (flag1 == 0) {
        startActivity(new Intent(SM_enter.this,Homescreen.class));
        SM_enter.this.finish();
      }
 else {
        playAudio(R.raw.missinginfo);
      }
    }
  }
);
}
 

Example 39

From project conference-mobile-app, under directory /android-app/src/com/google/android/apps/iosched/util/.

Source file: ActivityHelper.java

  17 
vote

/** 
 * Sets up the action bar with the given title and accent color. If title is null, then the app logo will be shown instead of a title. Otherwise, a home button and title are visible. If color is null, then the default colorstrip is visible.
 */
public void setupActionBar(CharSequence title,int color){
  final ViewGroup actionBarCompat=getActionBarCompat();
  if (actionBarCompat == null) {
    return;
  }
  LinearLayout.LayoutParams springLayoutParams=new LinearLayout.LayoutParams(0,ViewGroup.LayoutParams.FILL_PARENT);
  springLayoutParams.weight=1;
  View.OnClickListener homeClickListener=new View.OnClickListener(){
    public void onClick(    View view){
      goHome();
    }
  }
;
  if (title != null) {
    addActionButtonCompat(R.drawable.ic_title_home,R.string.description_home,homeClickListener,true);
    TextView titleText=new TextView(mActivity,null,R.attr.actionbarCompatTextStyle);
    titleText.setLayoutParams(springLayoutParams);
    titleText.setText(title);
    actionBarCompat.addView(titleText);
  }
 else {
    ImageButton logo=new ImageButton(mActivity,null,R.attr.actionbarCompatLogoStyle);
    logo.setOnClickListener(homeClickListener);
    actionBarCompat.addView(logo);
    View spring=new View(mActivity);
    spring.setLayoutParams(springLayoutParams);
    actionBarCompat.addView(spring);
  }
  setActionBarColor(color);
}
 

Example 40

From project dccsched, under directory /src/com/underhilllabs/dccsched/util/.

Source file: UIUtils.java

  17 
vote

public static void setTitleBarColor(View titleBarView,int color){
  final ViewGroup titleBar=(ViewGroup)titleBarView;
  titleBar.setBackgroundColor(color);
  int brColor=(30 * Color.red(color) + 59 * Color.green(color) + 11 * Color.blue(color)) / 100;
  if (brColor > BRIGHTNESS_THRESHOLD) {
    ((TextView)titleBar.findViewById(R.id.title_text)).setTextColor(titleBar.getContext().getResources().getColor(R.color.title_text_alt));
    titleBar.post(new Runnable(){
      public void run(){
        final int childCount=titleBar.getChildCount();
        for (int i=0; i < childCount; i++) {
          final View child=titleBar.getChildAt(i);
          if (child instanceof ImageButton) {
            final ImageButton childButton=(ImageButton)child;
            if (childButton.getDrawable() != null && childButton.getDrawable() instanceof LevelListDrawable) {
              ((LevelListDrawable)childButton.getDrawable()).setLevel(1);
            }
          }
        }
      }
    }
);
  }
}
 

Example 41

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

Source file: ActivityHelper.java

  17 
vote

/** 
 * Sets up the action bar with the given title and accent color. If title is null, then the app logo will be shown instead of a title. Otherwise, a home button and title are visible. If color is null, then the default colorstrip is visible.
 */
public void setupActionBar(CharSequence title,int color){
  final ViewGroup actionBarCompat=getActionBarCompat();
  if (actionBarCompat == null) {
    return;
  }
  LinearLayout.LayoutParams springLayoutParams=new LinearLayout.LayoutParams(0,ViewGroup.LayoutParams.FILL_PARENT);
  springLayoutParams.weight=1;
  View.OnClickListener homeClickListener=new View.OnClickListener(){
    public void onClick(    View view){
      goHome();
    }
  }
;
  if (title != null) {
    addActionButtonCompat(R.drawable.ic_title_home,R.string.description_home,homeClickListener,true);
    TextView titleText=new TextView(mActivity,null,R.attr.actionbarCompatTextStyle);
    titleText.setLayoutParams(springLayoutParams);
    titleText.setText(title);
    actionBarCompat.addView(titleText);
  }
 else {
    ImageButton logo=new ImageButton(mActivity,null,R.attr.actionbarCompatLogoStyle);
    logo.setOnClickListener(homeClickListener);
    actionBarCompat.addView(logo);
    View spring=new View(mActivity);
    spring.setLayoutParams(springLayoutParams);
    actionBarCompat.addView(spring);
  }
  setActionBarColor(color);
}
 

Example 42

From project DiscogsForAndroid, under directory /src/android/support/v4/actionbar/.

Source file: ActionBarHelperBase.java

  17 
vote

/** 
 * Adds an action button to the compatibility action bar, using menu information from a {@link android.view.MenuItem}. If the menu item ID is <code>menu_refresh</code>, the menu item's state can be changed to show a loading spinner using {@link android.support.v4.actionbar.ActionBarHelperBase#setRefreshActionItemState(boolean)}.
 */
private View addActionItemCompatFromMenuItem(final MenuItem item){
  final int itemId=item.getItemId();
  final ViewGroup actionBar=getActionBarCompat();
  if (actionBar == null) {
    return null;
  }
  ImageButton actionButton=new ImageButton(mActivity,null,itemId == android.R.id.home ? R.attr.actionbarCompatItemHomeStyle : R.attr.actionbarCompatItemStyle);
  actionButton.setLayoutParams(new ViewGroup.LayoutParams((int)mActivity.getResources().getDimension(itemId == android.R.id.home ? R.dimen.actionbar_compat_button_home_width : R.dimen.actionbar_compat_button_width),ViewGroup.LayoutParams.FILL_PARENT));
  if (itemId == R.id.menu_refresh) {
    actionButton.setId(R.id.actionbar_compat_item_refresh);
  }
  actionButton.setImageDrawable(item.getIcon());
  actionButton.setScaleType(ImageView.ScaleType.CENTER);
  actionButton.setContentDescription(item.getTitle());
  actionButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      mActivity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL,item);
    }
  }
);
  actionBar.addView(actionButton);
  if (item.getItemId() == R.id.menu_refresh) {
    ProgressBar indicator=new ProgressBar(mActivity,null,R.attr.actionbarCompatProgressIndicatorStyle);
    final int buttonWidth=mActivity.getResources().getDimensionPixelSize(R.dimen.actionbar_compat_button_width);
    final int buttonHeight=mActivity.getResources().getDimensionPixelSize(R.dimen.actionbar_compat_height);
    final int progressIndicatorWidth=buttonWidth / 2;
    LinearLayout.LayoutParams indicatorLayoutParams=new LinearLayout.LayoutParams(progressIndicatorWidth,progressIndicatorWidth);
    indicatorLayoutParams.setMargins((buttonWidth - progressIndicatorWidth) / 2,(buttonHeight - progressIndicatorWidth) / 2,(buttonWidth - progressIndicatorWidth) / 2,0);
    indicator.setLayoutParams(indicatorLayoutParams);
    indicator.setVisibility(View.GONE);
    indicator.setId(R.id.actionbar_compat_item_refresh_progress);
    actionBar.addView(indicator);
  }
  return actionButton;
}
 

Example 43

From project dmix, under directory /MPDroid/src/com/namelessdev/mpdroid/fragments/.

Source file: NowPlayingFragment.java

  17 
vote

private void updateStatus(MPDStatus status){
  lastElapsedTime=status.getElapsedTime();
  lastSongTime=status.getTotalTime();
  trackTime.setText(timeToString(lastElapsedTime));
  trackTotalTime.setText(timeToString(lastSongTime));
  progressBarTrack.setProgress((int)status.getElapsedTime());
  if (status.getState() != null) {
    if (status.getState().equals(MPDStatus.MPD_STATE_PLAYING)) {
      startPosTimer(status.getElapsedTime());
      ImageButton button=(ImageButton)getView().findViewById(R.id.playpause);
      button.setImageDrawable(getResources().getDrawable(R.drawable.ic_media_pause));
    }
 else {
      stopPosTimer();
      ImageButton button=(ImageButton)getView().findViewById(R.id.playpause);
      button.setImageDrawable(getResources().getDrawable(R.drawable.ic_media_play));
    }
  }
  setShuffleButton(status.isRandom());
  setRepeatButton(status.isRepeat());
}
 

Example 44

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

Source file: LegacyActionContainer.java

  17 
vote

/** 
 * Add the  {@link #menu} members as children in the view. Each view will have the corresponding MenuItem as its tag.
 */
private void loadChildViews(){
  ImageButton itemView=null;
  LayoutParams params=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  params.weight=1;
  for (int i=0; i < menu.size(); i++) {
    itemView=new ImageButton(getContext());
    itemView.setLayoutParams(params);
    itemView.setImageDrawable(menu.getItem(i).getIcon());
    itemView.setBackgroundResource(R.drawable.bg_action_container_button);
    itemView.setTag(menu.getItem(i));
    itemView.setScaleType(ScaleType.CENTER_INSIDE);
    itemView.setAdjustViewBounds(true);
    itemView.setOnLongClickListener(new View.OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        Toast t=Toast.makeText(getContext(),((MenuItem)v.getTag()).getTitle(),Toast.LENGTH_SHORT);
        t.setGravity(Gravity.TOP | Gravity.LEFT,v.getLeft() - 50,v.getBottom() + 40);
        t.show();
        return true;
      }
    }
);
    itemView.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        if (mListener != null)         mListener.actionSelected((MenuItem)v.getTag());
      }
    }
);
    addView(itemView);
  }
}
 

Example 45

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

Source file: StartGameScreen.java

  17 
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 46

From project FlickrCity, under directory /src/com/FlickrCity/FlickrCityAndroid/Activities/.

Source file: PhotoActivity.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.photo);
  Bundle extras=getIntent().getExtras();
  if (extras != null) {
    newUrl=extras.getString(Constants.URL_KEY);
    owner=extras.getString(Constants.USERNAME_KEY);
    title=extras.getString(Constants.TITLE_KEY);
    flickrPhotoID=extras.getString(Constants.PHOTO_ID_KEY);
    urls_list=extras.getStringArrayList(Constants.URLS_LIST_KEY);
    current_position=extras.getInt(Constants.CURRENT_POSITION);
    mCity=extras.getString(Constants.CITY_NAME_KEY);
    geoTextInfo=extras.getString(Constants.CITY_GEO_INFO_KEY);
  }
  TextView citytext=(TextView)findViewById(R.id.textviewcityname_photo);
  citytext.setText(mCity);
  TextView text_view_lat_lon=(TextView)findViewById(R.id.text_view_lat_lon_photo);
  text_view_lat_lon.setText(geoTextInfo);
  iv=(ImageView)findViewById(R.id.picture_full_size);
  text_username=(TextView)findViewById(R.id.photo_username);
  text_title=(TextView)findViewById(R.id.photo_title);
  gestureDetector=new GestureDetector(new MyGestureDetector());
  ImageButton addToFavButton=(ImageButton)findViewById(R.id.addToFavoriteBtn);
  addToFavButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      addToFavorites();
    }
  }
);
  new BitmapDownloaderTask(PhotoActivity.this).execute(newUrl);
  text_username.setText("By: " + owner);
  if (!"".equals(title))   text_title.setText(title);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  mSettings=PreferenceManager.getDefaultSharedPreferences(this);
}
 

Example 47

From project gddsched2, under directory /trunk/android/src/com/google/android/apps/iosched2/util/.

Source file: ActivityHelper.java

  17 
vote

/** 
 * Sets up the action bar with the given title and accent color. If title is null, then the app logo will be shown instead of a title. Otherwise, a home button and title are visible. If color is null, then the default colorstrip is visible.
 */
public void setupActionBar(CharSequence title,int color){
  final ViewGroup actionBarCompat=getActionBarCompat();
  if (actionBarCompat == null) {
    return;
  }
  LinearLayout.LayoutParams springLayoutParams=new LinearLayout.LayoutParams(0,ViewGroup.LayoutParams.FILL_PARENT);
  springLayoutParams.weight=1;
  View.OnClickListener homeClickListener=new View.OnClickListener(){
    public void onClick(    View view){
      goHome();
    }
  }
;
  if (title != null) {
    addActionButtonCompat(R.drawable.ic_title_home,R.string.description_home,homeClickListener,true);
    TextView titleText=new TextView(mActivity,null,R.attr.actionbarCompatTextStyle);
    titleText.setLayoutParams(springLayoutParams);
    titleText.setText(title);
    actionBarCompat.addView(titleText);
  }
 else {
    ImageButton logo=new ImageButton(mActivity,null,R.attr.actionbarCompatLogoStyle);
    logo.setOnClickListener(homeClickListener);
    actionBarCompat.addView(logo);
    View spring=new View(mActivity);
    spring.setLayoutParams(springLayoutParams);
    actionBarCompat.addView(spring);
  }
  setActionBarColor(color);
}
 

Example 48

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

Source file: SearchActivity.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  setTheme(Gh4Application.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.search);
  ActionBar actionBar=getSupportActionBar();
  actionBar.setTitle(R.string.search);
  mListViewResults=(ListView)findViewById(R.id.list_search);
  registerForContextMenu(mListViewResults);
  final Spinner languageSpinner=(Spinner)findViewById(R.id.spinner_language);
  final EditText etSearchKey=(EditText)findViewById(R.id.et_search);
  ImageButton btnSearch=(ImageButton)findViewById(R.id.btn_search);
  if (Gh4Application.THEME == R.style.DefaultTheme) {
    btnSearch.setImageResource(R.drawable.action_search_dark);
  }
  etSearchKey.setOnEditorActionListener(new TextView.OnEditorActionListener(){
    @Override public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_SEARCH) {
        String searchKey=etSearchKey.getText().toString();
        String selectedLanguage=(String)languageSpinner.getSelectedItem();
        mProgressDialog=SearchActivity.this.showProgressDialog(SearchActivity.this.getResources().getString(R.string.loading_msg),true);
        searchRepository(searchKey,selectedLanguage);
        hideKeyboard(etSearchKey.getWindowToken());
        return true;
      }
      return false;
    }
  }
);
  btnSearch.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      String searchKey=etSearchKey.getText().toString();
      String selectedLanguage=(String)languageSpinner.getSelectedItem();
      mProgressDialog=SearchActivity.this.showProgressDialog(SearchActivity.this.getResources().getString(R.string.loading_msg),true);
      searchRepository(searchKey,selectedLanguage);
      hideKeyboard(etSearchKey.getWindowToken());
    }
  }
);
}
 

Example 49

From project HapiPodcastJ, under directory /src/info/xuluan/podcast/actionbar/.

Source file: ActionBarHelperBase.java

  17 
vote

/** 
 * Adds an action button to the compatibility action bar, using menu information from a  {@link android.view.MenuItem}. If the menu item ID is <code>menu_refresh</code>, the menu item's state can be changed to show a loading spinner using {@link com.example.android.actionbarcompat.ActionBarHelperBase#setRefreshActionItemState(boolean)}.
 */
private View addActionItemCompatFromMenuItem(final MenuItem item){
  final int itemId=item.getItemId();
  final ViewGroup actionBar=getActionBarCompat();
  if (actionBar == null) {
    return null;
  }
  ImageButton actionButton=new ImageButton(mActivity,null,itemId == android.R.id.home ? R.attr.actionbarCompatItemHomeStyle : R.attr.actionbarCompatItemStyle);
  actionButton.setLayoutParams(new ViewGroup.LayoutParams((int)mActivity.getResources().getDimension(itemId == android.R.id.home ? R.dimen.actionbar_compat_button_home_width : R.dimen.actionbar_compat_button_width),ViewGroup.LayoutParams.FILL_PARENT));
  if (itemId == R.id.menu_refresh) {
    actionButton.setId(R.id.actionbar_compat_item_refresh);
  }
  actionButton.setImageDrawable(item.getIcon());
  actionButton.setScaleType(ImageView.ScaleType.CENTER);
  actionButton.setContentDescription(item.getTitle());
  actionButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      mActivity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL,item);
    }
  }
);
  actionBar.addView(actionButton);
  if (item.getItemId() == R.id.menu_refresh) {
    ProgressBar indicator=new ProgressBar(mActivity,null,R.attr.actionbarCompatProgressIndicatorStyle);
    final int buttonWidth=mActivity.getResources().getDimensionPixelSize(R.dimen.actionbar_compat_button_width);
    final int buttonHeight=mActivity.getResources().getDimensionPixelSize(R.dimen.actionbar_compat_height);
    final int progressIndicatorWidth=buttonWidth / 2;
    LinearLayout.LayoutParams indicatorLayoutParams=new LinearLayout.LayoutParams(progressIndicatorWidth,progressIndicatorWidth);
    indicatorLayoutParams.setMargins((buttonWidth - progressIndicatorWidth) / 2,(buttonHeight - progressIndicatorWidth) / 2,(buttonWidth - progressIndicatorWidth) / 2,0);
    indicator.setLayoutParams(indicatorLayoutParams);
    indicator.setVisibility(View.GONE);
    indicator.setId(R.id.actionbar_compat_item_refresh_progress);
    actionBar.addView(indicator);
  }
  return actionButton;
}
 

Example 50

From project iosched, under directory /android/src/com/google/android/apps/iosched/util/.

Source file: ActivityHelper.java

  17 
vote

/** 
 * Sets up the action bar with the given title and accent color. If title is null, then the app logo will be shown instead of a title. Otherwise, a home button and title are visible. If color is null, then the default colorstrip is visible.
 */
public void setupActionBar(CharSequence title,int color){
  final ViewGroup actionBarCompat=getActionBarCompat();
  if (actionBarCompat == null) {
    return;
  }
  LinearLayout.LayoutParams springLayoutParams=new LinearLayout.LayoutParams(0,ViewGroup.LayoutParams.FILL_PARENT);
  springLayoutParams.weight=1;
  View.OnClickListener homeClickListener=new View.OnClickListener(){
    public void onClick(    View view){
      goHome();
    }
  }
;
  if (title != null) {
    addActionButtonCompat(R.drawable.ic_title_home,R.string.description_home,homeClickListener,true);
    TextView titleText=new TextView(mActivity,null,R.attr.actionbarCompatTextStyle);
    titleText.setLayoutParams(springLayoutParams);
    titleText.setText(title);
    actionBarCompat.addView(titleText);
  }
 else {
    ImageButton logo=new ImageButton(mActivity,null,R.attr.actionbarCompatLogoStyle);
    logo.setOnClickListener(homeClickListener);
    actionBarCompat.addView(logo);
    View spring=new View(mActivity);
    spring.setLayoutParams(springLayoutParams);
    actionBarCompat.addView(spring);
  }
  setActionBarColor(color);
}
 

Example 51

From project iosched2011, under directory /android/src/com/google/android/apps/iosched/util/.

Source file: ActivityHelper.java

  17 
vote

/** 
 * Sets up the action bar with the given title and accent color. If title is null, then the app logo will be shown instead of a title. Otherwise, a home button and title are visible. If color is null, then the default colorstrip is visible.
 */
public void setupActionBar(CharSequence title,int color){
  final ViewGroup actionBarCompat=getActionBarCompat();
  if (actionBarCompat == null) {
    return;
  }
  LinearLayout.LayoutParams springLayoutParams=new LinearLayout.LayoutParams(0,ViewGroup.LayoutParams.FILL_PARENT);
  springLayoutParams.weight=1;
  View.OnClickListener homeClickListener=new View.OnClickListener(){
    public void onClick(    View view){
      goHome();
    }
  }
;
  if (title != null) {
    addActionButtonCompat(R.drawable.ic_title_home,R.string.description_home,homeClickListener,true);
    TextView titleText=new TextView(mActivity,null,R.attr.actionbarCompatTextStyle);
    titleText.setLayoutParams(springLayoutParams);
    titleText.setText(title);
    actionBarCompat.addView(titleText);
  }
 else {
    ImageButton logo=new ImageButton(mActivity,null,R.attr.actionbarCompatLogoStyle);
    logo.setOnClickListener(homeClickListener);
    actionBarCompat.addView(logo);
    View spring=new View(mActivity);
    spring.setLayoutParams(springLayoutParams);
    actionBarCompat.addView(spring);
  }
  setActionBarColor(color);
}
 

Example 52

From project iosched_1, under directory /src/com/google/android/apps/iosched/util/.

Source file: UIUtils.java

  17 
vote

public static void setTitleBarColor(View titleBarView,int color){
  final ViewGroup titleBar=(ViewGroup)titleBarView;
  titleBar.setBackgroundColor(color);
  int brColor=(30 * Color.red(color) + 59 * Color.green(color) + 11 * Color.blue(color)) / 100;
  if (brColor > BRIGHTNESS_THRESHOLD) {
    ((TextView)titleBar.findViewById(R.id.title_text)).setTextColor(titleBar.getContext().getResources().getColor(R.color.title_text_alt));
    titleBar.post(new Runnable(){
      public void run(){
        final int childCount=titleBar.getChildCount();
        for (int i=0; i < childCount; i++) {
          final View child=titleBar.getChildAt(i);
          if (child instanceof ImageButton) {
            final ImageButton childButton=(ImageButton)child;
            if (childButton.getDrawable() != null && childButton.getDrawable() instanceof LevelListDrawable) {
              ((LevelListDrawable)childButton.getDrawable()).setLevel(1);
            }
          }
        }
      }
    }
);
  }
}
 

Example 53

From project iosched_2, under directory /android/src/com/google/android/apps/iosched/util/.

Source file: ActivityHelper.java

  17 
vote

/** 
 * Sets up the action bar with the given title and accent color. If title is null, then the app logo will be shown instead of a title. Otherwise, a home button and title are visible. If color is null, then the default colorstrip is visible.
 */
public void setupActionBar(CharSequence title,int color){
  final ViewGroup actionBarCompat=getActionBarCompat();
  if (actionBarCompat == null) {
    return;
  }
  LinearLayout.LayoutParams springLayoutParams=new LinearLayout.LayoutParams(0,ViewGroup.LayoutParams.FILL_PARENT);
  springLayoutParams.weight=1;
  View.OnClickListener homeClickListener=new View.OnClickListener(){
    public void onClick(    View view){
      goHome();
    }
  }
;
  if (title != null) {
    addActionButtonCompat(R.drawable.ic_title_home,R.string.description_home,homeClickListener,true);
    TextView titleText=new TextView(mActivity,null,R.attr.actionbarCompatTextStyle);
    titleText.setLayoutParams(springLayoutParams);
    titleText.setText(title);
    actionBarCompat.addView(titleText);
  }
 else {
    ImageButton logo=new ImageButton(mActivity,null,R.attr.actionbarCompatLogoStyle);
    logo.setOnClickListener(homeClickListener);
    actionBarCompat.addView(logo);
    View spring=new View(mActivity);
    spring.setLayoutParams(springLayoutParams);
    actionBarCompat.addView(spring);
  }
  setActionBarColor(color);
}
 

Example 54

From project madvertise-android-sdk, under directory /madvertiseSDK/src/de/madvertise/android/sdk/.

Source file: MadvertiseMraidView.java

  17 
vote

private ImageButton addCloseButtonToViewGroup(final ViewGroup parent){
  final ImageButton closeButton=new ImageButton(getContext());
  final FrameLayout.LayoutParams closeButtonParams=new FrameLayout.LayoutParams(CLOSE_BUTTON_SIZE,CLOSE_BUTTON_SIZE);
  closeButtonParams.gravity=Gravity.RIGHT;
  closeButton.setLayoutParams(closeButtonParams);
  closeButton.setBackgroundColor(Color.TRANSPARENT);
  closeButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      close();
    }
  }
);
  parent.addView(closeButton);
  return closeButton;
}
 

Example 55

From project NotePad, under directory /NotePad/src/org/openintents/notepad/filename/.

Source file: FilenameDialog.java

  17 
vote

public FilenameDialog(Context context){
  super(context);
  mContext=context;
  setTitle(context.getText(R.string.menu_edit_tags));
  setButton(context.getText(android.R.string.ok),this);
  setButton2(context.getText(android.R.string.cancel),(OnClickListener)null);
  setIcon(R.drawable.ic_launcher_folder_small);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view=inflater.inflate(R.layout.dialog_filename,null);
  setView(view);
  mEditText=(EditText)view.findViewById(R.id.file_path);
  ImageButton buttonFileManager=(ImageButton)view.findViewById(R.id.file_manager);
  buttonFileManager.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View arg0){
      openFileManager();
    }
  }
);
}
 

Example 56

From project CHMI, under directory /src/org/kaldax/app/chmi/.

Source file: StandardLayoutProviderLegacy.java

  16 
vote

public void AllocateLayoutItems(){
  dateTextView=new TextView(chmiActivity);
  iv=new ImageView(chmiActivity){
    @Override public boolean onTouchEvent(    MotionEvent event){
      iZoomOriginWidth=this.getWidth();
      iZoomOriginHeight=this.getHeight();
      iZoomXCenterPos=event.getX();
      iZoomYCenterPos=event.getY();
      bZoomActive=!bZoomActive;
      ShowImage(chmiActivity.getCurrentImgIdx());
      return super.onTouchEvent(event);
    }
  }
;
  seekBar=new SeekBar(chmiActivity);
  btPlay=new ImageButton(chmiActivity);
  lSeekBar=new LinearLayout(chmiActivity);
  imgProgressText=new TextView(chmiActivity);
  statusText=new TextView(chmiActivity);
  layout=new TableLayout(chmiActivity);
  row2lin=new LinearLayout(chmiActivity);
  imgs=new FrameLayout(chmiActivity);
  tableButtons=new TableLayout(chmiActivity);
  row2a=new TableRow(chmiActivity);
  row2b=new TableRow(chmiActivity);
  row2c=new TableRow(chmiActivity);
  row2d=new TableRow(chmiActivity);
  row2e=new TableRow(chmiActivity);
  frLayout=new FrameLayout(chmiActivity);
  row1=new TableRow(chmiActivity);
  row2fr=new FrameLayout(chmiActivity);
  row4=new LinearLayout(chmiActivity);
  row5=new LinearLayout(chmiActivity);
  row3=new LinearLayout(chmiActivity);
  imgScrollView=new ScrollView(chmiActivity);
}
 

Example 57

From project kevoree-library, under directory /android/org.kevoree.library.android.osmdroid/src/main/java/org/osmdroid/views/overlay/.

Source file: ItemizedOverlayControlView.java

  16 
vote

public ItemizedOverlayControlView(final Context context,final AttributeSet attrs,final ResourceProxy pResourceProxy){
  super(context,attrs);
  this.mPreviousButton=new ImageButton(context);
  this.mPreviousButton.setImageBitmap(pResourceProxy.getBitmap(ResourceProxy.bitmap.previous));
  this.mNextButton=new ImageButton(context);
  this.mNextButton.setImageBitmap(pResourceProxy.getBitmap(ResourceProxy.bitmap.next));
  this.mCenterToButton=new ImageButton(context);
  this.mCenterToButton.setImageBitmap(pResourceProxy.getBitmap(ResourceProxy.bitmap.center));
  this.mNavToButton=new ImageButton(context);
  this.mNavToButton.setImageBitmap(pResourceProxy.getBitmap(ResourceProxy.bitmap.navto_small));
  this.addView(mPreviousButton,new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
  this.addView(mCenterToButton,new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
  this.addView(mNavToButton,new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
  this.addView(mNextButton,new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
  initViewListeners();
}
 

Example 58

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 59

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

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 60

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AAMain.java

  15 
vote

/** 
 * Called when the activity is created and put into memory. This is where all GUI elements should be set up and any other member variables that is used throughout the class
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  articles=new ArrayList<Article>();
  settings=this.getSharedPreferences("settings",0);
  AlarmReceiver.stopAlarm(this);
  adapter=new ArticleAdapter(this);
  this.setListAdapter(adapter);
  ib_refresh=(ImageButton)findViewById(R.id.ib_refresh);
  TextView tv=(TextView)findViewById(R.id.AATitle);
  Typeface face=Typeface.createFromAsset(getAssets(),"fonts/WREXHAM_.TTF");
  tv.setTypeface(face);
  finishReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      articles.clear();
      Bundle articleBundle=intent.getBundleExtra("articles");
      ArrayList<String> titles=articleBundle.getStringArrayList("titles");
      for (      String title : titles)       articles.add((Article)articleBundle.getSerializable(title));
      progressDialog.cancel();
      refresh();
    }
  }
;
  this.registerReceiver(finishReceiver,new IntentFilter("RSSFinish"));
  ib_refresh.setOnClickListener(new OnClickListener(){
    /** 
 * Handles when the user clicks the refresh button
 * @param v - view that was clicked
 */
    @Override public void onClick(    View v){
      runService();
    }
  }
);
  runService();
}
 

Example 61

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

Source file: ActionBar.java

  15 
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 62

From project AlarmApp-Android, under directory /src/org/alarmapp/activities/.

Source file: AlarmStatusActivity.java

  15 
vote

@Override protected void onPostExecute(Collection<AlarmedUser> result){
  super.onPostExecute(result);
  AlarmStatusActivity.this.btRefresh.setVisibility(ImageButton.VISIBLE);
  AlarmStatusActivity.this.pbLoader.setVisibility(ProgressBar.GONE);
  if (result == null)   return;
  displayAlarmStatusView(result);
}
 

Example 63

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

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 64

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

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 65

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

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 66

From project Android_1, under directory /DynamicListItems/src/com/novoda/.

Source file: DynamicListItems.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.dynamic_list);
  newValue=(EditText)findViewById(R.id.new_value_field);
  setListAdapter(new SimpleAdapter(this,list,R.layout.row,new String[]{ITEM_KEY},new int[]{R.id.list_value}));
  ((ImageButton)findViewById(R.id.button)).setOnClickListener(getBtnClickListener());
}
 

Example 67

From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/.

Source file: SearchActivity.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  if (TRACE)   startMethodTracing();
  recordStartTime();
  if (DBG)   Log.d(TAG,"onCreate()");
  super.onCreate(savedInstanceState);
  setContentView();
  SuggestListFocusListener suggestionFocusListener=new SuggestListFocusListener();
  mSuggestionsAdapter=getQsbApplication().createSuggestionsAdapter();
  mSuggestionsAdapter.setSuggestionClickListener(new ClickHandler());
  mSuggestionsAdapter.setOnFocusChangeListener(suggestionFocusListener);
  mQueryTextView=(QueryTextView)findViewById(R.id.search_src_text);
  mSuggestionsView=(SuggestionsView)findViewById(R.id.suggestions);
  mSuggestionsView.setOnScrollListener(new InputMethodCloser());
  mSuggestionsView.setOnKeyListener(new SuggestionsViewKeyListener());
  mSuggestionsView.setOnFocusChangeListener(suggestionFocusListener);
  mSearchGoButton=(ImageButton)findViewById(R.id.search_go_btn);
  mVoiceSearchButton=(ImageButton)findViewById(R.id.search_voice_btn);
  mCorpusIndicator=(ImageButton)findViewById(R.id.corpus_indicator);
  mQueryTextView.addTextChangedListener(new SearchTextWatcher());
  mQueryTextView.setOnKeyListener(new QueryTextViewKeyListener());
  mQueryTextView.setOnFocusChangeListener(new QueryTextViewFocusListener());
  mQueryTextView.setSuggestionClickListener(new ClickHandler());
  mQueryTextEmptyBg=mQueryTextView.getBackground();
  mCorpusIndicator.setOnClickListener(new CorpusIndicatorClickListener());
  mSearchGoButton.setOnClickListener(new SearchGoButtonClickListener());
  mVoiceSearchButton.setOnClickListener(new VoiceSearchButtonClickListener());
  ButtonsKeyListener buttonsKeyListener=new ButtonsKeyListener();
  mSearchGoButton.setOnKeyListener(buttonsKeyListener);
  mVoiceSearchButton.setOnKeyListener(buttonsKeyListener);
  mCorpusIndicator.setOnKeyListener(buttonsKeyListener);
  mUpdateSuggestions=true;
  Intent intent=getIntent();
  setupFromIntent(intent);
  restoreInstanceState(savedInstanceState);
  mSuggestionsAdapter.registerDataSetObserver(new SuggestionsObserver());
  mSuggestionsView.setAdapter(mSuggestionsAdapter);
  mCorporaObserver=new CorporaObserver();
  getCorpora().registerDataSetObserver(mCorporaObserver);
}
 

Example 68

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/ui/tutorials/.

Source file: BaseTutorialActivity.java

  15 
vote

protected void setClickHandler(View content){
  if (content instanceof ViewGroup) {
    for (    View touchable : content.getTouchables()) {
      setClickHandler(touchable);
    }
  }
 else {
    if ((content instanceof Button) || (content instanceof ImageButton)) {
      content.setOnClickListener(this);
    }
  }
}
 

Example 69

From project apg, under directory /src/org/thialfihar/android/apg/ui/widget/.

Source file: KeyEditor.java

  15 
vote

@Override protected void onFinishInflate(){
  setDrawingCacheEnabled(true);
  setAlwaysDrawnWithCacheEnabled(true);
  mAlgorithm=(TextView)findViewById(R.id.algorithm);
  mKeyId=(TextView)findViewById(R.id.keyId);
  mCreationDate=(TextView)findViewById(R.id.creation);
  mExpiryDateButton=(Button)findViewById(R.id.expiry);
  mUsage=(Spinner)findViewById(R.id.usage);
  Choice choices[]={new Choice(Id.choice.usage.sign_only,getResources().getString(R.string.choice_signOnly)),new Choice(Id.choice.usage.encrypt_only,getResources().getString(R.string.choice_encryptOnly)),new Choice(Id.choice.usage.sign_and_encrypt,getResources().getString(R.string.choice_signAndEncrypt))};
  ArrayAdapter<Choice> adapter=new ArrayAdapter<Choice>(getContext(),android.R.layout.simple_spinner_item,choices);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mUsage.setAdapter(adapter);
  mDeleteButton=(ImageButton)findViewById(R.id.delete);
  mDeleteButton.setOnClickListener(this);
  setExpiryDate(null);
  mExpiryDateButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      GregorianCalendar date=mExpiryDate;
      if (date == null) {
        date=new GregorianCalendar();
      }
      DatePickerDialog dialog=new DatePickerDialog(getContext(),mExpiryDateSetListener,date.get(Calendar.YEAR),date.get(Calendar.MONTH),date.get(Calendar.DAY_OF_MONTH));
      dialog.setCancelable(true);
      dialog.setButton(Dialog.BUTTON_NEGATIVE,getContext().getString(R.string.btn_noDate),new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          setExpiryDate(null);
        }
      }
);
      dialog.show();
    }
  }
);
  super.onFinishInflate();
}
 

Example 70

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

Source file: NewMessageActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  Utils.updateTheme(this);
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  setContentView(R.layout.newmessage);
  etTo=(EditText)findViewById(R.id.editTo);
  etMessage=(EditText)findViewById(R.id.editMessage);
  bLocationHint=(Button)findViewById(R.id.buttonLocationHint);
  bTags=(ImageButton)findViewById(R.id.buttonTags);
  bLocation=(ImageButton)findViewById(R.id.buttonLocation);
  bAttachment=(ImageButton)findViewById(R.id.buttonAttachment);
  bSend=(Button)findViewById(R.id.buttonSend);
  progressSend=(ProgressBar)findViewById(R.id.progressSend);
  bLocationHint.setOnClickListener(this);
  bTags.setOnClickListener(this);
  bLocation.setOnClickListener(this);
  bAttachment.setOnClickListener(this);
  bSend.setOnClickListener(this);
  resetForm();
  handleIntent(getIntent());
}
 

Example 71

From project cornerstone, under directory /packages/apps/CSPanel/src/com/onskreen/cornerstone/panel/.

Source file: CSPanel.java

  15 
vote

/** 
 * Author: Onskreen Date: 23/02/2011 Toggle the CS Panel Handler image when user clicks on panel to collapse/expand the CS panel. By default, the panel will be in expanded mode.
 */
public void togglePanel(View view){
  if ((csHandler == (ImageButton)view) && (csState == Cornerstone_State.OPEN)) {
    try {
      ActivityManagerNative.getDefault().setCornerstoneState(false);
    }
 catch (    RemoteException e) {
      e.printStackTrace();
    }
    csHandler.setBackgroundResource(R.drawable.cornerstone_panel_controller_collapsed);
    csState=Cornerstone_State.CLOSED;
  }
 else   if ((csHandler == (ImageButton)view) && (csState == Cornerstone_State.CLOSED)) {
    try {
      ActivityManagerNative.getDefault().setCornerstoneState(true);
    }
 catch (    RemoteException e) {
      e.printStackTrace();
    }
    csHandler.setBackgroundResource(R.drawable.cornerstone_panel_controller_expanded);
    csState=Cornerstone_State.OPEN;
  }
}
 

Example 72

From project cow, under directory /libs/ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(Button)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 73

From project cw-advandroid, under directory /Media/Audio/src/com/commonsware/android/audio/.

Source file: AudioDemo.java

  15 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.main);
  play=(ImageButton)findViewById(R.id.play);
  pause=(ImageButton)findViewById(R.id.pause);
  stop=(ImageButton)findViewById(R.id.stop);
  play.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      play();
    }
  }
);
  pause.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      pause();
    }
  }
);
  stop.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      stop();
    }
  }
);
  setup();
}
 

Example 74

From project cw-omnibus, under directory /external/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 75

From project daily-money, under directory /dailymoney/src/com/bottleworks/dailymoney/ui/.

Source file: DetailListActivity.java

  15 
vote

private void initialContent(){
  dayDateFormat=new SimpleDateFormat("yyyy/MM/dd");
  weekDateFormat=new SimpleDateFormat("MM/dd");
  monthDateFormat=new SimpleDateFormat("yyyy/MM - MMM");
  yearDateFormat=new SimpleDateFormat("yyyy");
  detailListHelper=new DetailListHelper(this,i18n,calHelper,true,new DetailListHelper.OnDetailListener(){
    @Override public void onDetailDeleted(    Detail detail){
      GUIs.shortToast(DetailListActivity.this,i18n.string(R.string.msg_detail_deleted));
      reloadData();
    }
  }
);
  infoView=(TextView)findViewById(R.id.detlist_infobar);
  toolbarView=findViewById(R.id.detlist_toolbar);
  sumIncomeView=(TextView)findViewById(R.id.detlist_sum_income);
  sumExpenseView=(TextView)findViewById(R.id.detlist_sum_expense);
  sumAssetView=(TextView)findViewById(R.id.detlist_sum_asset);
  sumLiabilityView=(TextView)findViewById(R.id.detlist_sum_liability);
  sumOtherView=(TextView)findViewById(R.id.detlist_sum_other);
  sumUnknowView=(TextView)findViewById(R.id.detlist_sum_unknow);
  findViewById(R.id.detlist_prev).setOnClickListener(this);
  findViewById(R.id.detlist_next).setOnClickListener(this);
  findViewById(R.id.detlist_today).setOnClickListener(this);
  modeBtn=(ImageButton)findViewById(R.id.detlist_mode);
  modeBtn.setOnClickListener(this);
  ListView listView=(ListView)findViewById(R.id.detlist_list);
  detailListHelper.setup(listView);
  registerForContextMenu(listView);
  reloadToolbar();
}
 

Example 76

From project DeskSMS, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 77

From project dreamDroid, under directory /libraries/ABS/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 78

From project examples_2, under directory /SearchView/actionbarsherlock-lib/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 79

From project farebot, under directory /libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 80

From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/app/.

Source file: UserPresenceView.java

  15 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  if (isInEditMode())   return;
  mStatusDialogButton=(ImageButton)findViewById(R.id.statusDropDownButton);
  mStatusDialogButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      showStatusListDialog();
    }
  }
);
  mProgressBar=(ProgressBar)findViewById(R.id.progressBar1);
}
 

Example 81

From project GnucashMobile, under directory /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 82

From project Google-Tasks-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 83

From project groundhog-reader, under directory /src/main/java/com/almarsoft/GroundhogReader/.

Source file: MessageListActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.messagelist);
  Context context=getApplicationContext();
  mConfigAlert=new AlertDialog.Builder(this).create();
  mConfigAlert.setButton(getString(R.string.ok),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dlg,    int sumthin){
      startActivity(new Intent(MessageListActivity.this,OptionsActivity.class));
    }
  }
);
  mNumUnread=0;
  mPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  mOfflineMode=mPrefs.getBoolean("offlineMode",true);
  mTitleBar=(TextView)this.findViewById(R.id.topbar_text);
  mGroup=getIntent().getExtras().getString("selectedGroup");
  mGroupID=DBUtils.getGroupIdFromName(mGroup,context);
  mGoGroups=(ImageButton)this.findViewById(R.id.btn_gogroups);
  mGoGroups.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      MessageListActivity.this.startActivity(new Intent(MessageListActivity.this,GroupListActivity.class));
    }
  }
);
  mServerManager=new ServerManager(context);
  PowerManager pm=(PowerManager)context.getSystemService(Context.POWER_SERVICE);
  mWakeLock=pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE,"GroundhogThreading");
  mMsgList=(ListView)this.findViewById(R.id.list_msgs);
  mMsgList.setOnItemClickListener(mListItemClickListener);
  registerForContextMenu(mMsgList);
  Drawable dw=getResources().getDrawable(R.drawable.greyline2);
  mMsgList.setDivider(dw);
  mWakeLock.acquire();
  threadMessagesFromDB();
}
 

Example 84

From project HeLauncher, under directory /src/com/handlerexploit/launcher_reloaded/.

Source file: Search.java

  15 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  mSearchText=(TextView)findViewById(R.id.search_src_text);
  mVoiceButton=(ImageButton)findViewById(R.id.search_voice_btn);
  mSearchText.setOnKeyListener(this);
  mSearchText.setOnClickListener(this);
  mVoiceButton.setOnClickListener(this);
  setOnClickListener(this);
  mSearchText.setOnLongClickListener(this);
  mVoiceButton.setOnLongClickListener(this);
  Drawable googlePlaceholder=getContext().getResources().getDrawable(R.drawable.placeholder_google);
  mSearchText.setCompoundDrawablesWithIntrinsicBounds(googlePlaceholder,null,null,null);
  configureVoiceSearchButton();
}
 

Example 85

From project HSR-Timetable, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 86

From project iosched_3, under directory /libprojects/abs/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 87

From project IRC-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 88

From project ListViewTipsAndTricks, under directory /src/com/cyrilmottier/android/listviewtipsandtricks/widget/.

Source file: LargeTouchableAreasView.java

  15 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  mSelectButton=(ImageButton)findViewById(R.id.btn_select);
  mSelectButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      setItemViewSelected(!mIsSelected);
      if (mOnLargeTouchableAreasListener != null) {
        mOnLargeTouchableAreasListener.onSelected(LargeTouchableAreasView.this,mIsSelected);
      }
    }
  }
);
  mStarButton=(ImageButton)findViewById(R.id.btn_star);
  mStarButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      setItemViewStarred(!mIsStarred);
      if (mOnLargeTouchableAreasListener != null) {
        mOnLargeTouchableAreasListener.onStarred(LargeTouchableAreasView.this,mIsStarred);
      }
    }
  }
);
  mTextView=(TextView)findViewById(R.id.content);
}
 

Example 89

From project Locast-Android, under directory /src/edu/mit/mobile/android/locast/widget/.

Source file: TagList.java

  15 
vote

private void init(Context context){
  recommendedTagView=(ViewGroup)findViewById(R.id.tag_recommended_tags);
  recommendedTagLabel=(TextView)findViewById(R.id.tag_recommended_label);
  addTagEditText=(AutoCompleteTextView)findViewById(R.id.tag_add_text);
  ((ImageButton)findViewById(R.id.tag_add_button)).setOnClickListener(this);
  setOnTagClickListener(this);
  acAdapter=new RemoteTagsAdapter(context,android.R.layout.simple_dropdown_item_1line);
  addTagEditText.setOnFocusChangeListener(this);
  addTagEditText.setAdapter(acAdapter);
  addTagEditText.setOnEditorActionListener(this);
}
 

Example 90

From project LoL-Chat, under directory /src/com/rei/lolchat/ui/.

Source file: ChangeStatus.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.d(TAG,"oncreate");
  setContentView(R.layout.changestatus);
  mOk=(Button)findViewById(R.id.ChangeStatusOk);
  mOk.setOnClickListener(mOnClickOk);
  mContact=(Button)findViewById(R.id.OpenContactList);
  mContact.setOnClickListener(mOnClickOk);
  BeemApplication app=(BeemApplication)getApplication();
  mSettings=PreferenceManager.getDefaultSharedPreferences(this);
  mStatusMessageEditText=(EditText)findViewById(R.id.ChangeStatusMessage);
  mStatusLevelEditText=(EditText)findViewById(R.id.editTextLevel);
  mStatusLeavesEditText=(EditText)findViewById(R.id.editTextLeaves);
  mStatusWinsEditText=(EditText)findViewById(R.id.editTextWins);
  mStatusMsgEditText=(EditText)findViewById(R.id.editTextMsg);
  mStatusMsgEditText.setOnKeyListener(keyListener);
  mStatusWinsEditText.setOnKeyListener(keyListener);
  mStatusLeavesEditText.setOnKeyListener(keyListener);
  mStatusLevelEditText.setOnKeyListener(keyListener);
  mStatusMsgEditText.setText(getPreferenceString(BeemApplication.MSG_KEY));
  mStatusWinsEditText.setText(getPreferenceString(BeemApplication.WINS_KEY));
  mStatusLeavesEditText.setText(getPreferenceString(BeemApplication.LEAVES_KEY));
  mStatusLevelEditText.setText(getPreferenceString(BeemApplication.LEVEL_KEY));
  profileIcon=mSettings.getInt(BeemApplication.PROFILE_KEY,23);
  mAvatar=(ImageButton)findViewById(R.id.avatarButton);
  mAvatar.setOnClickListener(mOnClickOk);
  mAvatar.setImageDrawable(getResources().getDrawable(BeemApplication.PROFILEIDS[profileIcon]));
  refreshStatusXml();
  mSpinner=(Spinner)findViewById(R.id.ChangeStatusSpinner);
  mAdapter=ArrayAdapter.createFromResource(this,R.array.status_types,android.R.layout.simple_spinner_item);
  mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mSpinner.setAdapter(mAdapter);
  mToast=Toast.makeText(this,R.string.ChangeStatusOk,Toast.LENGTH_LONG);
  mSpinner.setSelection(getPreferenceStatusIndex());
  this.registerReceiver(mReceiver,new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
}
 

Example 91

From project MensaUPB, under directory /libs/ActionbarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 92

From project MicDroid, under directory /src/com/intervigil/micdroid/.

Source file: InstrumentalLibrary.java

  15 
vote

/** 
 * Called when the activity is starting. This is where most initialization should go: calling setContentView(int) to inflate the activity's UI, etc.
 * @param savedInstanceState Activity's saved state, if any.
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.instrumental_library);
  mShowAds=PreferenceHelper.getShowAds(InstrumentalLibrary.this);
  mAdView=(AdView)findViewById(R.id.instrumental_ad);
  AdHelper.GenerateAd(mAdView,mShowAds);
  mCurrentTrack=(EditText)findViewById(R.id.instrumental_current);
  mInputFilename=(EditText)findViewById(R.id.instrumental_selected);
  String currentTrack=PreferenceHelper.getInstrumentalTrack(InstrumentalLibrary.this);
  if (!currentTrack.equals(Constants.EMPTY_STRING)) {
    mCurrentTrack.setText(currentTrack);
  }
  ((Button)findViewById(R.id.instrumental_clear_btn)).setOnClickListener(this);
  ((ImageButton)findViewById(R.id.instrumental_select_btn)).setOnClickListener(this);
  ((Button)findViewById(R.id.instrumental_set_btn)).setOnClickListener(this);
}
 

Example 93

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

Source file: AudioPlayer.java

  15 
vote

/** 
 */
public void togglePlay(String url,ImageButton audioButton){
  Log.v(TAG,"audio_debug: togglePlay");
  boolean playNew=false;
  final String filename=safeFilenameEncode(url);
  if (mp.isPlaying()) {
    curPos=mp.getCurrentPosition();
    seekTimes.put(curFilename,curPos);
    if (filename.equals(curFilename)) {
      audioButton.setImageResource(R.drawable.audio_speaker);
      mp.pause();
    }
 else {
      curAudioButton.setImageResource(R.drawable.audio_speaker);
      mp.stop();
      playNew=true;
    }
  }
 else {
    playNew=true;
  }
  if (playNew) {
    mp.reset();
    if (!isFileAvailable(filename)) {
      downloadFileThread(url,audioButton);
    }
 else {
      audioButton.setImageResource(R.drawable.audio_pause);
      play(filename);
    }
  }
  curFilename=filename;
  curAudioButton=audioButton;
}
 

Example 94

From project Monetizing-Android-Demo-Project, under directory /src/dk/trifork/geeknight/bigredbutton/.

Source file: MainActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  buttonText=(TextView)findViewById(R.id.button_text);
  buttonText.setText("");
  button=(ImageButton)findViewById(R.id.red_button);
  textList=getResources().getStringArray(R.array.button_texts);
  currentButtonNumber=-1;
  button.setOnClickListener(this);
  if (isPurchased("upgrade")) {
    button.setBackgroundDrawable(getResources().getDrawable(R.drawable.green_button));
  }
  initializeAdWhirl();
}
 

Example 95

From project mp3tunes-android, under directory /src/com/mp3tunes/android/activity/.

Source file: Player.java

  15 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.audio_player);
  mLocker=(Locker)MP3tunesApplication.getInstance().map.get("mp3tunes_locker");
  mCurrentTime=(TextView)findViewById(R.id.currenttime);
  mTotalTime=(TextView)findViewById(R.id.totaltime);
  mProgress=(ProgressBar)findViewById(android.R.id.progress);
  mProgress.setMax(1000);
  mAlbum=(RemoteImageView)findViewById(R.id.album);
  mArtistName=(TextView)findViewById(R.id.track_artist);
  mTrackName=(TextView)findViewById(R.id.track_title);
  mPrevButton=(ImageButton)findViewById(R.id.rew);
  mPrevButton.setOnClickListener(mPrevListener);
  mPlayButton=(ImageButton)findViewById(R.id.play);
  mPlayButton.setOnClickListener(mPlayListener);
  mPlayButton.requestFocus();
  mNextButton=(ImageButton)findViewById(R.id.fwd);
  mNextButton.setOnClickListener(mNextListener);
  mQueueButton=(ImageButton)findViewById(R.id.playlist_button);
  mQueueButton.setOnClickListener(mQueueListener);
  mAlbumArtWorker=new Worker("album art worker");
  mAlbumArtHandler=new RemoteImageHandler(mAlbumArtWorker.getLooper(),mHandler);
  Music.bindToService(this);
  mIntentFilter=new IntentFilter();
  mIntentFilter.addAction(Mp3tunesService.META_CHANGED);
  mIntentFilter.addAction(Mp3tunesService.PLAYBACK_FINISHED);
  mIntentFilter.addAction(Mp3tunesService.PLAYBACK_STATE_CHANGED);
  mIntentFilter.addAction(Mp3tunesService.PLAYBACK_ERROR);
  mIntentFilter.addAction(Mp3tunesService.DATABASE_ERROR);
}
 

Example 96

From project MyHeath-Android, under directory /actionbarlib/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 97

From project npr-android-app, under directory /src/org/npr/android/news/.

Source file: ListenView.java

  15 
vote

private void init(){
  ViewGroup.inflate(getContext(),R.layout.listen,this);
  drawer=(SlidingDrawer)findViewById(R.id.drawer);
  drawer.setOnDrawerOpenListener(this);
  drawer.setOnDrawerCloseListener(this);
  playButton=(ImageButton)findViewById(R.id.StreamPlayButton);
  playButton.setEnabled(false);
  playButton.setOnClickListener(this);
  streamButton=(ImageButton)findViewById(R.id.StreamShareButton);
  streamButton.setOnClickListener(this);
  streamButton.setEnabled(false);
  Button playlistButton=(Button)findViewById(R.id.StreamPlaylistButton);
  playlistButton.setOnClickListener(this);
  progressBar=(SeekBar)findViewById(R.id.StreamProgressBar);
  progressBar.setOnSeekBarChangeListener(this);
  progressBar.setEnabled(false);
  infoText=(TextView)findViewById(R.id.StreamTextView);
  lengthText=(TextView)findViewById(R.id.StreamLengthText);
  lengthText.setText("");
  attachToPlaybackService();
}
 

Example 98

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 99

From project onebusaway-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 100

From project open311-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuItemView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageButton=(ImageButton)findViewById(R.id.abs__imageButton);
  mTextButton=(CapitalizingButton)findViewById(R.id.abs__textButton);
  mImageButton.setOnClickListener(this);
  mTextButton.setOnClickListener(this);
  mImageButton.setOnLongClickListener(this);
  setOnClickListener(this);
  setOnLongClickListener(this);
}
 

Example 101

From project opensudoku, under directory /OpenSudoku/src/cz/romario/opensudoku/gui/inputmethod/.

Source file: IMNumpad.java

  15 
vote

@Override protected View createControlPanelView(){
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View controlPanel=inflater.inflate(R.layout.im_numpad,null);
  mNumberButtons=new HashMap<Integer,Button>();
  mNumberButtons.put(1,(Button)controlPanel.findViewById(R.id.button_1));
  mNumberButtons.put(2,(Button)controlPanel.findViewById(R.id.button_2));
  mNumberButtons.put(3,(Button)controlPanel.findViewById(R.id.button_3));
  mNumberButtons.put(4,(Button)controlPanel.findViewById(R.id.button_4));
  mNumberButtons.put(5,(Button)controlPanel.findViewById(R.id.button_5));
  mNumberButtons.put(6,(Button)controlPanel.findViewById(R.id.button_6));
  mNumberButtons.put(7,(Button)controlPanel.findViewById(R.id.button_7));
  mNumberButtons.put(8,(Button)controlPanel.findViewById(R.id.button_8));
  mNumberButtons.put(9,(Button)controlPanel.findViewById(R.id.button_9));
  mNumberButtons.put(0,(Button)controlPanel.findViewById(R.id.button_clear));
  for (  Integer num : mNumberButtons.keySet()) {
    Button b=mNumberButtons.get(num);
    b.setTag(num);
    b.setOnClickListener(mNumberButtonClick);
  }
  mSwitchNumNoteButton=(ImageButton)controlPanel.findViewById(R.id.switch_num_note);
  mSwitchNumNoteButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      mEditMode=mEditMode == MODE_EDIT_VALUE ? MODE_EDIT_NOTE : MODE_EDIT_VALUE;
      update();
    }
  }
);
  return controlPanel;
}