Giter Site home page Giter Site logo

eltos / simpledialogfragments Goto Github PK

View Code? Open in Web Editor NEW
118.0 7.0 17.0 119.87 MB

An Android library to create dialogs with ease and handle user interaction reliably, using fragments and material design.

License: Apache License 2.0

Java 99.06% Kotlin 0.94%
android dialogs library material-design easy-to-use dialog fragments color-picker android-library java

simpledialogfragments's Introduction

SimpleDialogFragments

API 14+ Maven Central JitPack Code Climate Rating Github CI License

SimpleDialogFragments Library is a collection of easy to use and extendable DialogFragment's for Android. It is fully compatible with rotation changes and can be implemented with only a few lines of code.

A new approach of result handling ensures data integrity over rotation changes, that many other libraries lack.

🧑‍💻 API ℹ️ Wiki 🚀 Releases
🖼️ Screenshots 📱 Demo 🪙 Donate

Features

  • Common dialogs that can be used with few lines of code
    • Alert dialogs
    • Input and checkbox dialogs with suggestions and validations
    • Filterable single- / multi-choice dialogs
    • Color pickers (palettes and/or HSV)
    • Extensive forms
    • Date and time pickers
    • Pin code dialog
    • Progress dialogs
  • Easy result handling even after rotation changes
  • Persistence on rotation changes
  • Material design
  • Fullscreen dialogs
  • Customizable and extendable dialogs

Usage

Check the release page for the latest and older versions:

In your module level build.gradle when using mavenCentral:

dependencies {
    implementation 'io.github.eltos:simpledialogfragments:3.8.3'
}

or if using JitPack:

dependencies {
    implementation 'com.github.eltos:simpledialogfragments:v3.8.3'
}

Building dialogs

Building dialogs is very easy and short handed:

SimpleDialog.build()
            .title(R.string.hello)
            .msg(R.string.hello_world)
            .show(this);

Check the wiki pages for instructions and examples on how to build the different dialogs available.

Receive Results

Supply a tag when showing the dialog and let the hosting Activity or Fragment implement the SimpleDialog.OnDialogResultListener.
For details, please refere to the wiki pages.

@Override
public boolean onResult(@NonNull String dialogTag, int which, @NonNull Bundle extras) {
    if (YES_NO_DIALOG.equals(dialogTag) && which == BUTTON_POSITIVE){
        // ...
        return true;
    }
    if (LIST_DIALOG.equals(dialogTag) && which == BUTTON_POSITIVE){
        ArrayList<Integer> pos = extras.getIntegerArrayList(SimpleListDialog.SELECTED_POSITIONS);
        // ...
        return true;
    }
    if (REGISTRATION_DIALOG.equals(dialogTag) && which == BUTTON_POSITIVE){
        String username = extras.getString(USERNAME);
        String password = extras.getString(PASSWORD);
        // ...
        return true;
    }
    // ...
    return false;
}

Extensions

Known extensions and projects using this library:

License

Copyright 2017-2022 Philipp Niedermayer (github.com/eltos)

Licensed under the Apache License 2.0

You may only use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software in compliance with the License. For more information visit http://www.apache.org/licenses/LICENSE-2.0
The above copyright notice alongside a copy of the Apache License shall be included in all copies or substantial portions of the Software not only in source code but also in a license listing accessible by the user.

simpledialogfragments's People

Contributors

asdfasdfasdfasdfas avatar eltos avatar gustavoasantos avatar mendhak avatar mtotschnig avatar peoxnen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

simpledialogfragments's Issues

Negative buttons & custom texts

Hi ,

In the future it would be a nice functionalities:

  • Negative buttons
  • Set custom text for positive & neagtive buttons

Regards!

SimpleDialogFragments show showHsvWheel problem with low res device

Steps to reproduce

  1. Show dialog showHsvWheel on low res device Landscape mode 720*580

Expected and actual behaviour

Expected full dialog window - get not full color picker window, some parts missed, transparent and hex are not fully visible and usable. The window should be wider.

Test Environment

Property Value
Screen resolution 580x720
Screen density
Library version
Android version 4.2

Spinner crashes if used without required or placeholder

If Spinner form element is used without specifying either required or placeholder it leads to crash

Steps to reproduce

  1. Spinner.plain(KEY_TYPE).items("A", "B", "C").preset(0)

Expected and actual behaviour

In my opinion, this should either be interpreted as required true, or use empty string as a placeholder, instead of crashing. Alternatively the requirement of specifying either required or placeholder should be documented, ideally runtime error with meaningful explanation being thrown

Test Environment

Library version | 3.2.0
Android version | API 27

Stack Trace

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
        at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:445)
        at android.widget.ArrayAdapter.getView(ArrayAdapter.java:407)
        at eltos.simpledialogfragment.form.SpinnerViewHolder$CustomSpinnerAdapter.getView(SpinnerViewHolder.java:182)
        at android.widget.Spinner.measureContentWidth(Spinner.java:856)
        at android.widget.Spinner.onMeasure(Spinner.java:606)
        at android.support.v7.widget.AppCompatSpinner.onMeasure(AppCompatSpinner.java:421)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
        at android.view.View.measure(View.java:22071)
        at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1308)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.widget.ScrollView.onMeasure(ScrollView.java:350)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.view.View.measure(View.java:22071)
        at android.support.v7.widget.AlertDialogLayout.tryOnMeasure(AlertDialogLayout.java:134)
        at android.support.v7.widget.AlertDialogLayout.onMeasure(AlertDialogLayout.java:64)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at com.android.internal.policy.DecorView.onMeasure(DecorView.java:724)
        at android.view.View.measure(View.java:22071)
        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2422)

Selected color not the true color

I selected the white color from the wheel and when I change the view color based on that , it show gray. All the color are slightly different than the selected colour? why is that?

Improved tag handling

Make all SomeDialog.TAG fields public and use these fields as default TAG when calling show-Method without tag (e.g. via a static method getTag).

Showing a dialog without taking note of the results is a rare usage case and could still be achieved by explicitly passing null as tag.

Related: #1, Wiki

Library incompatible with AndroidX

Hi, I use your library (v2.2.2) and when I try to update to version 3.0 or 3.1, my Gradle sync fails with error:

Failed to transform file 'pinentryedittext-1.3.3.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform

I see the issue in PinEntryEditText library alphamu/PinEntryEditText#40 and solution is to use version 2.0 to properly support Android Jetpack.

Could you update the library to use the new version? Thanks.

Tag/keyword dialog

Input dialog for tags/keywords/recipients/...

  • Suggestions (custom list and or frequently used tags)
  • Spannables for representation
  • Delimeter: comma, point+space, double space or hash
  • Validation pattern

Example

Implementation as FormElement based on Input (?)

Adding to gradel causes chrome to crash

Steps to reproduce

  1. add compile 'com.github.eltos:simpledialogfragment:2.2.1' at module level
  2. open run with an app with a recylerView with a webview, causes chrome to crash
  3. removing from gradle and chrome does not crash (I also removed all web components, imports, and web view, and it still happened - not sure why)

Expected and actual behaviour

Expected: To be able to run an activity without chrome crashing (yes chrome, not my app).
Behavior: Chrome crashes when added"com.github.eltos:simpledialogfragment" is added to project

Test Environment

. Version
Library supportLibVersion = '26.1.0'
Android 19 -17

Stack Trace

01-17 02:01:24.824 1915-1916/? E/ANDR-PERF-OPTSHANDLER: Warning: Resource [2, 0] not supported for core 1. Instead use resource for core 0
01-17 02:01:24.824 1915-1916/? E/ANDR-PERF-RESOURCEQS: Failed to apply optimization [2, 2, 0]
01-17 02:01:30.632 18729-18729/? E//system/bin/webview_zygote32: Failed to make and chown /acct/uid_99164: Permission denied
01-17 02:01:30.633 18729-18729/? E/Zygote: createProcessGroup(99164, 0) failed: Permission denied
01-17 02:01:30.696 18756-18756/? E/asset: setgid: Operation not permitted
01-17 02:01:30.771 18729-18729/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.android.chrome:sandboxed_process0, PID: 18729
                                                   android.content.res.Resources$NotFoundException: Array resource ID #0x7f03000a
                                                       at android.content.res.Resources.obtainTypedArray(Resources.java:618)
                                                       at android.content.res.Resources.preloadFonts(Resources.java:380)
                                                       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5769)
                                                       at android.app.ActivityThread.-wrap1(Unknown Source:0)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
                                                       at android.os.Handler.dispatchMessage(Handler.java:106)
                                                       at android.os.Looper.loop(Looper.java:164)
                                                       at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                       at com.android.internal.os.WebViewZygoteInit.main(WebViewZygoteInit.java:146)

Migrate to JFrog

The jcenter is closed down, would you like to migrate to mavencentral?
I cannot build your project dependency anymore

[Problem] Lib compiled under API 28 needed.

It seems the new gradle plugin of AS 3.1 has problems compiling a project with your library in dependencies under API 28. Is it possible to make a new version of your lib under API 28 with "implementation" insead of "compile" and etc.?

Hide the HEX EditView in SimpleColorWheelDialog

When selecting to customize the color from the SimpleColorDialog, the SimpleColorWheelDialog show up and also the soft keyboard pops-up because the focus is in the EditView of the hex value and it's really annoying.

Either an way to disable it or don't give focus to it at the start would be great.

Add new feature

Hello, please, in the section Color Picker add the pos Button, if custom is false

SimpleListDialog (choiceMode SINGLE_CHOICE and MULTI_CHOICE): Text may not be fully visible

SimpleListDialog with choiceMode SINGLE_CHOICE and MULTI_CHOICE does not display items with long text fully. This problem may also affect shorter items when user has selected large font size or display size.

Steps to reproduce

  1. Create a SimpleListDialog and add an item with long text, and/or change system settings for font size and/or display size.

Expected behaviour

Item should be fully visible.

Actual behaviour

Item appears cut.
device-2020-12-28-163821

Test Environment

Property Value
Library version 3.3
Android version 10

The issue was brought up in the context of mtotschnig/MyExpenses#715

Crash after phone wake up if SimpleFormDialog was stay in foreground.

There is a problem with SimpleFormDialog if it was in foreground when device going to sleep. When it wake up application crashes because of getDialog() is null in the following code:

@Override
protected void onDialogShown() {
    // resize dialog when keyboard is shown to prevent fields from hiding behind the keyboard
    if (getDialog().getWindow() != null) {
        getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    }

    setPositiveButtonEnabled(posButtonEnabled());
    requestFocus(0);
}

If I add null check to it - if (getDialog() != null && getDialog().getWindow() != null) - the crash disappears.

ColorWheelView incorrect state handling leads to crash

When ColorWhellView tries to restore its state, app crashes, with below stacktrace.

Steps to reproduce

  1. Activate Developer options and switch on option "Don't keep activities"
  2. Open a SimpleColorWheelDialog. Put app into background, e.g by clicking on system UI Home button. Bring app back into foreground via task switcher.

App crashes

Test Environment

Property Value
Library version 3.1-androidx
Android version API 25

Stack Trace

    java.lang.RuntimeException: Unable to start activity ComponentInfo{org.totschnig.myexpenses.debug/org.totschnig.myexpenses.activity.AccountEdit}: java.lang.NullPointerException: Attempt to get length of null array
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
     Caused by: java.lang.NullPointerException: Attempt to get length of null array
        at android.os.Parcel.readFloatArray(Parcel.java:1048)
        at eltos.simpledialogfragment.color.ColorWheelView$SavedState.<init>(ColorWheelView.java:398)
        at eltos.simpledialogfragment.color.ColorWheelView$SavedState.<init>(ColorWheelView.java:388)
        at eltos.simpledialogfragment.color.ColorWheelView$SavedState$1.createFromParcel(ColorWheelView.java:412)
        at eltos.simpledialogfragment.color.ColorWheelView$SavedState$1.createFromParcel(ColorWheelView.java:410)
        at android.os.Parcel.readParcelable(Parcel.java:2471)
        at android.os.Parcel.readValue(Parcel.java:2365)
        at android.os.Parcel.readSparseArrayInternal(Parcel.java:2813)
        at android.os.Parcel.readSparseArray(Parcel.java:2068)
        at android.os.Parcel.readValue(Parcel.java:2422)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:2732)
        at android.os.BaseBundle.unparcel(BaseBundle.java:269)
        at android.os.Bundle.getSparseParcelableArray(Bundle.java:934)
        at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2104)
        at android.app.Dialog.onRestoreInstanceState(Dialog.java:462)
        at androidx.fragment.app.DialogFragment.onActivityCreated(DialogFragment.java:475)
        at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2619)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:904)
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
        at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2659)
        at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
        at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
        at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
        at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)
        at android.app.Activity.performStart(Activity.java:6696)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2628)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) 
        at android.app.ActivityThread.-wrap12(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6119) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

Default TAG for results is unreliable

When showing a Dialog without passing an explicit TAG, the implementation tries to use the TAG field as default (See show(Fragment fragment) and show(FragmentActivity activity) in SimpleDialog.java):

try {
    tag = (String) this.getClass().getField("TAG").get(null);
} catch (Exception ignored) { }

This is unreliable and fails if the code was minified, which is common practice for android apps during release build (e.g. minifyEnabled true in build.gradle).
The bug is particularly insidious, as it will not occur for debug builds where minification is disabled by default.

Simplify onResult API: void instead of boolean

If I am not mistaken the value returned from the onResult callback has no effect. onResult is only used from callResultListener, and the return value of callResultListener is always ignored. Wouldn't it make sense to redesign the API and have onResult as a void function?

Travis CI

  • Library build
  • Test-App assembleRelease
  • Run Test app on emulator

How to use your library if I do not extend a FragmentActivity?

I am trying to adopt your lib for my project in which I need to show some dialogs in the android.app.Activity but not the FragmentActivity.

    SimpleListDialog.build()
            .title(R.string.dialog_title_attention)
            .choiceMode(SimpleListDialog.SINGLE_CHOICE_DIRECT)
            .items(getBaseContext(), new int[]{R.string.choice_A, R.string.choice_B, R.string.choice_C})
            .show(???????????????????, SimpleListDialog.class.getName());

What should I write at the first argument of the show method?

Feature request - a "SimpleProgressDialog" - progress bar (the indeterminate type)

Hello there, I like how simple and easy to use your library is.
I have a feature request, for a progress bar, but in a dialog.

I'm mainly interested in an indeterminate progress bar, so it just spins forever until I get rid of it. Just thinking out loud, we call the .show() on a SimpleProgressDialog. Then we start a long process in our code. Then later on we call .dismiss().

Some examples of circular progress bars can be seen here:

https://github.com/castorflex/SmoothProgressBar
https://github.com/zhanghai/MaterialProgressBar

Add a method to get title, message and etc. of an already shown dialog.

I am using your library to show errors from various threads. Two threads throw the same error like a "Server timeout" sometimes and I wouldn't show error dialog twice. To avoid this I need to check an existence of dialog with the message "Server timeout" and do nothing if it exists. But a method to get a message of the already shown dialog is absent and I have to do following in androidx.fragment.app.Fragment:

public abstract class BaseFragment extends Fragment{
    private static final String CONVERSATION_ERROR_DIALOG = "dialogTagError";
    ...
    private boolean isErrorDialogAlreadyShown(String message){
        Fragment dialogFragment = getFragmentManager().findFragmentByTag(CONVERSATION_ERROR_DIALOG);
        return dialogFragment instanceof SimpleDialog && message.equals(dialogFragment.getArguments().getString(SimpleDialog.TAG + "message", null));
    }
}

It would be nice to have the method

getFragmentManager().findFragmentByTag(DIALOG_TAG).getArguments().getString(SimpleDialog.TAG + "message", null)

ready in your library.

ColorWheelView.OnColorChangeListener is not public

I used ColorWheelView in my layout and I wanted to set ColorPicker.setOnColorChangeListener(OnColorChangeListener listener);, but I can't use/implement the OnColorChangeListener interface as it's marked package-private. It should be marked as public instead.

Set texts of buttons in ColorWheelDialog called from the custom color button in ColorDialog

So I'm using this library's ColorDialog for the user to pick a color from a predefined palette of mine in the res directory. I'm also allowing the user to pick his own color by pressing the palette icon in the color selection, which brings up the ColorWheelDialog.

This is the constructor I'm using: (the pre-selected color comes from the background color of the button which brings up the ColorDialog, and whose background color is updated in the callback)

SimpleColorDialog.build()
.title(getString(R.string.highlight_dialog_color_title))
.colors(getActivity(), R.array.highlightColors)
.allowCustom(true)
.colorPreset(ViewCompat.getBackgroundTintList(colorButton).getDefaultColor())
.pos(R.string.highlight_dialog_confirm)
.neg(R.string.highlight_dialog_cancel)
.show(KeyWordDialog.this, COLOR_DIALOG);

My question is: How can I also set the negative and positive buttons of the ColorWheelDialog, in which the user pics his custom color?

Make automatic opening of Spinner when focusing optional

If the first form field in a SimpleFormDialog is a spinner, it automatically opens when the dialog is displayed. I think this is irritating at least in that circumstance. I am not sure if this has some benefit in other circumstances.

Custom Input Validation

I am trying to user this great library but I have one issue. When using the SimpleFormDialog I cannot add my own validation for a username. Matchers work for many things but I need to be able to check for bad words customers may put into their username. Any suggestions?

File/Folder picker dialog

I am going to create a simple file/folder chooser based on your library. For this purpose I would like to extending your SimpleListDialog and customize onItemClick :

import android.view.View;
import android.widget.AdapterView;

import eltos.simpledialogfragment.list.SimpleListDialog;

public class SimpleListDialogMod extends SimpleListDialog {

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        super.onItemClick(parent, view, position, id); 
        //Some custom code
    }
}

and use it as follows:

SimpleListDialogMod.build()
        .title(titleResId)
        .choiceMode(SimpleListDialog.SINGLE_CHOICE)
        .choiceMin(1)
        .items(itemNames)
        .extra(extras)
        .pos(R.string.button_deeper)
        .neg(R.string.button_up)
        .neut(R.string.button_pick)
        .show(this, PICK_DIALOG);

but onItemClick is never called when I press an item in the list! Why?

P.S. Would you be so kind to write your own SimplePickFileDialog? It is widely used and would be very useful as I suppose.

Duplicate Manifest.xml, Can't run or build apk

This is a bug which occurs with Kotlin. It cannot build APK which also prevents running the app through ADB. I've also searched over google to find any solution but none worked. I also followed one solution to remove the manifest file from lint.jar and rebuild it but it didn't work either. I have also tried cleaning the project, invalidating caches, deleting gradle cache files etc, none worked.

Build error - duplicate entry: AndroidManifest.xml

Removing the library from the project resolves the error, adding it again gives the error. I remember including it my other project about 5 months ago and even back then it gave me the same error. I hope it will be solved as soon as possible.

Test Environment

Property Version
JavaVersion VERSION_1_8
minSdkVersion 23
compileSdkVersion 29
targetSdkVersion 29
buildToolsVersion 29.0.3
kotlin_version 1.3.72
Lib version 3.1 as in implementation 'com.github.eltos:simpledialogfragment:3.1'

Ability to show selected items if Dialog is called second time

Thanks for this great library, very helpful and saved me time. I was thinking I would be great if there is a way to show selected items in the multi-choice mode especially if the same Dialog is shown for the second time, like if the user already picked some items from the list and then wanted to be sure of the selection or wants to add more items to the selection. Maybe something like

SimpleListDialog.build() .title("Select Categories") .choiceMode(SimpleListDialog.MULTI_CHOICE) .theme(R.style.MyFancyDialogTheme) .choiceMax(5) .items(getActivity(), R.array.activites) .filterable(true)**.preselected(2, 6, 8)** .show(registrationActivity, CATEGORY_DIALOG);

InputDialog strange log

I have tried this for simple name input:

SimpleInputDialog.build()
              .msg(getString(R.string.enter_flashcard_name))
              .inputType(InputType.TYPE_CLASS_TEXT)
              .show(MainActivity.this);

But in logcat, it gives this:

I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead. and it makes me nervous, what the hell did I do wrong?

Pin input dialog

I need to show PIN code input dialog with number keyboard only. If I set inputType(InputType.TYPE_CLASS_NUMBER) as follows:

         SimpleFormDialog.build()
            .extra(extras)
            .title("Title")
            .msg("Message")
            .fields(
                    Input.password(USER_PIN)
                            .showPasswordToggle(false)
                            .inputType(InputType.TYPE_CLASS_NUMBER)
                        )
            .neut()
            .cancelable(false)
            .show(this, CASH_BACK_DIALOG);

my PIN code becomes visible during input. If I remove inputType(InputType.TYPE_CLASS_NUMBER) PIN code is closed by stars during input, but keyboard has letter symbols too instead of numbers only. Is it posible to have closed PIN code input and numeric only keyboard?

Dialog crash after screen rotation

test1
test2

When downloading and running demo/test application SimpleDialogFragmentMaster and selecting dialogs from List and Choices, Date and Time, Inputs and Forms, dialog crash after screen rotation.

  1. Start demo app. SimpleDialogFragmentsMaster MainActivity.
  2. Tap on the DATE button
  3. Rotate device

Test Environment

compileSdkVersion 25, buildToolsVersion '27.0.3'

emulator Nexus 7 API 19 1200x1920 xhdpi Android 4.4.2
real device Lenovo A5500-F Android 4.4.2 800 x 1280 pixels, 16:10 ratio (~189 ppi density)

Stack Trace

FATAL EXCEPTION: main
Process: eltos.simpledialogfragments.test, PID: 2678
java.lang.RuntimeException: Unable to start activity ComponentInfo{eltos.simpledialogfragments.test/eltos.simpledialogfragments.MainActivity}: java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class android.widget.ScrollView$SavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/scrollView. Make sure other views do not use the same id.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3738)
at android.app.ActivityThread.access$900(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class android.widget.ScrollView$SavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/scrollView. Make sure other views do not use the same id.
at android.view.View.onRestoreInstanceState(View.java:12823)
at android.support.v4.widget.NestedScrollView.onRestoreInstanceState(NestedScrollView.java:1832)
at android.view.View.dispatchRestoreInstanceState(View.java:12799)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2637)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2643)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2643)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2643)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2643)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2643)
at android.view.View.restoreHierarchyState(View.java:12777)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1744)
at android.app.Dialog.onRestoreInstanceState(Dialog.java:428)
at android.support.v4.app.DialogFragment.onActivityCreated(DialogFragment.java:407)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:2198)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1326)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2888)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:603)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5241)

Add alpha to SimpleColorDialog

Is it possible to add alpha channel to SimpleColorDialog when we click on "color palette" button to edit the choosen color (like for SimpleColorWheelDialog)?

Library version 3.0

String Array in strings.xml

Hello,

I love your plugins and will add in my app but can you please add a new features?

I define my Arrays in strings.xml

    <string-array name="country_arrays">
        <item>ABC</item>
        <item>A</item>
        <item>B</item>
        <item>C</item>
        <item>D</item>
.............
...............

and use like a spinner in your sample app (onSingleClick)

    // That work OK
   //int[] data = new int[]{R.string.choice_A, R.string.choice_B, R.string.choice_C, R.string.choice_D, R.string.choice_E, R.string.choice_F, R.string.choice_G, R.string.choice_H, R.string.choice_I, R.string.choice_K, R.string.choice_L, R.string.choice_M};

        int[] data = new int[]{R.array.country_arrays};   // <==  DONT WORK HERE
        Bundle extras = new Bundle();
        extras.putIntArray("labels", data);

        SimpleListDialog.build()
                .title(R.string.select_one)
                .choiceMode(SimpleListDialog.SINGLE_CHOICE) // _DIRECT
                .choiceMin(1)
                .items(getBaseContext(), data)
                .extra(extras)
                .show(MainActivity.this, LIST_DIALOG);

and crash;

   Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f0d0002
                      at android.content.res.Resources.getText(Resources.java:1442)
                      at android.content.res.Resources.getString(Resources.java:1536)
                      at android.content.Context.getString(Context.java:383)
                      at eltos.simpledialogfragment.list.SimpleListDialog.items(SimpleListDialog.java:63)
                      at eltos.simpledialogfragments.MainActivity.onSingleClick(MainActivity.java:161)

Can you please add this features an we can user your plugins with R.array.xxxx ???

Thanks
erkan kaplan

minSdk9 branch not functional on Gingerbread

While trying to use the SimpleColorDialog on Gingerbread I found the following problems:

  1. mListView.setAdapter(mAdapter); in CustomListDialog
  2. PorterDuff.Mode.ADD in ColorWheelView

were added in API 11 and lead to crash.

Spinner automatically scrolls to bottom when opened

The Spinner in the SimpleFormDialog automatically scrolls to the bottom of the items when opened as long as no item was selected before, this may be confusing for the user.

Steps to reproduce

  1. Make SimpleFormDialog with a Spinner field.
  2. Populate the Spinner with enough items to make the Spinner scrollable.
  3. Open the Spinner.
  4. The Spinner shows the bottom of the items.

Expected and actual behaviour

I would expect that as long as there is no item selected before and no preset is used, the list would open at the top of the items.
For the moment the Spinners opens at the bottom.

Test Environment

Property Value
Library version 3.1-androidx
Android version API 28

Attribute application@allowBackup

I am wondering why did you set in the library Attribute application@allowBackup = true?
This flag shall not be present in a library.

Incompleted wiki while creating your own Dialog

Hi, in this wiki the instructions are not complete. If you don't create your own builder which instantiates your custom class, the Dialog will show an empty view. In my case I added:

    public static JustifyDialog build() {
        return new JustifyDialog();
    }

to solve the problem. This should be a mandatory instruction, maybe could save other's people time

Event repetition dialog

Dialog to pick a reoccuring event

Fields:

  • First occurence: (day).(month).year
  • Type: daily/weekdays/weekly/monthly/quarterly/annually
  • [Type dependent fields]
  • Until/for: one of:
    • Until (day).(month).year
    • For x days/weeks/months/years
    • x times
    • For ever

Display for control: (x occurences, last event on xx.xx.xxxx)

Fields for daily repetition

  • Every x days

Fields for weekly repetition

  • Every x weeks
  • Distinguish even/odd weeks (checkbox)
  • Select day(s): Mon/Tue/Wed/Thu/Fri/Sat/Sun
  • (Select day(s) for odd weeks: Mon/Tue/Wed/Thu/Fri/Sat/Sun)

Fields for monthly repetition

  • Every x months
  • Type:
    • On the x th of the month
    • On the 1st/2nd/3rd/4th/last Mon/Tue/Wed/Thu/Fri/Sat/Sun of the month
    • On the 1st/2nd/3rd last day of the month
  • And the following x days (optional)

Fields for annually repetition

  • Every x years
  • Select month(s): Jan/Feb/Mar/.../Dec
  • Type:
    • On the xx th of th month
    • On the 1st/2nd/3rd/4th/last Mon/Tue/Wed/Thu/Fri/Sat/Sun of the month
    • On the 1st/2nd/3rd last day of the month
    • On Mon/Tue/Wed/Thu/Fri/Sat/Sun of the x th calender week
  • And the following x days (optional)

Functions

  • Calculate all Dates (with given max) from first occurence/given date
  • Human readable representation of repetition, e.g. "Every 2nd Monday in January", "Quarterly on the 1st of the month"

Standard

  • Is there a standard for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.