Java Examples for android.widget.AbsListView.LayoutParams
The following java examples will help you to understand the usage of android.widget.AbsListView.LayoutParams. These source code samples are taken from different open source projects.
Example 1
| Project: CHatMomentDemo-master File: DynamicGridAdapter.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MyGridViewHolder viewHolder;
if (convertView == null) {
viewHolder = new MyGridViewHolder();
convertView = mLayoutInflater.inflate(R.layout.gridview_item, parent, false);
viewHolder.imageView = (ImageView) convertView.findViewById(R.id.album_image);
convertView.setTag(viewHolder);
} else {
viewHolder = (MyGridViewHolder) convertView.getTag();
}
String url = getItem(position);
if (getCount() == 1) {
viewHolder.imageView.setLayoutParams(new android.widget.AbsListView.LayoutParams(300, 250));
}
if (getCount() == 2 || getCount() == 4) {
viewHolder.imageView.setLayoutParams(new android.widget.AbsListView.LayoutParams(200, 200));
}
ImageLoader.getInstance().displayImage(url, viewHolder.imageView);
return convertView;
}Example 2
| Project: aceim-master File: AceIMActivity.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public void setStyle(View view, AttributeSet attrs) {
TypedArray styleables = getBaseContext().obtainStyledAttributes(attrs, R.styleable.StyleableView, 0, 0);
Context themeContext = mThemesManager.getCurrentThemeContext();
int N = styleables.getIndexCount();
for (int i = 0; i < N; i++) {
int res = styleables.getIndex(i);
int id;
switch(styleables.getInt(res, -1)) {
case bottom_bar_background:
id = mThemesManager.getViewResources().getBottomBarBackgroundId();
break;
case top_bar_background:
id = mThemesManager.getViewResources().getTopBarBackgroundId();
break;
case screen_background:
id = mThemesManager.getViewResources().getScreenBackgroundId();
break;
case bottom_bar_button_background:
id = mThemesManager.getViewResources().getBottomBarButtonBackgroundId();
break;
case grid_item_size:
id = mThemesManager.getViewResources().getGridItemSizeId();
break;
case list_item_height:
id = mThemesManager.getViewResources().getListItemHeightId();
break;
case accent_background:
id = mThemesManager.getViewResources().getAccentBackgroundId();
break;
default:
styleables.recycle();
return;
}
try {
switch(res) {
case R.styleable.StyleableView_styleableBackground:
Drawable d = themeContext.getResources().getDrawable(id);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
view.setBackgroundDrawable(d);
} else {
view.setBackground(d);
}
break;
case R.styleable.StyleableView_styleableLayoutWidth:
int width = themeContext.getResources().getDimensionPixelSize(id);
if (view.getLayoutParams() != null) {
view.getLayoutParams().width = width;
} else {
view.setLayoutParams(new ViewGroup.LayoutParams(width, ARTIFICIAL_LAYOUT_MARKER));
}
break;
case R.styleable.StyleableView_styleableLayoutHeight:
int height = themeContext.getResources().getDimensionPixelSize(id);
if (view.getLayoutParams() != null) {
view.getLayoutParams().height = height;
} else {
view.setLayoutParams(new ViewGroup.LayoutParams(ARTIFICIAL_LAYOUT_MARKER, height));
}
break;
}
} catch (Exception e) {
Logger.log(e);
}
}
styleables.recycle();
}Example 3
| Project: CeiReport-master File: GGridView.java View source code |
public void setAdapter(BaseAdapter baseAdapter) {
super.setAdapter(baseAdapter);
if (baseAdapter.getCount() > 0) {
setNumColumns(baseAdapter.getCount());
DisplayMetrics displaymetrics = new DisplayMetrics();
((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int itemWidth = displaymetrics.widthPixels / 4;
/*setLayoutParams(new android.widget.LinearLayout.LayoutParams(
itemWidth * baseAdapter.getCount()>displaymetrics.widthPixels?itemWidth * baseAdapter.getCount():
displaymetrics.widthPixels,LayoutParams.FILL_PARENT));*/
setLayoutParams(new android.widget.LinearLayout.LayoutParams(itemWidth * baseAdapter.getCount(), LayoutParams.MATCH_PARENT));
}
}Example 4
| Project: appone-master File: ChapterHolder.java View source code |
@Override
protected View initView() {
View view = UIUtils.inflate(R.layout.item_chapter);
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, SystemUtils.getScreenWidth() / 5);
// SystemUtils.getScreenWidth()/5
view.setLayoutParams(layoutParams);
ButterKnife.bind(this, view);
return view;
}Example 5
| Project: EasyDice-master File: DieViewArrayAdapter.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Die die = (Die) getItem(position);
if (null == die) {
return null;
}
DieView dieView = (DieView) convertView;
if (null == dieView) {
dieView = new DieView(getContext());
int px = dpToPx(dieView, 66);
dieView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, px));
}
dieView.setDie(die);
return dieView;
}Example 6
| Project: GeekBand-Android-1501-Homework-master File: MyGridAdapter.java View source code |
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
v = View.inflate(context, R.layout.item_single_picture, null);
}
ImageView ivPic = (ImageView) v.findViewById(R.id.iv_picture);
ivPic.setLayoutParams(new android.widget.AbsListView.LayoutParams(mWidth / 4, mWidth / 4));
ivPic.setImageResource(picIds.get(position));
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e(TAG, "item onClick " + position);
}
});
v.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Log.e(TAG, "item onLongClick " + position);
return true;
}
});
return v;
}Example 7
| Project: -KJFrameForAndroid-master File: EmojiGridAdapter.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = new ImageView(cxt);
LayoutParams params = new LayoutParams(120, 120);
convertView.setLayoutParams(params);
convertView.setPadding(10, 10, 10, 10);
holder.image = (ImageView) convertView;
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.image.setImageResource(datas.get(position).getResId());
return convertView;
}Example 8
| Project: caw_shell-master File: AutofillListAdapter.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View layout = convertView;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout = inflater.inflate(R.layout.autofill_text, null);
ApiCompatibilityUtils.setBackgroundForView(layout, new AutofillDividerDrawable());
}
TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
labelView.setText(getItem(position).mLabel);
AutofillDividerDrawable divider = (AutofillDividerDrawable) layout.getBackground();
int height = mContext.getResources().getDimensionPixelSize(R.dimen.autofill_text_height);
if (position == 0) {
divider.setColor(Color.TRANSPARENT);
} else {
int dividerHeight = mContext.getResources().getDimensionPixelSize(R.dimen.autofill_text_divider_height);
height += dividerHeight;
divider.setHeight(dividerHeight);
if (mSeparators.contains(position)) {
divider.setColor(mContext.getResources().getColor(R.color.autofill_dark_divider_color));
} else {
divider.setColor(mContext.getResources().getColor(R.color.autofill_divider_color));
}
}
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, height));
TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
CharSequence sublabel = getItem(position).mSublabel;
if (TextUtils.isEmpty(sublabel)) {
sublabelView.setVisibility(View.GONE);
} else {
sublabelView.setText(sublabel);
sublabelView.setVisibility(View.VISIBLE);
}
return layout;
}Example 9
| Project: chromium_webview-master File: AutofillListAdapter.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View layout = convertView;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout = inflater.inflate(R.layout.autofill_text, null);
ApiCompatibilityUtils.setBackgroundForView(layout, new AutofillDividerDrawable());
}
TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
labelView.setText(getItem(position).mLabel);
AutofillDividerDrawable divider = (AutofillDividerDrawable) layout.getBackground();
int height = mContext.getResources().getDimensionPixelSize(R.dimen.autofill_text_height);
if (position == 0) {
divider.setColor(Color.TRANSPARENT);
} else {
int dividerHeight = mContext.getResources().getDimensionPixelSize(R.dimen.autofill_text_divider_height);
height += dividerHeight;
divider.setHeight(dividerHeight);
if (mSeparators.contains(position)) {
divider.setColor(mContext.getResources().getColor(R.color.autofill_dark_divider_color));
} else {
divider.setColor(mContext.getResources().getColor(R.color.autofill_divider_color));
}
}
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, height));
TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
CharSequence sublabel = getItem(position).mSublabel;
if (TextUtils.isEmpty(sublabel)) {
sublabelView.setVisibility(View.GONE);
} else {
sublabelView.setText(sublabel);
sublabelView.setVisibility(View.VISIBLE);
}
return layout;
}Example 10
| Project: KJFrameForAndroid-master File: EmojiGridAdapter.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = new ImageView(cxt);
LayoutParams params = new LayoutParams(120, 120);
convertView.setLayoutParams(params);
convertView.setPadding(10, 10, 10, 10);
holder.image = (ImageView) convertView;
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.image.setImageResource(datas.get(position).getResId());
return convertView;
}Example 11
| Project: SealBrowser-master File: AutofillListAdapter.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View layout = convertView;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout = inflater.inflate(R.layout.autofill_text, null);
ApiCompatibilityUtils.setBackgroundForView(layout, new AutofillDividerDrawable());
}
TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
labelView.setText(getItem(position).mLabel);
AutofillDividerDrawable divider = (AutofillDividerDrawable) layout.getBackground();
int height = mContext.getResources().getDimensionPixelSize(R.dimen.autofill_text_height);
if (position == 0) {
divider.setColor(Color.TRANSPARENT);
} else {
int dividerHeight = mContext.getResources().getDimensionPixelSize(R.dimen.autofill_text_divider_height);
height += dividerHeight;
divider.setHeight(dividerHeight);
if (mSeparators.contains(position)) {
divider.setColor(mContext.getResources().getColor(R.color.autofill_dark_divider_color));
} else {
divider.setColor(mContext.getResources().getColor(R.color.autofill_divider_color));
}
}
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, height));
TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
CharSequence sublabel = getItem(position).mSublabel;
if (TextUtils.isEmpty(sublabel)) {
sublabelView.setVisibility(View.GONE);
} else {
sublabelView.setText(sublabel);
sublabelView.setVisibility(View.VISIBLE);
}
return layout;
}Example 12
| Project: TTAndroidClient-master File: EmoGridViewAdapter.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
try {
GridViewHolder gridViewHolder = null;
if (null == convertView && null != context) {
gridViewHolder = new GridViewHolder();
convertView = gridViewHolder.layoutView;
if (convertView != null) {
convertView.setTag(gridViewHolder);
}
} else {
gridViewHolder = (GridViewHolder) convertView.getTag();
}
if (null == gridViewHolder || null == convertView) {
return null;
}
gridViewHolder.faceIv.setImageBitmap(getBitmap(position));
if (position == emoResIds.length - 1) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.topMargin = CommonUtil.getElementSzie(context) / 3;
gridViewHolder.faceIv.setLayoutParams(params);
}
return convertView;
} catch (Exception e) {
logger.e(e.getMessage());
return null;
}
}Example 13
| Project: android-simple-facebook-master File: ExamplesAdapter.java View source code |
@Override
public View getView(int position, View view, ViewGroup group) {
if (view == null) {
TextView textView = new TextView(SharedObjects.context);
textView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, SharedObjects.context.getResources().getDimensionPixelSize(R.dimen.example_list_height)));
textView.setTextColor(SharedObjects.context.getResources().getColor(R.color.black));
textView.setSingleLine();
if (getItemViewType(position) == EXAMPLE_VIEW) {
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, SharedObjects.context.getResources().getDimensionPixelSize(R.dimen.example_list_text_size));
} else {
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, SharedObjects.context.getResources().getDimensionPixelSize(R.dimen.example_list_title_size));
}
textView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
int pix10dp = SharedObjects.context.getResources().getDimensionPixelSize(R.dimen.padding_10dp);
textView.setPadding(pix10dp, 0, pix10dp, 0);
view = textView;
}
Example example = mExamples.get(position);
TextView textView = (TextView) view;
if (getItemViewType(position) == EXAMPLE_VIEW) {
textView.setText(Html.fromHtml(" ▶ " + example.getTitle()));
} else {
textView.setText(Html.fromHtml(example.getTitle()));
}
if (mLoggedIn || (!mLoggedIn && !example.isRequireLogin())) {
textView.setTextColor(Color.BLACK);
textView.setEnabled(true);
} else {
textView.setTextColor(Color.GRAY);
textView.setEnabled(false);
}
return view;
}Example 14
| Project: DingDingMap-master File: OfflineMapActivity.java View source code |
/**
* �始化已下载列表
*/
public void initDownloadedList() {
mDownLoadedList = (ListView) LayoutInflater.from(OfflineMapActivity.this).inflate(R.layout.offline_downloaded_list, null);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.widget.AbsListView.LayoutParams.MATCH_PARENT, android.widget.AbsListView.LayoutParams.WRAP_CONTENT);
mDownLoadedList.setLayoutParams(params);
mDownloadedAdapter = new OfflineDownloadedAdapter(this, amapManager);
mDownLoadedList.setAdapter(mDownloadedAdapter);
}Example 15
| Project: gyz-master File: KXActivity.java View source code |
public View getView(int position, View convertView, ViewGroup parent) {
ImageView face = null;
if (convertView == null) {
face = new ImageView(mContext);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
int widthAndHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, mContext.getResources().getDisplayMetrics());
params.width = widthAndHeight;
params.height = widthAndHeight;
face.setLayoutParams(params);
face.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
} else {
face = (ImageView) convertView;
}
face.setImageBitmap(mKXApplication.getFaceBitmap(position));
return face;
}Example 16
| Project: material-calendar-datepicker-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 17
| Project: MiBandDecompiled-master File: DynamicListFragment.java View source code |
public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle) {
View view = layoutinflater.inflate(0x7f030029, viewgroup, false);
c = (ListView) view;
View view1 = new View(getActivity());
view1.setLayoutParams(new android.widget.AbsListView.LayoutParams(-1, (int) (390F * ChartUtil.getDensity(getActivity()))));
view1.setTag("MarginView");
c.addHeaderView(view1, null, false);
return view;
}Example 18
| Project: MyLibrary-master File: UIUtils.java View source code |
/**
* 自适应高度
*/
public static int getHeightSpec(View view, int heightMeasureSpec) {
int heightSpec = 0;
if (view.getLayoutParams().height == LayoutParams.WRAP_CONTENT) {
// The great Android "hackatlon", the love, the magic.
// The two leftmost bits in the height measure spec have
// a special meaning, hence we can't use them to describe height.
heightSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
} else {
// Any other height should be respected as is.
heightSpec = heightMeasureSpec;
}
return heightSpec;
}Example 19
| Project: umeng_community_android-master File: FeedImageAdapter.java View source code |
// æ¤å¤„ä¸?用ViewParser的方å¼?,主è¦?是å?ªæœ‰ImageView且都需è¦?设置Tag(ViewHolder跟图片的url地å?€ï¼Œå¯¼è‡´å†²çª?)
@Override
public View getView(int position, View view, ViewGroup parent) {
SquareImageView imageView;
if (view == null) {
LayoutParams mImageViewLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
imageView = new SquareImageView(mContext);
imageView.setScaleType(ScaleType.CENTER_CROP);
imageView.setLayoutParams(mImageViewLayoutParams);
} else {
imageView = (SquareImageView) view;
}
imageView.setImageUrl(getItem(position).thumbnail, mDisplayOption);
return imageView;
}Example 20
| Project: open-keychain-master File: ViewKeyAdvUserIdsFragment.java View source code |
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
View root = super.onCreateView(inflater, superContainer, savedInstanceState);
View view = inflater.inflate(R.layout.view_key_adv_user_ids_fragment, getContainer());
mUserIds = (ListView) view.findViewById(R.id.view_key_user_ids);
mUserIdsAddedList = (ListView) view.findViewById(R.id.view_key_user_ids_added);
mUserIdsAddedLayout = view.findViewById(R.id.view_key_user_ids_add_layout);
mUserIds.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
showOrEditUserIdInfo(position);
}
});
View footer = new View(getActivity());
int spacing = (int) android.util.TypedValue.applyDimension(android.util.TypedValue.COMPLEX_UNIT_DIP, 72, getResources().getDisplayMetrics());
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.widget.AbsListView.LayoutParams.MATCH_PARENT, spacing);
footer.setLayoutParams(params);
mUserIdsAddedList.addFooterView(footer, null, false);
mUserIdAddFabLayout = (ViewAnimator) view.findViewById(R.id.view_key_subkey_fab_layout);
view.findViewById(R.id.view_key_subkey_fab).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addUserId();
}
});
setHasOptionsMenu(true);
return root;
}Example 21
| Project: android-smarterwifi-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 22
| Project: AndroidPicker-master File: ImageAdapter.java View source code |
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
viewHolder = new ViewHolder();
convertView = new ImageView(context);
ViewGroup.LayoutParams params;
if (parent instanceof AbsListView) {
//java.lang.ClassCastException:
// android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
params = new AbsListView.LayoutParams(width, height);
} else {
params = new ViewGroup.LayoutParams(width, height);
}
convertView.setLayoutParams(params);
viewHolder.imageView = (ImageView) convertView;
viewHolder.imageView.setScaleType(scaleType);
//åŠ ä¸Škey,é?¿å…?å’ŒGlide框架冲çª?: You must not call setTag() on a view Glide is targeting
convertView.setTag(TAG_KEY_AVOID_CONFLICT_WITH_GLIDE, viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag(TAG_KEY_AVOID_CONFLICT_WITH_GLIDE);
}
final Object item = data.get(position);
viewHolder.imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onImageClickListener != null) {
onImageClickListener.onImageClick(position, item);
}
}
});
switch(mode) {
case INTEGER:
viewHolder.imageView.setImageResource((Integer) item);
break;
case DRAWABLE:
viewHolder.imageView.setImageDrawable((Drawable) item);
break;
case BITMAP:
viewHolder.imageView.setImageBitmap((Bitmap) item);
break;
default:
ImageHelper.getInstance().display(item.toString(), viewHolder.imageView, width, height);
break;
}
return convertView;
}Example 23
| Project: Android_App_OpenSource-master File: MyCalendarView.java View source code |
// æ·»åŠ gridview
private void addGridView() {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
// �得�幕的宽度和高度
WindowManager windowManager = getWindowManager();
Display display = windowManager.getDefaultDisplay();
int Width = display.getWidth();
int Height = display.getHeight();
mGridView = new GridView(this);
// 7列
mGridView.setNumColumns(7);
// �项的宽度
mGridView.setColumnWidth(46);
if (Width == 480 && Height == 800) {
mGridView.setColumnWidth(69);
}
mGridView.setGravity(Gravity.CENTER_VERTICAL);
// 是å?¦æ˜¾ç¤ºç½‘æ ¼è¾¹æ¡†
isShowGridViewBorder(mGridView, false);
mGridView.setBackgroundResource(R.drawable.mycalendar_gridview_bg);
mGridView.setOnTouchListener(new OnTouchListener() {
@Override
public // å°†gridviewä¸çš„è§¦æ‘¸äº‹ä»¶å›žä¼ ç»™gestureDetector
boolean onTouch(// å°†gridviewä¸çš„è§¦æ‘¸äº‹ä»¶å›žä¼ ç»™gestureDetector
View v, // å°†gridviewä¸çš„è§¦æ‘¸äº‹ä»¶å›žä¼ ç»™gestureDetector
MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
});
mGridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
// Toast.makeText(MyCalendarView.this, position % 7 + "",
// Toast.LENGTH_SHORT).show();
// 当月第一天的�置
int startPosition = mAdp.getStartPositon();
// 当月最�一天的�置
int endPosition = mAdp.getEndPosition();
Log.i("andli", "点击�置=" + position);
Log.i("andli", "当月第一天,最�一天的�置[" + startPosition + "," + endPosition + "]");
// 本月范围内方å?¯æ·»åŠ æ—¥ç¨‹
if (startPosition <= position && position <= endPosition) {
String scheduleDay = mAdp.getDateByClickItem(position).split(// 这一天的阳历
"\\.")[0];
// String scheduleLunarDay =
// mAdp.getDateByClickItem(position).split("\\.")[1];
// //这一天的阴历
String scheduleYear = mAdp.getShowYear();
String scheduleMonth = mAdp.getShowMonth();
// 通过日期查询这一天是å?¦è¢«æ ‡è®°ï¼Œå¦‚æžœæ ‡è®°äº†æ—¥ç¨‹å°±æŸ¥è¯¢å‡ºè¿™å¤©çš„æ‰€æœ‰æ—¥ç¨‹ä¿¡æ?¯
String[] scheduleIDs = dao.getScheduleByTagDate(Integer.parseInt(scheduleYear), Integer.parseInt(scheduleMonth), Integer.parseInt(scheduleDay));
if (scheduleIDs != null && scheduleIDs.length > 0) {
// 跳转到显示这一天的所有日程信�界�
Intent intent = new Intent();
intent.setClass(MyCalendarView.this, ScheduleInfoView.class);
intent.putExtra("scheduleID", scheduleIDs);
startActivity(intent);
} else // 直接跳转到需è¦?æ·»åŠ æ—¥ç¨‹çš„ç•Œé?¢
{
ArrayList<String> scheduleDate = new ArrayList<String>();
scheduleDate.add(scheduleYear);
scheduleDate.add(scheduleMonth);
scheduleDate.add(scheduleDay);
scheduleDate.add(getWeek(position));
Intent intent = new Intent();
intent.putStringArrayListExtra("scheduleDate", scheduleDate);
intent.setClass(MyCalendarView.this, ScheduleAddView.class);
startActivity(intent);
}
}
// else {
// Toast.makeText(MyCalendarView.this, "é?žå½“æœˆï¼Œæ— æ³•æ–°å¢žæ—¥ç¨‹",
// Toast.LENGTH_SHORT).show();
// }
}
});
mGridView.setLayoutParams(params);
}Example 24
| Project: Android_Example_Projects-master File: SimpleMonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SimpleMonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (SimpleMonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = new SimpleMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
Log.d(TAG, "Year: " + year + ", Month: " + month);
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 25
| Project: Appsii-master File: MonthAdapter.java View source code |
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
SimpleArrayMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (SimpleArrayMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new SimpleArrayMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 26
| Project: BitTorrentApp-master File: PromotionsAdapter.java View source code |
@Override
public void setupView(View convertView, ViewGroup parent, Slide viewItem) {
ImageView imageView = (ImageView) convertView;
GridView gridView = (GridView) parent;
//hack
int promoWidth = getColumnWidth(gridView);
int promoHeight = (int) (promoWidth * PROMO_HEIGHT_TO_WIDTH_RATIO);
imageView.setLayoutParams(new LayoutParams(promoWidth, promoHeight));
ImageUtils.load(viewItem.imageSrc, imageView);
}Example 27
| Project: BlurEffectForAndroidDesign-master File: MainActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_main);
// Get the screen width
final int screenWidth = ImageUtils.getScreenWidth(this);
// Find the view
mBlurredImage = (ImageView) findViewById(R.id.blurred_image);
mNormalImage = (ImageView) findViewById(R.id.normal_image);
mBlurredImageHeader = (ScrollableImageView) findViewById(R.id.blurred_image_header);
mSwitch = (Switch) findViewById(R.id.background_switch);
mList = (ListView) findViewById(R.id.list);
// prepare the header ScrollableImageView
mBlurredImageHeader.setScreenWidth(screenWidth);
// Action for the switch
mSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
mBlurredImage.setAlpha(alpha);
} else {
mBlurredImage.setAlpha(0f);
}
}
});
// Try to find the blurred image
final File blurredImage = new File(getFilesDir() + BLURRED_IMG_PATH);
if (!blurredImage.exists()) {
// launch the progressbar in ActionBar
setProgressBarIndeterminateVisibility(true);
new Thread(new Runnable() {
@Override
public void run() {
// No image found => let's generate it!
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 2;
Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.image, options);
Bitmap newImg = Blur.fastblur(MainActivity.this, image, 12);
ImageUtils.storeImage(newImg, blurredImage);
runOnUiThread(new Runnable() {
@Override
public void run() {
updateView(screenWidth);
// And finally stop the progressbar
setProgressBarIndeterminateVisibility(false);
}
});
}
}).start();
} else {
// The image has been found. Let's update the view
updateView(screenWidth);
}
String[] strings = getResources().getStringArray(R.array.list_content);
// Prepare the header view for our list
headerView = new View(this);
headerView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, TOP_HEIGHT));
mList.addHeaderView(headerView);
mList.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item, strings));
mList.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
/**
* Listen to the list scroll. This is where magic happens ;)
*/
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
// Calculate the ratio between the scroll amount and the list
// header weight to determinate the top picture alpha
alpha = (float) -headerView.getTop() / (float) TOP_HEIGHT;
// Apply a ceil
if (alpha > 1) {
alpha = 1;
}
// Apply on the ImageView if needed
if (mSwitch.isChecked()) {
mBlurredImage.setAlpha(alpha);
}
// Parallax effect : we apply half the scroll amount to our
// three views
mBlurredImage.setTop(headerView.getTop() / 2);
mNormalImage.setTop(headerView.getTop() / 2);
mBlurredImageHeader.handleScroll(headerView.getTop() / 2);
}
});
}Example 28
| Project: BottomSheetPickers-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext, mThemeDark);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 29
| Project: Diandi1.20-master File: SimpleMonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SimpleMonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (SimpleMonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = new SimpleMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
Log.d(TAG, "Year: " + year + ", Month: " + month);
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 30
| Project: domo-master File: DnDListView.java View source code |
public boolean onTouchEvent(MotionEvent ev) {
// TODO Auto-generated method stub
if (isMoveFlag) {
switch(ev.getAction()) {
case MotionEvent.ACTION_DOWN:
Log.v(getClass().toString(), "action_dowm");
int y = (int) ev.getY();
if (getParent() instanceof AbsoluteLayout) {
AbsoluteLayout parent = (AbsoluteLayout) getParent();
if (moveView != null) {
parent.removeView(DnDAdapter.emptyView);
parent.addView(DnDAdapter.emptyView, new AbsoluteLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0, y - 22));
}
}
break;
case MotionEvent.ACTION_MOVE:
Log.v(getClass().toString(), "action_move");
int yMove = (int) ev.getY();
if (getParent() instanceof AbsoluteLayout) {
AbsoluteLayout parent = (AbsoluteLayout) getParent();
if (moveView != null) {
parent.removeView(DnDAdapter.emptyView);
parent.addView(DnDAdapter.emptyView, new AbsoluteLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0, yMove - 22));
inChild(MotionEvent.ACTION_MOVE);
}
}
break;
case MotionEvent.ACTION_UP:
if (getParent() instanceof AbsoluteLayout) {
AbsoluteLayout parent = (AbsoluteLayout) getParent();
if (moveView != null) {
parent.removeView(DnDAdapter.emptyView);
inChild(MotionEvent.ACTION_UP);
// DnDAdapter.addEntry(movedPosition);
}
}
isMoveFlag = false;
setEnabled(true);
Log.v(getClass().toString(), "action_up: " + isMoveFlag);
break;
default:
break;
}
}
return super.onTouchEvent(ev);
}Example 31
| Project: GoogleDateTimePickers-master File: SimpleMonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SimpleMonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (SimpleMonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = new SimpleMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
Log.d(TAG, "Year: " + year + ", Month: " + month);
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 32
| Project: HoloEverywhere-master File: SimpleMonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SimpleMonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (SimpleMonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = new SimpleMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
Log.d(TAG, "Year: " + year + ", Month: " + month);
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 33
| Project: MaterialDateTimePicker-master File: MonthAdapter.java View source code |
@Override
public MonthViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
MonthView v = createMonthView(parent.getContext());
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
return new MonthViewHolder(v);
}Example 34
| Project: odyssey-master File: ArtistsAdapter.java View source code |
/**
* Get a View that displays the data at the specified position in the data set.
*
* @param position The position of the item within the adapter's data set.
* @param convertView The old view to reuse, if possible.
* @param parent The parent that this view will eventually be attached to.
* @return A View corresponding to the data at the specified position.
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ArtistModel artist = (ArtistModel) getItem(position);
String label = artist.getArtistName();
if (mUseList) {
ListViewItem listItem;
// Check if a view can be recycled
if (convertView != null) {
listItem = (ListViewItem) convertView;
listItem.setTitle(label);
} else {
listItem = new ListViewItem(mContext, label, this);
}
if (!mHideArtwork) {
// This will prepare the view for fetching the image from the internet if not already saved in local database.
listItem.prepareArtworkFetching(mArtworkManager, artist);
// Check if the scroll speed currently is already 0, then start the image task right away.
if (mScrollSpeed == 0) {
listItem.startCoverImageTask();
}
}
return listItem;
} else {
GridViewItem gridItem;
ViewGroup.LayoutParams layoutParams;
// Check if a view can be recycled
if (convertView != null) {
gridItem = (GridViewItem) convertView;
gridItem.setTitle(label);
layoutParams = gridItem.getLayoutParams();
layoutParams.height = ((GridView) mListView).getColumnWidth();
layoutParams.width = ((GridView) mListView).getColumnWidth();
} else {
// Create new view if no reusable is available
gridItem = new GridViewItem(mContext, label, this);
layoutParams = new android.widget.AbsListView.LayoutParams(((GridView) mListView).getColumnWidth(), ((GridView) mListView).getColumnWidth());
}
// Make sure to reset the layoutParams in case of change (rotation for example)
gridItem.setLayoutParams(layoutParams);
if (!mHideArtwork) {
// This will prepare the view for fetching the image from the internet if not already saved in local database.
gridItem.prepareArtworkFetching(mArtworkManager, artist);
// Check if the scroll speed currently is already 0, then start the image task right away.
if (mScrollSpeed == 0) {
gridItem.startCoverImageTask();
}
}
return gridItem;
}
}Example 35
| Project: PersianMaterialDateTimePicker-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 36
| Project: RefreashTabView-master File: Tab3ListFragment.java View source code |
private void listViewAddHeader() {
placeHolderView = new LinearLayout(getActivity());
AbsListView.LayoutParams params = new LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, getResources().getDimensionPixelSize(R.dimen.max_header_height));
placeHolderView.setLayoutParams(params);
listView.getRefreshableView().addHeaderView(placeHolderView);
}Example 37
| Project: show-client-master File: PlayerMenuDialog.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
TextView view;
if (convertView == null) {
view = new TextView(mContext);
LayoutParams layoutParams = new LayoutParams(parent.getWidth(), Utils.getStandardValue(mContext, 70));
view.setLayoutParams(layoutParams);
view.setGravity(Gravity.CENTER);
view.setTextColor(Color.WHITE);
view.setTextSize(25);
view.setSingleLine(true);
view.setEllipsize(TruncateAt.MARQUEE);
} else {
view = (TextView) convertView;
}
if (title_selecet_index == 0) {
view.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
view.setPadding(Utils.getStandardValue(mContext, 35), 0, Utils.getStandardValue(mContext, 35), 0);
} else {
view.setGravity(Gravity.CENTER);
view.setPadding(0, 0, 0, 0);
}
switch(title_selecet_index) {
case 0:
view.setText(list_juji.get(position));
break;
case 1:
view.setText(list_zimu.get(position));
break;
case 2:
switch(list_definition.get(position)) {
case Constant.DEFINATION_HD2:
view.setText("超 清");
break;
case Constant.DEFINATION_HD:
view.setText("高 清");
break;
case Constant.DEFINATION_MP4:
view.setText("æ ‡ 清");
break;
case Constant.DEFINATION_FLV:
view.setText("æµ? ç•…");
break;
}
break;
case 3:
switch(list_size.get(position)) {
case JoyplusMediaPlayerScreenManager.LINEARLAYOUT_PARAMS_FULL:
view.setText("å…¨ å±?");
break;
case JoyplusMediaPlayerScreenManager.LINEARLAYOUT_PARAMS_16x9:
view.setText("16 : 9");
break;
case JoyplusMediaPlayerScreenManager.LINEARLAYOUT_PARAMS_4x3:
view.setText("4 : 3");
break;
case JoyplusMediaPlayerScreenManager.LINEARLAYOUT_PARAMS_ORIGINAL:
view.setText("自 适 应");
break;
}
break;
}
return view;
}Example 38
| Project: SnoozMark-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 39
| Project: stxnext-intranet-android-master File: SimpleMonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SimpleMonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (SimpleMonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = new SimpleMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
Log.d(TAG, "Year: " + year + ", Month: " + month);
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 40
| Project: android-datepickers-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 41
| Project: android-lunar-event-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 42
| Project: android-packages-apps-calendar-compiled-master File: MonthByWeekAdapter.java View source code |
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (mIsMiniMonth) {
return super.getView(position, convertView, parent);
}
MonthWeekEventsView v;
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
HashMap<String, Integer> drawingParams = null;
boolean isAnimatingToday = false;
if (convertView != null) {
v = (MonthWeekEventsView) convertView;
// params, so this is assuming the view is relatively stable
if (mAnimateToday && v.updateToday(mSelectedDay.timezone)) {
long currentTime = System.currentTimeMillis();
// before reaching today.
if (currentTime - mAnimateTime > ANIMATE_TODAY_TIMEOUT) {
mAnimateToday = false;
mAnimateTime = 0;
} else {
isAnimatingToday = true;
// There is a bug that causes invalidates to not work some
// of the time unless we recreate the view.
v = new MonthWeekEventsView(mContext);
}
} else {
drawingParams = (HashMap<String, Integer>) v.getTag();
}
} else {
v = new MonthWeekEventsView(mContext);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
v.setLayoutParams(params);
v.setClickable(true);
v.setOnTouchListener(this);
int selectedDay = -1;
if (mSelectedWeek == position) {
selectedDay = mSelectedDay.weekDay;
}
drawingParams.put(SimpleWeekView.VIEW_PARAMS_HEIGHT, (parent.getHeight() + parent.getTop()) / mNumWeeks);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SHOW_WK_NUM, mShowWeekNumber ? 1 : 0);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK_START, mFirstDayOfWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_NUM_DAYS, mDaysPerWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK, position);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_FOCUS_MONTH, mFocusMonth);
drawingParams.put(MonthWeekEventsView.VIEW_PARAMS_ORIENTATION, mOrientation);
if (isAnimatingToday) {
drawingParams.put(MonthWeekEventsView.VIEW_PARAMS_ANIMATE_TODAY, 1);
mAnimateToday = false;
}
v.setWeekParams(drawingParams, mSelectedDay.timezone);
sendEventsToView(v);
return v;
}Example 43
| Project: android-sdk-sources-for-api-level-23-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 44
| Project: Android_datetimepicker_kitkat_4.4-master File: SimpleMonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SimpleMonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (SimpleMonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = new SimpleMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
Log.d(TAG, "Year: " + year + ", Month: " + month);
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 45
| Project: android_packages_apps-master File: SimpleWeeksAdapter.java View source code |
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SimpleWeekView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (SimpleWeekView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = new SimpleWeekView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnTouchListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
int selectedDay = -1;
if (mSelectedWeek == position) {
selectedDay = mSelectedDay.weekDay;
}
// pass in all the view parameters
drawingParams.put(SimpleWeekView.VIEW_PARAMS_HEIGHT, (parent.getHeight() - WEEK_7_OVERHANG_HEIGHT) / mNumWeeks);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SHOW_WK_NUM, mShowWeekNumber ? 1 : 0);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK_START, mFirstDayOfWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_NUM_DAYS, mDaysPerWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK, position);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_FOCUS_MONTH, mFocusMonth);
v.setWeekParams(drawingParams, mSelectedDay.timezone);
v.invalidate();
return v;
}Example 46
| Project: DateTimePickerCompat-master File: SimpleMonthAdapter.java View source code |
@SuppressLint("InlinedApi")
@SuppressWarnings({ "unchecked", "deprecation" })
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SimpleMonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (SimpleMonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = new SimpleMonthView(mContext);
// Set up the new view
LayoutParams params = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
} else {
params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
}
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
Log.d(TAG, "Year: " + year + ", Month: " + month);
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 47
| Project: LightUpDroid-Alarm-master File: SimpleMonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
SimpleMonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (SimpleMonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = new SimpleMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
Log.d(TAG, "Year: " + year + ", Month: " + month);
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 48
| Project: MaterialDateRangePicker-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
if (mAccentColor != -1) {
v.setAccentColor(mAccentColor);
}
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 49
| Project: MaterialDesignSupport-master File: AnimatedExpandableListAdapter.java View source code |
/**
* Override {@link #getChildView(int, int, boolean, View, ViewGroup)} instead.
*/
@Override
public final View getChildView(final int holderPosition, int childPosition, boolean isLastChild, View convertView, final ViewGroup parent) {
final ExpandableListStateHolder stateHolder = getExpandableListStateHolder(holderPosition);
if (stateHolder == null) {
return convertView;
}
if (stateHolder.isAnimating()) {
if (convertView == null) {
convertView = new ExpandableListDummyView(parent.getContext());
convertView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
}
if (childPosition < stateHolder.getFirstChildPosition()) {
// The reason why we do this is to support the collapse
// this group when the group view is not visible but the
// children of this group are. When notifyDataSetChanged
// is called, the ExpandableListView tries to keep the
// list position the same by saving the first visible item
// and jumping back to that item after the views have been
// refreshed. Now the problem is, if a group has 2 items
// and the first visible item is the 2nd child of the group
// and this group is collapsed, then the dummy view will be
// used for the group. But now the group only has 1 item
// which is the dummy view, thus when the ListView is trying
// to restore the scroll position, it will try to jump to
// the second item of the group. But this group no longer
// has a second item, so it is forced to jump to the next
// group. This will cause a very ugly visual glitch. So
// the way that we counteract this is by creating as many
// dummy views as we need to maintain the scroll position
// of the ListView after notifyDataSetChanged has been
// called.
convertView.getLayoutParams().height = 0;
return convertView;
}
final ExpandableListDummyView dummyView = (ExpandableListDummyView) convertView;
// Clear the views that the dummy view draws.
dummyView.clearViews();
// Set the style of the divider
dummyView.setDivider(mExpandableListView.getDivider(), parent.getMeasuredWidth(), mExpandableListView.getDividerHeight());
// Make measure specs to measure child views
final int measureSpecW = MeasureSpec.makeMeasureSpec(parent.getWidth(), MeasureSpec.EXACTLY);
final int measureSpecH = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
int totalHeight = 0;
int clipHeight = parent.getHeight();
final int len = getRealChildrenCount(holderPosition);
for (int i = stateHolder.getFirstChildPosition(); i < len; i++) {
View childView = getRealChildView(holderPosition, i, (i == len - 1), null, parent);
childView.measure(measureSpecW, measureSpecH);
totalHeight += childView.getMeasuredHeight();
if (totalHeight < clipHeight) {
// we only need to draw enough views to fool the user...
dummyView.addFakeView(childView);
} else {
dummyView.addFakeView(childView);
// if this group has too many views, we don't want to
// calculate the height of everything... just do a light
// approximation and break
int averageHeight = totalHeight / (i + 1);
totalHeight += (len - i - 1) * averageHeight;
break;
}
}
Object o;
int state = (o = dummyView.getTag()) == null ? STATE_IDLE : (Integer) o;
if (stateHolder.isExpanding() && state != STATE_EXPANDING) {
ExpandCollapseAnimation ani = new ExpandCollapseAnimation(dummyView, 0, totalHeight, stateHolder);
ani.setDuration(AnimatedExpandableListView.ANIMATION_DURATION);
ani.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
stopAnimation(holderPosition);
notifyDataSetChanged();
dummyView.setTag(STATE_IDLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationStart(Animation animation) {
}
});
dummyView.startAnimation(ani);
dummyView.setTag(STATE_EXPANDING);
} else if (stateHolder.isExpanding() == false && state != STATE_COLLAPSING) {
if (stateHolder.getDummyHeight() == -1) {
stateHolder.setDummyHeight(totalHeight);
}
ExpandCollapseAnimation ani = new ExpandCollapseAnimation(dummyView, stateHolder.getDummyHeight(), 0, stateHolder);
ani.setDuration(AnimatedExpandableListView.ANIMATION_DURATION);
ani.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
stopAnimation(holderPosition);
mExpandableListView.collapseGroup(holderPosition);
notifyDataSetChanged();
stateHolder.setDummyHeight(-1);
dummyView.setTag(STATE_IDLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationStart(Animation animation) {
}
});
dummyView.startAnimation(ani);
dummyView.setTag(STATE_COLLAPSING);
}
return convertView;
} else {
return getRealChildView(holderPosition, childPosition, isLastChild, convertView, parent);
}
}Example 50
| Project: Notepad-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 51
| Project: pretty-ordinary-client-master File: LoginView.java View source code |
private void setBoxVersionLowViews() {
tvDeviderLine.setVisibility(View.GONE);
llGradientCover.setVisibility(View.GONE);
setHint(null, View.INVISIBLE);
llBtn.setVisibility(View.VISIBLE);
loginBtn.setVisibility(View.VISIBLE);
loginBtn.setText(R.string.login_retry);
loginBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
listener.onViewChange(MESSAGE_RECONNECT, null);
}
});
LinearLayout ll = (LinearLayout) inflater.inflate(R.layout.layout_login_boxversion_low, null);
ll.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
viewStub.removeAllViews();
viewStub.addView(ll);
}Example 52
| Project: StyleableDateTimePicker-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 53
| Project: uhabits-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 54
| Project: Wendler-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = position % MONTHS_IN_YEAR;
final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}Example 55
| Project: drum-machine.audio-master File: SelectDialog.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
FileItem fItem = this.getItem(position);
//view.setLayoutParams(new LayoutParams(android.widget.AbsListView.LayoutParams.FILL_PARENT, android.widget.AbsListView.LayoutParams.WRAP_CONTENT));
TextView tv1 = (TextView) view.findViewById(android.R.id.text1);
if (fItem.getName().endsWith("json")) {
tv1.setText(fItem.getName().replace(".json", " PACK"));
view.setBackgroundColor(SelectConstants.COLOR_FILE_PACK);
} else
view.setBackgroundColor(fItem.getType().getColor());
tv1.setTextColor(Color.WHITE);
tv1.setTextSize(15);
tv1.setShadowLayer((float) 0.01, 1, 1, Color.BLACK);
TextView tv2 = (TextView) view.findViewById(android.R.id.text2);
tv2.setTextColor(Color.WHITE);
tv2.setTextSize(10);
tv2.setShadowLayer((float) 0.01, 1, 1, Color.BLACK);
ImageButton play = (ImageButton) view.findViewById(R.id.imageButton1);
play.setVisibility(View.VISIBLE);
if (fItem.getName().equalsIgnoreCase("Up..")) {
//play.setVisibility(View.GONE);
play.setEnabled(false);
play.setImageResource(R.drawable.ic_menu_back);
if (fItem.isOnline)
tv2.setText("Press to go back");
else
tv2.setText("Press to go back to\n" + fItem.getFullPath());
} else if (fItem.getType() == FileType.Folder) {
//play.setVisibility(View.GONE);
play.setEnabled(false);
play.setImageResource(R.drawable.ic_menu_archive);
if (fItem.isOnline)
tv2.setText(fItem.getFormattedCreationDate() + "\n" + fItem.getFormattedLastViewDate());
else
tv2.setText("Path:\n" + fItem.getFullPath());
} else if (fItem.getType() == FileType.File) {
tv2.setText(fItem.getFormattedLastModifiedDate() + "\n" + fItem.getFormattedSize());
//play.setText(R.string.play);
play.setTag(fItem);
if (fItem.getName().endsWith("json")) {
play.setEnabled(false);
play.setImageResource(R.drawable.ic_menu_moreoverflow);
} else {
play.setEnabled(true);
play.setImageResource(android.R.drawable.ic_media_play);
}
play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final FileItem fItem = (FileItem) v.getTag();
Log.i("PREVIEW", "File:" + fItem.getFile().getName() + " name:" + fItem.getName());
if (!fItem.isOnline) {
if (fItem.getFile().exists()) {
if (fItem.getName().endsWith("wav")) {
MediaPlayer mp = MediaPlayer.create(getContext(), Uri.fromFile(fItem.getFile()));
if (mp != null)
mp.start();
} else {
selectCallback(fItem.getFile(), "playSoundFile", DrumCloud.X);
}
} else {
Log.i("FILE ERROR", "Unable to locate file:" + fItem.getFile().getAbsolutePath());
}
} else {
downloadPreview = true;
lastSelectedFileItem = fItem;
GoogleDriveService.downloadFile(fItem.downloadUrl);
}
}
});
}
return view;
}Example 56
| Project: android-betterpickers-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView monthView;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
monthView = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) monthView.getTag();
} else {
monthView = createMonthView(mContext);
monthView.setTheme(mThemeColors);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
monthView.setLayoutParams(params);
monthView.setClickable(true);
monthView.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = (position + mController.getMinDate().month) % MONTHS_IN_YEAR;
final int year = (position + mController.getMinDate().month) / MONTHS_IN_YEAR + mController.getMinDate().year;
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
int rangeMin = -1;
if (isRangeMinInMonth(year, month)) {
rangeMin = mController.getMinDate().day;
}
int rangeMax = -1;
if (isRangeMaxInMonth(year, month)) {
rangeMax = mController.getMaxDate().day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
monthView.reuse();
// Set disabled days if they exist
if (mController.getDisabledDays() != null) {
monthView.setDisabledDays(mController.getDisabledDays());
}
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
drawingParams.put(MonthView.VIEW_PARAMS_RANGE_MIN, rangeMin);
drawingParams.put(MonthView.VIEW_PARAMS_RANGE_MAX, rangeMax);
monthView.setMonthParams(drawingParams);
monthView.invalidate();
return monthView;
}Example 57
| Project: betterpickers-master File: MonthAdapter.java View source code |
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView monthView;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
monthView = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) monthView.getTag();
} else {
monthView = createMonthView(mContext);
monthView.setTheme(mThemeColors);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
monthView.setLayoutParams(params);
monthView.setClickable(true);
monthView.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
final int month = (position + mController.getMinDate().month) % MONTHS_IN_YEAR;
final int year = (position + mController.getMinDate().month) / MONTHS_IN_YEAR + mController.getMinDate().year;
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
int rangeMin = -1;
if (isRangeMinInMonth(year, month)) {
rangeMin = mController.getMinDate().day;
}
int rangeMax = -1;
if (isRangeMaxInMonth(year, month)) {
rangeMax = mController.getMaxDate().day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
monthView.reuse();
// Set disabled days if they exist
if (mController.getDisabledDays() != null) {
monthView.setDisabledDays(mController.getDisabledDays());
}
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
drawingParams.put(MonthView.VIEW_PARAMS_RANGE_MIN, rangeMin);
drawingParams.put(MonthView.VIEW_PARAMS_RANGE_MAX, rangeMax);
monthView.setMonthParams(drawingParams);
monthView.invalidate();
return monthView;
}Example 58
| Project: Calendar_lunar-master File: MonthByWeekAdapter.java View source code |
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (mIsMiniMonth) {
return super.getView(position, convertView, parent);
}
MonthWeekEventsView v;
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
HashMap<String, Integer> drawingParams = null;
boolean isAnimatingToday = false;
if (convertView != null) {
v = (MonthWeekEventsView) convertView;
// params, so this is assuming the view is relatively stable
if (mAnimateToday && v.updateToday(mSelectedDay.timezone)) {
long currentTime = System.currentTimeMillis();
// before reaching today.
if (currentTime - mAnimateTime > ANIMATE_TODAY_TIMEOUT) {
mAnimateToday = false;
mAnimateTime = 0;
} else {
isAnimatingToday = true;
// There is a bug that causes invalidates to not work some
// of the time unless we recreate the view.
v = new MonthWeekEventsView(mContext);
}
} else {
drawingParams = (HashMap<String, Integer>) v.getTag();
}
} else {
v = new MonthWeekEventsView(mContext);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
v.setLayoutParams(params);
v.setClickable(true);
v.setOnTouchListener(this);
int selectedDay = -1;
if (mSelectedWeek == position) {
selectedDay = mSelectedDay.weekDay;
}
drawingParams.put(SimpleWeekView.VIEW_PARAMS_HEIGHT, (parent.getHeight() + parent.getTop()) / mNumWeeks);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SHOW_WK_NUM, mShowWeekNumber ? 1 : 0);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK_START, mFirstDayOfWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_NUM_DAYS, mDaysPerWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK, position);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_FOCUS_MONTH, mFocusMonth);
drawingParams.put(MonthWeekEventsView.VIEW_PARAMS_ORIENTATION, mOrientation);
if (isAnimatingToday) {
drawingParams.put(MonthWeekEventsView.VIEW_PARAMS_ANIMATE_TODAY, 1);
mAnimateToday = false;
}
v.setWeekParams(drawingParams, mSelectedDay.timezone);
sendEventsToView(v);
return v;
}Example 59
| Project: GoogleCalendarView-master File: MonthByWeekAdapter.java View source code |
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// if (mIsMiniMonth) {
// return super.getView(position, convertView, parent);
// }
MonthWeekEventsView v;
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
HashMap<String, Integer> drawingParams = null;
boolean isAnimatingToday = false;
if (convertView != null) {
v = (MonthWeekEventsView) convertView;
// params, so this is assuming the view is relatively stable
if (mAnimateToday && v.updateToday(mSelectedDay.timezone)) {
long currentTime = System.currentTimeMillis();
// before reaching today.
if (currentTime - mAnimateTime > ANIMATE_TODAY_TIMEOUT) {
mAnimateToday = false;
mAnimateTime = 0;
} else {
isAnimatingToday = true;
// There is a bug that causes invalidates to not work some
// of the time unless we recreate the view.
v = new MonthWeekEventsView(mContext);
}
} else {
drawingParams = (HashMap<String, Integer>) v.getTag();
}
} else {
v = new MonthWeekEventsView(mContext);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
v.setLayoutParams(params);
v.setClickable(true);
v.setOnTouchListener(this);
int selectedDay = -1;
if (mSelectedWeek == position) {
selectedDay = mSelectedDay.weekDay;
}
drawingParams.put(SimpleWeekView.VIEW_PARAMS_HEIGHT, (parent.getHeight() + parent.getTop()) / mNumWeeks);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SHOW_WK_NUM, mShowWeekNumber ? 1 : 0);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK_START, mFirstDayOfWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_NUM_DAYS, mDaysPerWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK, position);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_FOCUS_MONTH, mFocusMonth);
drawingParams.put(MonthWeekEventsView.VIEW_PARAMS_ORIENTATION, mOrientation);
if (isAnimatingToday) {
drawingParams.put(MonthWeekEventsView.VIEW_PARAMS_ANIMATE_TODAY, 1);
mAnimateToday = false;
}
v.setWeekParams(drawingParams, mSelectedDay.timezone);
sendEventsToView(v);
return v;
}Example 60
| Project: kanqiu_letv-master File: RankerFragment.java View source code |
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
GroupHolder mHolder = null;
if (null == convertView) {
mHolder = new GroupHolder();
convertView = LayoutInflater.from(getActivity()).inflate(R.layout.ranker_fragment_list_item_group, null);
mHolder.groupName = (TextView) convertView.findViewById(R.id.ranker_fragment_item_rank_group);
convertView.setTag(mHolder);
lParams0 = new LayoutParams(LayoutParams.MATCH_PARENT, 1);
lParamsNomel = (LayoutParams) convertView.getLayoutParams();
} else {
mHolder = (GroupHolder) convertView.getTag();
}
String groupName = getGroup(groupPosition).group;
if (TextUtils.isEmpty(groupName.trim())) {
if (null != lParams0)
convertView.setLayoutParams(lParams0);
} else {
if (null != lParamsNomel)
convertView.setLayoutParams(lParamsNomel);
mHolder.groupName.setText(groupName);
}
return convertView;
}Example 61
| Project: n-puzzle-master File: ImageSource.java View source code |
private LayoutParams getThumbnailSize() { if (null == thumbnailSize) { DisplayMetrics metrics = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(metrics); thumbnailSize = new LayoutParams((int) (metrics.density * GRID_CELL_WIDTH_DP), (int) (metrics.density * GRID_CELL_HEIGHT_DP)); } return thumbnailSize; }
Example 62
| Project: platform_packages_apps_calendar-master File: MonthByWeekAdapter.java View source code |
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (mIsMiniMonth) {
return super.getView(position, convertView, parent);
}
MonthWeekEventsView v;
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
HashMap<String, Integer> drawingParams = null;
boolean isAnimatingToday = false;
if (convertView != null) {
v = (MonthWeekEventsView) convertView;
// params, so this is assuming the view is relatively stable
if (mAnimateToday && v.updateToday(mSelectedDay.timezone)) {
long currentTime = System.currentTimeMillis();
// before reaching today.
if (currentTime - mAnimateTime > ANIMATE_TODAY_TIMEOUT) {
mAnimateToday = false;
mAnimateTime = 0;
} else {
isAnimatingToday = true;
// There is a bug that causes invalidates to not work some
// of the time unless we recreate the view.
v = new MonthWeekEventsView(mContext);
}
} else {
drawingParams = (HashMap<String, Integer>) v.getTag();
}
} else {
v = new MonthWeekEventsView(mContext);
}
if (drawingParams == null) {
drawingParams = new HashMap<String, Integer>();
}
drawingParams.clear();
v.setLayoutParams(params);
v.setClickable(true);
v.setOnTouchListener(this);
int selectedDay = -1;
if (mSelectedWeek == position) {
selectedDay = mSelectedDay.weekDay;
}
drawingParams.put(SimpleWeekView.VIEW_PARAMS_HEIGHT, (parent.getHeight() + parent.getTop()) / mNumWeeks);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_SHOW_WK_NUM, mShowWeekNumber ? 1 : 0);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK_START, mFirstDayOfWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_NUM_DAYS, mDaysPerWeek);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_WEEK, position);
drawingParams.put(SimpleWeekView.VIEW_PARAMS_FOCUS_MONTH, mFocusMonth);
drawingParams.put(MonthWeekEventsView.VIEW_PARAMS_ORIENTATION, mOrientation);
if (isAnimatingToday) {
drawingParams.put(MonthWeekEventsView.VIEW_PARAMS_ANIMATE_TODAY, 1);
mAnimateToday = false;
}
v.setWeekParams(drawingParams, mSelectedDay.timezone);
sendEventsToView(v);
return v;
}Example 63
| Project: Sapelli-master File: AndroidControlsUI.java View source code |
@Override
protected View getPlatformView() {
if (view == null) {
view = new ItemPickerView(collectorUI.getContext());
// UI set-up:
view.setBackgroundColor(Color.BLACK);
view.setHorizontalSpacing(collectorUI.getSpacingPx());
// Bottom padding (to put spacing between buttons and view underneath)
view.setPadding(0, 0, 0, collectorUI.getSpacingPx());
// ControlItem size:
view.setItemDimensionsPx(LayoutParams.MATCH_PARENT, collectorUI.getControlHeightPx());
// Listen for clicks:
view.setOnItemClickListener(this);
view.setOnItemLongClickListener(this);
}
return view;
}Example 64
| Project: Studiportal-Checker-master File: ExamCategoryAdapter.java View source code |
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
//Get Exam
Exam e = this.objects.get(position);
//Save context
Context ctx = holder.itemView.getContext();
//If e is a seperator hide all views, if not show them all
if (e instanceof Seperator) {
holder.itemView.setVisibility(View.GONE);
holder.itemView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 60));
return;
} else {
holder.itemView.setVisibility(View.VISIBLE);
holder.itemView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
holder.itemView.setVisibility(View.VISIBLE);
for (TextView v : holder.textViews) v.setVisibility(View.VISIBLE);
}
//Get Kind
Exam.Kind kind = e.getKindEnum();
//Set title and exam no
holder.textViews.get(0).setText(e.getName());
//Fill Views with data
switch(kind) {
case KO:
if (e.getBonus().equals("-")) {
//If there are no bnous ects -> hide the useless view, else -> show them
holder.textViews.get(1).setVisibility(View.GONE);
} else {
holder.textViews.get(1).setText(String.format("%s: %s %s", this.BONUS, e.getBonus(), this.ECTS));
}
if (e.getMalus().equals("-")) {
//If there are no malus ects -> hide the useless view, else -> show them
holder.textViews.get(2).setVisibility(View.GONE);
} else {
holder.textViews.get(2).setText(String.format("%s: %s %s", this.MALUS, e.getMalus(), this.ECTS));
}
if (e.getMalus().equals("-") && e.getBonus().equals("-")) {
//If both are not set, the View will be empty (both textview are hidden)! Show the first and say no ects
holder.textViews.get(1).setVisibility(View.VISIBLE);
holder.textViews.get(1).setText(this.NO_ECTS);
holder.textViews.get(2).setVisibility(View.GONE);
}
break;
case PL:
case P:
case G:
if (e.isResignated()) {
//If e is resignated, shw special info on the topic
holder.textViews.get(1).setText(String.format("%s: %s", this.STATE, this.STATE_RESIGNATED));
holder.textViews.get(2).setText(String.format("%s: %s", this.NOTE, e.getNoteName(ctx)));
} else {
//First field
if (e.getStateEnum() == Exam.State.AN) {
//If e is only AN, there is no grade to show. Display state: an
holder.textViews.get(1).setText(String.format("%s: %s (%s %s)", this.STATE, e.getStateName(ctx), e.getECTS(), this.ECTS));
} else {
//e is not an -> be, nb or en. Show grade and ects
holder.textViews.get(1).setText(String.format("%s: %s (%s %s)", this.GRADE, e.getGrade(), e.getECTS(), this.ECTS));
}
//Second Field
if (e.getKindEnum() == Exam.Kind.G) {
//If e is generatde, show only the semester
holder.textViews.get(2).setText(String.format("%s: %s", this.SEMESTER, e.getSemester()));
} else {
//Else show attempt and semester
holder.textViews.get(2).setText(String.format("%s: %s (%s)", this.ATTEMPT, e.getTryCount(), e.getSemester()));
}
}
break;
case VL:
//Show state and sign that e is a vl
holder.textViews.get(1).setText(String.format("%s: %s (%s %s)", this.STATE, e.getStateName(ctx), e.getECTS(), this.ECTS));
holder.textViews.get(2).setText(this.PRACTICAL_WORK);
break;
case UNDEFINED:
default:
//This should not happen. show state an Kind
holder.textViews.get(1).setText(String.format("%s: %s", this.STATE, e.getStateName(ctx)));
holder.textViews.get(2).setText(e.getKind());
break;
}
//Set icon
switch(e.getStateEnum()) {
case AN:
holder.imageView.setImageDrawable(this.IC_AN);
break;
case BE:
holder.imageView.setImageDrawable(this.IC_BE);
break;
case NB:
holder.imageView.setImageDrawable(this.IC_NB);
break;
case EN:
holder.imageView.setImageDrawable(this.IC_EN);
break;
case UNDEFINED:
holder.imageView.setVisibility(View.GONE);
break;
}
//If eis resignated, override icon with flag
if (e.isResignated()) {
holder.imageView.setImageDrawable(this.IC_RE);
}
}Example 65
| Project: apg-master File: KeyListFragment.java View source code |
/**
* Define Adapter and Loader on create of Activity
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// show app name instead of "keys" from nav drawer
getActivity().setTitle(R.string.app_name);
mStickyList.setOnItemClickListener(this);
mStickyList.setAreHeadersSticky(true);
mStickyList.setDrawingListUnderStickyHeader(false);
mStickyList.setFastScrollEnabled(true);
// Adds an empty footer view so that the Floating Action Button won't block content
// in last few rows.
View footer = new View(getActivity());
int spacing = (int) android.util.TypedValue.applyDimension(android.util.TypedValue.COMPLEX_UNIT_DIP, 72, getResources().getDisplayMetrics());
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.widget.AbsListView.LayoutParams.MATCH_PARENT, spacing);
footer.setLayoutParams(params);
mStickyList.addFooterView(footer, null, false);
/*
* Multi-selection
*/
mStickyList.setFastScrollAlwaysVisible(true);
mStickyList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
mStickyList.getWrappedList().setMultiChoiceModeListener(new MultiChoiceModeListener() {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
android.view.MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.key_list_multi, menu);
mActionMode = mode;
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
// get IDs for checked positions as long array
long[] ids;
switch(item.getItemId()) {
case R.id.menu_key_list_multi_encrypt:
{
ids = mAdapter.getCurrentSelectedMasterKeyIds();
encrypt(mode, ids);
break;
}
case R.id.menu_key_list_multi_delete:
{
ids = mAdapter.getCurrentSelectedMasterKeyIds();
showDeleteKeyDialog(mode, ids, mAdapter.isAnySecretSelected());
break;
}
case R.id.menu_key_list_multi_export:
{
ids = mAdapter.getCurrentSelectedMasterKeyIds();
showMultiExportDialog(ids);
break;
}
case R.id.menu_key_list_multi_select_all:
{
// select all
for (int i = 0; i < mAdapter.getCount(); i++) {
mStickyList.setItemChecked(i, true);
}
break;
}
}
return true;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
mActionMode = null;
mAdapter.clearSelection();
}
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
if (checked) {
mAdapter.setNewSelection(position, true);
} else {
mAdapter.removeSelection(position);
}
int count = mStickyList.getCheckedItemCount();
String keysSelected = getResources().getQuantityString(R.plurals.key_list_selected_keys, count, count);
mode.setTitle(keysSelected);
}
});
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Start out with a progress indicator.
setContentShown(false);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new KeyListAdapter(getActivity(), null, 0);
mStickyList.setAdapter(mAdapter);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}Example 66
| Project: boardgamegeek4android-master File: PlayFragment.java View source code |
@Override
public View getView(int position, final View convertView, ViewGroup parent) {
PlayerRow row = new PlayerRow(getActivity());
row.setLayoutParams(new ListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
final Player player = (Player) getItem(position);
row.setPlayer(player);
row.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityUtils.startBuddyActivity(getActivity(), player.username, player.name);
}
});
return row;
}Example 67
| Project: Cocoa4Android-master File: UITableView.java View source code |
public void setTableHeaderView(UIView view) {
if (headerView != null) {
listView.removeHeaderView(headerView.getView());
}
if (view != null) {
AbsListView.LayoutParams params = null;
if (view.frame == null) {
params = new AbsListView.LayoutParams(LayoutParams.FILL_PARENT, (int) (44 * scaleDensityY));
} else {
params = new AbsListView.LayoutParams((int) (view.frame.size.width * scaleDensityX), (int) (view.frame.size.height * scaleDensityY));
}
view.getView().setLayoutParams(params);
listView.addHeaderView(view.getView());
}
headerView = view;
}Example 68
| Project: Musubi-Android-master File: IntroductionObj.java View source code |
@Override
public View createView(Context context, ViewGroup frame) {
LinearLayout wrap = new LinearLayout(context);
wrap.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
wrap.setOrientation(LinearLayout.VERTICAL);
wrap.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
wrap.setEnabled(false);
wrap.setFocusableInTouchMode(false);
wrap.setFocusable(false);
wrap.setClickable(false);
TextView title = new TextView(context);
title.setText(R.string.introduced);
title.setTypeface(null, Typeface.BOLD);
title.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
wrap.addView(title);
Gallery intro = new Gallery(context);
intro.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
hackGalleryInit(context, intro);
wrap.addView(intro);
return wrap;
}Example 69
| Project: AndroidRivers-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(context);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = mSelectedWeek == position ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 70
| Project: GWSHolmesWatson-master File: CalendarView.java View source code |
/* (non-Javadoc)
* @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(context);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = mSelectedWeek == position ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 71
| Project: Hancel-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(context);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = mSelectedWeek == position ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 72
| Project: katbag-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(context);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = mSelectedWeek == position ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 73
| Project: little-bear-dictionary-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(context);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = mSelectedWeek == position ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 74
| Project: TflTravelAlerts-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(context);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = mSelectedWeek == position ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 75
| Project: touchtrack-lib-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(context);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = mSelectedWeek == position ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 76
| Project: v2droid-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(context);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = mSelectedWeek == position ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 77
| Project: android-15-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(mContext);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = (mSelectedWeek == position) ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 78
| Project: XobotOS-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(mContext);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = (mSelectedWeek == position) ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 79
| Project: android-calendarview-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(getContext());
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = (mSelectedWeek == position) ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 80
| Project: cnAndroidDocs-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(mContext);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = (mSelectedWeek == position) ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 81
| Project: frameworks_base_disabled-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(mContext);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = (mSelectedWeek == position) ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 82
| Project: property-db-master File: CalendarView.java View source code |
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeekView weekView = null;
if (convertView != null) {
weekView = (WeekView) convertView;
} else {
weekView = new WeekView(mContext);
android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
weekView.setLayoutParams(params);
weekView.setClickable(true);
weekView.setOnTouchListener(this);
}
int selectedWeekDay = (mSelectedWeek == position) ? mSelectedDate.get(Calendar.DAY_OF_WEEK) : -1;
weekView.init(position, selectedWeekDay, mFocusedMonth);
return weekView;
}Example 83
| Project: AndroidStore-master File: ListPopupWindow.java View source code |
/**
* Show the popup list. If the list is already showing, this method will
* recalculate the popup's size and position.
*/
public void show() {
int height = buildDropDown();
int widthSpec = 0;
int heightSpec = 0;
boolean noInputMethod = isInputMethodNotNeeded();
if (mPopup.isShowing()) {
if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
// The call to PopupWindow's update method below can accept -1
// for any
// value you do not want to update.
widthSpec = -1;
} else if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
widthSpec = getAnchorView().getWidth();
} else {
widthSpec = mDropDownWidth;
}
if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
// The call to PopupWindow's update method below can accept -1
// for any
// value you do not want to update.
heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.MATCH_PARENT;
if (noInputMethod) {
mPopup.setWindowLayoutMode(mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, 0);
} else {
mPopup.setWindowLayoutMode(mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, ViewGroup.LayoutParams.MATCH_PARENT);
}
} else if (mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {
heightSpec = height;
} else {
heightSpec = mDropDownHeight;
}
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.update(getAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset, widthSpec, heightSpec);
} else {
if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
widthSpec = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
mPopup.setWidth(getAnchorView().getWidth());
} else {
mPopup.setWidth(mDropDownWidth);
}
}
if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
heightSpec = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
if (mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {
mPopup.setHeight(height);
} else {
mPopup.setHeight(mDropDownHeight);
}
}
mPopup.setWindowLayoutMode(widthSpec, heightSpec);
// mPopup.setClipToScreenEnabled(true); might be important aap
// use outside touchable to dismiss drop down when touching outside
// of it, so
// only set this if the dropdown is not always visible
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.setTouchInterceptor(mTouchInterceptor);
mPopup.showAsDropDown(getAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset);
mDropDownList.setSelection(ListView.INVALID_POSITION);
if (!mModal || mDropDownList.isInTouchMode()) {
clearListSelection();
}
if (!mModal) {
mHandler.post(mHideSelector);
}
}
}Example 84
| Project: LemonLancher-master File: ListPopupWindow.java View source code |
/**
* Show the popup list. If the list is already showing, this method will
* recalculate the popup's size and position.
*/
public void show() {
int height = buildDropDown();
int widthSpec = 0;
int heightSpec = 0;
boolean noInputMethod = isInputMethodNotNeeded();
if (mPopup.isShowing()) {
if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
// The call to PopupWindow's update method below can accept -1
// for any
// value you do not want to update.
widthSpec = -1;
} else if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
widthSpec = getAnchorView().getWidth();
} else {
widthSpec = mDropDownWidth;
}
if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
// The call to PopupWindow's update method below can accept -1
// for any
// value you do not want to update.
heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.MATCH_PARENT;
if (noInputMethod) {
mPopup.setWindowLayoutMode(mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, 0);
} else {
mPopup.setWindowLayoutMode(mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, ViewGroup.LayoutParams.MATCH_PARENT);
}
} else if (mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {
heightSpec = height;
} else {
heightSpec = mDropDownHeight;
}
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.update(getAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset, widthSpec, heightSpec);
} else {
if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
widthSpec = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
mPopup.setWidth(getAnchorView().getWidth());
} else {
mPopup.setWidth(mDropDownWidth);
}
mDropDownHorizontalOffset = getAnchorView().getLeft() + (getAnchorView().getWidth() - mPopup.getWidth()) / 2;
}
if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
heightSpec = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
if (mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {
mPopup.setHeight(height);
} else {
mPopup.setHeight(mDropDownHeight);
}
}
mPopup.setWindowLayoutMode(widthSpec, heightSpec);
// mPopup.setClipToScreenEnabled(true); might be important aap
// use outside touchable to dismiss drop down when touching outside
// of it, so
// only set this if the dropdown is not always visible
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.setTouchInterceptor(mTouchInterceptor);
mPopup.showAsDropDown(getAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset);
mDropDownList.setSelection(ListView.INVALID_POSITION);
if (!mModal || mDropDownList.isInTouchMode()) {
clearListSelection();
}
if (!mModal) {
mHandler.post(mHideSelector);
}
}
}Example 85
| Project: momock-android-master File: ListPopupWindowCompat.java View source code |
/**
* Show the popup list. If the list is already showing, this method will
* recalculate the popup's size and position.
*/
@Override
public void show() {
final int height = buildDropDown();
int widthSpec = 0;
int heightSpec = 0;
final boolean noInputMethod = isInputMethodNotNeeded();
if (mPopup.isShowing()) {
if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
// The call to PopupWindow's update method below can accept -1
// for any
// value you do not want to update.
widthSpec = -1;
} else if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
widthSpec = getAnchorView().getWidth();
} else {
widthSpec = mDropDownWidth;
}
if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
// The call to PopupWindow's update method below can accept -1
// for any
// value you do not want to update.
heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.MATCH_PARENT;
if (noInputMethod) {
mPopup.setWindowLayoutMode(mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, 0);
} else {
mPopup.setWindowLayoutMode(mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, ViewGroup.LayoutParams.MATCH_PARENT);
}
} else if (mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {
heightSpec = height;
} else {
heightSpec = mDropDownHeight;
}
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.update(getAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset, widthSpec, heightSpec);
} else {
if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
widthSpec = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
mPopup.setWidth(getAnchorView().getWidth());
} else {
mPopup.setWidth(mDropDownWidth);
}
}
if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
heightSpec = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
if (mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {
mPopup.setHeight(height);
} else {
mPopup.setHeight(mDropDownHeight);
}
}
mPopup.setWindowLayoutMode(widthSpec, heightSpec);
// mPopup.setClipToScreenEnabled(true); might be important aap
// use outside touchable to dismiss drop down when touching outside
// of it, so
// only set this if the dropdown is not always visible
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.setTouchInterceptor(mTouchInterceptor);
mPopup.showAsDropDown(getAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset);
mDropDownList.setSelection(ListView.INVALID_POSITION);
if (!mModal || mDropDownList.isInTouchMode()) {
clearListSelection();
}
if (!mModal) {
mHandler.post(mHideSelector);
}
}
}Example 86
| Project: tweetings-master File: ListPopupWindowCompat.java View source code |
/**
* Show the popup list. If the list is already showing, this method will
* recalculate the popup's size and position.
*/
@Override
public void show() {
final int height = buildDropDown();
int widthSpec = 0;
int heightSpec = 0;
final boolean noInputMethod = isInputMethodNotNeeded();
if (mPopup.isShowing()) {
if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
// The call to PopupWindow's update method below can accept -1
// for any
// value you do not want to update.
widthSpec = -1;
} else if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
widthSpec = getAnchorView().getWidth();
} else {
widthSpec = mDropDownWidth;
}
if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
// The call to PopupWindow's update method below can accept -1
// for any
// value you do not want to update.
heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.MATCH_PARENT;
if (noInputMethod) {
mPopup.setWindowLayoutMode(mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, 0);
} else {
mPopup.setWindowLayoutMode(mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ? ViewGroup.LayoutParams.MATCH_PARENT : 0, ViewGroup.LayoutParams.MATCH_PARENT);
}
} else if (mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {
heightSpec = height;
} else {
heightSpec = mDropDownHeight;
}
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.update(getAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset, widthSpec, heightSpec);
} else {
if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
widthSpec = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
if (mDropDownWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
mPopup.setWidth(getAnchorView().getWidth());
} else {
mPopup.setWidth(mDropDownWidth);
}
}
if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
heightSpec = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
if (mDropDownHeight == ViewGroup.LayoutParams.WRAP_CONTENT) {
mPopup.setHeight(height);
} else {
mPopup.setHeight(mDropDownHeight);
}
}
mPopup.setWindowLayoutMode(widthSpec, heightSpec);
// mPopup.setClipToScreenEnabled(true); might be important aap
// use outside touchable to dismiss drop down when touching outside
// of it, so
// only set this if the dropdown is not always visible
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.setTouchInterceptor(mTouchInterceptor);
mPopup.showAsDropDown(getAnchorView(), mDropDownHorizontalOffset, mDropDownVerticalOffset);
mDropDownList.setSelection(ListView.INVALID_POSITION);
if (!mModal || mDropDownList.isInTouchMode()) {
clearListSelection();
}
if (!mModal) {
mHandler.post(mHideSelector);
}
}
}Example 87
| Project: Android-Ultra-Photo-Selector-master File: PhotoSelectorAdapter.java View source code |
/** ÉèÖÃÿһ¸öItemµÄ¿í¸ß */
public void setItemWidth(int screenWidth) {
int horizentalSpace = context.getResources().getDimensionPixelSize(R.dimen.sticky_item_horizontalSpacing);
this.itemWidth = (screenWidth - (horizentalSpace * (horizentalNum - 1))) / horizentalNum;
this.itemLayoutParams = new LayoutParams(itemWidth, itemWidth);
}Example 88
| Project: UniversalPhotoStudio-master File: PhotoGridAdapter.java View source code |
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new GridView.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
// mImageFetcher.setImageSize(height);
notifyDataSetChanged();
}Example 89
| Project: Dreamiya-master File: ImageGridFragment.java View source code |
/**
* Sets the item height. Useful for when we know the column width so the
* height can be set to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageResizer.setImageSize(height);
notifyDataSetChanged();
}Example 90
| Project: FanXin2.0_IM-master File: ImageGridFragment.java View source code |
/**
* Sets the item height. Useful for when we know the column width so the
* height can be set to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageResizer.setImageSize(height);
notifyDataSetChanged();
}Example 91
| Project: FanXin3.0-master File: ImageGridFragment.java View source code |
/**
* Sets the item height. Useful for when we know the column width so the
* height can be set to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageResizer.setImageSize(height);
notifyDataSetChanged();
}Example 92
| Project: GoldAssistant-master File: ImageGridFragment.java View source code |
/**
* Sets the item height. Useful for when we know the column width so the
* height can be set to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageResizer.setImageSize(height);
notifyDataSetChanged();
}Example 93
| Project: GoldAssistant2-master File: ImageGridFragment.java View source code |
/**
* Sets the item height. Useful for when we know the column width so the
* height can be set to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageResizer.setImageSize(height);
notifyDataSetChanged();
}Example 94
| Project: sdkdemoapp3.0_android-master File: ImageGridFragment.java View source code |
/**
* Sets the item height. Useful for when we know the column width so the
* height can be set to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageResizer.setImageSize(height);
notifyDataSetChanged();
}Example 95
| Project: sdkexamples-android-master File: ImageGridFragment.java View source code |
/**
* Sets the item height. Useful for when we know the column width so the
* height can be set to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageResizer.setImageSize(height);
notifyDataSetChanged();
}Example 96
| Project: woc-master File: ImageGridFragment.java View source code |
/**
* Sets the item height. Useful for when we know the column width so the
* height can be set to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageResizer.setImageSize(height);
notifyDataSetChanged();
}Example 97
| Project: zaina-master File: ImageGridFragment.java View source code |
/**
* Sets the item height. Useful for when we know the column width so the
* height can be set to match.
*
* @param height
*/
public void setItemHeight(int height) {
if (height == mItemHeight) {
return;
}
mItemHeight = height;
mImageViewLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, mItemHeight);
mImageResizer.setImageSize(height);
notifyDataSetChanged();
}Example 98
| Project: TYComponent-master File: HorizontalListViewDemo.java View source code |
HorizontalListView getHListView() {
HorizontalListView listView = new HorizontalListView(this, null);
listView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
listView.setBackgroundColor(0xFF33B5E5);
return listView;
}