use of android.widget.ImageView in project Launcher3 by chislon.
the class LauncherTransitionable method updateGlobalSearchIcon.
protected boolean updateGlobalSearchIcon() {
final View searchButtonContainer = findViewById(R.id.search_button_container);
final ImageView searchButton = (ImageView) findViewById(R.id.search_button);
final View voiceButtonContainer = findViewById(R.id.voice_button_container);
final View voiceButton = findViewById(R.id.voice_button);
final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
ComponentName activityName = searchManager.getGlobalSearchActivity();
if (activityName != null) {
int coi = getCurrentOrientationIndexForGlobalIcons();
sGlobalSearchIcon[coi] = updateButtonWithIconFromExternalActivity(R.id.search_button, activityName, R.drawable.ic_home_search_normal_holo, TOOLBAR_SEARCH_ICON_METADATA_NAME);
if (sGlobalSearchIcon[coi] == null) {
sGlobalSearchIcon[coi] = updateButtonWithIconFromExternalActivity(R.id.search_button, activityName, R.drawable.ic_home_search_normal_holo, TOOLBAR_ICON_METADATA_NAME);
}
if (searchButtonContainer != null)
searchButtonContainer.setVisibility(View.VISIBLE);
searchButton.setVisibility(View.VISIBLE);
invalidatePressedFocusedStates(searchButtonContainer, searchButton);
return true;
} else {
// We disable both search and voice search when there is no global search provider
if (searchButtonContainer != null)
searchButtonContainer.setVisibility(View.GONE);
if (voiceButtonContainer != null)
voiceButtonContainer.setVisibility(View.GONE);
if (searchButton != null)
searchButton.setVisibility(View.GONE);
if (voiceButton != null)
voiceButton.setVisibility(View.GONE);
updateVoiceButtonProxyVisible(false);
return false;
}
}
use of android.widget.ImageView in project Launcher3 by chislon.
the class LauncherTransitionable method updateGlobalSearchIcon.
protected void updateGlobalSearchIcon(Drawable.ConstantState d) {
final View searchButtonContainer = findViewById(R.id.search_button_container);
final View searchButton = (ImageView) findViewById(R.id.search_button);
updateButtonWithDrawable(R.id.search_button, d);
invalidatePressedFocusedStates(searchButtonContainer, searchButton);
}
use of android.widget.ImageView in project Launcher3 by chislon.
the class LauncherTransitionable method updateButtonWithDrawable.
private void updateButtonWithDrawable(int buttonId, Drawable.ConstantState d) {
ImageView button = (ImageView) findViewById(buttonId);
button.setImageDrawable(d.newDrawable(getResources()));
}
use of android.widget.ImageView in project philm by chrisbanes.
the class PinnedSectionListView method createPinnedShadow.
/**
* Create shadow wrapper with a pinned view for a view at given position
*/
void createPinnedShadow(int position) {
// try to recycle shadow
PinnedSection pinnedShadow = mRecycleSection;
mRecycleSection = null;
// create new shadow, if needed
if (pinnedShadow == null) {
pinnedShadow = new PinnedSection();
}
// request new view using recycled view, if such
View pinnedView;
final int childIndex = position - getFirstVisiblePosition();
final View sectionView = getChildAt(childIndex);
if (sectionView != null) {
Bitmap b = Bitmap.createBitmap(sectionView.getWidth(), sectionView.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
c.drawColor(getThemeBackgroundColor());
sectionView.draw(c);
pinnedView = new ImageView(getContext());
((ImageView) pinnedView).setImageBitmap(b);
} else {
pinnedView = getAdapter().getView(position, null, PinnedSectionListView.this);
}
// read layout parameters
LayoutParams layoutParams = (LayoutParams) pinnedView.getLayoutParams();
if (layoutParams == null) {
// create default layout params
layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
int heightMode = MeasureSpec.getMode(layoutParams.height);
int heightSize = MeasureSpec.getSize(layoutParams.height);
if (heightMode == MeasureSpec.UNSPECIFIED) {
heightMode = MeasureSpec.EXACTLY;
}
int maxHeight = getHeight() - getListPaddingTop() - getListPaddingBottom();
if (heightSize > maxHeight) {
heightSize = maxHeight;
}
// measure & layout
int ws = MeasureSpec.makeMeasureSpec(getWidth() - getListPaddingLeft() - getListPaddingRight(), MeasureSpec.EXACTLY);
int hs = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
pinnedView.measure(ws, hs);
pinnedView.layout(0, 0, pinnedView.getMeasuredWidth(), pinnedView.getMeasuredHeight());
mTranslateY = 0;
// initialize pinned shadow
pinnedShadow.view = pinnedView;
pinnedShadow.position = position;
pinnedShadow.id = getAdapter().getItemId(position);
// store pinned shadow
mPinnedSection = pinnedShadow;
}
use of android.widget.ImageView in project SimplifyReader by chentao0707.
the class CommonImagePickerDetailActivity method initViewsAndEvents.
@Override
protected void initViewsAndEvents() {
mGridViewAdapter = new ListViewDataAdapter<>(new ViewHolderCreator<ImageItem>() {
@Override
public ViewHolderBase<ImageItem> createViewHolder(int position) {
return new ViewHolderBase<ImageItem>() {
ImageView mItemImage;
@Override
public View createView(LayoutInflater layoutInflater) {
View convertView = layoutInflater.inflate(R.layout.grid_item_common_image_picker, null);
mItemImage = ButterKnife.findById(convertView, R.id.grid_item_common_image_picker_image);
return convertView;
}
@Override
public void showData(int position, ImageItem itemData) {
if (null != itemData) {
String imagePath = itemData.getImagePath();
if (!CommonUtils.isEmpty(imagePath)) {
ImageLoader.getInstance().displayImage("file://" + imagePath, mItemImage, ImageLoaderHelper.getInstance(mContext).getDisplayOptions());
}
}
}
};
}
});
mGridViewAdapter.getDataList().addAll(mGridListData);
commonImagePickerDetailGridView.setAdapter(mGridViewAdapter);
commonImagePickerDetailGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (null != mGridViewAdapter && null != mGridViewAdapter.getDataList() && !mGridViewAdapter.getDataList().isEmpty() && position < mGridViewAdapter.getDataList().size()) {
Intent intent = new Intent();
intent.putExtra(KEY_BUNDLE_RESULT_IMAGE_PATH, mGridViewAdapter.getDataList().get(position).getImagePath());
setResult(RESULT_OK, intent);
finish();
}
}
});
}
Aggregations