Project

General

Profile

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

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

1 1237d25d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6 9d51b9d6 Leszek Koltunski
// 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 1237d25d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
9
10 5b22f901 leszek
package org.distorted.info;
11 1237d25d Leszek Koltunski
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 5b22f901 leszek
public class InfoScreen
21 1237d25d Leszek Koltunski
{
22 58fd2ec0 leszek
  private TransparentImageButton mBackButton;
23 5b22f901 leszek
  private InfoScreenPane mPane;
24 1237d25d Leszek Koltunski
25
///////////////////////////////////////////////////////////////////////////////////////////////////
26
27 5b22f901 leszek
  private void setupBackButton(final InfoActivity act)
28 1237d25d Leszek Koltunski
    {
29 97a4ae23 Leszek Koltunski
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
30 70688a23 leszek
    mBackButton = new TransparentImageButton(act,R.drawable.ui_smallback,params);
31 1237d25d Leszek Koltunski
32
    mBackButton.setOnClickListener( new View.OnClickListener()
33
      {
34
      @Override
35
      public void onClick(View v)
36
        {
37
        act.finish();
38
        }
39
      });
40
    }
41
42 8bf8fe70 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
43
44 5b22f901 leszek
  void onAttachedToWindow(final InfoActivity act, final int objectOrdinal)
45 97a4ae23 Leszek Koltunski
    {
46
    int width = act.getScreenWidthInPixels();
47
48 74d088c3 Leszek Koltunski
    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 97a4ae23 Leszek Koltunski
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 1237d25d Leszek Koltunski
68 58fd2ec0 leszek
    mPane = new InfoScreenPane(act,objectOrdinal);
69 1237d25d Leszek Koltunski
    }
70
}