Search in sources :

Example 26 with OnClickListener

use of android.view.View.OnClickListener in project android_frameworks_base by ParanoidAndroid.

the class ZoomControlExternal method createZoomControls.

private ExtendedZoomControls createZoomControls() {
    ExtendedZoomControls zoomControls = new ExtendedZoomControls(mWebView.getContext());
    zoomControls.setOnZoomInClickListener(new OnClickListener() {

        public void onClick(View v) {
            // reset time out
            mPrivateHandler.removeCallbacks(mZoomControlRunnable);
            mPrivateHandler.postDelayed(mZoomControlRunnable, ZOOM_CONTROLS_TIMEOUT);
            mWebView.zoomIn();
        }
    });
    zoomControls.setOnZoomOutClickListener(new OnClickListener() {

        public void onClick(View v) {
            // reset time out
            mPrivateHandler.removeCallbacks(mZoomControlRunnable);
            mPrivateHandler.postDelayed(mZoomControlRunnable, ZOOM_CONTROLS_TIMEOUT);
            mWebView.zoomOut();
        }
    });
    return zoomControls;
}
Also used : OnClickListener(android.view.View.OnClickListener) View(android.view.View)

Example 27 with OnClickListener

use of android.view.View.OnClickListener in project android_frameworks_base by ParanoidAndroid.

the class ProfileActivity method onCreate.

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mInspectButton = (Button) findViewById(R.id.inspect);
    mCaptureButton = (ToggleButton) findViewById(R.id.capture);
    mVelocitySpinner = (Spinner) findViewById(R.id.velocity);
    mMovementSpinner = (Spinner) findViewById(R.id.movement);
    mUrl = (EditText) findViewById(R.id.url);
    mWeb = (ProfiledWebView) findViewById(R.id.web);
    setCallback(new ProfileCallback() {

        @SuppressWarnings("unchecked")
        @Override
        public void profileCallback(RunData data) {
            new StoreFileTask().execute(new Pair<String, RunData>(TEMP_FILENAME, data));
            Log.d("ProfileActivity", "stored " + data.frames.length + " frames in file");
            setTestingState(TestingState.STOP_TESTING);
        }
    });
    // Inspect button (opens PlaybackActivity)
    mInspectButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivity(new Intent(ProfileActivity.this, PlaybackActivity.class));
        }
    });
    // Velocity spinner
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.velocity_array, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mVelocitySpinner.setAdapter(adapter);
    mVelocitySpinner.setOnItemSelectedListener(new VelocitySelectedListener());
    mVelocitySpinner.setSelection(3);
    // Movement spinner
    String[] content = { getResources().getString(R.string.movement_auto_scroll), getResources().getString(R.string.movement_manual), getResources().getString(R.string.movement_timed) };
    adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item, content);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mMovementSpinner.setAdapter(adapter);
    mMovementSpinner.setOnItemSelectedListener(new MovementSelectedListener());
    mMovementSpinner.setSelection(0);
    // Capture toggle button
    mCaptureButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (mCaptureButton.isChecked()) {
                startViewProfiling(false);
            } else {
                mWeb.stopScrollTest();
            }
        }
    });
    // Custom profiling WebView
    mWeb.init(this);
    mWeb.setWebViewClient(new LoggingWebViewClient());
    // URL text entry
    mUrl.setOnEditorActionListener(new OnEditorActionListener() {

        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            String url = mUrl.getText().toString();
            mWeb.loadUrl(url);
            mWeb.requestFocus();
            return true;
        }
    });
    setTestingState(TestingState.NOT_TESTING);
}
Also used : Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) WebView(android.webkit.WebView) TextView(android.widget.TextView) KeyEvent(android.view.KeyEvent) OnClickListener(android.view.View.OnClickListener) OnEditorActionListener(android.widget.TextView.OnEditorActionListener) TextView(android.widget.TextView) Pair(android.util.Pair)

Example 28 with OnClickListener

use of android.view.View.OnClickListener in project android_frameworks_base by ParanoidAndroid.

the class PlaybackActivity method onCreate.

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.playback);
    mPlaybackView = (PlaybackView) findViewById(R.id.playback);
    mSeekBar = (SeekBar) findViewById(R.id.seek_bar);
    mForward = (Button) findViewById(R.id.forward);
    mBackward = (Button) findViewById(R.id.backward);
    mFrameDisplay = (TextView) findViewById(R.id.frame_display);
    mForward.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            setFrame(v, mFrame + 1);
        }
    });
    mBackward.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            setFrame(v, mFrame - 1);
        }
    });
    mSeekBar.setOnSeekBarChangeListener(new SeekFrameChangeListener());
    mPlaybackView.setOnGestureListener(new TouchFrameChangeListener());
    new LoadFileTask().execute(ProfileActivity.TEMP_FILENAME);
}
Also used : OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View)

Example 29 with OnClickListener

use of android.view.View.OnClickListener in project HoloEverywhere by Prototik.

the class DatePickerDialog method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView: ");
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    View view = inflater.inflate(R.layout.date_picker_dialog, container, false);
    mDayOfWeekView = (TextView) view.findViewById(R.id.date_picker_week);
    mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day);
    mMonthAndDayView.setOnClickListener(this);
    mSelectedMonthTextView = (TextView) view.findViewById(R.id.date_picker_month);
    mSelectedDayTextView = (TextView) view.findViewById(R.id.date_picker_day);
    mYearView = (TextView) view.findViewById(R.id.date_picker_year);
    mYearView.setOnClickListener(this);
    int listPosition = -1;
    int listPositionOffset = 0;
    int currentView = MONTH_AND_DAY_VIEW;
    if (savedInstanceState != null) {
        mWeekStart = savedInstanceState.getInt(KEY_WEEK_START);
        mMinYear = savedInstanceState.getInt(KEY_YEAR_START);
        mMaxYear = savedInstanceState.getInt(KEY_YEAR_END);
        currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW);
        listPosition = savedInstanceState.getInt(KEY_LIST_POSITION);
        listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET);
    }
    final Activity activity = getActivity();
    mDayPickerView = new DayPickerView(activity, this);
    mYearPickerView = new YearPickerView(activity, this);
    Resources res = getResources();
    mDayPickerDescription = res.getString(R.string.day_picker_description);
    mSelectDay = res.getString(R.string.select_day);
    mYearPickerDescription = res.getString(R.string.year_picker_description);
    mSelectYear = res.getString(R.string.select_year);
    mAnimator = (AccessibleDateAnimator) view.findViewById(R.id.animator);
    mAnimator.addView(mDayPickerView);
    mAnimator.addView(mYearPickerView);
    mAnimator.setDateMillis(mCalendar.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(ANIMATION_DURATION);
    mAnimator.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2 = new AlphaAnimation(1.0f, 0.0f);
    animation2.setDuration(ANIMATION_DURATION);
    mAnimator.setOutAnimation(animation2);
    mDoneButton = (Button) view.findViewById(R.id.done);
    mDoneButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            tryVibrate();
            if (mCallBack != null) {
                mCallBack.onDateSet(DatePickerDialog.this, mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH));
            }
            dismiss();
        }
    });
    updateDisplay(false);
    setCurrentView(currentView);
    if (listPosition != -1) {
        if (currentView == MONTH_AND_DAY_VIEW) {
            mDayPickerView.postSetSelection(listPosition);
        } else if (currentView == YEAR_VIEW) {
            mYearPickerView.postSetSelection(listPosition);
        }
    }
    return view;
}
Also used : Activity(android.app.Activity) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) OnClickListener(android.view.View.OnClickListener) Resources(android.content.res.Resources) TextView(org.holoeverywhere.widget.TextView) View(android.view.View) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 30 with OnClickListener

use of android.view.View.OnClickListener in project HoloEverywhere by Prototik.

the class TimePickerDialog method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    View view = inflater.inflate(R.layout.time_picker_dialog, null);
    KeyboardListener keyboardListener = new KeyboardListener();
    view.findViewById(R.id.time_picker_dialog).setOnKeyListener(keyboardListener);
    Resources res = getResources();
    mHourPickerDescription = res.getString(R.string.hour_picker_description);
    mSelectHours = res.getString(R.string.select_hours);
    mMinutePickerDescription = res.getString(R.string.minute_picker_description);
    mSelectMinutes = res.getString(R.string.select_minutes);
    mHourView = (TextView) view.findViewById(R.id.hours);
    mHourView.setOnKeyListener(keyboardListener);
    mHourSpaceView = (TextView) view.findViewById(R.id.hour_space);
    mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space);
    mMinuteView = (TextView) view.findViewById(R.id.minutes);
    mMinuteView.setOnKeyListener(keyboardListener);
    mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label);
    mAmPmTextView.setOnKeyListener(keyboardListener);
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    mAmText = amPmTexts[0];
    mPmText = amPmTexts[1];
    mTimePicker = (RadialPickerLayout) view.findViewById(R.id.time_picker);
    mTimePicker.setOnValueSelectedListener(this);
    mTimePicker.setOnKeyListener(keyboardListener);
    mTimePicker.initialize(getActivity(), mInitialHourOfDay, mInitialMinute, mIs24HourMode);
    int currentItemShowing = HOUR_INDEX;
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_CURRENT_ITEM_SHOWING)) {
        currentItemShowing = savedInstanceState.getInt(KEY_CURRENT_ITEM_SHOWING);
    }
    setCurrentItemShowing(currentItemShowing, false, true, true);
    mTimePicker.invalidate();
    mHourView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            setCurrentItemShowing(HOUR_INDEX, true, false, true);
            mTimePicker.tryVibrate();
        }
    });
    mMinuteView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            setCurrentItemShowing(MINUTE_INDEX, true, false, true);
            mTimePicker.tryVibrate();
        }
    });
    mDoneButton = (Button) view.findViewById(R.id.done_button);
    mDoneButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (mInKbMode && isTypedTimeFullyLegal()) {
                finishKbMode(false);
            } else {
                mTimePicker.tryVibrate();
            }
            if (mCallback != null) {
                mCallback.onTimeSet(mTimePicker, mTimePicker.getHours(), mTimePicker.getMinutes());
            }
            dismiss();
        }
    });
    mDoneButton.setOnKeyListener(keyboardListener);
    // Enable or disable the AM/PM view.
    if (mIs24HourMode) {
        mAmPmTextView.setVisibility(View.GONE);
        RelativeLayout.LayoutParams paramsSeparator = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        paramsSeparator.addRule(RelativeLayout.CENTER_IN_PARENT);
        TextView separatorView = (TextView) view.findViewById(R.id.separator);
        separatorView.setLayoutParams(paramsSeparator);
    } else {
        mAmPmTextView.setVisibility(View.VISIBLE);
        updateAmPmDisplay(mInitialHourOfDay < 12 ? AM : PM);
        mAmPmTextView.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                mTimePicker.tryVibrate();
                int amOrPm = mTimePicker.getIsCurrentlyAmOrPm();
                if (amOrPm == AM) {
                    amOrPm = PM;
                } else if (amOrPm == PM) {
                    amOrPm = AM;
                }
                updateAmPmDisplay(amOrPm);
                mTimePicker.setAmOrPm(amOrPm);
            }
        });
    }
    mAllowAutoAdvance = true;
    setHour(mInitialHourOfDay, true);
    setMinute(mInitialMinute);
    // Set up for keyboard mode.
    mDoublePlaceholderText = "--";
    mDeletedKeyFormat = res.getString(R.string.deleted_key);
    mPlaceholderText = mDoublePlaceholderText.charAt(0);
    mAmKeyCode = mPmKeyCode = -1;
    generateLegalTimesTree();
    if (mInKbMode) {
        mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES);
        tryStartingKbMode(-1);
        mHourView.invalidate();
    } else if (mTypedTimes == null) {
        mTypedTimes = new ArrayList<Integer>();
    }
    return view;
}
Also used : ArrayList(java.util.ArrayList) TextView(org.holoeverywhere.widget.TextView) View(android.view.View) RelativeLayout(android.widget.RelativeLayout) OnClickListener(android.view.View.OnClickListener) DateFormatSymbols(java.text.DateFormatSymbols) TextView(org.holoeverywhere.widget.TextView) Resources(android.content.res.Resources)

Aggregations

OnClickListener (android.view.View.OnClickListener)772 View (android.view.View)770 TextView (android.widget.TextView)478 Button (android.widget.Button)262 ImageView (android.widget.ImageView)251 Intent (android.content.Intent)179 ListView (android.widget.ListView)110 AdapterView (android.widget.AdapterView)88 LinearLayout (android.widget.LinearLayout)49 ScrollView (android.widget.ScrollView)49 Bundle (android.os.Bundle)42 LayoutInflater (android.view.LayoutInflater)35 ViewGroup (android.view.ViewGroup)30 ArrayList (java.util.ArrayList)29 EditText (android.widget.EditText)27 BindView (butterknife.BindView)27 KeyEvent (android.view.KeyEvent)25 DialogInterface (android.content.DialogInterface)24 FragmentManager (android.support.v4.app.FragmentManager)23 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)23