List of usage examples for android.widget LinearLayout getMeasuredHeight
public final int getMeasuredHeight()
From source file:com.sociablue.nanodegree_p1.MovieDetailPagerFragment.java
private void setupEnterAnimations() { int id = mMovieList.get(mCurrentPosition).getId(); View currentPage = mPager.findViewWithTag(id); FrameLayout imgContainer = (FrameLayout) currentPage.findViewById(R.id.details_img_container); imgContainer.setTranslationY(-imgContainer.getMeasuredHeight()); LinearLayout contentContainer = (LinearLayout) currentPage.findViewById(R.id.details_copy_container); contentContainer.setTranslationY(contentContainer.getMeasuredHeight()); }
From source file:rosmi.acagild.alarmclock.ringing.ShareFragment.java
private static void drawStamp(Context context, Bitmap bitmap, String question) { Canvas canvas = new Canvas(bitmap); canvas.drawBitmap(bitmap, 0, 0, null); float opacity = 0.7f; int horizontalPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, context.getResources().getDisplayMetrics()); int verticalPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, context.getResources().getDisplayMetrics()); int textSize = 16; // defined in SP int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16, context.getResources().getDisplayMetrics()); LinearLayout layout = new LinearLayout(context); layout.setOrientation(LinearLayout.HORIZONTAL); layout.setBackgroundResource(R.drawable.rounded_corners); layout.getBackground().setAlpha((int) (opacity * 255)); layout.setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding); ImageView logo = new ImageView(context); logo.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.ic_launcher)); layout.addView(logo);//from ww w .java 2 s .c o m TextView textView = new TextView(context); textView.setVisibility(View.VISIBLE); if (question != null) { textView.setText(question); } else { textView.setText("Mimicker"); } textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); textView.setPadding(horizontalPadding, 0, 0, 0); LinearLayout.LayoutParams centerInParent = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); centerInParent.gravity = Gravity.CENTER_VERTICAL; layout.addView(textView, centerInParent); layout.measure(canvas.getWidth(), height); layout.layout(0, 0, layout.getMeasuredWidth(), layout.getMeasuredHeight()); canvas.translate(horizontalPadding, (float) (canvas.getHeight() * 0.8 - height)); float scale = Math.min(1.0f, canvas.getWidth() / 1080f); canvas.scale(scale, scale); layout.draw(canvas); }
From source file:com.microsoft.mimickeralarm.ringing.ShareFragment.java
private static void drawStamp(Context context, Bitmap bitmap, String question) { Canvas canvas = new Canvas(bitmap); canvas.drawBitmap(bitmap, 0, 0, null); float opacity = 0.7f; int horizontalPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, context.getResources().getDisplayMetrics()); int verticalPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, context.getResources().getDisplayMetrics()); int textSize = 16; // defined in SP int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16, context.getResources().getDisplayMetrics()); LinearLayout layout = new LinearLayout(context); layout.setOrientation(LinearLayout.HORIZONTAL); layout.setBackgroundResource(R.drawable.rounded_corners); layout.getBackground().setAlpha((int) (opacity * 255)); layout.setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding); ImageView logo = new ImageView(context); logo.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.ic_launcher_no_bg)); layout.addView(logo);/*from www . j a va 2 s . co m*/ TextView textView = new TextView(context); textView.setVisibility(View.VISIBLE); if (question != null) { textView.setText(question); } else { textView.setText("Mimicker"); } textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); textView.setPadding(horizontalPadding, 0, 0, 0); LinearLayout.LayoutParams centerInParent = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); centerInParent.gravity = Gravity.CENTER_VERTICAL; layout.addView(textView, centerInParent); layout.measure(canvas.getWidth(), height); layout.layout(0, 0, layout.getMeasuredWidth(), layout.getMeasuredHeight()); canvas.translate(horizontalPadding, (float) (canvas.getHeight() * 0.8 - height)); float scale = Math.min(1.0f, canvas.getWidth() / 1080f); canvas.scale(scale, scale); layout.draw(canvas); }
From source file:com.layer.atlas.AtlasMessageComposer.java
/** * Prepares this AtlasMessageComposer for use. * * @return this AtlasMessageComposer.//from ww w . j a v a2 s .co m */ public AtlasMessageComposer init(LayerClient layerClient, ParticipantProvider participantProvider) { LayoutInflater.from(getContext()).inflate(R.layout.atlas_message_composer, this); mLayerClient = layerClient; mParticipantProvider = participantProvider; mAttachButton = (ImageView) findViewById(R.id.attachment); mAttachButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (mAttachmentMenu.isShowing()) { mAttachmentMenu.dismiss(); } else { LinearLayout menu = (LinearLayout) mAttachmentMenu.getContentView(); menu.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); mAttachmentMenu.showAsDropDown(v, 0, -menu.getMeasuredHeight() - v.getHeight()); } } }); mMessageEditText = (EditText) findViewById(R.id.message_edit_text); mMessageEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (mConversation == null || mConversation.isDeleted()) return; if (s.length() > 0) { mSendButton.setEnabled(isEnabled()); mConversation.send(LayerTypingIndicatorListener.TypingIndicator.STARTED); } else { mSendButton.setEnabled(false); mConversation.send(LayerTypingIndicatorListener.TypingIndicator.FINISHED); } } }); mSendButton = (Button) findViewById(R.id.send_button); mSendButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (!mTextSender.requestSend(mMessageEditText.getText().toString())) return; mMessageEditText.setText(""); mSendButton.setEnabled(false); } }); applyStyle(); return this; }
From source file:com.layer.messenger.makemoji.MakeMojiAtlasComposer.java
/** * Prepares this AtlasMessageComposer for use. * * @return this AtlasMessageComposer./*from w w w .j av a 2 s. c o m*/ */ public MakeMojiAtlasComposer init(LayerClient layerClient, ParticipantProvider participantProvider) { LayoutInflater.from(getContext()).inflate(com.layer.atlas.R.layout.atlas_message_composer, this); mLayerClient = layerClient; mParticipantProvider = participantProvider; mAttachButton = (ImageView) findViewById(com.layer.atlas.R.id.attachment); mAttachButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { LinearLayout menu = (LinearLayout) mAttachmentMenu.getContentView(); menu.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); mAttachmentMenu.showAsDropDown(v, 0, -menu.getMeasuredHeight() - v.getHeight()); } }); mMessageEditText = (EditText) findViewById(com.layer.atlas.R.id.message_edit_text); mMessageEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (mConversation == null || mConversation.isDeleted()) return; if (s.length() > 0) { mSendButton.setEnabled(isEnabled()); mConversation.send(LayerTypingIndicatorListener.TypingIndicator.STARTED); } else { mSendButton.setEnabled(false); mConversation.send(LayerTypingIndicatorListener.TypingIndicator.FINISHED); } } }); mSendButton = (Button) findViewById(com.layer.atlas.R.id.send_button); final MojiInputLayout analytics = new MojiInputLayout(getContext()); mSendButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (!mTextSender.requestSend(Moji.toHtml(mMessageEditText.getText()))) return; analytics.setInputText(mMessageEditText.getText()); analytics.manualSaveInputToRecentsAndBackend(); mMessageEditText.setText(""); mSendButton.setEnabled(false); } }); applyStyle(); return this; }
From source file:it.angrydroids.epub3reader.MainActivity.java
public int getHeight() { LinearLayout main = (LinearLayout) findViewById(R.id.MainLayout); return main.getMeasuredHeight(); }
From source file:cz.metaverse.android.bilingualreader.ReaderActivity.java
/** * @return height of the display area/*from w w w .j av a2s . co m*/ */ public int getHeight() { LinearLayout main = (LinearLayout) findViewById(R.id.PanelsLayout); return main.getMeasuredHeight(); }
From source file:com.microsoft.mimickeralarm.mimics.MimicTongueTwisterFragment.java
private void createSharableBitmap() { Bitmap sharableBitmap = Bitmap.createBitmap(getView().getWidth(), getView().getHeight(), Bitmap.Config.ARGB_8888);//w ww . j a va 2 s . c o m Canvas canvas = new Canvas(sharableBitmap); canvas.drawColor(ContextCompat.getColor(getContext(), R.color.white)); // Load the view for the sharable. This will be drawn to the bitmap LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.fragment_sharable_tongue_twister, null); TextView textView = (TextView) layout.findViewById(R.id.twister_sharable_tongue_twister); textView.setText(mQuestion); textView = (TextView) layout.findViewById(R.id.twister_sharable_i_said); textView.setText(mUnderstoodText); textView = (TextView) layout.findViewById(R.id.mimic_twister_share_success); textView.setText(mSuccessMessage); // Perform the layout using the dimension of the bitmap int widthSpec = View.MeasureSpec.makeMeasureSpec(canvas.getWidth(), View.MeasureSpec.EXACTLY); int heightSpec = View.MeasureSpec.makeMeasureSpec(canvas.getHeight(), View.MeasureSpec.EXACTLY); layout.measure(widthSpec, heightSpec); layout.layout(0, 0, layout.getMeasuredWidth(), layout.getMeasuredHeight()); // Draw the generated view to canvas layout.draw(canvas); String title = getString(R.string.app_short_name) + ": " + getString(R.string.mimic_twister_name); mSharableUri = ShareFragment.saveShareableBitmap(getActivity(), sharableBitmap, title); }
From source file:com.thingsee.tracker.MainActivity.java
public static void refreshTrackerMarker(String serial) { TrackerModel trackerModel = trackers.get(serial); if (trackerModel != null) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout tv = (LinearLayout) inflater.inflate(R.layout.tracker_map_marker, null, false); ImageView image2 = (ImageView) tv.findViewById(R.id.tracker_marker_icon); TextView name = (TextView) tv.findViewById(R.id.tracker_name); name.setText(trackerModel.getName()); ImageView trackerBg = (ImageView) trackerModel.getView().findViewById(R.id.tracker_image_bg); if (trackerModel.isLocationTimeoutAlarmOn()) { image2.setColorFilter(mResources.getColor(R.color.red)); trackerBg.setColorFilter(mResources.getColor(R.color.red)); name.setTextColor(mResources.getColor(R.color.white_effect)); } else {//from w w w .j a v a2 s . co m image2.clearColorFilter(); trackerBg.setColorFilter(mResources.getColor(R.color.green)); name.setTextColor(mResources.getColor(R.color.black_effect)); } tv.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight()); tv.setDrawingCacheEnabled(true); tv.buildDrawingCache(); Bitmap bm = tv.getDrawingCache(); tv = null; if (trackerModel.getMarker() != null) { trackerModel.getMarker().setIcon(BitmapDescriptorFactory.fromBitmap(bm)); } if (trackerModelWithMarker != null) { if (onChildOnMapView) { trackerModelWithMarker.getMarker().showInfoWindow(); } } } }
From source file:com.mobicage.rogerthat.plugins.messaging.widgets.AdvancedOrderWidget.java
private void setBasketListViewHeight() { final Point displaySize = UIUtils.getDisplaySize(mActivity); final TextView nameLbl = (TextView) mBasketDialog.findViewById(R.id.name); final ListView listView = (ListView) mBasketDialog.findViewById(R.id.list_view); final LinearLayout buttonContainer = (LinearLayout) mBasketDialog.findViewById(R.id.button_container); int maxPopupHeight = (int) Math.floor(displaySize.y * 0.75); nameLbl.measure(0, 0);//from w w w . j ava 2 s . co m int nameLblHeight = nameLbl.getMeasuredHeight(); buttonContainer.measure(0, 0); int buttonContainerHeight = buttonContainer.getMeasuredHeight(); UIUtils.setListViewHeightBasedOnItems(listView, maxPopupHeight - nameLblHeight - buttonContainerHeight); }