Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
feat: Custom Checkbox Ripple effect for 21 and above devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Angad committed May 20, 2017
1 parent f7607d7 commit 7067e24
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 37 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
buildToolsVersion "25.0.3"

defaultConfig {
applicationId "com.github.angads25.filepickerdemo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,16 @@ public void onClick(View view) {
properties.error_dir=new File("/mnt");
//Set new properties of dialog.
dialog.setProperties(properties);
ArrayList<String> paths=new ArrayList<>();
paths.add("/mnt/sdcard/.VOD");
paths.add("/mnt/sdcard/.VOD/100.jpg");
paths.add("/mnt/sdcard/.VOD/1000.jpg");
paths.add("/mnt/sdcard/.VOD/1010.jpg");
paths.add("/mnt/sdcard/.VOD/1020.jpg");
paths.add("/mnt/sdcard/.VOD/1070.jpg");
dialog.markFiles(paths);

// Pre marking of files in Dialog
// ArrayList<String> paths=new ArrayList<>();
// paths.add("/mnt/sdcard/.VOD");
// paths.add("/mnt/sdcard/.VOD/100.jpg");
// paths.add("/mnt/sdcard/.VOD/1000.jpg");
// paths.add("/mnt/sdcard/.VOD/1010.jpg");
// paths.add("/mnt/sdcard/.VOD/1020.jpg");
// paths.add("/mnt/sdcard/.VOD/1070.jpg");
// dialog.markFiles(paths);
}
});

Expand Down
2 changes: 1 addition & 1 deletion filepicker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ext {

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
buildToolsVersion "25.0.3"

defaultConfig {
minSdkVersion 9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.github.angads25.filepicker.controller;

/**<p>
/* <p>
* Created by Angad Singh on 10-07-2016.
* </p>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,24 +151,7 @@ public View getView(final int i, View view, ViewGroup viewGroup) {
holder.fmark.setChecked(false);
}
}
// holder.fmark.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// item.setMarked(!item.isMarked());
// if (item.isMarked()) {
// if(properties.selection_mode == DialogConfigs.MULTI_MODE) {
// MarkedItemList.addSelectedItem(item);
// }
// else {
// MarkedItemList.addSingleFile(item);
// }
// }
// else {
// MarkedItemList.removeSelectedItem(item.getLocation());
// }
// notifyItemChecked.notifyCheckBoxIsClicked();
// }
// });

holder.fmark.setOnCheckedChangedListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(MaterialCheckbox checkbox, boolean isChecked) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.github.angads25.filepicker.model;

/**<p>
/* <p>
* Created by Angad Singh on 09-07-2016.
* </p>
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2017 Angad Singh
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.github.angads25.filepicker.widget;

import android.content.Context;
Expand All @@ -20,13 +36,12 @@

public class MaterialCheckbox extends View {
private Context context;
private int width, height, minDim;
private int minDim;
private Paint paint;
private RectF bounds;
private boolean checked;
private OnCheckedChangeListener onCheckedChangeListener;
private Path tick;
private float paintStroke, paintStyle, paintJoint;

public MaterialCheckbox(Context context) {
super(context);
Expand Down Expand Up @@ -98,8 +113,8 @@ protected void onDraw(Canvas canvas) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
height = getMeasuredHeight();
width = getMeasuredWidth();
int height = getMeasuredHeight();
int width = getMeasuredWidth();
minDim = Math.min(width, height);
bounds.set(minDim / 10, minDim / 10, minDim - (minDim/10), minDim - (minDim/10));
tick.moveTo(minDim / 4, minDim / 2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2017 Angad Singh
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.github.angads25.filepicker.widget;

/**
Expand Down
6 changes: 3 additions & 3 deletions filepicker/src/main/res/layout/dialog_file_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:layout_marginStart="8dp"
android:scaleType="centerInside"
android:id="@+id/image_type"
android:layout_gravity="center" />
android:layout_gravity="center"/>

<LinearLayout
android:orientation="vertical"
Expand Down Expand Up @@ -46,10 +46,10 @@
</LinearLayout>

<com.github.angads25.filepicker.widget.MaterialCheckbox
android:id="@+id/file_mark"
android:layout_width="@dimen/checkbox_dimens"
android:layout_height="@dimen/checkbox_dimens"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/checkbox_margin"
android:layout_marginRight="@dimen/checkbox_margin"
android:id="@+id/file_mark"/>
android:layout_marginRight="@dimen/checkbox_margin"/>
</LinearLayout>

0 comments on commit 7067e24

Please sign in to comment.