Search in sources :

Example 91 with OnClickListener

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);
        }
    }
}
Also used : DatePickerDialog(com.fourmob.datetimepicker.date.DatePickerDialog) Calendar(java.util.Calendar) OnClickListener(android.view.View.OnClickListener) TimePickerDialog(com.sleepbot.datetimepicker.time.TimePickerDialog) View(android.view.View)

Example 92 with OnClickListener

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);
                }
            }
        });
    }
}
Also used : OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Example 93 with OnClickListener

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;
}
Also used : LayoutParams(android.view.WindowManager.LayoutParams) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) View(android.view.View)

Example 94 with OnClickListener

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++;
}
Also used : Drawable(android.graphics.drawable.Drawable) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View)

Example 95 with OnClickListener

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;
}
Also used : ActivityInfo(android.content.pm.ActivityInfo) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) LayoutInflater(android.view.LayoutInflater) OnLongClickListener(android.view.View.OnLongClickListener) FrameLayout(android.widget.FrameLayout) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Aggregations

OnClickListener (android.view.View.OnClickListener)794 View (android.view.View)792 TextView (android.widget.TextView)492 Button (android.widget.Button)265 ImageView (android.widget.ImageView)256 Intent (android.content.Intent)183 ListView (android.widget.ListView)112 AdapterView (android.widget.AdapterView)91 ScrollView (android.widget.ScrollView)52 LinearLayout (android.widget.LinearLayout)49 Bundle (android.os.Bundle)43 LayoutInflater (android.view.LayoutInflater)35 ViewGroup (android.view.ViewGroup)30 ArrayList (java.util.ArrayList)30 BindView (butterknife.BindView)29 KeyEvent (android.view.KeyEvent)28 EditText (android.widget.EditText)28 DialogInterface (android.content.DialogInterface)27 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)25 FragmentManager (android.support.v4.app.FragmentManager)23