Java Code Examples for android.widget.ImageButton#setFocusable()

The following examples show how to use android.widget.ImageButton#setFocusable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppPickerPreference.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);

    LinearLayout widgetFrameView = ((LinearLayout) view.findViewById(android.R.id.widget_frame));
    mBtnAppIcon = new ImageButton(mContext);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mAppIconPreviewSizePx, mAppIconPreviewSizePx);
    lp.gravity = Gravity.CENTER;
    mBtnAppIcon.setLayoutParams(lp);
    mBtnAppIcon.setScaleType(ScaleType.CENTER_CROP);
    mBtnAppIcon.setImageDrawable(mAppInfo.icon);
    mBtnAppIcon.setFocusable(false);
    if (mIconPickerEnabled) {
        mBtnAppIcon.setOnClickListener(this);
        mBtnAppIcon.setOnLongClickListener(this);
    } else {
        mBtnAppIcon.setEnabled(false);
    }
    widgetFrameView.addView(mBtnAppIcon);
    widgetFrameView.setVisibility(View.VISIBLE);
}
 
Example 2
Source File: PagerSlidingTabStripEmoji.java    From Yahala-Messenger with MIT License 6 votes vote down vote up
private void addIconTab(final int position, int resId) {

        ImageButton tab = new ImageButton(getContext());
        tab.setFocusable(true);
        tab.setImageResource(resId);

        tab.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                pager.setCurrentItem(position);
            }
        });

        tabsContainer.addView(tab);
        tab.setSelected(position == currentPosition);
    }
 
Example 3
Source File: AlbumView.java    From Popeens-DSub with GNU General Public License v3.0 6 votes vote down vote up
public AlbumView(Context context, boolean cell) {
	super(context);

	if(cell) {
		LayoutInflater.from(context).inflate(R.layout.album_cell_item, this, true);
	} else {
		LayoutInflater.from(context).inflate(R.layout.album_list_item, this, true);
	}

	coverArtView = findViewById(R.id.album_coverart);
	listenedView = (ImageView) findViewById(R.id.album_listened);
	titleView = (TextView) findViewById(R.id.album_title);
	artistView = (TextView) findViewById(R.id.album_artist);

	ratingBar = (RatingBar) findViewById(R.id.album_rating);
	ratingBar.setFocusable(false);
	starButton = (ImageButton) findViewById(R.id.album_star);
	starButton.setFocusable(false);
	moreButton = (ImageView) findViewById(R.id.item_more);

	sqlh  = new SQLiteHandler(context);

	checkable = true;
}
 
Example 4
Source File: PodcastChannelView.java    From Popeens-DSub with GNU General Public License v3.0 6 votes vote down vote up
public PodcastChannelView(Context context, ImageLoader imageLoader, boolean largeCell) {
	super(context);

	this.imageLoader = imageLoader;
	if(imageLoader != null) {
		LayoutInflater.from(context).inflate(largeCell ? R.layout.basic_cell_item : R.layout.basic_art_item, this, true);
	} else {
		LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true);
	}

	titleView = (TextView) findViewById(R.id.item_name);

	starButton = (ImageButton) findViewById(R.id.item_star);
	if(starButton != null) {
		starButton.setFocusable(false);
	}
	moreButton = (ImageView) findViewById(R.id.item_more);
	moreButton.setOnClickListener(new View.OnClickListener() {
		public void onClick(View v) {
			v.showContextMenu();
		}
	});
	coverArtView = findViewById(R.id.item_art);
}
 
Example 5
Source File: SongView.java    From Popeens-DSub with GNU General Public License v3.0 6 votes vote down vote up
public SongView(Context context) {
	super(context);
	LayoutInflater.from(context).inflate(R.layout.song_list_item, this, true);

	trackTextView = (TextView) findViewById(R.id.song_track);
	titleTextView = (TextView) findViewById(R.id.song_title);
	artistTextView = (TextView) findViewById(R.id.song_artist);
	durationTextView = (TextView) findViewById(R.id.song_duration);
	statusTextView = (TextView) findViewById(R.id.song_status);
	statusImageView = (ImageView) findViewById(R.id.song_status_icon);
	ratingBar = (RatingBar) findViewById(R.id.song_rating);
	starButton = (ImageButton) findViewById(R.id.song_star);
	starButton.setFocusable(false);
	bookmarkButton = (ImageButton) findViewById(R.id.song_bookmark);
	bookmarkButton.setFocusable(false);
	playedButton = (ImageButton) findViewById(R.id.song_played);
	moreButton = (ImageView) findViewById(R.id.item_more);
	bottomRowView = findViewById(R.id.song_bottom);
}
 
Example 6
Source File: PagerSlidingTabStrip.java    From Pimp_my_Z1 with GNU General Public License v2.0 6 votes vote down vote up
private void addIconTab(final int position, int resId) {

        ImageButton tab = new ImageButton(getContext());
        tab.setFocusable(true);
        tab.setImageResource(resId);

        tab.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                pager.setCurrentItem(position);
            }
        });

        tabsContainer.addView(tab);

    }
 
Example 7
Source File: MainActivity.java    From hyperion-android-grabber with MIT License 5 votes vote down vote up
private void initActivity() {
    // assume the recorder is not running until we are notified otherwise
    mRecorderRunning = false;

    setContentView(R.layout.activity_main);
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    mMediaProjectionManager = (MediaProjectionManager)
                                    getSystemService(Context.MEDIA_PROJECTION_SERVICE);

    ImageView iv = findViewById(R.id.power_toggle);
    iv.setOnClickListener(this);
    iv.setOnFocusChangeListener(this);
    iv.setFocusable(true);
    iv.requestFocus();

    ImageButton ib = findViewById(R.id.settingsButton);
    ib.setOnClickListener(this);
    ib.setOnFocusChangeListener(this);
    ib.setFocusable(true);

    setImageViews(mRecorderRunning, false);

    LocalBroadcastManager.getInstance(this).registerReceiver(
            mMessageReceiver, new IntentFilter(BROADCAST_FILTER));

    // request an update on the running status
    checkForInstance();
}
 
Example 8
Source File: SearchScreenOverlay.java    From talkback with Apache License 2.0 5 votes vote down vote up
/** Disables the {@code button} and applies the grey-out effect. */
private static void disableImageButton(@Nullable ImageButton button) {
  if (button == null) {
    return;
  }

  button.setEnabled(false);
  // Set focusable to false to prevent receiving focus.
  button.setFocusable(false);
  // Apply grey out effect.
  button.setImageAlpha(0x50);
}
 
Example 9
Source File: SearchScreenOverlay.java    From talkback with Apache License 2.0 5 votes vote down vote up
/** Enables the {@code button} and removes the grey-out effect. */
private static void enableImageButton(@Nullable ImageButton button) {
  if (button == null) {
    return;
  }

  button.setEnabled(true);
  // Set focusable to true to receive focus.
  button.setFocusable(true);
  // Remove grey out effect.
  button.setImageAlpha(0xFF);
}
 
Example 10
Source File: ArtistEntryView.java    From Popeens-DSub with GNU General Public License v3.0 5 votes vote down vote up
public ArtistEntryView(Context context) {
      super(context);
      LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true);

      titleView = (TextView) findViewById(R.id.item_name);
starButton = (ImageButton) findViewById(R.id.item_star);
starButton.setFocusable(false);
moreButton = (ImageView) findViewById(R.id.item_more);
moreButton.setOnClickListener(new View.OnClickListener() {
	public void onClick(View v) {
		v.showContextMenu();
	}
});
  }
 
Example 11
Source File: ShareView.java    From Popeens-DSub with GNU General Public License v3.0 5 votes vote down vote up
public ShareView(Context context) {
	super(context, false);
	LayoutInflater.from(context).inflate(R.layout.complex_list_item, this, true);

	titleView = (TextView) findViewById(R.id.item_name);
	descriptionView = (TextView) findViewById(R.id.item_description);
	starButton = (ImageButton) findViewById(R.id.item_star);
	starButton.setFocusable(false);
	moreButton = (ImageView) findViewById(R.id.item_more);
	moreButton.setOnClickListener(new View.OnClickListener() {
		public void onClick(View v) {
			v.showContextMenu();
		}
	});
}
 
Example 12
Source File: BasicListView.java    From Popeens-DSub with GNU General Public License v3.0 5 votes vote down vote up
public BasicListView(Context context) {
	super(context, false);
	LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true);

	titleView = (TextView) findViewById(R.id.item_name);
	starButton = (ImageButton) findViewById(R.id.item_star);
	starButton.setFocusable(false);
	moreButton = (ImageView) findViewById(R.id.item_more);
	moreButton.setVisibility(View.GONE);
}
 
Example 13
Source File: ArtistView.java    From Popeens-DSub with GNU General Public License v3.0 5 votes vote down vote up
public ArtistView(Context context) {
      super(context);
      LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true);

      titleView = (TextView) findViewById(R.id.item_name);
starButton = (ImageButton) findViewById(R.id.item_star);
starButton.setFocusable(false);
moreButton = (ImageView) findViewById(R.id.item_more);
moreButton.setOnClickListener(new View.OnClickListener() {
	public void onClick(View v) {
		v.showContextMenu();
	}
});
  }
 
Example 14
Source File: LocalServiceFragment.java    From android-tv-launcher with MIT License 5 votes vote down vote up
private void initView(View view) {

        tv = (ImageButton) view.findViewById(R.id.local_tv);
        tour = (ImageButton) view.findViewById(R.id.local_tour);
        ad1 = (ImageButton) view.findViewById(R.id.local_ad1);
        ad2 = (ImageButton) view.findViewById(R.id.local_ad2);
        cate = (ImageButton) view.findViewById(R.id.local_cate);
        weather = (ImageButton) view.findViewById(R.id.local_weather);
        news = (ImageButton) view.findViewById(R.id.local_news);
        appStore = (ImageButton) view.findViewById(R.id.local_app_store);
        video = (ImageButton) view.findViewById(R.id.local_video);

        tv.setOnFocusChangeListener(mFocusChangeListener);
        tour.setOnFocusChangeListener(mFocusChangeListener);
        ad1.setOnFocusChangeListener(mFocusChangeListener);
        ad2.setOnFocusChangeListener(mFocusChangeListener);
        cate.setOnFocusChangeListener(mFocusChangeListener);
        weather.setOnFocusChangeListener(mFocusChangeListener);
        news.setOnFocusChangeListener(mFocusChangeListener);
        appStore.setOnFocusChangeListener(mFocusChangeListener);
        video.setOnFocusChangeListener(mFocusChangeListener);

        tv.setOnClickListener(this);
        video.setOnClickListener(this);

        tv.setFocusable(true);
        tv.setFocusableInTouchMode(true);
        tv.requestFocus();
        tv.requestFocusFromTouch();
    }
 
Example 15
Source File: PagerSlidingTabStrip.java    From KitKatEmoji with MIT License 5 votes vote down vote up
private void addIconTab(final int position, int resId) {

        ImageButton tab = new ImageButton(getContext());
        tab.setImageResource(resId);
        tab.setFocusable(true);
        addTab(position, tab);
        tab.setSelected(position == currentPosition);
    }
 
Example 16
Source File: ZenMenuAdapter.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
		View convertView, ViewGroup parent) {
	Map<String, String> map = (Map<String, String>)mHeaders.get(groupPosition);
	String text = (String)map.get("name");
	if(convertView == null) {
		convertView = mInflater.inflate(R.layout.zen_menu_group, null);			
	}
	ImageButton itemLeft = (ImageButton)convertView.findViewById(R.id.zen_menu_header_left);
	Button itemRight = (Button)convertView.findViewById(R.id.zen_menu_header_right);
	itemRight.setText(text);
	
	itemLeft.setImageResource(R.drawable.menu_right_arrow);
	if(isExpanded) {
		itemLeft.setImageResource(R.drawable.menu_down_arrow);
	}
	
	int background = menu_item_backgrounds[groupPosition%9];
	itemLeft.setBackgroundResource(background);
	itemRight.setBackgroundResource(background);
	itemLeft.setFocusable(false);
	itemRight.setFocusable(false);
	itemLeft.setClickable(false);
	itemRight.setClickable(false);
	
	
	
	return convertView;
}