Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / DialogCreatorView.java @ 0c7a8a11

1 5a4ee169 leszek
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2023 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8
///////////////////////////////////////////////////////////////////////////////////////////////////
9
10
package org.distorted.dialogs;
11
12
import android.util.TypedValue;
13
import android.view.View;
14
import android.widget.Button;
15
import android.widget.ImageView;
16
import android.widget.LinearLayout;
17
import android.widget.TextView;
18
19 1c04d054 leszek
import org.distorted.main.MainActivity;
20 5a4ee169 leszek
import org.distorted.main.R;
21
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23
24 8477cf44 leszek
public class DialogCreatorView
25 5a4ee169 leszek
  {
26
  private final View mView;
27
28
///////////////////////////////////////////////////////////////////////////////////////////////////
29
30 8477cf44 leszek
  public DialogCreatorView(final MainActivity act, final DialogCreators dialog,
31
                           final int index, int icon, int title, int desc, int padding, int fontSize,
32
                           LinearLayout.LayoutParams pView, LinearLayout.LayoutParams pText, LinearLayout.LayoutParams pButt)
33 5a4ee169 leszek
    {
34
    mView = act.getLayoutInflater().inflate(R.layout.dialog_creators_pane, null);
35
    mView.setLayoutParams(pView);
36
    mView.setPadding(padding,padding,padding,padding);
37
38
    TextView titleView = mView.findViewById(R.id.creators_pane_title);
39
    titleView.setText(title);
40
    TextView descView = mView.findViewById(R.id.creators_pane_description);
41
    descView.setText(desc);
42
43
    titleView.setLayoutParams(pText);
44
45
    ImageView iconView = mView.findViewById(R.id.creators_pane_image);
46
    iconView.setImageResource(icon);
47
48
    Button button = mView.findViewById(R.id.creators_pane_button);
49
50
    button.setOnClickListener( new View.OnClickListener()
51
      {
52
      @Override
53
      public void onClick(View v)
54
        {
55
        dialog.dismiss();
56
        act.switchToBandagedCreator(index);
57
        }
58
      });
59
60
    button.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
61
    button.setLayoutParams(pButt);
62
    }
63
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65
66
  public View getView()
67
    {
68
    return mView;
69
    }
70
  }