Java Code Examples for com.hippo.ripple.Ripple#addRipple()

The following examples show how to use com.hippo.ripple.Ripple#addRipple() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadsScene.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
public DownloadHolder(View itemView) {
    super(itemView);

    thumb = (LoadImageView) itemView.findViewById(R.id.thumb);
    title = (TextView) itemView.findViewById(R.id.title);
    uploader = (TextView) itemView.findViewById(R.id.uploader);
    rating = (SimpleRatingView) itemView.findViewById(R.id.rating);
    category = (TextView) itemView.findViewById(R.id.category);
    start = itemView.findViewById(R.id.start);
    stop = itemView.findViewById(R.id.stop);
    state = (TextView) itemView.findViewById(R.id.state);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progress_bar);
    percent = (TextView) itemView.findViewById(R.id.percent);
    speed = (TextView) itemView.findViewById(R.id.speed);

    // TODO cancel on click listener when select items
    thumb.setOnClickListener(this);
    start.setOnClickListener(this);
    stop.setOnClickListener(this);

    boolean isDarkTheme = !AttrResources.getAttrBoolean(getContext2(), R.attr.isLightTheme);
    Ripple.addRipple(start, isDarkTheme);
    Ripple.addRipple(stop, isDarkTheme);
}
 
Example 2
Source File: DirPickerActivity.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dir_picker);
    setNavigationIcon(R.drawable.v_arrow_left_dark_x24);

    mPath = (TextView) ViewUtils.$$(this, R.id.path);
    mDirExplorer = (DirExplorer) ViewUtils.$$(this, R.id.dir_explorer);
    mOk = ViewUtils.$$(this, R.id.ok);

    File file;
    if (null == savedInstanceState) {
        file = onInit();
    } else {
        file = onRestore(savedInstanceState);
    }

    mDirExplorer.setCurrentFile(file);
    mDirExplorer.setOnChangeDirListener(this);

    Ripple.addRipple(mOk, !AttrResources.getAttrBoolean(this, R.attr.isLightTheme));

    mOk.setOnClickListener(this);

    mPath.setText(mDirExplorer.getCurrentFile().getPath());
}
 
Example 3
Source File: PostFragment.java    From Nimingban with Apache License 2.0 6 votes vote down vote up
@SuppressLint("InflateParams")
public ReferenceDialogHelper(Site site, String id) {
    mSite = site;
    mId = id;

    mView = getActivity().getLayoutInflater().inflate(R.layout.dialog_reference, null);

    View progress = mView.findViewById(R.id.progress_view);
    View reference = mView.findViewById(R.id.reference);
    mViewTransition = new ViewTransition(progress, reference);

    mLeftText = (TextView) reference.findViewById(R.id.left_text);
    mCenterText = (TextView) reference.findViewById(R.id.center_text);
    mRightText = (TextView) reference.findViewById(R.id.right_text);
    mContent = (LinkifyTextView) reference.findViewById(R.id.content);
    mThumb = (LoadImageView) reference.findViewById(R.id.thumb);
    mButton = reference.findViewById(R.id.button);

    mContent.setOnClickListener(this);
    mThumb.setOnClickListener(this);
    Ripple.addRipple(mButton, ResourcesUtils.getAttrBoolean(getContext(), R.attr.dark));
}
 
Example 4
Source File: DownloadsScene.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
public DownloadHolder(View itemView) {
    super(itemView);

    thumb = (LoadImageView) itemView.findViewById(R.id.thumb);
    title = (TextView) itemView.findViewById(R.id.title);
    uploader = (TextView) itemView.findViewById(R.id.uploader);
    rating = (SimpleRatingView) itemView.findViewById(R.id.rating);
    category = (TextView) itemView.findViewById(R.id.category);
    start = itemView.findViewById(R.id.start);
    stop = itemView.findViewById(R.id.stop);
    state = (TextView) itemView.findViewById(R.id.state);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progress_bar);
    percent = (TextView) itemView.findViewById(R.id.percent);
    speed = (TextView) itemView.findViewById(R.id.speed);

    // TODO cancel on click listener when select items
    thumb.setOnClickListener(this);
    start.setOnClickListener(this);
    stop.setOnClickListener(this);

    boolean isDarkTheme = !AttrResources.getAttrBoolean(getContext2(), R.attr.isLightTheme);
    Ripple.addRipple(start, isDarkTheme);
    Ripple.addRipple(stop, isDarkTheme);
}
 
Example 5
Source File: ExcludedLanguagesActivity.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.scene_excluded_languages);
    setNavigationIcon(R.drawable.v_arrow_left_dark_x24);

    if (null == savedInstanceState) {
        onInit();
    } else {
        onRestore(savedInstanceState);
    }

    mCancel = ViewUtils.$$(this, R.id.cancel);
    mOk = ViewUtils.$$(this, R.id.ok);
    mSelectAll = ViewUtils.$$(this, R.id.select_all);
    mDeselectAll = ViewUtils.$$(this, R.id.deselect_all);
    mInvertSelection = ViewUtils.$$(this, R.id.invert_selection);
    mRecyclerView = (EasyRecyclerView) ViewUtils.$$(this, R.id.recycler_view);

    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setClipToPadding(false);
    mAdapter = new LanguageAdapter();
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    mCancel.setOnClickListener(this);
    mOk.setOnClickListener(this);
    mSelectAll.setOnClickListener(this);
    mDeselectAll.setOnClickListener(this);
    mInvertSelection.setOnClickListener(this);

    boolean isDarkTheme = !AttrResources.getAttrBoolean(this, R.attr.isLightTheme);
    Ripple.addRipple(mCancel, isDarkTheme);
    Ripple.addRipple(mOk, isDarkTheme);
    Ripple.addRipple(mSelectAll, isDarkTheme);
    Ripple.addRipple(mDeselectAll, isDarkTheme);
    Ripple.addRipple(mInvertSelection, isDarkTheme);
}
 
Example 6
Source File: LeftDrawer.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
private void init(Context context) {
    setFillViewport(true);
    setHorizontalScrollBarEnabled(false);
    setVerticalScrollBarEnabled(false);

    LayoutInflater.from(context).inflate(R.layout.widget_left_drawer, this);
    mHeader = (HeaderImageView) findViewById(R.id.header);
    mDrawerListView = (DrawerListView) findViewById(R.id.drawer_list_view);
    mDarkTheme = (TextView) findViewById(R.id.dark_theme);

    mHeader.setOnLongClickImageListener(this);

    Resources resources = context.getResources();

    Drawable search = DrawableManager.getDrawable(context, R.drawable.v_magnify_x24);
    Drawable feed = DrawableManager.getDrawable(context, R.drawable.v_rss_x24);
    Drawable record = DrawableManager.getDrawable(context, R.drawable.v_history_x24);
    Drawable settings = DrawableManager.getDrawable(context, R.drawable.v_settings_x24);

    Drawable[] drawables = {
            search,
            feed,
            record,
            settings
    };
    String[] strings = {
            resources.getString(R.string.search),
            resources.getString(R.string.feed),
            resources.getString(R.string.record),
            resources.getString(R.string.settings)
    };

    mDrawerListView.setData(drawables, strings);
    mDrawerListView.setOnItemClickListener(this);

    mDarkTheme.setText(Settings.getDarkTheme() ? R.string.let_there_light : R.string.let_there_dark);
    mDarkTheme.setOnClickListener(this);
    Ripple.addRipple(mDarkTheme, ResourcesUtils.getAttrBoolean(context, R.attr.dark));
}
 
Example 7
Source File: ExcludedLanguagesActivity.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.scene_excluded_languages);
    setNavigationIcon(R.drawable.v_arrow_left_dark_x24);

    if (null == savedInstanceState) {
        onInit();
    } else {
        onRestore(savedInstanceState);
    }

    mCancel = ViewUtils.$$(this, R.id.cancel);
    mOk = ViewUtils.$$(this, R.id.ok);
    mSelectAll = ViewUtils.$$(this, R.id.select_all);
    mDeselectAll = ViewUtils.$$(this, R.id.deselect_all);
    mInvertSelection = ViewUtils.$$(this, R.id.invert_selection);
    mRecyclerView = (EasyRecyclerView) ViewUtils.$$(this, R.id.recycler_view);

    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setClipToPadding(false);
    mAdapter = new LanguageAdapter();
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    mCancel.setOnClickListener(this);
    mOk.setOnClickListener(this);
    mSelectAll.setOnClickListener(this);
    mDeselectAll.setOnClickListener(this);
    mInvertSelection.setOnClickListener(this);

    boolean isDarkTheme = !AttrResources.getAttrBoolean(this, R.attr.isLightTheme);
    Ripple.addRipple(mCancel, isDarkTheme);
    Ripple.addRipple(mOk, isDarkTheme);
    Ripple.addRipple(mSelectAll, isDarkTheme);
    Ripple.addRipple(mDeselectAll, isDarkTheme);
    Ripple.addRipple(mInvertSelection, isDarkTheme);
}
 
Example 8
Source File: DirPickerActivity.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dir_picker);
    setNavigationIcon(R.drawable.v_arrow_left_dark_x24);

    mPath = findViewById(R.id.path);
    mDirExplorer = findViewById(R.id.dir_explorer);
    mDefault = findViewById(R.id.preset);
    mOk = findViewById(R.id.ok);

    File file;
    if (null == savedInstanceState) {
        file = onInit();
    } else {
        file = onRestore(savedInstanceState);
    }

    mDirExplorer.setCurrentFile(file);
    mDirExplorer.setOnChangeDirListener(this);

    Ripple.addRipple(mOk, !AttrResources.getAttrBoolean(this, R.attr.isLightTheme));

    mDefault.setOnClickListener(this);
    mOk.setOnClickListener(this);

    mPath.setText(mDirExplorer.getCurrentFile().getPath());
}
 
Example 9
Source File: SearchLayout.java    From MHViewer with Apache License 2.0 4 votes vote down vote up
@SuppressLint("InflateParams")
private void init(Context context) {
    Resources resources = context.getResources();
    mInflater = LayoutInflater.from(context);

    mLayoutManager = new LinearLayoutManager(context);
    mAdapter = new SearchAdapter();
    setLayoutManager(mLayoutManager);
    setAdapter(mAdapter);
    setHasFixedSize(true);
    setClipToPadding(false);
    int interval = resources.getDimensionPixelOffset(R.dimen.search_layout_interval);
    int paddingH = resources.getDimensionPixelOffset(R.dimen.search_layout_margin_h);
    int paddingV = resources.getDimensionPixelOffset(R.dimen.search_layout_margin_v);
    MarginItemDecoration decoration = new MarginItemDecoration(
            interval, paddingH, paddingV, paddingH, paddingV);
    addItemDecoration(decoration);
    decoration.applyPaddings(this);

    // Create normal view
    View normalView = mInflater.inflate(R.layout.search_normal, null);
    mNormalView = normalView;
    mCategoryTable = (CategoryTable) normalView.findViewById(R.id.search_category_table);
    mNormalSearchMode = (RadioGridGroup) normalView.findViewById(R.id.normal_search_mode);
    mNormalSearchModeHelp = (ImageView) normalView.findViewById(R.id.normal_search_mode_help);
    mEnableAdvanceSwitch = (SwitchCompat) normalView.findViewById(R.id.search_enable_advance);
    mNormalSearchModeHelp.setOnClickListener(this);
    Ripple.addRipple(mNormalSearchModeHelp, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme));
    mEnableAdvanceSwitch.setOnCheckedChangeListener(SearchLayout.this);
    mEnableAdvanceSwitch.setSwitchPadding(resources.getDimensionPixelSize(R.dimen.switch_padding));

    // Create advance view
    mAdvanceView = mInflater.inflate(R.layout.search_advance, null);
    mTableAdvanceSearch = (AdvanceSearchTable) mAdvanceView.findViewById(R.id.search_advance_search_table);

    // Create image view
    mImageView = (ImageSearchLayout) mInflater.inflate(R.layout.search_image, null);
    mImageView.setHelper(this);

    // Create action view
    mActionView = mInflater.inflate(R.layout.search_action, null);
    mAction = (TextView) mActionView.findViewById(R.id.action);
    mAction.setOnClickListener(this);
}
 
Example 10
Source File: DoodleActivity.java    From Nimingban with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    File dir = NMBAppConfig.getDoodleDir();
    if (dir != null) {
        String filename = "doodle-" + ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".png";
        mOutputFile = new File(dir, filename);
    }

    setStatusBarColor(ResourcesUtils.getAttrColor(this, R.attr.colorPrimaryDark));
    setContentView(R.layout.activity_doodle);

    mDoodleView = (DoodleView) findViewById(R.id.doodle_view);
    mSide = findViewById(R.id.side);
    mPalette = findViewById(R.id.palette);
    mThickness = findViewById(R.id.thickness);
    mDrawAction = (ImageView) findViewById(R.id.draw_action);
    mImage = (ImageView) findViewById(R.id.image);
    mUndo = (ImageView) findViewById(R.id.undo);
    mRedo = (ImageView) findViewById(R.id.redo);
    mClear = findViewById(R.id.clear);
    mOk = findViewById(R.id.ok);
    mMenu = findViewById(R.id.menu);

    mDoodleView.setHelper(this);

    StateListDrawable undoDrawable = new StateListDrawable();
    undoDrawable.addState(new int[]{-android.R.attr.state_enabled},
            DrawableManager.getDrawable(this, R.drawable.v_undo_disabled_dark_x24));
    undoDrawable.addState(new int[]{},
            DrawableManager.getDrawable(this, R.drawable.v_undo_default_dark_x24));
    mUndo.setImageDrawable(undoDrawable);

    StateListDrawable redoDrawable = new StateListDrawable();
    redoDrawable.addState(new int[]{-android.R.attr.state_enabled},
            DrawableManager.getDrawable(this, R.drawable.v_redo_disabled_dark_x24));
    redoDrawable.addState(new int[]{},
            DrawableManager.getDrawable(this, R.drawable.v_redo_default_dark_x24));
    mRedo.setImageDrawable(redoDrawable);

    StateListDrawable actionDrawable = new StateListDrawable();
    actionDrawable.addState(new int[]{android.R.attr.state_activated},
            DrawableManager.getDrawable(this, R.drawable.v_eraser_dark_x24));
    actionDrawable.addState(new int[]{},
            DrawableManager.getDrawable(this, R.drawable.v_brush_dark_x24));
    mDrawAction.setImageDrawable(actionDrawable);

    StateListDrawable imageDrawable = new StateListDrawable();
    imageDrawable.addState(new int[]{android.R.attr.state_activated},
            DrawableManager.getDrawable(this, R.drawable.v_image_off_dark_x24));
    imageDrawable.addState(new int[]{},
            DrawableManager.getDrawable(this, R.drawable.v_image_dark_x24));
    mImage.setImageDrawable(imageDrawable);

    Ripple.addRipple(mPalette, true);
    Ripple.addRipple(mThickness, true);
    Ripple.addRipple(mDrawAction, true);
    Ripple.addRipple(mImage, true);
    Ripple.addRipple(mUndo, true);
    Ripple.addRipple(mRedo, true);
    Ripple.addRipple(mClear, true);
    Ripple.addRipple(mOk, true);
    Ripple.addRipple(mMenu, ResourcesUtils.getAttrBoolean(this, R.attr.dark));

    mSide.setOnClickListener(this);
    mPalette.setOnClickListener(this);
    mThickness.setOnClickListener(this);
    mDrawAction.setOnClickListener(this);
    mImage.setOnClickListener(this);
    mUndo.setOnClickListener(this);
    mRedo.setOnClickListener(this);
    mClear.setOnClickListener(this);
    mOk.setOnClickListener(this);
    mMenu.setOnClickListener(this);

    updateUndoRedo();

    if (mOutputFile == null) {
        Toast.makeText(this, R.string.cant_create_image_file, Toast.LENGTH_SHORT).show();
    }

    mSideAnimator = new ValueAnimator();
    mSideAnimator.setDuration(300);
    mSideAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mSide.setTranslationX((Float) animation.getAnimatedValue());
        }
    });

    mHideSideRunnable = new Runnable() {
        @Override
        public void run() {
            hideSide();
        }
    };
    SimpleHandler.getInstance().postDelayed(mHideSideRunnable, 3000);
}
 
Example 11
Source File: SearchLayout.java    From EhViewer with Apache License 2.0 4 votes vote down vote up
@SuppressLint("InflateParams")
private void init(Context context) {
    Resources resources = context.getResources();
    mInflater = LayoutInflater.from(context);

    mLayoutManager = new LinearLayoutManager(context);
    mAdapter = new SearchAdapter();
    setLayoutManager(mLayoutManager);
    setAdapter(mAdapter);
    setHasFixedSize(true);
    setClipToPadding(false);
    int interval = resources.getDimensionPixelOffset(R.dimen.search_layout_interval);
    int paddingH = resources.getDimensionPixelOffset(R.dimen.search_layout_margin_h);
    int paddingV = resources.getDimensionPixelOffset(R.dimen.search_layout_margin_v);
    MarginItemDecoration decoration = new MarginItemDecoration(
            interval, paddingH, paddingV, paddingH, paddingV);
    addItemDecoration(decoration);
    decoration.applyPaddings(this);

    // Create normal view
    View normalView = mInflater.inflate(R.layout.search_normal, null);
    mNormalView = normalView;
    mCategoryTable = (CategoryTable) normalView.findViewById(R.id.search_category_table);
    mNormalSearchMode = (RadioGridGroup) normalView.findViewById(R.id.normal_search_mode);
    mNormalSearchModeHelp = (ImageView) normalView.findViewById(R.id.normal_search_mode_help);
    mEnableAdvanceSwitch = (SwitchCompat) normalView.findViewById(R.id.search_enable_advance);
    mNormalSearchModeHelp.setOnClickListener(this);
    Ripple.addRipple(mNormalSearchModeHelp, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme));
    mEnableAdvanceSwitch.setOnCheckedChangeListener(SearchLayout.this);
    mEnableAdvanceSwitch.setSwitchPadding(resources.getDimensionPixelSize(R.dimen.switch_padding));

    // Create advance view
    mAdvanceView = mInflater.inflate(R.layout.search_advance, null);
    mTableAdvanceSearch = (AdvanceSearchTable) mAdvanceView.findViewById(R.id.search_advance_search_table);

    // Create image view
    mImageView = (ImageSearchLayout) mInflater.inflate(R.layout.search_image, null);
    mImageView.setHelper(this);

    // Create action view
    mActionView = mInflater.inflate(R.layout.search_action, null);
    mAction = (TextView) mActionView.findViewById(R.id.action);
    mAction.setOnClickListener(this);
}