Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / RubikDialogAbout.java @ 1f9772f3

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.content.DialogInterface;
24
import android.os.Bundle;
25
import android.support.annotation.NonNull;
26
import android.support.v4.app.FragmentActivity;
27
import android.support.v7.app.AlertDialog;
28
import android.support.v7.app.AppCompatDialogFragment;
29
import android.view.LayoutInflater;
30
import android.view.View;
31 4235de9b Leszek Koltunski
import android.view.Window;
32
import android.view.WindowManager;
33 0fd3ac1f Leszek Koltunski
import android.widget.TextView;
34 1cbcc6bf Leszek Koltunski
35 1f9772f3 Leszek Koltunski
import org.distorted.main.R;
36 211b48f2 Leszek Koltunski
37 1cbcc6bf Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
38
39 0fd3ac1f Leszek Koltunski
public class RubikDialogAbout extends AppCompatDialogFragment
40 1cbcc6bf Leszek Koltunski
  {
41 4235de9b Leszek Koltunski
  @Override
42
  public void onStart()
43
    {
44
    super.onStart();
45
46
    Window window = getDialog().getWindow();
47
    window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
48
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
49
    window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
50
    }
51
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53
54 1cbcc6bf Leszek Koltunski
  @NonNull
55
  @Override
56
  public Dialog onCreateDialog(Bundle savedInstanceState)
57
    {
58
    FragmentActivity act = getActivity();
59 0fd3ac1f Leszek Koltunski
    LayoutInflater inflater = act.getLayoutInflater();
60 1cbcc6bf Leszek Koltunski
    AlertDialog.Builder builder = new AlertDialog.Builder(act);
61
62 0fd3ac1f Leszek Koltunski
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
63 4235de9b Leszek Koltunski
    tv.setText(R.string.about);
64 0fd3ac1f Leszek Koltunski
    builder.setCustomTitle(tv);
65
66
    builder.setCancelable(true);
67 1cbcc6bf Leszek Koltunski
    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
68
      {
69
      @Override
70
      public void onClick(DialogInterface dialog, int which)
71
        {
72
73
        }
74
      });
75
76 0fd3ac1f Leszek Koltunski
    final View view = inflater.inflate(R.layout.dialog_about, null);
77
    TextView text = view.findViewById(R.id.about_version);
78 329c0aeb Leszek Koltunski
    String appName = getString(R.string.app_name);
79
    String appVers = getString(R.string.app_version);
80
    text.setText(getString(R.string.ap_placeholder,appName, appVers));
81 1cbcc6bf Leszek Koltunski
    builder.setView(view);
82
83
    return builder.create();
84
    }
85
  }