use of android.view.View.OnClickListener in project datetimepicker by flavienlaurent.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Calendar calendar = Calendar.getInstance();
final DatePickerDialog datePickerDialog = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), isVibrate());
final TimePickerDialog timePickerDialog = TimePickerDialog.newInstance(this, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), false, false);
findViewById(R.id.dateButton).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
datePickerDialog.setVibrate(isVibrate());
datePickerDialog.setYearRange(1985, 2028);
datePickerDialog.setCloseOnSingleTapDay(isCloseOnSingleTapDay());
datePickerDialog.show(getSupportFragmentManager(), DATEPICKER_TAG);
}
});
findViewById(R.id.timeButton).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
timePickerDialog.setVibrate(isVibrate());
timePickerDialog.setCloseOnSingleTapMinute(isCloseOnSingleTapMinute());
timePickerDialog.show(getSupportFragmentManager(), TIMEPICKER_TAG);
}
});
if (savedInstanceState != null) {
DatePickerDialog dpd = (DatePickerDialog) getSupportFragmentManager().findFragmentByTag(DATEPICKER_TAG);
if (dpd != null) {
dpd.setOnDateSetListener(this);
}
TimePickerDialog tpd = (TimePickerDialog) getSupportFragmentManager().findFragmentByTag(TIMEPICKER_TAG);
if (tpd != null) {
tpd.setOnTimeSetListener(this);
}
}
}
use of android.view.View.OnClickListener in project MagicCamera by wuhaoyu1990.
the class FilterAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(FilterHolder arg0, final int arg1) {
if (filterInfos.get(arg1).getFilterType() != -1) {
arg0.thumbImage.setImageResource(FilterTypeHelper.FilterType2Thumb(filterInfos.get(arg1).getFilterType()));
arg0.filterName.setText(FilterTypeHelper.FilterType2Name(filterInfos.get(arg1).getFilterType()));
arg0.filterName.setBackgroundColor(context.getResources().getColor(FilterTypeHelper.FilterType2Color(filterInfos.get(arg1).getFilterType())));
if (filterInfos.get(arg1).isSelected()) {
arg0.thumbSelected.setVisibility(View.VISIBLE);
arg0.thumbSelected_bg.setBackgroundColor(context.getResources().getColor(FilterTypeHelper.FilterType2Color(filterInfos.get(arg1).getFilterType())));
arg0.thumbSelected_bg.setAlpha(0.7f);
} else
arg0.thumbSelected.setVisibility(View.GONE);
if (!filterInfos.get(arg1).isFavourite() || arg1 == 0)
arg0.filterFavourite.setVisibility(View.GONE);
else
arg0.filterFavourite.setVisibility(View.VISIBLE);
arg0.filterRoot.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (onFilterChangeListener != null && filterInfos.get(arg1).getFilterType() != -1 && arg1 != lastSelected && !filterInfos.get(arg1).isSelected()) {
filterInfos.get(lastSelected).setSelected(false);
filterInfos.get(arg1).setSelected(true);
notifyItemChanged(lastSelected);
notifyItemChanged(arg1);
lastSelected = arg1;
onFilterChangeListener.onFilterChanged(filterInfos.get(arg1).getFilterType(), arg1);
}
}
});
}
}
use of android.view.View.OnClickListener in project XobotOS by xamarin.
the class ZoomButtonsController method createContainer.
private FrameLayout createContainer() {
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// Controls are positioned BOTTOM | CENTER with respect to the owner view.
lp.gravity = Gravity.TOP | Gravity.LEFT;
lp.flags = LayoutParams.FLAG_NOT_TOUCHABLE | LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_LAYOUT_NO_LIMITS | LayoutParams.FLAG_ALT_FOCUSABLE_IM;
lp.height = LayoutParams.WRAP_CONTENT;
lp.width = LayoutParams.MATCH_PARENT;
lp.type = LayoutParams.TYPE_APPLICATION_PANEL;
lp.format = PixelFormat.TRANSLUCENT;
lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons;
mContainerLayoutParams = lp;
FrameLayout container = new Container(mContext);
container.setLayoutParams(lp);
container.setMeasureAllChildren(true);
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(com.android.internal.R.layout.zoom_container, container);
mControls = (ZoomControls) container.findViewById(com.android.internal.R.id.zoomControls);
mControls.setOnZoomInClickListener(new OnClickListener() {
public void onClick(View v) {
dismissControlsDelayed(ZOOM_CONTROLS_TIMEOUT);
if (mCallback != null)
mCallback.onZoom(true);
}
});
mControls.setOnZoomOutClickListener(new OnClickListener() {
public void onClick(View v) {
dismissControlsDelayed(ZOOM_CONTROLS_TIMEOUT);
if (mCallback != null)
mCallback.onZoom(false);
}
});
return container;
}
use of android.view.View.OnClickListener in project ZI by yixia.
the class QuickAction method addActionItem.
public void addActionItem(ActionItem action, int position) {
String title = action.getTitle();
Drawable icon = action.getIcon();
View container = (View) inflater.inflate(R.layout.quickaction_item, null);
ImageView img = (ImageView) container.findViewById(R.id.iv_icon);
TextView text = (TextView) container.findViewById(R.id.tv_title);
if (icon != null)
img.setImageDrawable(icon);
else
img.setVisibility(View.GONE);
if (title != null)
text.setText(title);
else
text.setVisibility(View.GONE);
final int pos = position;
container.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mListener != null)
mListener.onItemClick(pos);
dismiss();
}
});
container.setFocusable(true);
container.setClickable(true);
mTrack.addView(container, position);
mChildPos++;
}
use of android.view.View.OnClickListener in project StandOut by pingpongboss.
the class FloatingFolder method getAppView.
private View getAppView(final int id, final ActivityInfo app) {
LayoutInflater inflater = LayoutInflater.from(this);
final View frame = inflater.inflate(R.layout.app_square, null);
frame.setTag(app);
frame.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = mPackageManager.getLaunchIntentForPackage(app.packageName);
startActivity(intent);
}
});
frame.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
ActivityInfo app = (ActivityInfo) v.getTag();
Log.d("FloatingFolder", "Long clicked: " + app.loadLabel(mPackageManager));
onUserRemoveApp(id, app);
return true;
}
});
ImageView icon = (ImageView) frame.findViewById(R.id.icon);
icon.setImageDrawable(app.loadIcon(mPackageManager));
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(iconSize, iconSize);
params.gravity = Gravity.CENTER_HORIZONTAL;
icon.setLayoutParams(params);
TextView name = (TextView) frame.findViewById(R.id.name);
name.setText(app.loadLabel(mPackageManager));
View square = frame.findViewById(R.id.square);
square.setLayoutParams(new FrameLayout.LayoutParams(squareWidth, FrameLayout.LayoutParams.WRAP_CONTENT));
return frame;
}
Aggregations