Search in sources :

Example 71 with AdapterView

use of android.widget.AdapterView in project facebook-android-sdk by facebook.

the class AccountKitLoginActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.accountkit_activity_main);
    if (AccountKit.getCurrentAccessToken() != null) {
        showHelloActivity(null);
    }
    final View skinUIOptionsLayout = setupSkinUIOptions();
    skinBackgroundTintIntensityTitle = (TextView) skinUIOptionsLayout.findViewById(R.id.tint_intensity_title);
    skinBackgroundTintIntensity = (SeekBar) skinUIOptionsLayout.findViewById(R.id.tint_intensity_field);
    skinBackgroundTintIntensity.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
            skinBackgroundTintIntensityTitle.setText(getString(R.string.config_tint_intensity_label, progress + TINT_SEEKBAR_ADJUSTMENT));
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        /* no op */
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        /* no op */
        }
    });
    skinBackgroundTintIntensity.setProgress(75 - TINT_SEEKBAR_ADJUSTMENT);
    skinBackgroundImage = (Switch) findViewById(R.id.background_image);
    skinBackgroundImage.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            skinUIOptionsLayout.setVisibility((isSkinSelected() && getBackgroundImage() >= 0) ? View.VISIBLE : View.GONE);
        }
    });
    final Spinner themeSpinner = (Spinner) findViewById(R.id.theme_spinner);
    if (themeSpinner != null) {
        final ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.theme_options, android.R.layout.simple_spinner_dropdown_item);
        themeSpinner.setAdapter(adapter);
        themeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

            @Override
            public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) {
                // init defaults
                skin = SkinManager.Skin.NONE;
                selectedThemeId = -1;
                selectedBackgroundId = -1;
                switch(position) {
                    case 0:
                        skin = SkinManager.Skin.CLASSIC;
                        advancedUISwitch.setChecked(false);
                        break;
                    case 1:
                        skin = SkinManager.Skin.CONTEMPORARY;
                        advancedUISwitch.setChecked(false);
                        break;
                    case 2:
                        selectedThemeId = -1;
                        skin = SkinManager.Skin.TRANSLUCENT;
                        advancedUISwitch.setChecked(false);
                        break;
                    case 3:
                        selectedThemeId = R.style.AppLoginTheme_Salmon;
                        break;
                    case 4:
                        selectedThemeId = R.style.AppLoginTheme_Yellow;
                        break;
                    case 5:
                        selectedThemeId = R.style.AppLoginTheme_Red;
                        break;
                    case 6:
                        skin = SkinManager.Skin.CLASSIC;
                        advancedUISwitch.setChecked(false);
                        selectedBackgroundId = R.drawable.dog;
                        break;
                    case 7:
                        selectedThemeId = R.style.AppLoginTheme_Bicycle;
                        break;
                    case 8:
                        selectedThemeId = R.style.AppLoginTheme_Reverb_A;
                        advancedUISwitch.setChecked(true);
                        break;
                    case 9:
                        selectedThemeId = R.style.AppLoginTheme_Reverb_B;
                        advancedUISwitch.setChecked(true);
                        break;
                    case 10:
                        selectedThemeId = R.style.AppLoginTheme_Reverb_C;
                        advancedUISwitch.setChecked(true);
                        break;
                    default:
                        advancedUISwitch.setChecked(false);
                        break;
                }
                skinBackgroundImage.setVisibility(isSkinSelected() ? View.VISIBLE : View.GONE);
                skinUIOptionsLayout.setVisibility((isSkinSelected() && getBackgroundImage() >= 0) ? View.VISIBLE : View.GONE);
            }

            @Override
            public void onNothingSelected(final AdapterView<?> parent) {
                selectedThemeId = -1;
                selectedBackgroundId = -1;
                skin = SkinManager.Skin.NONE;
                advancedUISwitch.setChecked(false);
                skinUIOptionsLayout.setVisibility(View.GONE);
                skinBackgroundImage.setVisibility(View.GONE);
            }
        });
    }
    setupAdvancedUIOptions();
}
Also used : SeekBar(android.widget.SeekBar) Spinner(android.widget.Spinner) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) CompoundButton(android.widget.CompoundButton)

Example 72 with AdapterView

use of android.widget.AdapterView in project KenBurnsView by flavioarfaria.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.main_options, android.R.layout.simple_list_item_1);
    final ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

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

Example 73 with AdapterView

use of android.widget.AdapterView in project XobotOS by xamarin.

the class AppWidgetHostView method viewDataChanged.

/**
     * Process data-changed notifications for the specified view in the specified
     * set of {@link RemoteViews} views.
     */
void viewDataChanged(int viewId) {
    View v = findViewById(viewId);
    if ((v != null) && (v instanceof AdapterView<?>)) {
        AdapterView<?> adapterView = (AdapterView<?>) v;
        Adapter adapter = adapterView.getAdapter();
        if (adapter instanceof BaseAdapter) {
            BaseAdapter baseAdapter = (BaseAdapter) adapter;
            baseAdapter.notifyDataSetChanged();
        } else if (adapter == null && adapterView instanceof RemoteAdapterConnectionCallback) {
            // If the adapter is null, it may mean that the RemoteViewsAapter has not yet
            // connected to its associated service, and hence the adapter hasn't been set.
            // In this case, we need to defer the notify call until it has been set.
            ((RemoteAdapterConnectionCallback) adapterView).deferNotifyDataSetChanged();
        }
    }
}
Also used : RemoteAdapterConnectionCallback(android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback) AdapterView(android.widget.AdapterView) Adapter(android.widget.Adapter) BaseAdapter(android.widget.BaseAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) BaseAdapter(android.widget.BaseAdapter)

Example 74 with AdapterView

use of android.widget.AdapterView in project Hummingbird-for-Android by xiprox.

the class NavigationDrawerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_navigation_drawer, null);
    String[] ArrayMain = getResources().getStringArray(R.array.list_main_strings);
    String[] ArraySecond = getResources().getStringArray(R.array.list_secondary_strings);
    ListView mListMain = (ListView) rootView.findViewById(R.id.nav_list_main);
    ListView mListSecondary = (ListView) rootView.findViewById(R.id.nav_list_second);
    mUsername = (TextView) rootView.findViewById(R.id.navigation_drawer_username);
    mAvatar = (ImageView) rootView.findViewById(R.id.navigation_drawer_avatar);
    mCoverImage = (ImageView) rootView.findViewById(R.id.navigation_drawer_cover);
    mProfile = (FrameLayout) rootView.findViewById(R.id.navigation_drawer_profile);
    mProfile.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            getFragmentManager().beginTransaction().replace(R.id.container, new UserInfoFragment()).commit();
            mDrawerLayout.closeDrawer(mFragmentContainerView);
            selectItem(ITEM_POSITION_PROFILE);
        }
    });
    username = prefMan.getUsername();
    mUsername.setText(username);
    new LoadTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    mListMain.setAdapter(new ArrayAdapter<String>(getActivity(), R.layout.item_nav_main, ArrayMain));
    mListSecondary.setAdapter(new ArrayAdapter<String>(getActivity(), R.layout.item_nav_secondary, ArraySecond));
    mListMain.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            selectItem(position);
        }
    });
    mListSecondary.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            switch(position) {
                case 0:
                    // TODO - Settings
                    Toast.makeText(context, "YOU SHALL NOT PASS!", Toast.LENGTH_LONG).show();
                    break;
                case 1:
                    showLogoutDialog();
                    break;
            }
        }
    });
    selectItem(mCurrentSelectedPosition);
    return rootView;
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView)

Example 75 with AdapterView

use of android.widget.AdapterView in project Android-skin-support by ximsfei.

the class SplashActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    initToolbar();
    mListView = (ListView) findViewById(R.id.list);
    mListView.setCacheColorHint(Color.TRANSPARENT);
    mListView.setFadingEdgeLength(0);
    mListView.setAdapter(new HomeAdapter(mContext, mItems));
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(mContext, mClasses[position]);
            startActivity(intent);
        }
    });
}
Also used : AdapterView(android.widget.AdapterView) Intent(android.content.Intent) AbsListView(android.widget.AbsListView) 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