OSDN Git Service

レイアウトの見直し。(その2)
[gokigen/JoggingTimer.git] / wear / src / main / java / net / osdn / gokigen / joggingtimer / utilities / CreateModelDataDialog.java
index 1698e75..4c3fb38 100644 (file)
@@ -3,8 +3,9 @@ package net.osdn.gokigen.joggingtimer.utilities;
 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;
@@ -76,7 +77,7 @@ public class CreateModelDataDialog  extends DialogFragment
         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();
@@ -132,42 +133,37 @@ public class CreateModelDataDialog  extends DialogFragment
 
         // ボタンを設定する(実行ボタン)
         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);
     }