import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
-import android.app.DialogFragment;
-import android.content.DialogInterface;
+import androidx.fragment.app.DialogFragment;
+
+import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
Activity activity = getActivity();
// 確認ダイアログの生成
//final AlertDialog.Builder alertDialog = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.wear2_dialog_theme));
- final AlertDialog.Builder alertDialog = new AlertDialog.Builder(activity);
+ final AlertDialog.Builder alertDialog = new AlertDialog.Builder(activity, R.style.wear2_dialog_theme);
// Get the layout inflater
LayoutInflater inflater = activity.getLayoutInflater();
// ボタンを設定する(実行ボタン)
alertDialog.setPositiveButton(activity.getString(R.string.dialog_positive_execute),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which)
+ (dialog, which) -> {
+ try
+ {
+ Log.v(TAG, "ENTRY [" + lap.getValue() + "] " + hour.getValue() + ":" + minute.getValue() + ":" + second.getValue());
+ int lapC = (isLap) ? lap.getValue() : lapCount;
+ long newMillis = ((long) hour.getValue() * 60 * 60 * 1000) + ((long) minute.getValue() * 60 * 1000) + (second.getValue() * 1000L);
+ callback.dataCreated(isLap, lapC, defaultValue, newMillis);
+ }
+ catch (Exception e)
{
- try
- {
- Log.v(TAG, "ENTRY [" + lap.getValue() + "] " + hour.getValue() + ":" + minute.getValue() + ":" + second.getValue());
- int lapC = (isLap) ? lap.getValue() : lapCount;
- long newMillis = (hour.getValue() * 60 * 60 * 1000) + (minute.getValue() * 60 * 1000) + (second.getValue() * 1000);
- callback.dataCreated(isLap, lapC, defaultValue, newMillis);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- callback.dataCreateCancelled();
- }
- dialog.dismiss();
+ e.printStackTrace();
+ callback.dataCreateCancelled();
}
+ dialog.dismiss();
});
// ボタンを設定する (キャンセルボタン)
alertDialog.setNegativeButton(activity.getString(R.string.dialog_negative_cancel),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which)
+ (dialog, which) -> {
+ try
+ {
+ callback.dataCreateCancelled();
+ }
+ catch (Exception e)
{
- try
- {
- callback.dataCreateCancelled();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- dialog.cancel();
+ e.printStackTrace();
}
+ dialog.cancel();
});
+ alertView.setBackgroundColor(Color.BLACK);
myDialog = alertDialog.create();
return (myDialog);
}