Skip to content

Commit 16ee3c3

Browse files
folder
1 parent c39a016 commit 16ee3c3

File tree

15 files changed

+327
-58
lines changed

15 files changed

+327
-58
lines changed

.idea/assetWizardSettings.xml

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/caches/gradle_models.ser

14.8 KB
Binary file not shown.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ android {
1616
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1717
}
1818
}
19+
20+
compileOptions {
21+
sourceCompatibility JavaVersion.VERSION_1_8
22+
targetCompatibility JavaVersion.VERSION_1_8
23+
}
1924
}
2025

2126
dependencies {

app/src/main/java/ka/enes/com/sample/MainActivity.java

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
import android.view.View;
88
import android.widget.Toast;
99

10+
import java.util.ArrayList;
11+
import java.util.List;
12+
1013
import karpuzoglu.enes.com.fastdialog.Animations;
14+
import karpuzoglu.enes.com.fastdialog.CustomItemClickListener;
1115
import karpuzoglu.enes.com.fastdialog.DismissListener;
1216
import karpuzoglu.enes.com.fastdialog.FastDialog;
1317
import karpuzoglu.enes.com.fastdialog.FastDialogBuilder;
18+
import karpuzoglu.enes.com.fastdialog.FolderButton;
1419
import karpuzoglu.enes.com.fastdialog.Positions;
1520
import karpuzoglu.enes.com.fastdialog.PositiveClick;
1621
import karpuzoglu.enes.com.fastdialog.Type;
@@ -111,13 +116,26 @@ public void topAnim(View view){
111116
.setAnimation(Animations.SLIDE_TOP)
112117
.setPosition(Positions.TOP)
113118
.create();
114-
dialog.positiveClickListener(new PositiveClick() {
115-
@Override
116-
public void onClick(View view) {
117-
dialog.dismiss();
118-
Toast.makeText(MainActivity.this,dialog.getInputText().equals("")?"EditText is Empty":dialog.getInputText(),Toast.LENGTH_SHORT).show();
119-
}
119+
dialog.positiveClickListener(view1 -> {
120+
dialog.dismiss();
121+
Toast.makeText(MainActivity.this,dialog.getInputText().equals("")?"EditText is Empty":dialog.getInputText(),Toast.LENGTH_SHORT).show();
120122
});
121123
dialog.show();
122124
}
125+
public void buttonFolder(View view){
126+
FolderButton button = new FolderButton("1", "one", 0, R.drawable.ic_android);
127+
FolderButton button2 = new FolderButton("2", "two", 1, R.drawable.ic_android);
128+
List<FolderButton> buttons = new ArrayList<>();
129+
buttons.add(button);
130+
buttons.add(button2);
131+
dialog = new FastDialogBuilder(this,Type.FOLDER)
132+
.setActiveButtons(buttons)
133+
.onClickListener((v, position) -> {
134+
Toast.makeText(MainActivity.this,v.getTag()+"",Toast.LENGTH_SHORT).show();
135+
})
136+
.setAnimation(Animations.SLIDE_BOTTOM)
137+
.setPosition(Positions.BOTTOM)
138+
.create();
139+
dialog.show();
140+
}
123141
}

app/src/main/res/layout/activity_main.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@
6060
android:onClick="topAnim"
6161
android:text="Colored Dialog with EditText and positivelistener "
6262
/>
63+
<Button
64+
android:layout_width="match_parent"
65+
android:layout_height="wrap_content"
66+
android:textAllCaps="false"
67+
android:onClick="buttonFolder"
68+
android:text="Button Folder "
69+
/>
6370
</LinearLayout>
6471

6572
</RelativeLayout>

fastdialog/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ android {
2121
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2222
}
2323
}
24+
compileOptions {
25+
sourceCompatibility JavaVersion.VERSION_1_8
26+
targetCompatibility JavaVersion.VERSION_1_8
27+
}
2428

2529
}
2630

2731
dependencies {
2832
implementation fileTree(dir: 'libs', include: ['*.jar'])
33+
//noinspection GradleCompatible
34+
implementation 'com.android.support:recyclerview-v7:28.0.0'
2935
implementation "com.airbnb.android:lottie:2.7.0"
36+
implementation 'com.jakewharton:butterknife:8.8.1'
37+
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
3038
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package karpuzoglu.enes.com.fastdialog;
2+
3+
import android.view.View;
4+
5+
public interface CustomItemClickListener {
6+
7+
void onItemClick(View v, int position);
8+
}

fastdialog/src/main/java/karpuzoglu/enes/com/fastdialog/FastDialogBuilder.java

Lines changed: 70 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@
77
import android.graphics.drawable.GradientDrawable;
88
import android.support.annotation.NonNull;
99
import android.support.v4.content.ContextCompat;
10+
import android.support.v7.widget.GridLayoutManager;
11+
import android.support.v7.widget.RecyclerView;
1012
import android.text.InputFilter;
1113
import android.text.method.PasswordTransformationMethod;
1214
import android.view.Gravity;
1315
import android.view.View;
1416
import android.view.WindowManager;
1517
import android.widget.Button;
18+
import android.widget.LinearLayout;
1619
import android.widget.TextView;
1720

1821
import com.airbnb.lottie.LottieAnimationView;
1922

23+
import java.util.List;
24+
2025
/**
2126
* Created by ENES on 7.12.2018.
2227
*/
@@ -36,6 +41,11 @@ public class FastDialogBuilder {
3641
private PositiveClick positiveClick;
3742
private NegativeClick negativeClick;
3843
private DismissListener dismissListener;
44+
45+
private FolderAdapter folderAdapter;
46+
private LinearLayout folderLayout;
47+
private RecyclerView rvFolder;
48+
3949
private boolean isDecimal = false;
4050
private boolean fullScreen = true;
4151
private Type type;
@@ -55,38 +65,38 @@ private FastDialogBuilder createDialog(Type type){
5565
if (type == Type.PROGRESS){
5666
dialog.setContentView(R.layout.progress_dialog);
5767
tvProgress = dialog.findViewById(R.id.wait_text);
58-
}else if(type == Type.LOGIN){
68+
}else if(type == Type.LOGIN) {
5969
dialog.setContentView(R.layout.login_dialog);
6070
tvTitle = dialog.findViewById(R.id.login_dialog_title);
6171
etUsername = dialog.findViewById(R.id.login_dialog_username);
6272
etPassword = dialog.findViewById(R.id.login_dialog_password);
63-
Drawable imgPassword = context.getResources().getDrawable( R.drawable.ic_password_black );
64-
imgPassword.setBounds( 0, 0, 45, 45 );
65-
etPassword.setCompoundDrawables(imgPassword,null,null,null);
66-
Drawable imgUser = context.getResources().getDrawable( R.drawable.ic_user_black );
67-
imgUser.setBounds( 0, 0, 45, 45 );
68-
etUsername.setCompoundDrawables(imgUser,null,null,null);
73+
Drawable imgPassword = context.getResources().getDrawable(R.drawable.ic_password_black);
74+
imgPassword.setBounds(0, 0, 45, 45);
75+
etPassword.setCompoundDrawables(imgPassword, null, null, null);
76+
Drawable imgUser = context.getResources().getDrawable(R.drawable.ic_user_black);
77+
imgUser.setBounds(0, 0, 45, 45);
78+
etUsername.setCompoundDrawables(imgUser, null, null, null);
6979
btCancel = dialog.findViewById(R.id.warning_dialog_cancel_bt);
7080
btOk = dialog.findViewById(R.id.warning_dialog_ok_bt);
71-
btCancel.setOnClickListener(new View.OnClickListener() {
72-
@Override
73-
public void onClick(View v) {
74-
if(negativeClick != null)
75-
negativeClick.onClick(v);
76-
dialog.dismiss();
77-
}
81+
btCancel.setOnClickListener(v -> {
82+
if (negativeClick != null)
83+
negativeClick.onClick(v);
84+
dialog.dismiss();
7885
});
79-
btOk.setOnClickListener(new View.OnClickListener() {
80-
@Override
81-
public void onClick(View v) {
82-
if(positiveClick != null)
83-
positiveClick.onClick(v);
84-
dialog.dismiss();
85-
}
86+
btOk.setOnClickListener(v -> {
87+
if (positiveClick != null)
88+
positiveClick.onClick(v);
89+
dialog.dismiss();
8690
});
8791
btOk.setBackground(getShape());
8892
btCancel.setBackground(getShape());
89-
93+
}else if(type == Type.FOLDER){
94+
dialog.setContentView(R.layout.folder_dialog);
95+
folderLayout = dialog.findViewById(R.id.folder_layout);
96+
rvFolder = dialog.findViewById(R.id.folder_recylerview);
97+
folderAdapter = new FolderAdapter(context,fullScreen);
98+
rvFolder.setLayoutManager(new GridLayoutManager(context,5));
99+
rvFolder.setAdapter(folderAdapter);
90100

91101
}else{
92102
dialog.setContentView(R.layout.warning_dialog);
@@ -97,21 +107,15 @@ public void onClick(View v) {
97107
etWarningDecimal = dialog.findViewById(R.id.warning_dialog_et_decimal);
98108
btCancel = dialog.findViewById(R.id.warning_dialog_cancel_bt);
99109
btOk = dialog.findViewById(R.id.warning_dialog_ok_bt);
100-
btCancel.setOnClickListener(new View.OnClickListener() {
101-
@Override
102-
public void onClick(View v) {
103-
if(negativeClick != null)
104-
negativeClick.onClick(v);
105-
dialog.dismiss();
106-
}
110+
btCancel.setOnClickListener(v -> {
111+
if(negativeClick != null)
112+
negativeClick.onClick(v);
113+
dialog.dismiss();
107114
});
108-
btOk.setOnClickListener(new View.OnClickListener() {
109-
@Override
110-
public void onClick(View v) {
111-
if(positiveClick != null)
112-
positiveClick.onClick(v);
113-
dialog.dismiss();
114-
}
115+
btOk.setOnClickListener(v -> {
116+
if(positiveClick != null)
117+
positiveClick.onClick(v);
118+
dialog.dismiss();
115119
});
116120
btOk.setBackground(getShape());
117121
btCancel.setBackground(getShape());
@@ -126,6 +130,7 @@ public void onClick(View v) {
126130
}
127131
return this;
128132
}
133+
129134
private GradientDrawable getShape(){
130135
GradientDrawable shape = new GradientDrawable();
131136
shape.setShape(GradientDrawable.RECTANGLE);
@@ -156,20 +161,35 @@ private GradientDrawable getShape(){
156161
return shape;
157162
}
158163
public FastDialogBuilder changeColor(int colorItem,int colorItemText,int colorText){
159-
tvTitle.setBackgroundColor(colorItem);
160-
tvTitle.setTextColor(colorItemText);
161-
tvWarning.setTextColor(colorText);
162-
GradientDrawable shape = new GradientDrawable();
163-
shape.setShape(GradientDrawable.RECTANGLE);
164-
//shape.setCornerRadii(new float[] { 20,20,20,20,20,20,20,20 });
165-
shape.setCornerRadius(20);
166-
shape.setColor(colorItem);
167-
shape.setStroke(3, colorItem);
164+
if (folderLayout != null) {
165+
folderLayout.setBackgroundColor(colorItem);
166+
}else{
167+
tvTitle.setBackgroundColor(colorItem);
168+
tvTitle.setTextColor(colorItemText);
169+
tvWarning.setTextColor(colorText);
168170

169-
btCancel.setBackground(shape);
170-
btOk.setBackground(shape);
171-
btCancel.setTextColor(colorItemText);
172-
btOk.setTextColor(colorItemText);
171+
GradientDrawable shape = new GradientDrawable();
172+
shape.setShape(GradientDrawable.RECTANGLE);
173+
//shape.setCornerRadii(new float[] { 20,20,20,20,20,20,20,20 });
174+
shape.setCornerRadius(20);
175+
shape.setColor(colorItem);
176+
shape.setStroke(3, colorItem);
177+
178+
btCancel.setBackground(shape);
179+
btOk.setBackground(shape);
180+
btCancel.setTextColor(colorItemText);
181+
btOk.setTextColor(colorItemText);
182+
}
183+
return this;
184+
}
185+
public FastDialogBuilder setActiveButtons(List<FolderButton> buttonList){
186+
folderAdapter.setActiveButtons(buttonList);
187+
folderAdapter.notifyDataSetChanged();
188+
return this;
189+
}
190+
public FastDialogBuilder onClickListener(CustomItemClickListener listener){
191+
folderAdapter.setClickListener(listener);
192+
folderAdapter.notifyDataSetChanged();
173193
return this;
174194
}
175195
public FastDialogBuilder progressText(String progressString){
@@ -229,7 +249,7 @@ public FastDialogBuilder setHint(String hint){
229249
etWarningDecimal.setHint(hint);
230250
return this;
231251
}
232-
public FastDialogBuilder loginWithEmail(){
252+
public FastDialogBuilder loginWithSaleFooterAdapterEmail(){
233253
etUsername.setHint(context.getResources().getString(R.string.email));
234254
Drawable img = context.getResources().getDrawable( R.drawable.ic_email_black );
235255
img.setBounds( 0, 0, 45, 45 );

0 commit comments

Comments
 (0)