public static void addActionsButton(BaseButton baseButton) { Drawable iconImage = mShell.getResources().getDrawable(baseButton.getButtonIconId()); int ten_dip = (int) (10 * mShell.getResources().getDisplayMetrics().density); ImageView buttonIcon = new ImageView(mShell.getContext()); buttonIcon.setImageDrawable(iconImage); LayoutParams iconParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); iconParams.setMargins(ten_dip, 0, 0, 0); iconParams.gravity = Gravity.CENTER_VERTICAL; TextView buttonText = new TextView(mShell.getContext()); buttonText.setText(baseButton.getButtonText()); buttonText.setTextColor(Color.WHITE); buttonText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); LayoutParams textParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); buttonText.setPadding(ten_dip, ten_dip, ten_dip, ten_dip); LinearLayout button = new LinearLayout(mShell.getContext()); button.addView(buttonIcon, iconParams); button.addView(buttonText, textParams); baseButton.setActionImageView(buttonIcon); baseButton.setActionTextView(buttonText); button.setOnClickListener(baseButton.getOnClickListener()); ActionButtonRunnable addButtonRunnable = new ActionButtonRunnable(button); mCurrentActivity.runOnUiThread(addButtonRunnable); }
private static void setActivityContent(int layoutId) { LayoutInflater inflater = LayoutInflater.from(mShell.getContext()); View content = (View) inflater.inflate(layoutId, null); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); setContentContainerSize(); mContentContainer.addView(content, lp); }
public static void setSplashScreen() { LayoutInflater inflater = LayoutInflater.from(mShell.getContext()); View splashScreen = (View) inflater.inflate(R.layout.ui_splash_screen, null); TextView splashText = (TextView) splashScreen.findViewById(R.id.splash_text); splashText.setText("Downloading information..."); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mContentContainer.addView(splashScreen, 0, lp); mContentContainer.getChildAt(1).setVisibility(View.INVISIBLE); }
@Override public void run() { LinearLayout actionsButtons = (LinearLayout) mShell.findViewById(R.id.action_buttons_container); ImageView menuSeparator = new ImageView(mShell.getContext()); Drawable menuSeparatorImage = mShell.getResources().getDrawable(R.drawable.ui_menu_separator); menuSeparator.setImageDrawable(menuSeparatorImage); menuSeparator.setScaleType(ScaleType.FIT_XY); LayoutParams separatorParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); actionsButtons.addView(mButton, actionsButtons.getChildCount()); actionsButtons.addView(menuSeparator, separatorParams); }