Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / RubikDialogUpdateView.java @ 7bee6064

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.ImageView;
26
import android.widget.TextView;
27

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

    
32
///////////////////////////////////////////////////////////////////////////////////////////////////
33

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

    
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39

    
40
  public RubikDialogUpdateView()
41
    {
42

    
43
    }
44

    
45
///////////////////////////////////////////////////////////////////////////////////////////////////
46

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

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

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

    
72
    ImageView image = mView.findViewById(R.id.updates_pane_image);
73
    image.setBackgroundResource(R.drawable.unknown_icon);
74

    
75
    return mView;
76
    }
77
  }
(20-20/21)