use of io.github.hidroh.materialistic.annotation.Synthetic in project materialistic by hidroh.
the class StoryRecyclerViewAdapter method markAsViewed.
@Synthetic
void markAsViewed(int position) {
if (position < 0) {
return;
}
Item item = mItems != null && position < mItems.size() ? mItems.get(position) : null;
if (item == null || !isItemAvailable(item) || item.isViewed()) {
return;
}
mSessionManager.view(mContext, item.getId());
}
use of io.github.hidroh.materialistic.annotation.Synthetic in project materialistic by hidroh.
the class NavFloatingActionButton method bindNavigationPad.
@Synthetic
void bindNavigationPad() {
GestureDetectorCompat detectorCompat = new GestureDetectorCompat(getContext(), new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onDown(MotionEvent e) {
return mNavigable != null;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
Toast.makeText(getContext(), R.string.hint_nav_short, Toast.LENGTH_LONG).show();
return true;
}
@Override
public boolean onDoubleTap(MotionEvent e) {
trackKonami(DOUBLE_TAP);
return super.onDoubleTap(e);
}
@Override
public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent1, float velocityX, float velocityY) {
int direction;
if (Math.abs(velocityX) > Math.abs(velocityY)) {
direction = velocityX < 0 ? Navigable.DIRECTION_LEFT : Navigable.DIRECTION_RIGHT;
} else {
direction = velocityY < 0 ? Navigable.DIRECTION_UP : Navigable.DIRECTION_DOWN;
}
mNavigable.onNavigate(direction);
if (mVibrationEnabled) {
mVibrator.vibrate(VIBRATE_DURATION_MS);
}
trackKonami(direction);
return false;
}
@Override
public void onLongPress(MotionEvent e) {
if (mNavigable == null) {
return;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
Toast.makeText(getContext(), R.string.not_supported, Toast.LENGTH_SHORT).show();
} else {
startDrag(e.getX(), e.getY());
}
}
});
//noinspection Convert2Lambda
super.setOnTouchListener(new OnTouchListener() {
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return detectorCompat.onTouchEvent(motionEvent);
}
});
}
use of io.github.hidroh.materialistic.annotation.Synthetic in project materialistic by hidroh.
the class SubmitActivity method onSubmitted.
@Synthetic
void onSubmitted(Boolean successful) {
if (successful == null) {
toggleControls(false);
Toast.makeText(this, R.string.submit_failed, Toast.LENGTH_SHORT).show();
} else if (successful) {
Toast.makeText(this, R.string.submit_successful, Toast.LENGTH_SHORT).show();
if (!isFinishing()) {
Intent intent = new Intent(this, NewActivity.class);
intent.putExtra(NewActivity.EXTRA_REFRESH, true);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
// TODO should go to profile instead?
startActivity(intent);
finish();
}
} else if (!isFinishing()) {
AppUtils.showLogin(this, mAlertDialogBuilder);
}
}
use of io.github.hidroh.materialistic.annotation.Synthetic in project materialistic by hidroh.
the class FavoriteRecyclerViewAdapter method dismiss.
@Synthetic
void dismiss(final int position) {
final Favorite item = getItem(position);
mSelected.put(position, item.getId());
mFavoriteManager.remove(mContext, mSelected.values());
Snackbar.make(mRecyclerView, R.string.toast_removed, Snackbar.LENGTH_LONG).setAction(R.string.undo, v -> {
mPendingAdd = position;
mFavoriteManager.add(mContext, item);
}).show();
}
Aggregations