Project

General

Profile

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

magiccube / src / main / java / org / distorted / info / InfoScreen.java @ 58fd2ec0

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 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.info;
11

    
12
import android.view.View;
13
import android.widget.LinearLayout;
14

    
15
import org.distorted.helpers.TransparentImageButton;
16
import org.distorted.main.R;
17

    
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
public class InfoScreen
21
{
22
  private TransparentImageButton mBackButton;
23
  private InfoScreenPane mPane;
24

    
25
///////////////////////////////////////////////////////////////////////////////////////////////////
26

    
27
  private void setupBackButton(final InfoActivity act)
28
    {
29
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
30
    mBackButton = new TransparentImageButton(act,R.drawable.ui_smallback,params);
31

    
32
    mBackButton.setOnClickListener( new View.OnClickListener()
33
      {
34
      @Override
35
      public void onClick(View v)
36
        {
37
        act.finish();
38
        }
39
      });
40
    }
41

    
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43

    
44
  void onAttachedToWindow(final InfoActivity act, final int objectOrdinal)
45
    {
46
    int width = act.getScreenWidthInPixels();
47

    
48
    LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
49
    LinearLayout.LayoutParams paramsM = new LinearLayout.LayoutParams(width/2, LinearLayout.LayoutParams.MATCH_PARENT);
50
    LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
51

    
52
    LinearLayout layoutLeft = new LinearLayout(act);
53
    layoutLeft.setLayoutParams(paramsL);
54
    LinearLayout layoutMid  = new LinearLayout(act);
55
    layoutMid.setLayoutParams(paramsM);
56
    LinearLayout layoutRight= new LinearLayout(act);
57
    layoutRight.setLayoutParams(paramsR);
58

    
59
    setupBackButton(act);
60
    layoutRight.addView(mBackButton);
61

    
62
    LinearLayout layout = act.findViewById(R.id.lowerBar);
63
    layout.removeAllViews();
64
    layout.addView(layoutLeft);
65
    layout.addView(layoutMid);
66
    layout.addView(layoutRight);
67

    
68
    mPane = new InfoScreenPane(act,objectOrdinal);
69
    }
70
}
(4-4/6)