Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash dialog has swapped buttons. #37

Closed
mice777 opened this issue Dec 29, 2012 · 1 comment
Closed

Crash dialog has swapped buttons. #37

mice777 opened this issue Dec 29, 2012 · 1 comment
Assignees
Labels
Milestone

Comments

@mice777
Copy link

mice777 commented Dec 29, 2012

According to Android design guide: http://developer.android.com/design/building-blocks/dialogs.html

The dismissive action of a dialog is always on the left. Dismissive actions return to the user to the previous state.
The affirmative actions are on the right. Affirmative actions continue progress toward the user goal that triggered the dialog.

ACRA has it opposite way, hard-coded (no layout xml), and not configurable.

@ghost ghost assigned KevinGaudin Dec 29, 2012
@mice777
Copy link
Author

mice777 commented Dec 31, 2012

Proposal:
don't create buttons yourself
don't even let crash report activity to create view

Utilize AlertDialog, which has button order set correctly by platform version.
Working code for the activity:

  public class CrashShow extends Activity implements DialogInterface.OnClickListener{

     private static class AlertDialogBase extends AlertDialog{
        AlertDialogBase(Context c){
           super(c);
           setCanceledOnTouchOutside(false);
        }
     }

     @Override
     protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);

        AlertDialog dlg = new AlertDialogBase(this);
        dlg.setTitle("Crash");
        dlg.setMessage("Message");
        dlg.setButton(DialogInterface.BUTTON_POSITIVE, getText(android.R.string.ok), CrashShow.this);
        dlg.setButton(DialogInterface.BUTTON_NEGATIVE, getText(android.R.string.cancel), CrashShow.this);
        dlg.show();
     }

     @Override
     public void onClick(DialogInterface dialog, int which){
        if(which==DialogInterface.BUTTON_POSITIVE)
           sendCrash();
        finish();
     }

     private void sendCrash(){
     }
  }

in manifest:

  <activity
     android:name="org.acra.CrashReportDialog"
     android:theme="@android:style/Theme.Holo.Panel" >
  </activity>

for API<11, replace theme by this:
android:theme="@android:style/Theme.NoDisplay"

actually, automatic resource selection system should be used to pick correct theme, if app has to run on both API <11 and >=11

this gives nice dialog on all platforms, and the code is short
a
b

KevinGaudin added a commit that referenced this issue Apr 1, 2013
… ordered according to the platform UI guidelines. We can also remove the theme from the manifest for the CrashReportDialog activity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants