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);
}
}
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;
}
});
}
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);
}
}
});
}
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);
}
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);
}
Aggregations