本文整理汇总了Java中kankan.wheel.widget.WheelView.setViewAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java WheelView.setViewAdapter方法的具体用法?Java WheelView.setViewAdapter怎么用?Java WheelView.setViewAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kankan.wheel.widget.WheelView
的用法示例。
在下文中一共展示了WheelView.setViewAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// ---Inflate the layout for this fragment---
View rootView = inflater.inflate(R.layout.fragment2, container, false);
wheelView = (WheelView)rootView.findViewById(R.id.wheelView);
wheelView.setVisibleItems(5);
wheelView.setCyclic(true);
wheelView.setViewAdapter(new AbstractWheelTextAdapter(getActivity(), R.layout.wheel_text_view)
{
@Override
protected CharSequence getItemText(int index)
{
return new Date( ( (new Date().getTime())/1000+index)*1000 ).toString();
}
@Override
public int getItemsCount() {
return 60;
}
});
return rootView;
}
示例2: initWheel
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
private void initWheel(View dialog_exitView, Dict dCountry) {
WheelView country = (WheelView) dialog_exitView
.findViewById(R.id.country);
WheelView province = (WheelView) dialog_exitView
.findViewById(R.id.province);
WheelView city = (WheelView) dialog_exitView.findViewById(R.id.city);
country.setViewAdapter(new DictAdapter(countries, UserInfoActivity.this));
country.setVisibleItems(10);
country.setCurrentItem(countries.indexOf(dCountry));
updateProvince(province, provinces);
DictAdapter adapter = new DictAdapter(citys, UserInfoActivity.this);
city.setViewAdapter(adapter);
city.setVisibleItems(10);
if (user != null && user.getArea3() > 0) {
for (Dict dict : citys) {
if (user.getArea3() == dict.getDict_id()) {
city.setCurrentItem(citys.indexOf(dict));
break;
}
}
} else {
city.setCurrentItem(0);
}
removeProgressDialog();
}
示例3: updateProvince
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
private void updateProvince(WheelView dictView, Vector<Dict> dicts) {
DictAdapter adapter = new DictAdapter(dicts, this);
dictView.setViewAdapter(adapter);
dictView.setVisibleItems(10);
if (dicts.size()==0) {
return;
}
if (user != null && user.getArea2() > 0) {
for (Dict dict : dicts) {
if (user.getArea2() == dict.getDict_id()) {
dictView.setCurrentItem(dicts.indexOf(dict));
return;
}
}
} else {
dictView.setCurrentItem(0);
}
}
示例4: TimeSleep
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
public TimeSleep(Context context, AttributeSet attrs) {
super(context, attrs);
setTitle(R.string.sleep_title);
setIcon(Util.getResourceFromAttribute(context, R.attr.ic_sleep_normal_style));
setContent(context, R.layout.expandable_time_sleep);
mHourWheel = (WheelView) findViewById(R.id.hour);
mMinWheel = (WheelView) findViewById(R.id.min);
final Button okButton = (Button) findViewById(R.id.ok);
final Button cancelButton = (Button) findViewById(R.id.cancel);
mHourWheel.setViewAdapter(new NumericWheelAdapter(context, 0, 23, "%02d"));
mHourWheel.setCyclic(true);
mMinWheel.setViewAdapter(new NumericWheelAdapter(context, 0, 59, "%02d"));
mMinWheel.setCyclic(true);
okButton.setOnClickListener(mOnOkListener);
cancelButton.setOnClickListener(mOnCancelListener);
if (mTime != null && mTime.before(Calendar.getInstance()))
mTime = null;
Calendar c = mTime != null ? mTime : Calendar.getInstance();
mHourWheel.setCurrentItem(c.get(Calendar.HOUR_OF_DAY));
mMinWheel.setCurrentItem(c.get(Calendar.MINUTE));
setText();
}
示例5: TimeSleep
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
public TimeSleep(Context context, AttributeSet attrs) {
super(context, attrs);
setTitle(R.string.sleep_title);
setIcon(R.drawable.sleep);
setContent(context, R.layout.expandable_time_sleep);
mHourWheel = (WheelView) findViewById(R.id.hour);
mMinWheel = (WheelView) findViewById(R.id.min);
final Button okButton = (Button) findViewById(R.id.ok);
final Button cancelButton = (Button) findViewById(R.id.cancel);
mHourWheel.setViewAdapter(new NumericWheelAdapter(context, 0, 23, "%02d"));
mHourWheel.setCyclic(true);
mMinWheel.setViewAdapter(new NumericWheelAdapter(context, 0, 59, "%02d"));
mMinWheel.setCyclic(true);
okButton.setOnClickListener(mOnOkListener);
cancelButton.setOnClickListener(mOnCancelListener);
if (mTime != null && mTime.before(Calendar.getInstance()))
mTime = null;
Calendar c = mTime != null ? mTime : Calendar.getInstance();
mHourWheel.setCurrentItem(c.get(Calendar.HOUR_OF_DAY));
mMinWheel.setCurrentItem(c.get(Calendar.MINUTE));
setText();
}
示例6: updateDays
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
/**
* Updates day wheel. Sets max days according to selected month and year
*/
private void updateDays(WheelView year, WheelView month, WheelView day) {
Calendar calendar = Calendar.getInstance();
if(year.getCurrentItem() == MaxYearCount &&
month.getCurrentItem() == calendar.get(Calendar.MONTH)) {
int today = calendar.get(Calendar.DAY_OF_MONTH);
day.setViewAdapter(new DateNumericAdapter(mActivity, 1, today, -1));
day.setCurrentItem(today - 1);
} else {
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + year.getCurrentItem());
calendar.set(Calendar.MONTH, month.getCurrentItem());
int maxDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
day.setViewAdapter(new DateNumericAdapter(mActivity, 1, maxDays, -1));
int curDay = Math.min(maxDays, day.getCurrentItem() + 1);
day.setCurrentItem(curDay - 1);
}
}
示例7: setWheelAdapter
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
/**
* Sets adapter for wheel
*
* @param context
* application context
* @param wheel
* object for sets adapter
* @param values
* values for adapter
* @param textSizeResourceId
* text size resource id for wheels
* @param isFirstEmpty
* true if need first empty item
*/
public static void setWheelAdapter(Context context, WheelView wheel,
String values[], int textSizeResourceId, boolean isFirstEmpty) {
AbstractWheelTextAdapter adapter;
int textSize = (int) (context.getResources().getDimension(
textSizeResourceId) / context.getResources()
.getDisplayMetrics().density);
Log.variable("textSize", String.valueOf(textSize));
if (!isFirstEmpty) {
adapter = new ArrayWheelAdapter<>(context, values);
} else {
adapter = new WheelAdapter<>(context, values);
}
adapter.setTextSize(textSize);
wheel.setViewAdapter(adapter);
}
示例8: updateDays
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
private void updateDays(WheelView year, WheelView month, WheelView day,
WheelView hour, WheelView minute) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR,calendar.get(Calendar.YEAR) + year.getCurrentItem());// 将给定的日历字段设置为给定值。
calendar.set(Calendar.MONTH, month.getCurrentItem());
int maxDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);//给定此 Calendar 的时间值,返回指定日历字段可能拥有的最大值。
dayAdapter = new DateNumericAdapter(this, 1, maxDays,calendar.get(Calendar.DAY_OF_MONTH) - 1);//calendar.get(Calendar.DAY_OF_MONTH)返回给定日历字段的值。
day.setViewAdapter(dayAdapter);
int curDay = Math.min(maxDays, day.getCurrentItem() + 1);// 返回两个
// int值中较大的一个。
day.setCurrentItem(curDay - 1, true);
int years = calendar.get(Calendar.YEAR) - 100;
age = years + "-" + (month.getCurrentItem() + 1) + "-"
+ (day.getCurrentItem() + 1) + "-"
+ (hour.getCurrentItem() + 1) + "-"
+ (minute.getCurrentItem() + 1);
}
示例9: updateDays
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
void updateDays(WheelView year, WheelView month, WheelView day) {
this.calendar.clear();
this.calendar.set(1, this.calendar.get(1) + year.getCurrentItem());
this.calendar.set(2, month.getCurrentItem());
int maxDays = this.calendar.getActualMaximum(5);
day.setViewAdapter(new DateNumericAdapter(this.ctx, 1, maxDays, this.calendar.get(5) - 1,
false));
day.setCurrentItem(Math.min(maxDays, day.getCurrentItem() + 1) - 1, true);
}
示例10: setHighlightArray
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
public static void setHighlightArray(WheelView wheel, Context context, String[] strings, int
current) {
HighlightArrayWheelAdapter arrayWheelAdapter = new HighlightArrayWheelAdapter(context,
strings, current);
arrayWheelAdapter.setTextColor(context.getResources().getColor(R.color.du));
wheel.setViewAdapter(arrayWheelAdapter);
}
示例11: setHighlightNumeric
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
public static void setHighlightNumeric(WheelView wheel, Context context, int min, int max,
int current) {
HighlightNumericWheelAdapter arrayWheelAdapter = new HighlightNumericWheelAdapter
(context, min, max, current);
arrayWheelAdapter.setTextColor(context.getResources().getColor(R.color.du));
wheel.setViewAdapter(arrayWheelAdapter);
}
示例12: initPopupWindow
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
public void initPopupWindow(){
// 利用layoutInflater获得View
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(R.layout.citys, null);
mProvince = (WheelView) view.findViewById(R.id.id_province);
mCity = (WheelView) view.findViewById(R.id.id_city);
mArea = (WheelView) view.findViewById(R.id.id_area);
// 下面是两种方法得到宽度和高度 getWindow().getDecorView().getWidth()
popupWindow = new PopupWindow(view,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT);
// 设置popWindow弹出窗体可点击,这句话必须添加,并且是true
popupWindow.setFocusable(true);
// 必须要给调用这个方法,否则点击popWindow以外部分,popWindow不会消失
popupWindow.setBackgroundDrawable(new BitmapDrawable());
mProvince.setViewAdapter(new ArrayWheelAdapter<String>(LaPinAddressAdd.this, mProvinceDatas));
// 添加change事件
mProvince.addChangingListener(this);
// 添加change事件
mCity.addChangingListener(this);
// 添加change事件
mArea.addChangingListener(this);
mProvince.setVisibleItems(5);
mCity.setVisibleItems(5);
mArea.setVisibleItems(5);
popupWindow.setOnDismissListener(new OnDismissListener() {
public void onDismiss() {
city.setText(mCurrentProviceName+mCurrentCityName+mCurrentAreaName);
}
});
}
示例13: DialogEditVanityLength
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
public DialogEditVanityLength(Context context, Address address) {
super(context);
this.address = address;
setContentView(R.layout.dialog_edit_vanity_length);
setOnDismissListener(this);
findViewById(R.id.btn_cancel).setOnClickListener(this);
findViewById(R.id.btn_ok).setOnClickListener(this);
tvAddress = (TextView) findViewById(R.id.tv_address);
wvLength = (WheelView) findViewById(R.id.wv_length);
wvLength.setViewAdapter(lengthAdapter);
wvLength.setCurrentItem(address.exsitsVanityLen() ? Math.max(address.getVanityLen() - 1,
0) : 0);
wvLength.addChangingListener(this);
showVanityLength(address.getVanityLen());
}
示例14: initView
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
private void initView() {
removeAllViews();
addView(LayoutInflater.from(getContext()).inflate(R.layout.fragment_add_address_private_key, null), LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
wvCount = (WheelView) findViewById(R.id.wv_count);
cbxXRandom = (CheckBox) findViewById(R.id.cbx_xrandom);
cbxXRandom.setOnCheckedChangeListener(xRandomCheck);
btnAdd = (Button) findViewById(R.id.btn_add);
findViewById(R.id.ibtn_xrandom_info).setOnClickListener(DialogXRandomInfo.GuideClick);
dp = new DialogProgress(activity, R.string.please_wait);
dp.setCancelable(false);
wvCount.setViewAdapter(countAdapter);
wvCount.setCurrentItem(0);
btnAdd.setOnClickListener(addClick);
}
示例15: initView
import kankan.wheel.widget.WheelView; //导入方法依赖的package包/类
private void initView() {
findViewById(R.id.ibtn_cancel).setOnClickListener(new IBackClickListener());
findViewById(R.id.btn_add).setOnClickListener(addClick);
wvCount = (WheelView) findViewById(R.id.wv_count);
wvCount.setViewAdapter(new CountAdapter(this));
wvCount.setCurrentItem(0);
dp = new DialogProgress(this, R.string.please_wait);
dp.setCancelable(false);
passwordGetter = new DialogPassword.PasswordGetter(this, this);
}