Project

General

Profile

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

magiccube / src / main / java / org / distorted / magic / RubikDialogAbout.java @ 0fd3ac1f

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.magic;
21

    
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
import android.widget.TextView;
32

    
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

    
35
public class RubikDialogAbout extends AppCompatDialogFragment
36
  {
37
  @NonNull
38
  @Override
39
  public Dialog onCreateDialog(Bundle savedInstanceState)
40
    {
41
    FragmentActivity act = getActivity();
42
    LayoutInflater inflater = act.getLayoutInflater();
43
    AlertDialog.Builder builder = new AlertDialog.Builder(act);
44

    
45
    TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null);
46
    tv.setText(R.string.about_title);
47
    builder.setCustomTitle(tv);
48

    
49
    builder.setCancelable(true);
50
    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
51
      {
52
      @Override
53
      public void onClick(DialogInterface dialog, int which)
54
        {
55

    
56
        }
57
      });
58

    
59
    final View view = inflater.inflate(R.layout.dialog_about, null);
60
    TextView text = view.findViewById(R.id.about_version);
61
    text.setText(R.string.app_version);
62
    builder.setView(view);
63

    
64
    return builder.create();
65
    }
66
  }
(2-2/11)