Search in sources :

Example 91 with AdapterView

use of android.widget.AdapterView in project weiciyuan by qii.

the class RepostsByIdTimeLineFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.repostsbyidtimelinefragment_layout, container, false);
    empty = (TextView) view.findViewById(R.id.empty);
    progressBar = (ProgressBar) view.findViewById(R.id.progressbar);
    quick_repost = (LinearLayout) view.findViewById(R.id.quick_repost);
    pullToRefreshListView = (PullToRefreshListView) view.findViewById(R.id.listView);
    pullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {

        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            loadNewMsg();
        }
    });
    pullToRefreshListView.setOnLastItemVisibleListener(new PullToRefreshBase.OnLastItemVisibleListener() {

        @Override
        public void onLastItemVisible() {
            loadOldMsg(null);
        }
    });
    getListView().setScrollingCacheEnabled(false);
    getListView().setHeaderDividersEnabled(false);
    footerView = inflater.inflate(R.layout.listview_footer_layout, null);
    getListView().addFooterView(footerView);
    dismissFooterView();
    getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (actionMode != null) {
                getListView().clearChoices();
                actionMode.finish();
                actionMode = null;
                return;
            }
            getListView().clearChoices();
            if (position - 1 < getList().getSize() && position - 1 >= 0) {
                listViewItemClick(parent, view, position - 1, id);
            } else if (position - 1 >= getList().getSize()) {
                loadOldMsg(view);
            }
        }
    });
    if (savedInstanceState == null && msg != null) {
        if (msg.getRetweeted_status() == null) {
            quick_repost.setVisibility(View.VISIBLE);
        }
    } else if (savedInstanceState != null) {
        msg = (MessageBean) savedInstanceState.getParcelable("msg");
        if (msg.getRetweeted_status() == null) {
            quick_repost.setVisibility(View.VISIBLE);
        }
    }
    et = (EditText) view.findViewById(R.id.content);
    view.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            sendRepost();
        }
    });
    buildListAdapter();
    return view;
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) VelocityListView(org.qii.weiciyuan.support.lib.VelocityListView) View(android.view.View) AdapterView(android.widget.AdapterView) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ListView(android.widget.ListView) VelocityListView(org.qii.weiciyuan.support.lib.VelocityListView) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) PullToRefreshBase(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshBase)

Example 92 with AdapterView

use of android.widget.AdapterView in project weiciyuan by qii.

the class UserTopicListFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null) {
        userBean = (UserBean) savedInstanceState.getParcelable("userBean");
        result = (ArrayList<String>) savedInstanceState.getStringArrayList("topicList");
    }
    adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, result);
    setListAdapter(adapter);
    getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String str = result.get(position);
            String q;
            if (str.startsWith("#") && str.endsWith("#")) {
                q = str.substring(1, str.length() - 1);
            } else {
                q = str;
            }
            Intent intent = new Intent(getActivity(), SearchTopicByNameActivity.class);
            intent.putExtra("q", q);
            startActivity(intent);
        }
    });
    if (result == null || result.size() == 0) {
        refresh();
    }
}
Also used : AdapterView(android.widget.AdapterView) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 93 with AdapterView

use of android.widget.AdapterView in project materialish-progress by pnikosis.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button buttonAbout = (Button) findViewById(R.id.button_about);
    buttonAbout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this).setTitle(R.string.about).setMessage(R.string.about_text).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });
            dialog.show();
        }
    });
    progressWheel = (ProgressWheel) findViewById(R.id.progress_wheel);
    progressWheelInterpolated = (ProgressWheel) findViewById(R.id.interpolated);
    progressWheelLinear = (ProgressWheel) findViewById(R.id.linear);
    interpolatedValue = (TextView) findViewById(R.id.interpolatedValue);
    linearValue = (TextView) findViewById(R.id.linearValue);
    Spinner spinnerOptions = (Spinner) findViewById(R.id.spinner_options);
    spinnerOptions.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            switch(position) {
                case 0:
                    progressWheelLinear.setProgress(0.0f);
                    progressWheelInterpolated.setProgress(0.0f);
                    progressWheelInterpolated.setCallback(new ProgressWheel.ProgressCallback() {

                        @Override
                        public void onProgressUpdate(float progress) {
                            if (progress == 0) {
                                progressWheelInterpolated.setProgress(1.0f);
                            } else if (progress == 1.0f) {
                                progressWheelInterpolated.setProgress(0.0f);
                            }
                            interpolatedValue.setText(String.format("%.2f", progress));
                        }
                    });
                    progressWheelLinear.setCallback(new ProgressWheel.ProgressCallback() {

                        @Override
                        public void onProgressUpdate(float progress) {
                            if (progress == 0) {
                                progressWheelLinear.setProgress(1.0f);
                            } else if (progress == 1.0f) {
                                progressWheelLinear.setProgress(0.0f);
                            }
                            linearValue.setText(String.format("%.2f", progress));
                        }
                    });
                    break;
                case 1:
                    setProgress(0.0f);
                    break;
                case 2:
                    setProgress(0.1f);
                    break;
                case 3:
                    setProgress(0.25f);
                    break;
                case 4:
                    setProgress(0.5f);
                    break;
                case 5:
                    setProgress(0.75f);
                    break;
                case 6:
                    setProgress(1.0f);
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    final int defaultBarColor = progressWheel.getBarColor();
    final int defaultWheelColor = progressWheel.getRimColor();
    Spinner colorOptions = (Spinner) findViewById(R.id.spinner_options_color);
    colorOptions.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            switch(position) {
                case 0:
                    progressWheel.setBarColor(defaultBarColor);
                    progressWheelInterpolated.setBarColor(defaultBarColor);
                    progressWheelLinear.setBarColor(defaultBarColor);
                    break;
                case 1:
                    progressWheel.setBarColor(Color.RED);
                    progressWheelInterpolated.setBarColor(Color.RED);
                    progressWheelLinear.setBarColor(Color.RED);
                    break;
                case 2:
                    progressWheel.setBarColor(Color.MAGENTA);
                    progressWheelInterpolated.setBarColor(Color.MAGENTA);
                    progressWheelLinear.setBarColor(Color.MAGENTA);
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    Spinner wheelColorOptions = (Spinner) findViewById(R.id.spinner_options_rim_color);
    wheelColorOptions.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            switch(position) {
                case 0:
                    progressWheel.setRimColor(defaultWheelColor);
                    progressWheelInterpolated.setRimColor(defaultWheelColor);
                    progressWheelLinear.setRimColor(defaultWheelColor);
                    break;
                case 1:
                    progressWheel.setRimColor(Color.LTGRAY);
                    progressWheelInterpolated.setRimColor(Color.LTGRAY);
                    progressWheelLinear.setRimColor(Color.LTGRAY);
                    break;
                case 2:
                    progressWheel.setRimColor(Color.GRAY);
                    progressWheelInterpolated.setRimColor(Color.GRAY);
                    progressWheelLinear.setRimColor(Color.GRAY);
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
}
Also used : DialogInterface(android.content.DialogInterface) Spinner(android.widget.Spinner) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) CompoundButton(android.widget.CompoundButton) RadioButton(android.widget.RadioButton) Button(android.widget.Button) AdapterView(android.widget.AdapterView)

Example 94 with AdapterView

use of android.widget.AdapterView in project android-viewflow by pakerfeldt.

the class ViewFlowExample method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    listView = (ListView) findViewById(R.id.menu);
    String[] listeStrings = { "Circle indicator...", "Title indicator...", "Different Views...", "Async Data Loading..." };
    listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listeStrings));
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long arg3) {
            switch(position) {
                case 0:
                    startActivity(new Intent(ViewFlowExample.this, CircleViewFlowExample.class));
                    break;
                case 1:
                    startActivity(new Intent(ViewFlowExample.this, TitleViewFlowExample.class));
                    break;
                case 2:
                    startActivity(new Intent(ViewFlowExample.this, DiffViewFlowExample.class));
                    break;
                case 3:
                    startActivity(new Intent(ViewFlowExample.this, AsyncDataFlowExample.class));
                    break;
            }
        }
    });
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 95 with AdapterView

use of android.widget.AdapterView in project FlatUI by eluleci.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // converts the default values to dp to be compatible with different screen sizes
    FlatUI.initDefaultValues(this);
    // Default theme should be set before content view is added
    FlatUI.setDefaultTheme(APP_THEME);
    setContentView(R.layout.activity_main);
    // Getting action bar background and applying it
    getSupportActionBar().setBackgroundDrawable(FlatUI.getActionBarDrawable(this, APP_THEME, false, 2));
    // titles
    flatTextViews.add((FlatTextView) findViewById(R.id.title_edittexts));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_seekbar));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_buttons));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_buttons_shape));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_buttons_text_appearance));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_buttons_touch_effect));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_checkbox));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_checkbox_enabled));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_checkbox_disabled));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_radiobutton));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_radiobutton_enabled));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_radiobutton_disabled));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_toggle_button));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_toggle_enabled));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_toggle_disabled));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_themes));
    flatTextViews.add((FlatTextView) findViewById(R.id.title_themes_note));
    // edit texts
    flatEditTexts.add((FlatEditText) findViewById(R.id.edittext_flat));
    flatEditTexts.add((FlatEditText) findViewById(R.id.edittext_box));
    flatEditTexts.add((FlatEditText) findViewById(R.id.edittext_transparentbox));
    flatEditTexts.add((FlatEditText) findViewById(R.id.edittext_transparent));
    // buttons
    flatButtons.add((FlatButton) findViewById(R.id.button_block));
    flatButtons.add((FlatButton) findViewById(R.id.button_flat));
    flatButtons.add((FlatButton) findViewById(R.id.button_light));
    flatButtons.add((FlatButton) findViewById(R.id.button_white));
    flatButtons.add((FlatButton) findViewById(R.id.button_dark_text));
    flatButtons.add((FlatButton) findViewById(R.id.button_ease));
    flatButtons.add((FlatButton) findViewById(R.id.button_ripple));
    // check boxes
    flatCheckBoxes.add((FlatCheckBox) findViewById(R.id.checkbox_unchecked_enabled));
    flatCheckBoxes.add((FlatCheckBox) findViewById(R.id.checkbox_checked_enabled));
    flatCheckBoxes.add((FlatCheckBox) findViewById(R.id.checkbox_unchecked_disabled));
    flatCheckBoxes.add((FlatCheckBox) findViewById(R.id.checkbox_checked_disabled));
    // radio buttons
    flatRadioButtons.add((FlatRadioButton) findViewById(R.id.radio_unchecked_enabled));
    flatRadioButtons.add((FlatRadioButton) findViewById(R.id.radio_unchecked_disabled));
    flatRadioButtons.add((FlatRadioButton) findViewById(R.id.radio_checked_disabled));
    radioCheckedEnabled = (FlatRadioButton) findViewById(R.id.radio_checked_enabled);
    flatRadioButtons.add(radioCheckedEnabled);
    radioCheckedEnabled.setChecked(true);
    // toggle buttons
    flatToggleButtons.add((FlatToggleButton) findViewById(R.id.toggle_unchecked_enabled));
    flatToggleButtons.add((FlatToggleButton) findViewById(R.id.toggle_checked_enabled));
    flatToggleButtons.add((FlatToggleButton) findViewById(R.id.toggle_unchecked_disabled));
    flatToggleButtons.add((FlatToggleButton) findViewById(R.id.toggle_checked_disabled));
    flatSeekBar = (FlatSeekBar) findViewById(R.id.seekbar);
    flatSeekBar.setProgress(30);
    flatSeekBar.setSecondaryProgress(40);
    /**
         * This part is an example of spinner usage. You can change the theme of this spinner by
         * editing the layout files spinner_button and simple_flat_list_item.
         */
    Spinner spinner = (Spinner) findViewById(R.id.themes_spinner);
    // Create an ArrayAdapter using the string array and a custom spinner layout
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.themes_array, R.layout.spinner_button);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(R.layout.simple_flat_list_item);
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            // preventing the spinner to change the theme on start
            if (!isSpinnerSelectedBefore) {
                isSpinnerSelectedBefore = true;
                return;
            }
            int themeReference = APP_THEME;
            switch(position) {
                case 0:
                    themeReference = FlatUI.SAND;
                    break;
                case 1:
                    themeReference = FlatUI.ORANGE;
                    break;
                case 2:
                    themeReference = FlatUI.CANDY;
                    break;
                case 3:
                    themeReference = FlatUI.BLOSSOM;
                    break;
                case 4:
                    themeReference = FlatUI.GRAPE;
                    break;
                case 5:
                    themeReference = FlatUI.DEEP;
                    break;
                case 6:
                    themeReference = FlatUI.SKY;
                    break;
                case 7:
                    themeReference = FlatUI.GRASS;
                    break;
                case 8:
                    themeReference = FlatUI.DARK;
                    break;
                case 9:
                    themeReference = FlatUI.SNOW;
                    break;
                case 10:
                    themeReference = FlatUI.SEA;
                    break;
                case 11:
                    themeReference = FlatUI.BLOOD;
                    break;
            }
            changeTheme(themeReference);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    /**
         * Autocomplete textview. You can change the EditText color via theme but
         * you need to set a layout for the rows as shown below. This is the same
         * row that is used in the spinner example.
         */
    AutoCompleteTextView actv = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
    String[] themes = getResources().getStringArray(R.array.themes_array);
    ArrayAdapter acAdapter = new ArrayAdapter(this, R.layout.simple_flat_list_item, themes);
    actv.setAdapter(acAdapter);
}
Also used : Spinner(android.widget.Spinner) AutoCompleteTextView(android.widget.AutoCompleteTextView) FlatTextView(com.cengalabs.flatui.views.FlatTextView) View(android.view.View) AdapterView(android.widget.AdapterView) AdapterView(android.widget.AdapterView) ArrayAdapter(android.widget.ArrayAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView)

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