public TopButtonController(RelativeLayout rootLayour, GameActivity activity) { this.activity = activity; prefs = UserPreferences.getInstance(activity); layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.partial_topbuttons, null); pauseBtn = (ImageView) layout.findViewById(R.id.pauseBtn); hintBtn = (OutlinedTextView) layout.findViewById(R.id.hintBtn); nextBtn = (ImageView) layout.findViewById(R.id.nextBtn); restartBtn = (ImageView) layout.findViewById(R.id.restartBtn); menuBtn = (ImageView) layout.findViewById(R.id.menuBtn); helpBtn = (ImageView) layout.findViewById(R.id.helpBtn); pauseBtn.setOnClickListener(mainListener); hintBtn.setOnClickListener(mainListener); nextBtn.setOnClickListener(mainListener); restartBtn.setOnClickListener(mainListener); menuBtn.setOnClickListener(mainListener); helpBtn.setOnClickListener(mainListener); rlpTop = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, Math.round(Metrics.squareButtonSize * Metrics.squareButtonScale)); rlpTop.addRule(RelativeLayout.ALIGN_PARENT_TOP); rlpTop.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlpTop.setMargins(Metrics.screenMargin, Metrics.screenMargin, Metrics.screenMargin, 0); RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) hintBtn.getLayoutParams(); int bgWidth = hintBtn.getBackground().getIntrinsicWidth(); int bgHeight = hintBtn.getBackground().getIntrinsicHeight(); float scale = ((float) rlpTop.height / bgHeight); lp.width = Math.round(bgWidth * scale); lp.height = rlpTop.height; int[] iPaddings = {27, 23, 94, 23}; hintBtn.setPadding( (int) (iPaddings[0] * scale), (int) (iPaddings[1] * scale), (int) (iPaddings[2] * scale), (int) (iPaddings[3] * scale)); hintBtn.setLayoutParams(lp); hintBtn.setTypeface(Resources.getFont(activity.getApplicationContext())); hintBtn.setMaxLines2(1); updateHints(); addScoreCounter(); rootLayour.addView(layout, rlpTop); lp = (RelativeLayout.LayoutParams) pauseBtn.getLayoutParams(); lp.width = lp.height = rlpTop.height; }