fengdai / AlertDialogPro

[Deprecated] This project can make it easy to theme and custom Android's dialog. Also provides Holo and Material themes for old devices.
Other
467 stars 122 forks source link

Sample app? #1

Closed AndroidDeveloperLB closed 9 years ago

AndroidDeveloperLB commented 9 years ago

How do I use this library? Can you please post a sample code of how to create an alertDialog ? Does it work well on Gingerbread?

fengdai commented 9 years ago

Can you please post a sample code of how to create an alertDialog ?

Well. There's already a demo.

Does it work well on Gingerbread?

Yes. It works well on all versions of the Android platform back to v1.0. So it also works well on Gingerbread.

How do I use this library?

Checkout the project and take a look at the alertdialogpro-demo module. The styles.xml file shows you how to specify a global theme to the AlertDialogPro. The MainActivity.java file shows you how to build an AlertDialogPro and change the theme of AlertDialogPro in the code. You can also take a look at the alertdialogpro-theme-material module which implements a material theme. It can show you how to do theme customization with this project.

AndroidDeveloperLB commented 9 years ago

Oh, sorry for missing this. I was sure I've seen only a very short project for material, and now I see more. Probably missed a lot by staying up late. :) I think this is the part I've seen: https://github.com/fengdai/AlertDialogPro/tree/master/alertdialogpro-theme-material

Anyway, how come the support library doesn't have this functionality ?

fengdai commented 9 years ago

I don't know... Maybe there is no need for Google to do that since this functionality is not as complex as the ActionBar compatibility.

AndroidDeveloperLB commented 9 years ago

I see. Say, now I've tried to use Android-Studio and run the demo, but got an error running it. Can you please help me handle it? here's the error:

Error:Execution failed for task ':alertdialogpro-demo:processDebugResources'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: D:\android\build-tools\21.0.0\aapt.exe package -f --no-crunch -I D:\android\platforms\android-21\android.jar -M D:\android-studio\Android studio Projects\AlertDialogPro\alertdialogpro-demo\build\intermediates\manifests\debug\AndroidManifest.xml -S D:\android-studio\Android studio Projects\AlertDialogPro\alertdialogpro-demo\build\intermediates\res\debug -A D:\android-studio\Android studio Projects\AlertDialogPro\alertdialogpro-demo\build\intermediates\assets\debug -m -J D:\android-studio\Android studio Projects\AlertDialogPro\alertdialogpro-demo\build\generated\source\r\debug -F D:\android-studio\Android studio Projects\AlertDialogPro\alertdialogpro-demo\build\intermediates\libs\alertdialogpro-demo-debug.ap_ --debug-mode --custom-package com.alertdialogpro.demo -0 apk --output-text-symbols D:\android-studio\Android studio Projects\AlertDialogPro\alertdialogpro-demo\build\intermediates\symbols\debug Error Code: -1073741819

EDIT: with Eclipse (which I prefer to use anyway), it worked fine.

fengdai commented 9 years ago

Did you install the latest SDK Build-tools v21?

AndroidDeveloperLB commented 9 years ago

@fengdai Yes. I always install the latest. Anyway, I've succeeded using Eclipse, so if you wish you can close this thread.

fengdai commented 9 years ago

OK. If any question, be free to ask me : )

AndroidDeveloperLB commented 9 years ago

Yes, I actually have a question. Since I am willing to use only the material design, is it possible to avoid using the rest of the files (of Holo) ? Is it possible for me to merge the 2 libraries, and use a single one? BTW, you should check the warnings of the projects.

fengdai commented 9 years ago

Yes. Just delete the Holo files. And change the defValues to Material:

In AlertController.java, the constructor method:

    mAlertDialogLayout = a.getResourceId(R.styleable.AlertDialogProStyle_adpLayout,
            R.layout.alert_dialog_material);
    mListLayout = a.getResourceId(
            R.styleable.AlertDialogProStyle_adpListLayout,
            R.layout.select_dialog_material);
    mMultiChoiceItemLayout = a.getResourceId(
            R.styleable.AlertDialogProStyle_adpMultiChoiceItemLayout,
            R.layout.select_dialog_multichoice_material);
    mSingleChoiceItemLayout = a.getResourceId(
            R.styleable.AlertDialogProStyle_adpSingleChoiceItemLayout,
            R.layout.select_dialog_singlechoice_material);
    mListItemLayout = a.getResourceId(R.styleable.AlertDialogProStyle_adpListItemLayout,
            R.layout.select_dialog_item_material);
fengdai commented 9 years ago

Would you please open another issue for this question?

AndroidDeveloperLB commented 9 years ago

Yes, here: https://github.com/fengdai/AlertDialogPro/issues/2