Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / RubikDialogMain.java @ 85248b04

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// 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
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// 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
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.dialogs;
21

    
22
import android.app.Dialog;
23
import android.os.Bundle;
24
import androidx.annotation.NonNull;
25
import androidx.fragment.app.FragmentActivity;
26
import androidx.appcompat.app.AlertDialog;
27
import androidx.appcompat.app.AppCompatDialogFragment;
28
import android.view.LayoutInflater;
29
import android.view.View;
30
import android.view.Window;
31
import android.view.WindowManager;
32

    
33
import org.distorted.main.R;
34

    
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36

    
37
public class RubikDialogMain extends AppCompatDialogFragment
38
  {
39
  @NonNull
40
  @Override
41
  public Dialog onCreateDialog(Bundle savedInstanceState)
42
    {
43
    FragmentActivity act = getActivity();
44
    AlertDialog.Builder builder = new AlertDialog.Builder(act);
45
    LayoutInflater inflater = act.getLayoutInflater();
46
    final View view = inflater.inflate(R.layout.dialog_main, null);
47
    builder.setView(view);
48

    
49
    Dialog dialog = builder.create();
50

    
51
    dialog.setCanceledOnTouchOutside(false);
52

    
53
    Window window = dialog.getWindow();
54

    
55
    if( window!=null )
56
      {
57
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
58
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
59
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
60
      }
61

    
62
    return dialog;
63
    }
64

    
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66

    
67
  public static String getDialogTag()
68
    {
69
    return "DialogMain";
70
    }
71
  }
(3-3/13)