Search in sources :

Example 11 with ImageView

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;
    }
}
Also used : SearchManager(android.app.SearchManager) ComponentName(android.content.ComponentName) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) AppWidgetHostView(android.appwidget.AppWidgetHostView) Point(android.graphics.Point)

Example 12 with ImageView

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);
}
Also used : ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) AppWidgetHostView(android.appwidget.AppWidgetHostView)

Example 13 with ImageView

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()));
}
Also used : ImageView(android.widget.ImageView)

Example 14 with ImageView

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;
}
Also used : Bitmap(android.graphics.Bitmap) Canvas(android.graphics.Canvas) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) AbsListView(android.widget.AbsListView) View(android.view.View) ListView(android.widget.ListView) Paint(android.graphics.Paint)

Example 15 with ImageView

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();
            }
        }
    });
}
Also used : ViewHolderBase(com.github.obsessive.library.adapter.ViewHolderBase) Intent(android.content.Intent) GridView(android.widget.GridView) ImageView(android.widget.ImageView) InjectView(butterknife.InjectView) View(android.view.View) AdapterView(android.widget.AdapterView) LayoutInflater(android.view.LayoutInflater) AdapterView(android.widget.AdapterView) ImageItem(com.github.obsessive.library.picker.ImageItem) ImageView(android.widget.ImageView) ViewHolderCreator(com.github.obsessive.library.adapter.ViewHolderCreator)

Aggregations

ImageView (android.widget.ImageView)2176 View (android.view.View)1100 TextView (android.widget.TextView)963 Drawable (android.graphics.drawable.Drawable)192 Intent (android.content.Intent)191 LinearLayout (android.widget.LinearLayout)187 Bitmap (android.graphics.Bitmap)175 ViewGroup (android.view.ViewGroup)161 LayoutInflater (android.view.LayoutInflater)155 OnClickListener (android.view.View.OnClickListener)142 AdapterView (android.widget.AdapterView)108 ListView (android.widget.ListView)101 RecyclerView (android.support.v7.widget.RecyclerView)97 FrameLayout (android.widget.FrameLayout)95 Button (android.widget.Button)80 BitmapDrawable (android.graphics.drawable.BitmapDrawable)75 Bundle (android.os.Bundle)73 Test (org.junit.Test)70 RelativeLayout (android.widget.RelativeLayout)69 Context (android.content.Context)65