Search in sources :

Example 76 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project Android-InAppBilling by LiteKite.

the class ViewPurchasesActivity method start.

/**
 * Launches ViewPurchasesActivity.
 *
 * @param context An Activity Context.
 */
public static void start(Context context) {
    if (context instanceof AppCompatActivity) {
        Intent intent = new Intent(context, ViewPurchasesActivity.class);
        context.startActivity(intent);
        startActivityAnimation(context);
    }
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) Intent(android.content.Intent)

Example 77 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project android_packages_apps_Settings by crdroidandroid.

the class ZenModeScheduleRuleSettings method onCreateInternal.

@Override
protected void onCreateInternal() {
    addPreferencesFromResource(R.xml.zen_mode_schedule_rule_settings);
    final PreferenceScreen root = getPreferenceScreen();
    mDays = root.findPreference(KEY_DAYS);
    mDays.setOnPreferenceClickListener(new OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            showDaysDialog();
            return true;
        }
    });
    final FragmentManager mgr = getFragmentManager();
    mStart = new TimePickerPreference(getPrefContext(), mgr);
    mStart.setKey(KEY_START_TIME);
    mStart.setTitle(R.string.zen_mode_start_time);
    mStart.setCallback(new TimePickerPreference.Callback() {

        @Override
        public boolean onSetTime(final int hour, final int minute) {
            if (mDisableListeners)
                return true;
            if (!ZenModeConfig.isValidHour(hour))
                return false;
            if (!ZenModeConfig.isValidMinute(minute))
                return false;
            if (hour == mSchedule.startHour && minute == mSchedule.startMinute) {
                return true;
            }
            if (DEBUG)
                Log.d(TAG, "onPrefChange start h=" + hour + " m=" + minute);
            mSchedule.startHour = hour;
            mSchedule.startMinute = minute;
            updateRule(ZenModeConfig.toScheduleConditionId(mSchedule));
            return true;
        }
    });
    root.addPreference(mStart);
    mStart.setDependency(mDays.getKey());
    mEnd = new TimePickerPreference(getPrefContext(), mgr);
    mEnd.setKey(KEY_END_TIME);
    mEnd.setTitle(R.string.zen_mode_end_time);
    mEnd.setCallback(new TimePickerPreference.Callback() {

        @Override
        public boolean onSetTime(final int hour, final int minute) {
            if (mDisableListeners)
                return true;
            if (!ZenModeConfig.isValidHour(hour))
                return false;
            if (!ZenModeConfig.isValidMinute(minute))
                return false;
            if (hour == mSchedule.endHour && minute == mSchedule.endMinute) {
                return true;
            }
            if (DEBUG)
                Log.d(TAG, "onPrefChange end h=" + hour + " m=" + minute);
            mSchedule.endHour = hour;
            mSchedule.endMinute = minute;
            updateRule(ZenModeConfig.toScheduleConditionId(mSchedule));
            return true;
        }
    });
    root.addPreference(mEnd);
    mEnd.setDependency(mDays.getKey());
    mExitAtAlarm = (SwitchPreference) root.findPreference(KEY_EXIT_AT_ALARM);
    mExitAtAlarm.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {

        @Override
        public boolean onPreferenceChange(Preference preference, Object o) {
            mSchedule.exitAtAlarm = (Boolean) o;
            updateRule(ZenModeConfig.toScheduleConditionId(mSchedule));
            return true;
        }
    });
}
Also used : OnPreferenceClickListener(android.support.v7.preference.Preference.OnPreferenceClickListener) FragmentManager(android.app.FragmentManager) PreferenceScreen(android.support.v7.preference.PreferenceScreen) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference)

Example 78 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project PocketMaps by junjunguo.

the class MapActions method initControlBtnHandler.

/**
 * start button: control button handler FAB
 */
private void initControlBtnHandler() {
    final ScaleAnimation anim = new ScaleAnimation(0, 1, 0, 1);
    anim.setFillBefore(true);
    anim.setFillAfter(true);
    anim.setFillEnabled(true);
    anim.setDuration(300);
    anim.setInterpolator(new OvershootInterpolator());
    controlBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (isMenuVisible()) {
                setMenuVisible(false);
                sideBarMenuVP.setVisibility(View.INVISIBLE);
                controlBtn.setImageResource(R.drawable.ic_keyboard_arrow_up_white_24dp);
                controlBtn.startAnimation(anim);
            } else {
                setMenuVisible(true);
                sideBarMenuVP.setVisibility(View.VISIBLE);
                controlBtn.setImageResource(R.drawable.ic_keyboard_arrow_down_white_24dp);
                controlBtn.startAnimation(anim);
            }
        }
    });
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) MapView(org.oscim.android.MapView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 79 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project sbt-android by scala-android.

the class MaterialMultiAutoCompleteTextView method initFloatingLabel.

private void initFloatingLabel() {
    // observe the text changing
    addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            if (floatingLabelEnabled) {
                if (s.length() == 0) {
                    if (floatingLabelShown) {
                        floatingLabelShown = false;
                        getLabelAnimator().reverse();
                    }
                } else if (!floatingLabelShown) {
                    floatingLabelShown = true;
                    getLabelAnimator().start();
                }
            }
        }
    });
    // observe the focus state to animate the floating label's text color appropriately
    innerFocusChangeListener = new OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (floatingLabelEnabled && highlightFloatingLabel) {
                if (hasFocus) {
                    getLabelFocusAnimator().start();
                } else {
                    getLabelFocusAnimator().reverse();
                }
            }
            if (validateOnFocusLost && !hasFocus) {
                validate();
            }
            if (outerFocusChangeListener != null) {
                outerFocusChangeListener.onFocusChange(v, hasFocus);
            }
        }
    };
    super.setOnFocusChangeListener(innerFocusChangeListener);
}
Also used : TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) View(android.view.View) AppCompatMultiAutoCompleteTextView(android.support.v7.widget.AppCompatMultiAutoCompleteTextView) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Example 80 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project sbt-android by scala-android.

the class MaterialAutoCompleteTextView method initFloatingLabel.

private void initFloatingLabel() {
    // observe the text changing
    addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            if (floatingLabelEnabled) {
                if (s.length() == 0) {
                    if (floatingLabelShown) {
                        floatingLabelShown = false;
                        getLabelAnimator().reverse();
                    }
                } else if (!floatingLabelShown) {
                    floatingLabelShown = true;
                    getLabelAnimator().start();
                }
            }
        }
    });
    // observe the focus state to animate the floating label's text color appropriately
    innerFocusChangeListener = new OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (floatingLabelEnabled && highlightFloatingLabel) {
                if (hasFocus) {
                    getLabelFocusAnimator().start();
                } else {
                    getLabelFocusAnimator().reverse();
                }
            }
            if (validateOnFocusLost && !hasFocus) {
                validate();
            }
            if (outerFocusChangeListener != null) {
                outerFocusChangeListener.onFocusChange(v, hasFocus);
            }
        }
    };
    super.setOnFocusChangeListener(innerFocusChangeListener);
}
Also used : TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) AppCompatAutoCompleteTextView(android.support.v7.widget.AppCompatAutoCompleteTextView) View(android.view.View) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Aggregations

View (android.view.View)367 RecyclerView (android.support.v7.widget.RecyclerView)271 TextView (android.widget.TextView)175 Intent (android.content.Intent)109 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)84 Toolbar (android.support.v7.widget.Toolbar)77 TextWatcher (android.text.TextWatcher)77 Editable (android.text.Editable)76 ImageView (android.widget.ImageView)76 ArrayList (java.util.ArrayList)68 Bundle (android.os.Bundle)48 DialogInterface (android.content.DialogInterface)47 AlertDialog (android.support.v7.app.AlertDialog)47 AdapterView (android.widget.AdapterView)46 EditText (android.widget.EditText)42 SuppressLint (android.annotation.SuppressLint)39 Button (android.widget.Button)39 ActionBar (android.support.v7.app.ActionBar)34 List (java.util.List)34 ViewPropertyAnimatorCompat (android.support.v4.view.ViewPropertyAnimatorCompat)33