Closed peoxnen closed 6 years ago
Hello,
thanks for the suggestion, this looks very interesting.
I am wondering how you are using the FlexboxLayout without changing the underlying layout resource. Could you provide a usage example on this?
Another option I see here is to extend the SimpleFormDialog and overwrite the onCreateContentView method. Any thoughts about this?
Regards
I extends SimpleFormDialog and override onCreateContentView like you suggest in Wiki. I think better way is to extends from CustomViewDialog and add this to library. On the other hand we can create decorator.
@Override public View onCreateContentView(Bundle savedInstanceState) { View view = this.inflate(R.layout.dialog_form_flex); FlexboxLayout container = (FlexboxLayout) view.findViewById(R.id.container); setContainer(container); setFields(savedInstanceState); } return view; }
Regards
I see. If we go for your suggestion, i would combine the two methods into one and give it a more meaningful name. But a decorator or simply a way of setting the layout resource file might also (or in addition) be a good idea. Please allow some time to give it a more detailed look. Your Ideas are always welcome.
I think the best practice is to extend SimpleFormDialog
and overwrite the onCreateContentView
-method, as you most likely will have to do additional set-up when using a custom layout resource.
Using the method populateContainer(@NonNull ViewGroup container, @Nullable Bundle savedInstanceState)
, coding work is limited to a minimum.
Here is an example on how to use it:
public class FlexboxFormDialog extends SimpleFormDialog {
public static FlexboxFormDialog build(){
return new FlexboxFormDialog();
}
@Override
public View onCreateContentView(Bundle savedInstanceState) {
// inflate custom view
View view = inflate(R.layout.dialog_form_flex);
FlexboxLayout container = (FlexboxLayout) view.findViewById(R.id.container);
// TODO: set up flexbox-layout
populateContainer(container, savedInstanceState);
return view;
}
}
It's good idea :) Thx.
Hello,
If you allow to change Countainer for forms you can change LinearLayout to FlexboxLayout. Its pawerful comibination and you can build dynamic dialog with many items. You can make specific dialog's layout for tablets. I send u example https://ibb.co/ks8rnb. With this change your library would be more elastic and pawerful.
In the other way we can change this layout in your library and set default values to present in like LinearLayout but it require add FlexboxLayout https://github.com/google/flexbox-layout (its from Google).
Reargs, Witold Sieński