77import android .graphics .drawable .GradientDrawable ;
88import android .support .annotation .NonNull ;
99import android .support .v4 .content .ContextCompat ;
10+ import android .support .v7 .widget .GridLayoutManager ;
11+ import android .support .v7 .widget .RecyclerView ;
1012import android .text .InputFilter ;
1113import android .text .method .PasswordTransformationMethod ;
1214import android .view .Gravity ;
1315import android .view .View ;
1416import android .view .WindowManager ;
1517import android .widget .Button ;
18+ import android .widget .LinearLayout ;
1619import android .widget .TextView ;
1720
1821import 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