Project

General

Profile

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

magiccube / src / main / java / org / distorted / bandaged / BandagedCreatorObjectView.java @ c41c5ae3

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

    
22
import android.view.LayoutInflater;
23
import android.widget.LinearLayout;
24

    
25
import org.distorted.helpers.TransparentButton;
26
import org.distorted.helpers.TransparentImageButton;
27
import org.distorted.main.R;
28
import org.distorted.main.RubikActivity;
29

    
30
///////////////////////////////////////////////////////////////////////////////////////////////////
31

    
32
public class BandagedCreatorObjectView
33
{
34
  private final LinearLayout mPane;
35
  private final String mName;
36

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

    
39
  public BandagedCreatorObjectView(BandagedCreatorActivity act, String name, boolean leftmost)
40
    {
41
    mName = name;
42
    LayoutInflater inflater = act.getLayoutInflater();
43
    mPane = (LinearLayout) inflater.inflate(R.layout.bandaged_pane, null);
44

    
45
    int width    = act.getScreenWidthInPixels();
46
    int lMargin  = (int)(width*RubikActivity.LARGE_MARGIN);
47
    int textSize = (int)(width*RubikActivity.BUTTON_TEXT_SIZE);
48

    
49
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( (int)(width*0.35f), LinearLayout.LayoutParams.MATCH_PARENT);
50
    params.bottomMargin = lMargin;
51
    params.topMargin    = lMargin;
52
    params.leftMargin   = leftmost ? lMargin : 0;
53
    params.rightMargin  = lMargin;
54

    
55
    mPane.setLayoutParams(params);
56

    
57
    LinearLayout bottom = mPane.findViewById(R.id.bandagedCreatorObjectLayout);
58

    
59
    TransparentButton plaButton = new TransparentButton(act, R.string.play, textSize);
60

    
61
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_trash,R.drawable.ui_medium_trash, R.drawable.ui_big_trash, R.drawable.ui_huge_trash);
62
    LinearLayout.LayoutParams paramsB = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,3.0f);
63
    TransparentImageButton delButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, paramsB);
64

    
65
    bottom.addView(plaButton);
66
    bottom.addView(delButton);
67
    }
68

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

    
71
  public LinearLayout getPane()
72
    {
73
    return mPane;
74
    }
75
}
(2-2/12)