Git Product home page Git Product logo

alertdialogpro's Introduction

Build Status Android Arsenal

Deprecated

Please use android.support.v7.app.AlertDialog of support-v7.

AlertDialogPro

Why AlertDialogPro?

Theming Android's AlertDialog is not an easy thing. Because some of its attributes are not avaliable on old platform. Even on newer you still can't use android:layout to specify your own layout, since your views' ids should be consistant with Android's, some of which are not public... AlertDialogPro can make theming a lot easier.

holo-light mtrl-light flavored-mtrl-light mtrl-dark

Structure

alertdialogpro-core

Contains core codes for building an AlertDialogPro. Most of it's codes are ported from the latest Android Platform. It doesn't contain any resource file. If you want to implement a brand new theme, use this project directly. Otherwise, you should use alertdialogpro-theme-material or alertdialogpro-theme-holo.

alertdialogpro-theme-material

Based on alertdialogpro-core, gives AlertDialogPro a Material theme.

alertdialogpro-theme-holo (Obsolete)

Also based on alertdialogpro-core, gives AlertDialogPro a Holo theme.

Quick Start

Take alertdialogpro-theme-material for example.

Download

Grab latest version via Gradle:

dependencies {
  compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.6'
}

or Maven:

<dependency>
  <groupId>com.github.fengdai</groupId>
  <artifactId>alertdialogpro-theme-material</artifactId>
  <version>0.2.6</version>
</dependency>

Specify AlertDialogPro's theme

In your app's xml file, use attribute alertDialogProTheme to specify your AlertDialogPro's theme. alertdialogpro-theme-material contains two built-in theme: Theme.AlertDialogPro.Material and Theme.AlertDialogPro.Material.Light. Here, we use the light version:

<style name="YourAppTheme">
   ...
  <item name="alertDialogProTheme">@style/Theme.AlertDialogPro.Material.Light</item>
</style>

Build an AlertDialogPro

Use AlertDialogPro.Builder to build an AlertDialogPro:

AlertDialogPro.Builder builder = new AlertDialogPro.Builder(getContext());
builder.setIcon(R.drawable.icon).
        setTitle("Title").
        setMessage("Message Body").
        setNeutralButton("Neutral", null).
        setPositiveButton("Positive", null).
        setNegativeButton("Negative", null).
        show();

With the example codes above, you can create an AlertDialogPro which has an icon, a title, a message body and three option buttons. Look into the sample to see more usages.

Flavor built-in themes

Built-in themes can't meet your requirement? There are several attributes that you can use to make some slight changes. Here is an example to show how to change the positive button's color:

  1. Define your positive button's style:
<style name="YourButtonStyle" parent="Widget.AlertDialogPro.Material.Light.Button">
     <item name="android:textColor">@color/adp_positive_button_color</item>
</style>
  1. Specify button style to your AlertDialogPro's theme with attribute adpButtonBarPositiveButtonStyle:
<style name="FlavoredMaterialLight" parent="Theme.AlertDialogPro.Material.Light">
      ...
     <item name="adpButtonBarPositiveButtonStyle">@style/YourButtonStyle</item>
</style>
  1. Use it in your app's theme:
<item name="alertDialogProTheme">@style/FlavoredMaterialLight</item>

Look into here to see all attributes.

Advanced customization

You can specify your own layout to AlertDialogPro. This can be very useful when you want to use custom views or you want a special dialog layout. Remember to keep your views' ids consistant with AlertDialogPro's ids.

  1. Define your AlertDialogPro's style:
<style name="YourAlertDialogProStyle" parent="AlertDialogPro.Material.Light">
  <!-- Specify your AlertDialogPro's layout -->
  <item name="adpLayout">@layout/your_alert_dialog</item>
  <!-- Specify your AlertDialogPro's ListView layout. -->
  <item name="adpListLayout">@layout/your_list_layout</item>
  <!-- Specify your AlertDialogPro's list item layout. -->
  <item name="adpListItemLayout">@layout/your_dialog_item</item>
  <!-- Specify your AlertDialogPro's multi choice list item layout. -->
  <item name="adpMultiChoiceItemLayout">@layout/your_multichoice_dialog_item</item>
  <!-- Specify your AlertDialogPro's single choice list item layout. -->
  <item name="adpSingleChoiceItemLayout">@layout/your_singlechoice_dialog_item</item>
</style>
  1. And add it to your AlertDialogPro's theme:
<style name="YourAlertDialogProTheme" parent="Theme.AlertDialogPro.Material.Light">
  ...
  <item name="alertDialogProStyle">@style/YourAlertDialogProStyle</item>
</style>
  1. Use your AlertDialogPro theme in your app's theme:
<item name="alertDialogProTheme">@style/YourAlertDialogProTheme</item>

Migrate From AlertDialog

AlertDialogPro's Java API is exactly the same as AlertDialog's. In fact, most of AlertDialogPro's codes are ported from the latest AlertDialog. So the only thing you need to do in your Java codes is replacing AlertDialog.Builder with AlertDialogPro.Builder.

Requirements

AlertDialogPro requires at minimum Android 2.1 (API level 7).

Thanks

License

Copyright (C) 2014 Feng Dai
Copyright (C) 2007 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

alertdialogpro's People

Contributors

bryant1410 avatar fengdai 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alertdialogpro's Issues

Changing texts' typeface

I am wondering if there is a way to change the typefaces of all the texts that appear in the dialogs.
Thanks in advance.

full screen dialog

how can we open alert dialog in full screen.? i want to show it in custom view.

The library doesn't work

Hello! I have some problems with the library.
Firstly, I've used gradle for adding yours library to my project:

compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.0'
compile 'com.github.fengdai:alertdialogpro-core:0.2.0'

After that I've added into my style.xml:

<item name="alertDialogProTheme">@style/Theme.AlertDialogPro.Material</item>

Then I've used this example of code in my class:

AlertDialogPro.Builder builder = new AlertDialogPro.Builder(getContext());
builder.setIcon(R.drawable.icon).
setTitle("Title").
setMessage("Message Body").
setNeutralButton("Neutral", null).
setPositiveButton("Positive", null).
setNegativeButton("Negative", null).
show();

But I 'm getting an Exception when I'm trying to run the project:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Android\Releases\MealControl\app\build\intermediates\dex\debug --input-list=C:\Android\Releases\MealControl\app\build\intermediates\tmp\dex\debug\inputList.txt

Error Code: 2

Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)

When I'm trying to use version 0.1.0:

compile 'com.github.fengdai:alertdialogpro-theme-material:0.1.0'
compile 'com.github.fengdai:alertdialogpro-core:0.1.0'

I'm getting an Exception:

android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1131)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2327)
at android.content.res.Resources.getLayout(Resources.java:947)
at android.view.LayoutInflater.inflate(LayoutInflater.java:395)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
at com.alertdialogpro.internal.AlertController.installContent(AlertController.java:193)
at com.alertdialogpro.AlertDialogPro.onCreate(AlertDialogPro.java:166)
at android.app.Dialog.dispatchOnCreate(Dialog.java:369)
at android.app.Dialog.show(Dialog.java:270)
at com.alertdialogpro.AlertDialogPro$Builder.show(AlertDialogPro.java:774)
at bitfrom.me.mealcontrol.views.RationFragment$1.onClick(RationFragment.java:53)
at com.gc.materialdesign.views.Button.makeCircle(Button.java:123)
at com.gc.materialdesign.views.ButtonRectangle.onDraw(ButtonRectangle.java:128)

When I leave only core:

compile 'com.github.fengdai:alertdialogpro-core:0.2.0'

I'm getting the same android.content.res.Resources$NotFoundException: Resource ID #0x0 Exception.

Thank you for attention.

adpListItemBackground not implemented in any layout file?

Problem:
The adpListItemBackground attribute does not style the background of listitems.

Possible cause:
The adpListItemBackground attribute is not being used in the select_dialog_item_holo.xml file

https://github.com/fengdai/AlertDialogPro/blob/master/alertdialogpro/res/layout/select_dialog_item_holo.xml

Note: This could be expected behavior but it seems over kill to define your own list item layout when you just want to style the background.

Corrected code (this fixes my problem):

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:gravity="center_vertical"
    android:minHeight="?adpListItemHeight"
    android:paddingLeft="16dip"
    android:paddingRight="16dip"
    android:background="?adpListItemBackground"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="?adpListItemTextColor" />

Exception when using dialog without theme

If I not modify theme and not modify code, just replace AlertDialog to AlertDialogPro, my app crashes with this exception:
12-02 15:41:30.870 7189-7189/com.omihaz.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.omihaz.app, PID: 7189
android.content.res.Resources$NotFoundException: Resource ID #0x0

This occurs because by default @null
And
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at com.alertdialogpro.internal.AlertController.installContent(AlertController.java:193)

Cannot inflate null resource.
You need provide some base theme as default.

adpButtonBarPositiveButtonStyle with Holo theme

Hi,
I'm trying to change text color for positive button. It works well with Material theme but doesn't affect Holo theme.
My styles.xml:


    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        ...
        <item name="alertDialogProTheme">@style/CustomAlertDialog</item>
    </style>

    <style name="CustomAlertDialog" parent="Theme.AlertDialogPro.Material.Light">
        <item name="adpButtonBarPositiveButtonStyle">@style/CustomDialogPositiveButton</item>
    </style>

    <style name="CustomDialogPositiveButton" parent="Widget.AlertDialogPro.Material.Light.Button">
        <item name="android:textColor">@color/bittersweet</item>
    </style>

Failed to import&run sample inside Android-Studio

I just get this message:

"
Error:Execution failed for task ':alertdialogpro-core:processReleaseResources'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files (x86)\Android\android-sdk\build-tools\21.0.0\aapt.exe package -f --no-crunch -I C:\Program Files (x86)\Android\android-sdk\platforms\android-21\android.jar -M C:\Users\user\AndroidStudioProjects\AlertDialogPro\alertdialogpro-core\build\intermediates\bundles\release\AndroidManifest.xml -S C:\Users\user\AndroidStudioProjects\AlertDialogPro\alertdialogpro-core\build\intermediates\res\release -A C:\Users\user\AndroidStudioProjects\AlertDialogPro\alertdialogpro-core\build\intermediates\bundles\release\assets -m -J C:\Users\user\AndroidStudioProjects\AlertDialogPro\alertdialogpro-core\build\generated\source\r\release --custom-package com.alertdialogpro --non-constant-id -0 apk --output-text-symbols C:\Users\user\AndroidStudioProjects\AlertDialogPro\alertdialogpro-core\build\intermediates\bundles\release
Error Code:
-1073741819
"

How come? It worked fine in the past...

Compatibility with support v20

Hello and thanks for your great work.

I wanted to integrate your library for Holo styled dialogs in an existing project using AppCompat version 20 (pre-material). I don't want to migrate this project to AppCompat v21 because of the visual changes it implies: drawable tinting, new default colors, deprecated features in the ActionBar, ...

However I couldn't integrate AlertDialogPro-theme-holo at all because the core relies on Theme.AppCompat.Dialog. Could you adapt the library to make it inherit from the native themes directly and remove this dependency in order to make it compatible with v20 as well, or do you target v21 and Material Design only from now on?

Dialogs aren't exactly the same as on Android Lollipop...

Compare those:
Android Lollipop theme:
image

library theme:
image

The color of the text isn't the same, and there are dividers in the library itself, while on Lollipop there isn't .
Same happens when using a dark theme.
I also think the title is supposed to be a bit to the right.

Also, I think the layout file "alert_dialog_material.xml" (and others) can be a bit more optimized, as Lint suggests.
Some of its possible optimizations:

  1. merge "customPanel" and "custom" into a single layout.
  2. support RTL, by adding "...start" and "...end" attributes when needed.
  3. merge "buttonPanel" and its single child (which is also a layout).

Request: move "Holo" themes from the core to "Holo" library, and put the support library's into the core

I've just found this:
in core library, "values/themes.xml" has this :

<style name="AlertDialogProTheme" parent="android:Theme.Dialog"></style>
<style name="AlertDialogProTheme.Light" parent="android:Theme.Dialog"></style>

and "values-v11/themes.xml" has this:

<style name="AlertDialogProTheme" parent="android:Theme.Holo.Dialog">...
<style name="AlertDialogProTheme.Light" parent="android:Theme.Holo.Light.Dialog">...

in material library, "values/themes.xml" has this:

<style name="AlertDialogProTheme" parent="Theme.AppCompat.Dialog"></style>
<style name="AlertDialogProTheme.Light" parent="Theme.AppCompat.Light.Dialog"></style>

Is it in order to avoid making the dialog material by using the support library?
If so, since material is newer, shouldn't just the holo library change it to something else, instead of the material library?
I mean, you could have just the second declaration (in the material) and put it into the core library, and set a different declaration in the Holo library.

Is it because the core library doesn't really use the support library?
I'm not even sure if the Holo library is needed anymore, now that the support library goes more material...
What do you think?

Single choice needs double tapping instead of once (at least in the emulator)

The issue is that in the sample, when choosing "Show single-choice list" via the Android Lollipop emulator, it needs double tapping in order to choose an item, compared to once for the normal dialog.

I can't put videos and other files here, so here's a link to both the video and the sample project, after some changes had to be made to show the native dialog:
https://drive.google.com/file/d/0B-PZZGk2vPohZ1lsUWkwNjBuRDA

Do note that on Kitkat (and maybe older) version it works fine. Only on the emulator (with Lollipop) it has this issue. Since I don't have Lollipop on a real device, I have no idea if it works fine there or not.
Also ignore the blinking. It's emulator issues.

Dialog with custom view might not show its buttons when using custom view

I've tried setting a custom view as a listView, and filled it with items.
I've also added OK,CANCEL buttons.

On normal sized screens, it worked fine.
On a small screen (QVGA) with Android 2.3 , it didn't show the buttons, only the listView.

Here's a snippet code:
final AlertDialogPro.Builder builder=new AlertDialogPro.Builder(activity,...);
builder.setTitle(...);
builder.setNeutralButton(android.R.string.cancel,null);
final String[] itemsStr=new String[items.size()];
// <= fill the array with strings
final ArrayAdapter adapter=new ArrayAdapter(activity,android.R.layout.simple_list_item_multiple_choice,itemsStr);
final ListView listView=new ListView(activity);
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listView.setAdapter(adapter);
builder.setPositiveButton(android.R.string.ok,new OnClickListener() ...);
builder.setView(listView);
builder.show();

What should I do? There isn't such a thing as "setMaxHeight" ...

change color

how can we change color of text of positive and negative buttons.?

NoClassDefFoundError AllCapsTransformationMethod

Caused by: java.lang.NoClassDefFoundError: android.support.v7.internal.text.AllCapsTransformationMethod at com.alertdialogpro.material.ButtonCompat.(ButtonCompat.java:30)

When setting textAllCaps to false, the problems does not occur since the ButtonCompat does not apply the transformation.

Gradle version not updated

It seems that the latest version published on maven, is not updated:
Some classes, like ProgressBarCompat are missing.

Could you fix it please?

Thanks in advance.
Marcello

Remove minHeight from customPanel

I found this library just today and I really like it! I'm probably gonna use it in my next project ;) The code style is way beter than the library I was using before (android-styled-dialogs). Great work!

But I found a small issue when I tried to create a AlertDialog with just an EditText inside it. But the resulting dialog shows unwanted space underneath the EditText. After digging around in the code base I found that the FrameLayout hosting the custom view has a minHeight parameter.

Shouldn't this minHeight be removed? When I removed the parameter everything worked just fine.

This is the code I use:

<FrameLayout
    android:id="@+id/customPanel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1">

    <FrameLayout
        android:id="@+id/custom"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</FrameLayout>

Removed line:

 android:minHeight="64dp"

示例代码报错?

this is my code
`package com.roselism.listdialog_alpha;

import com.alertdialogpro.AlertDialogPro;

import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    AlertDialogPro.Builder builder = new AlertDialogPro.Builder(this);
    builder.setIcon(R.drawable.adp_item_background_material_dark).
            setTitle("Title").
            setMessage("Message Body").
            setNeutralButton("Neutral", null).
            setPositiveButton("Positive", null).
            setNegativeButton("Negative", null).
            show();
}

}
and this is what i get, What shoud i do ?
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
`

Support RTL.

support RTL, by adding "...start" and "...end" attributes when needed.

How to use a single library, just for "Material-Design" ?

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?
If so, please show all the steps I need to perform.

LoggedErrorException when migrating from Eclipse to Android-Studio, using the library

Sadly, Google is officially stopping Eclipse support, so I tried to migrate my app to Android-Studio.

Now I get this error, which I'm not sure if it's because of Gradle or the library, or maybe Android Studio :

Error:Execution failed for task ':appManager:dexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command:
D:\android\build-tools\21.1.1\dx.bat --dex --no-optimize --output D:\android\Android studio Projects\AppManager\appManager\build\intermediates\dex\debug --input-list=D:\android\Android studio Projects\AppManager\appManager\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/alertdialogpro/AlertDialogPro$Builder;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)

Can you please help on this?

After choosing to analyze the code, I see a weird error for the file "adp_select_dialog_material.xml", which is" Unknown attribute class" for class="com.alertdialogpro.internal.AlertController$RecycleListView" .
I don't get it...

Indeterminate progress color

Is it possible to change circular progress bar color with styles?

Tried to add this to my theme:

<item name="colorControlActivated">@color/black</item>

but this doesn't change the color (I got the hint by looking into ProgressBarCompat.java, line 25).

It works by programmatically setting indeterminate drawable like this:

progressDialog.setIndeterminateDrawable(new CircularAnimatedDrawable(activity.getResources().getColor(R.color.black), 4));

But it would be nicer if we had solution to do this with styles.

Error when tryin do compile 23 SDK version

@color/link_text_material_light

Error:(88, 45) No resource found that matches the given name (at 'android:textColorLink' with value '@color/link_text_material_light').

i have a error in alertdialogpro-theme-materia when compile using 23 SDK version

Caused by: java.lang.NoClassDefFoundError: android.support.v7.internal.widget.TintTypedArray

if i user compile 'com.android.support:appcompat-v7:23.1.1' with alertdialogpro like this :
compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.5'
compile 'com.android.support:appcompat-v7:23.1.1'

it raise Caused by: java.lang.NoClassDefFoundError: android.support.v7.internal.widget.TintTypedArray
when do android.view.InflateException: Binary XML file line #2: Error inflating class com.alertdialogpro.material.CheckedTextViewCompat

LoggedErrorException

Hello! When I'm trying to include the library into my project, I'm getting an error:

:alertdialogpro-core:processDebugResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':alertdialogpro-core:processDebugResources'.

    com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Android\sdk\build-tools\21.0.0\aapt.exe package -f --no-crunch -I C:\Android\sdk\platforms\android-21\android.jar -M C:\Android\Projects\MealControl\alertdialogpro-core\build\intermediates\bundles\debug\AndroidManifest.xml -S C:\Android\Projects\MealControl\alertdialogpro-core\build\intermediates\res\debug -A C:\Android\Projects\MealControl\alertdialogpro-core\build\intermediates\bundles\debug\assets -m -J C:\Android\Projects\MealControl\alertdialogpro-core\build\generated\source\r\debug --debug-mode --custom-package com.alertdialogpro --non-constant-id -0 apk --output-text-symbols C:\Android\Projects\MealControl\alertdialogpro-core\build\intermediates\bundles\debug
    Error Code:
    -1073741819

How to slove this problem?

Checkbox Buttons Offset on Xperia T

I use this library for MTG Familiar. A user using an Xperia T reported the following dialog with strangely offset checkboxes:
screenshot_2015-07-05-14-47-12
The dialog is built using this code:

mRarityDialog = new AlertDialogPro
    .Builder(this.getActivity())
    .setTitle(R.string.search_rarities)
    .setMultiChoiceItems(mRarityNames, mRarityChecked, multiChoiceClickListener)
    .setPositiveButton(R.string.dialog_ok, clickListener)
    .create();

Thank you for looking into this UI issue.

Resource not found Exception for Api > 21

Hi!
I am experiencing an exception that only occurs on api 21 or higher:

    06-04 10:22:07.076    3484-3484/test.testap E/AndroidRuntimeFATAL EXCEPTION: main
    Process: test.testapp, PID: 3484
    android.content.res.Resources$NotFoundException: Resource ID #0x0
            at android.content.res.Resources.getValue(Resources.java:1233)
            at android.content.res.Resources.loadXmlResourceParser(Resources.java:2598)
            at android.content.res.Resources.getLayout(Resources.java:1049)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:412)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
            at com.alertdialogpro.internal.AlertController.installContent(AlertController.java:193)
            at com.alertdialogpro.AlertDialogPro.onCreate(AlertDialogPro.java:166)
            at android.app.Dialog.dispatchOnCreate(Dialog.java:373)
            at android.app.Dialog.show(Dialog.java:274)
            at com.alertdialogpro.AlertDialogPro$Builder.show(AlertDialogPro.java:774)
            at test.testapp.MyResultsActivity.onOptionsItemSelected(MyResultsActivity.java:164)

This is how I use AlertdialogPro:

    AlertDialogPro.Builder builder = new AlertDialogPro.Builder(this);
                builder.setTitle("Choose race");
                builder.setCancelable(true);
                builder.setView(R.layout.choose_race_dialog);
                builder.show();

So to clarify on Api 19 this works wonderful, I get a clean Lollipop-style dialog. But it crashes on Lollipop.

I style it like:

  <style name="My.Theme" parent="Theme.AppCompat.Light">
      ....
        <item name="alertDialogProTheme">@style/MyAlertDialogProTheme</item>
      ....
  </style>

    <style name="MyAlertDialogProTheme" parent="Theme.AlertDialogPro.Material.Light">
        <item name="android:windowBackground">@drawable/dialog_background</item>
    </style>

I have also tried to not use any particular styling in my theme but that does not seem to make any difference.

I included the library in my project through Gradle like this:

    dependencies {
        compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.3'
    }

Any ideas to why I might get this exception?

ProgressDialogPro exception

Hi,

I'm using this great library in my application.
I'm getting the following crash report on a Lenovo A916 with Android 4.4, when showing a indeterminate ProgressDialogPro:

android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1133)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2381)
at android.content.res.Resources.getLayout(Resources.java:949)
at android.view.LayoutInflater.inflate(LayoutInflater.java:395)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:305)
at com.alertdialogpro.internal.AlertController.installContent(Unknown Source)
at com.alertdialogpro.AlertDialogPro.onCreate(Unknown Source)
at com.alertdialogpro.ProgressDialogPro.onCreate(Unknown Source)
at android.app.Dialog.dispatchOnCreate(Dialog.java:361)
at android.app.Dialog.show(Dialog.java:262)
at it.cammino.risuscito.PaginaRenderActivity.cmdPrepare(Unknown Source)
at it.cammino.risuscito.PaginaRenderActivity.access$900(Unknown Source)
at it.cammino.risuscito.PaginaRenderActivity$7.onClick(Unknown Source)
at android.view.View.performClick(View.java:4463)
at android.view.View$PerformClick.run(View.java:18772)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
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:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(Native Method)

My code is just:

mp3Dialog = new ProgressDialogPro(PaginaRenderActivity.this);
mp3Dialog.setMessage(getResources().getString(R.string.wait));
mp3Dialog.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface arg0) {
                setRequestedOrientation(prevOrientation);
            }
        });
mp3Dialog.show();

I set correctly the theme in my settings:

<style name="Theme.MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
     ..
        <item name="alertDialogProTheme">@style/AppTheme.FlavoredMaterialLight</item>
</style>

<style name="AppTheme.FlavoredMaterialLight" parent="Theme.AlertDialogPro.Material.Light">
        <item name="colorAccent">@color/theme_accent</item>
 </style>

It seems that the error occurs only on this particual device, as I tested my application on many Kitkat devices and this crash never occurred.

Any help?

Thanks in advance.
Marcello

Publish to Maven/jCenter

Would make using this much easier if I could just add it as a dependency in build.gradle and control which version I use.

How to show a dialog on an transparent activity?

I have a notification that I wish to open a transparent activity which will also show a dialog.
What should I change in the themes/code in order to support this?

In the past, I think this is what I've done (based on this link: http://stackoverflow.com/q/18337533 ) :

final Window window=dialog.getWindow();            
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT);
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

But it doesn't work anymore here.
Also, since the dialog doesn't have any border, it can blend with the activity behind it, so I think I should avoid having a totally transparent activity.

DatePickerDialog

Any plans to implement your version of DatePickerDialog (also extends AlertDialog)?

Nullpointerexception in customview

below is my code:

private void showCustomViewDialog() {

            createAlertDialogBuilder()
             .setTitle(getResources().getString(R.string.set_path))
             .setView(getLayoutInflater().inflate(R.layout.path_dialog, null))
             .setNegativeButton("Cancel", new PathClickedListener("Cancel"))
             .setPositiveButton("Save", null).show();

TextView tvPath = (TextView)findViewById(R.id.tvPDPath);
tvPath.setText("Test");

}

i am getting nullpointerexception at this line:

tvPath.setText("Test");

Sample app?

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?

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.