Search in sources :

Example 61 with AdapterView

use of android.widget.AdapterView in project cardslib by gabrielemariotti.

the class CardListDragDropView method init.

//--------------------------------------------------------------------------
// Init
//--------------------------------------------------------------------------
/**
     * Initialize
     *
     * @param attrs
     * @param defStyle
     */
protected void init(AttributeSet attrs, int defStyle) {
    //Init attrs
    initAttrs(attrs, defStyle);
    //Set divider to 0dp
    setDividerHeight(0);
    //enable and set the drag and drop feature
    enableDragAndDrop();
    setDraggableManager(new CardTouchViewDraggableManager(R.id.list_cardId));
    setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            startDragging(position - getHeaderViewsCount());
            return true;
        }
    });
}
Also used : CardTouchViewDraggableManager(it.gmariotti.cardslib.library.extra.dragdroplist.internal.CardTouchViewDraggableManager) View(android.view.View) AdapterView(android.widget.AdapterView) DynamicListView(com.nhaarman.listviewanimations.itemmanipulation.DynamicListView)

Example 62 with AdapterView

use of android.widget.AdapterView in project fresco by facebook.

the class DraweeRoundedCornersFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    findDrawees(view);
    initColors();
    final Spinner scaleType = (Spinner) view.findViewById(R.id.scaleType);
    final SimpleScaleTypeAdapter scaleTypeAdapter = SimpleScaleTypeAdapter.createForAllScaleTypes();
    scaleType.setAdapter(scaleTypeAdapter);
    scaleType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            final SimpleScaleTypeAdapter.Entry spinnerEntry = (SimpleScaleTypeAdapter.Entry) scaleTypeAdapter.getItem(position);
            final ScaleType scaleType = spinnerEntry.scaleType;
            changeDraweeViewScaleType(mDraweeRound, scaleType, spinnerEntry.focusPoint);
            changeDraweeViewScaleType(mDraweeRadius, scaleType, spinnerEntry.focusPoint);
            changeDraweeViewScaleType(mDraweeSome, scaleType, spinnerEntry.focusPoint);
            changeDraweeViewScaleType(mDraweeFancy, scaleType, spinnerEntry.focusPoint);
            if (BITMAP_ONLY_SCALETYPES.contains(scaleType) && !BITMAP_ONLY_SCALETYPES.contains(mPreviousScaleType)) {
                Toast.makeText(getContext(), R.string.drawee_rounded_corners_bitmap_only_toast, Toast.LENGTH_SHORT).show();
            } else if (!BITMAP_ONLY_SCALETYPES.contains(scaleType) && BITMAP_ONLY_SCALETYPES.contains(mPreviousScaleType)) {
                Toast.makeText(getContext(), R.string.drawee_rounded_corners_overlay_color_toast, Toast.LENGTH_SHORT).show();
            }
            mPreviousScaleType = scaleType;
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    final CheckBox borders = (CheckBox) view.findViewById(R.id.borders);
    borders.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            setShowBorder(mDraweeRound, isChecked);
            setShowBorder(mDraweeRadius, isChecked);
            setShowBorder(mDraweeSome, isChecked);
            setShowBorder(mDraweeFancy, isChecked);
        }
    });
    final Resources res = getResources();
    final RoundingParams fancyRoundingParams = RoundingParams.fromCornersRadii(res.getDimensionPixelSize(R.dimen.drawee_rounded_corners_fancy_top_left), res.getDimensionPixelSize(R.dimen.drawee_rounded_corners_fancy_top_right), res.getDimensionPixelSize(R.dimen.drawee_rounded_corners_fancy_bottom_right), res.getDimensionPixelSize(R.dimen.drawee_rounded_corners_fancy_bottom_left));
    mDraweeFancy.getHierarchy().setRoundingParams(fancyRoundingParams);
}
Also used : Spinner(android.widget.Spinner) ScaleType(com.facebook.drawee.drawable.ScalingUtils.ScaleType) SimpleScaleTypeAdapter(com.facebook.fresco.samples.showcase.common.SimpleScaleTypeAdapter) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) AdapterView(android.widget.AdapterView) CheckBox(android.widget.CheckBox) AdapterView(android.widget.AdapterView) Resources(android.content.res.Resources) CompoundButton(android.widget.CompoundButton) RoundingParams(com.facebook.drawee.generic.RoundingParams)

Example 63 with AdapterView

use of android.widget.AdapterView in project fresco by facebook.

the class DraweeScaleTypeFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_drawee_scale_type, container, false);
    mDraweeTop1 = (SimpleDraweeView) view.findViewById(R.id.drawee_view_top_1);
    mDraweeTop2 = (SimpleDraweeView) view.findViewById(R.id.drawee_view_top_2);
    mDraweeMain = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
    mSpinner = (Spinner) view.findViewById(R.id.spinner);
    mDraweeTop1.setImageURI(URI_1);
    mDraweeTop1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            changeMainDraweeUri(URI_1);
        }
    });
    mDraweeTop2.setImageURI(URI_2);
    mDraweeTop2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            changeMainDraweeUri(URI_2);
        }
    });
    changeMainDraweeUri(URI_1);
    final SimpleScaleTypeAdapter adapter = SimpleScaleTypeAdapter.createForAllScaleTypes();
    mSpinner.setAdapter(adapter);
    mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            final SimpleScaleTypeAdapter.Entry spinnerEntry = (SimpleScaleTypeAdapter.Entry) adapter.getItem(position);
            changeMainDraweeScaleType(spinnerEntry.scaleType, spinnerEntry.focusPoint);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    mSpinner.setSelection(0);
    return view;
}
Also used : SimpleScaleTypeAdapter(com.facebook.fresco.samples.showcase.common.SimpleScaleTypeAdapter) AdapterView(android.widget.AdapterView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) AdapterView(android.widget.AdapterView) Nullable(android.support.annotation.Nullable)

Example 64 with AdapterView

use of android.widget.AdapterView in project fresco by facebook.

the class ImageFormatGifFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
    final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
    switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked ? new CheckerBoardDrawable(getResources()) : null);
        }
    });
    final Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
    spinner.setAdapter(new SimpleUriListAdapter());
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            final Entry spinnerEntry = SPINNER_ENTRIES[spinner.getSelectedItemPosition()];
            setAnimationUri(spinnerEntry.uri);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    spinner.setSelection(0);
}
Also used : Spinner(android.widget.Spinner) TextView(android.widget.TextView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) AdapterView(android.widget.AdapterView) CheckerBoardDrawable(com.facebook.fresco.samples.showcase.misc.CheckerBoardDrawable) AdapterView(android.widget.AdapterView) CompoundButton(android.widget.CompoundButton) SwitchCompat(android.support.v7.widget.SwitchCompat)

Example 65 with AdapterView

use of android.widget.AdapterView in project Android-AccountChooser by frakbot.

the class ChooseAccountActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mAccounts = getIntent().getParcelableArrayExtra(AccountManager.KEY_ACCOUNTS);
    mAccountManagerResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_MANAGER_RESPONSE);
    // KEY_ACCOUNTS is a required parameter
    if (mAccounts == null) {
        setResult(RESULT_CANCELED);
        finish();
        return;
    }
    getAuthDescriptions();
    AccountInfo[] mAccountInfos = new AccountInfo[mAccounts.length];
    for (int i = 0; i < mAccounts.length; i++) {
        mAccountInfos[i] = new AccountInfo(((Account) mAccounts[i]).name, getDrawableForType(((Account) mAccounts[i]).type));
    }
    setContentView(R.layout.choose_account);
    // Setup the list
    ListView list = (ListView) findViewById(android.R.id.list);
    // Use an existing ListAdapter that will map an array of strings to TextViews
    list.setAdapter(new AccountArrayAdapter(this, android.R.layout.simple_list_item_1, mAccountInfos));
    list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    list.setTextFilterEnabled(true);
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            onListItemClick((ListView) parent, v, position, id);
        }
    });
}
Also used : Account(android.accounts.Account) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

AdapterView (android.widget.AdapterView)677 View (android.view.View)653 ListView (android.widget.ListView)412 TextView (android.widget.TextView)342 Intent (android.content.Intent)177 ImageView (android.widget.ImageView)174 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)142 ArrayAdapter (android.widget.ArrayAdapter)75 ArrayList (java.util.ArrayList)71 ViewGroup (android.view.ViewGroup)63 AbsListView (android.widget.AbsListView)59 GridView (android.widget.GridView)58 Bundle (android.os.Bundle)53 Spinner (android.widget.Spinner)50 LinearLayout (android.widget.LinearLayout)49 OnClickListener (android.view.View.OnClickListener)46 RecyclerView (android.support.v7.widget.RecyclerView)42 DialogInterface (android.content.DialogInterface)41 SuppressLint (android.annotation.SuppressLint)38 LayoutInflater (android.view.LayoutInflater)34