Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / RubikDialogUpdateView.java @ 99b8a069

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.util.TypedValue;
24
import android.view.View;
25
import android.widget.Button;
26
import android.widget.ImageView;
27
import android.widget.LinearLayout;
28
import android.widget.TextView;
29

    
30
import org.distorted.main.R;
31
import org.distorted.network.RubikUpdates;
32
import org.distorted.objectlib.json.JsonWriter;
33

    
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

    
36
public class RubikDialogUpdateView
37
  {
38
  private View mView;
39

    
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

    
42
  public RubikDialogUpdateView()
43
    {
44

    
45
    }
46

    
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48

    
49
  public View createView(Activity act, RubikUpdates.UpdateInfo info, int fontSize, int padding, boolean isNew,
50
                         LinearLayout.LayoutParams pImage, LinearLayout.LayoutParams pView,
51
                         LinearLayout.LayoutParams pText, LinearLayout.LayoutParams pButt )
52
    {
53
    int layoutID = R.layout.dialog_updates_pane;
54
    mView = act.getLayoutInflater().inflate(layoutID, null);
55

    
56
    Button button = mView.findViewById(R.id.updates_pane_button);
57

    
58
    button.setOnClickListener( new View.OnClickListener()
59
      {
60
      @Override
61
      public void onClick(View v)
62
        {
63
        android.util.Log.e("D", "INSTALL pressed");
64
        }
65
      });
66

    
67
    TextView title = mView.findViewById(R.id.updates_pane_title);
68
    title.setText(info.mObjectLongName);
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
    image.setLayoutParams(pImage);
76
    mView.setLayoutParams(pView);
77

    
78
    title.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
79
    description.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
80
    button.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
81

    
82
    title.setLayoutParams(pText);
83
    description.setLayoutParams(pText);
84
    button.setLayoutParams(pButt);
85

    
86
    mView.setPadding(padding,padding,padding,padding);
87

    
88
    return mView;
89
    }
90
  }
(20-20/21)