Project

General

Profile

Download (3.46 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / dialogs / RubikDialogMain.java @ b88be423

1 1cbcc6bf Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 Leszek Koltunski                                                               //
3
//                                                                                               //
4 fdec60a3 Leszek Koltunski
// This file is part of Magic Cube.                                                              //
5 1cbcc6bf Leszek Koltunski
//                                                                                               //
6 fdec60a3 Leszek Koltunski
// Magic Cube is free software: you can redistribute it and/or modify                            //
7 1cbcc6bf Leszek Koltunski
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11 fdec60a3 Leszek Koltunski
// Magic Cube is distributed in the hope that it will be useful,                                 //
12 1cbcc6bf Leszek Koltunski
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17 fdec60a3 Leszek Koltunski
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18 1cbcc6bf Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20 1f9772f3 Leszek Koltunski
package org.distorted.dialogs;
21 1cbcc6bf Leszek Koltunski
22
import android.app.Dialog;
23
import android.os.Bundle;
24 66e777b0 Leszek Koltunski
import androidx.annotation.NonNull;
25
import androidx.fragment.app.FragmentActivity;
26
import androidx.appcompat.app.AlertDialog;
27
import androidx.appcompat.app.AppCompatDialogFragment;
28 1cbcc6bf Leszek Koltunski
import android.view.LayoutInflater;
29
import android.view.View;
30 4235de9b Leszek Koltunski
import android.view.Window;
31
import android.view.WindowManager;
32 1cbcc6bf Leszek Koltunski
33 1f9772f3 Leszek Koltunski
import org.distorted.main.R;
34 211b48f2 Leszek Koltunski
35 1cbcc6bf Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
36
37 0fd3ac1f Leszek Koltunski
public class RubikDialogMain extends AppCompatDialogFragment
38 1cbcc6bf Leszek Koltunski
  {
39 4235de9b Leszek Koltunski
  @Override
40
  public void onStart()
41
    {
42
    super.onStart();
43
44 584585d0 Leszek Koltunski
    Dialog dialog = getDialog();
45
46 b88be423 Leszek Koltunski
    if( dialog!=null )
47 584585d0 Leszek Koltunski
      {
48 b88be423 Leszek Koltunski
      dialog.setCanceledOnTouchOutside(false);
49
50
      Window window = dialog.getWindow();
51
52
      if( window!=null )
53
        {
54
        window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
55
                        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
56
        window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
57
        }
58 584585d0 Leszek Koltunski
      }
59 4235de9b Leszek Koltunski
    }
60
61
///////////////////////////////////////////////////////////////////////////////////////////////////
62
63 1cbcc6bf Leszek Koltunski
  @NonNull
64
  @Override
65
  public Dialog onCreateDialog(Bundle savedInstanceState)
66
    {
67
    FragmentActivity act = getActivity();
68
    AlertDialog.Builder builder = new AlertDialog.Builder(act);
69
    LayoutInflater inflater = act.getLayoutInflater();
70 4235de9b Leszek Koltunski
    final View view = inflater.inflate(R.layout.dialog_main, null);
71 1cbcc6bf Leszek Koltunski
    builder.setView(view);
72
73
    return builder.create();
74
    }
75 33499c56 Leszek Koltunski
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77
78 211b48f2 Leszek Koltunski
  public static String getDialogTag()
79 33499c56 Leszek Koltunski
    {
80
    return "DialogMain";
81
    }
82 4235de9b Leszek Koltunski
  }