Skip to content

Commit

Permalink
Added confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Aug 22, 2016
1 parent 459974d commit c1cc30a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


dependencies {
compile 'com.github.neurospeech:android-hypercube:v1.38'
compile 'com.github.neurospeech:android-hypercube:v1.39'
}


Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/navigation_drawer.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/navigation_drawer"
Expand Down
4 changes: 2 additions & 2 deletions hypercube/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 38
versionName "1.38"
versionCode 39
versionName "1.39"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;

import java.io.PrintWriter;
import java.io.StringWriter;
Expand Down Expand Up @@ -116,6 +119,45 @@ public void run() {
}, milliSecondsDelay);
}

public static void confirm(
Context context,
String title,
String message,
final DialogInterface.OnClickListener clickListener){
confirm(context,title,message,clickListener,null);
}


public static void confirm(
Context context,
String title,
String message,
final DialogInterface.OnClickListener clickListener,
final DialogInterface.OnCancelListener cancelListener){
AlertDialog.Builder builder
= new AlertDialog.Builder(context);
builder.setTitle(title)
.setMessage(message)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
clickListener.onClick(dialog,which);
dialog.dismiss();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(cancelListener!=null){
cancelListener.onCancel(dialog);
}
dialog.dismiss();
}
});

builder.create().show();
}

public static String toString(Throwable ex){
String msg = ex.toString();
StringWriter sw = null;
Expand Down

0 comments on commit c1cc30a

Please sign in to comment.