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;
}
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();
}
}
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) {
}
});
}
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;
}
}
});
}
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);
}
Aggregations