Project

General

Profile

« Previous | Next » 

Revision cc48b275

Added by Leszek Koltunski about 3 years ago

Progress with ConfigPane.

View differences:

src/main/java/org/distorted/config/ConfigScreenPane.java
36 36
public class ConfigScreenPane
37 37
{
38 38
  private static final float TEXT_RATIO = 0.015f;
39

  
40
  private LinearLayout mDetailsLayout, mDifficultyLayout, mMeshLayout;
41 39
  private JsonReader mReader;
42 40

  
43 41
///////////////////////////////////////////////////////////////////////////////////////////////////
......
53 51
    String name = mReader.getObjectName();
54 52
    String author = mReader.getInventor();
55 53
    int year = mReader.getYearOfInvention();
54
    String both = year>0 ? author+" "+year : author;
56 55

  
57 56
    LinearLayout layout = act.findViewById(R.id.configLayout);
58 57
    TextView view = layout.findViewById(R.id.configDetailsName2);
59 58
    view.setText(name);
60 59
    view = layout.findViewById(R.id.configDetailsAuthor2);
61
    view.setText(author+" "+year);
60
    view.setText(both);
62 61
    }
63 62

  
64 63
///////////////////////////////////////////////////////////////////////////////////////////////////
65 64

  
66 65
  ConfigScreenPane(final ConfigActivity act, int objectOrdinal)
67 66
    {
68
    mDetailsLayout    = (LinearLayout)inflate( act, R.layout.config_details   , null);
69
    mDifficultyLayout = (LinearLayout)inflate( act, R.layout.config_difficulty, null);
70
    mMeshLayout       = (LinearLayout)inflate( act, R.layout.config_mesh      , null);
67
    LinearLayout detailsLayout    = (LinearLayout)inflate( act, R.layout.config_details   , null);
68
    LinearLayout difficultyLayout = (LinearLayout)inflate( act, R.layout.config_difficulty, null);
69
    LinearLayout meshLayout       = (LinearLayout)inflate( act, R.layout.config_mesh      , null);
71 70

  
72 71
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.0f);
73
    mDetailsLayout.setLayoutParams(params);
74
    mDifficultyLayout.setLayoutParams(params);
75
    mMeshLayout.setLayoutParams(params);
72
    detailsLayout.setLayoutParams(params);
73
    difficultyLayout.setLayoutParams(params);
74
    meshLayout.setLayoutParams(params);
76 75

  
77 76
    int height = act.getScreenHeightInPixels();
78 77
    float textSize = height*TEXT_RATIO;
79 78
    TextView text;
80
    text = mDetailsLayout.findViewById(R.id.configDetailsTitle);
79
    text = detailsLayout.findViewById(R.id.configDetailsTitle);
81 80
    text.setTextSize(textSize);
82
    text = mDetailsLayout.findViewById(R.id.configDetailsName1);
81
    text = detailsLayout.findViewById(R.id.configDetailsName1);
83 82
    text.setTextSize(textSize);
84
    text = mDetailsLayout.findViewById(R.id.configDetailsName2);
83
    text = detailsLayout.findViewById(R.id.configDetailsName2);
85 84
    text.setTextSize(textSize);
86
    text = mDetailsLayout.findViewById(R.id.configDetailsAuthor1);
85
    text = detailsLayout.findViewById(R.id.configDetailsAuthor1);
87 86
    text.setTextSize(textSize);
88
    text = mDetailsLayout.findViewById(R.id.configDetailsAuthor2);
87
    text = detailsLayout.findViewById(R.id.configDetailsAuthor2);
89 88
    text.setTextSize(textSize);
90 89

  
91
    text = mDifficultyLayout.findViewById(R.id.configDifficultyTitle);
90
    text = difficultyLayout.findViewById(R.id.configDifficultyTitle);
92 91
    text.setTextSize(textSize);
93
    text = mMeshLayout.findViewById(R.id.configMeshTitle);
92
    text = meshLayout.findViewById(R.id.configMeshTitle);
94 93
    text.setTextSize(textSize);
95 94

  
96 95
    LinearLayout layout = act.findViewById(R.id.configLayout);
97 96
    layout.removeAllViews();
98
    layout.addView(mDetailsLayout);
99
    layout.addView(mDifficultyLayout);
100
    layout.addView(mMeshLayout);
97
    layout.addView(detailsLayout);
98
    layout.addView(difficultyLayout);
99
    layout.addView(meshLayout);
101 100

  
102 101
    updatePane(act,objectOrdinal);
103 102
    }

Also available in: Unified diff