Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / RubikDialogUpdateView.java @ 9c39179e

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2022 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.Activity;
23
import android.view.View;
24
import android.widget.Button;
25
import android.widget.TextView;
26

    
27
import org.distorted.main.R;
28
import org.distorted.network.RubikUpdates;
29
import org.distorted.objectlib.json.JsonWriter;
30

    
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

    
33
public class RubikDialogUpdateView
34
  {
35
  private View mView;
36

    
37
///////////////////////////////////////////////////////////////////////////////////////////////////
38

    
39
  public RubikDialogUpdateView()
40
    {
41

    
42
    }
43

    
44
///////////////////////////////////////////////////////////////////////////////////////////////////
45

    
46
  public View createView(Activity act, RubikUpdates.UpdateInfo info, boolean isNew)
47
    {
48
    int layoutID = R.layout.dialog_updates_pane;
49
    mView = act.getLayoutInflater().inflate(layoutID, null);
50
    Button install = mView.findViewById(R.id.updates_pane_button);
51

    
52
    install.setOnClickListener( new View.OnClickListener()
53
      {
54
      @Override
55
      public void onClick(View v)
56
        {
57
        android.util.Log.e("D", "INSTALL pressed");
58
        }
59
      });
60

    
61
    TextView title = mView.findViewById(R.id.updates_pane_title);
62
    title.setText(info.mObjectLongName);
63
    TextView version = mView.findViewById(R.id.updates_pane_version);
64
    String strVersion = info.mUpdateObject
65
                        ? JsonWriter.VERSION_OBJECT_MAJOR+"."+info.mObjectMinorVersion
66
                        : JsonWriter.VERSION_EXTRAS_MAJOR+"."+info.mExtrasMinorVersion;
67
    version.setText(strVersion);
68
    TextView description = mView.findViewById(R.id.updates_pane_description);
69
    description.setText(info.mDescription);
70

    
71
    return mView;
72
    }
73
  }
(20-20/21)