com.facebook.R Java Examples
The following examples show how to use
com.facebook.R.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebDialog.java From kognitivo with Apache License 2.0 | 6 votes |
private void createCrossImage() { crossImageView = new ImageView(getContext()); // Dismiss the dialog when user click on the 'x' crossImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { cancel(); } }); Drawable crossDrawable = getContext().getResources().getDrawable(R.drawable.com_facebook_close); crossImageView.setImageDrawable(crossDrawable); /* 'x' should not be visible while webview is loading * make it visible only after webview has fully loaded */ crossImageView.setVisibility(View.INVISIBLE); }
Example #2
Source File: ProfilePictureView.java From kognitivo with Apache License 2.0 | 6 votes |
private int getPresetSizeInPixels(boolean forcePreset) { int dimensionId; switch (presetSizeType) { case SMALL: dimensionId = R.dimen.com_facebook_profilepictureview_preset_size_small; break; case NORMAL: dimensionId = R.dimen.com_facebook_profilepictureview_preset_size_normal; break; case LARGE: dimensionId = R.dimen.com_facebook_profilepictureview_preset_size_large; break; case CUSTOM: if (!forcePreset) { return ImageRequest.UNSPECIFIED_DIMENSION; } else { dimensionId = R.dimen.com_facebook_profilepictureview_preset_size_normal; break; } default: return ImageRequest.UNSPECIFIED_DIMENSION; } return getResources().getDimensionPixelSize(dimensionId); }
Example #3
Source File: FacebookButtonBase.java From kognitivo with Apache License 2.0 | 6 votes |
private void parseContentAttributes( final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) { final int attrsResources[] = { android.R.attr.paddingLeft, android.R.attr.paddingTop, android.R.attr.paddingRight, android.R.attr.paddingBottom, }; final TypedArray a = context.getTheme().obtainStyledAttributes( attrs, attrsResources, defStyleAttr, defStyleRes); try { setPadding( a.getDimensionPixelSize(0, 0), a.getDimensionPixelSize(1, 0), a.getDimensionPixelSize(2, 0), a.getDimensionPixelSize(3, 0)); } finally { a.recycle(); } }
Example #4
Source File: ProfilePictureView.java From kognitivo with Apache License 2.0 | 6 votes |
private void setBlankProfilePicture() { // If we have a pending image download request cancel it if (lastRequest != null) { ImageDownloader.cancelRequest(lastRequest); } if (customizedDefaultProfilePicture == null) { int blankImageResource = isCropped() ? R.drawable.com_facebook_profile_picture_blank_square : R.drawable.com_facebook_profile_picture_blank_portrait; setImageBitmap(BitmapFactory.decodeResource(getResources(), blankImageResource)); } else { // Update profile image dimensions. updateImageQueryParameters(); // Resize inputBitmap to new dimensions of queryWidth and queryHeight. Bitmap scaledBitmap = Bitmap.createScaledBitmap( customizedDefaultProfilePicture, queryWidth, queryHeight, false); setImageBitmap(scaledBitmap); } }
Example #5
Source File: LikeBoxCountView.java From kognitivo with Apache License 2.0 | 6 votes |
private void initialize(Context context) { setWillNotDraw(false); // Required for the onDraw() method to be called on a FrameLayout caretHeight = getResources().getDimension(R.dimen.com_facebook_likeboxcountview_caret_height); caretWidth = getResources().getDimension(R.dimen.com_facebook_likeboxcountview_caret_width); borderRadius = getResources().getDimension(R.dimen.com_facebook_likeboxcountview_border_radius); borderPaint = new Paint(); borderPaint.setColor( getResources().getColor(R.color.com_facebook_likeboxcountview_border_color)); borderPaint.setStrokeWidth(getResources().getDimension(R.dimen.com_facebook_likeboxcountview_border_width)); borderPaint.setStyle(Paint.Style.STROKE); initializeLikeCountLabel(context); addView(likeCountLabel); setCaretPosition(this.caretPosition); }
Example #6
Source File: LikeBoxCountView.java From kognitivo with Apache License 2.0 | 6 votes |
private void initializeLikeCountLabel(Context context) { likeCountLabel = new TextView(context); LayoutParams likeCountLabelLayoutParams = new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); likeCountLabel.setLayoutParams(likeCountLabelLayoutParams); likeCountLabel.setGravity(Gravity.CENTER); likeCountLabel.setTextSize( TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.com_facebook_likeboxcountview_text_size)); likeCountLabel.setTextColor( getResources().getColor(R.color.com_facebook_likeboxcountview_text_color)); textPadding = getResources().getDimensionPixelSize(R.dimen.com_facebook_likeboxcountview_text_padding); // Calculate the additional text padding that will be applied in the direction of the caret. additionalTextPadding = getResources().getDimensionPixelSize(R.dimen.com_facebook_likeboxcountview_caret_height); }
Example #7
Source File: LoginFragment.java From kognitivo with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.com_facebook_login_fragment, container, false); loginClient.setBackgroundProcessingListener( new LoginClient.BackgroundProcessingListener() { @Override public void onBackgroundProcessingStarted() { view.findViewById(R.id.com_facebook_login_activity_progress_bar) .setVisibility(View.VISIBLE); } @Override public void onBackgroundProcessingStopped() { view.findViewById(R.id.com_facebook_login_activity_progress_bar) .setVisibility(View.GONE); } }); return view; }
Example #8
Source File: LoginClient.java From kognitivo with Apache License 2.0 | 6 votes |
boolean checkInternetPermission() { if (checkedInternetPermission) { return true; } int permissionCheck = checkPermission(Manifest.permission.INTERNET); if (permissionCheck != PackageManager.PERMISSION_GRANTED) { Activity activity = getActivity(); String errorType = activity.getString(R.string.com_facebook_internet_permission_error_title); String errorDescription = activity.getString(R.string.com_facebook_internet_permission_error_message); complete(Result.createErrorResult(pendingRequest, errorType, errorDescription)); return false; } checkedInternetPermission = true; return true; }
Example #9
Source File: FacebookButtonBase.java From kognitivo with Apache License 2.0 | 5 votes |
private void parseBackgroundAttributes( final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) { // TODO, figure out why com_facebook_button_like_background.xml doesn't work in designers if (isInEditMode()) { return; } final int attrsResources[] = { android.R.attr.background, }; final TypedArray a = context.getTheme().obtainStyledAttributes( attrs, attrsResources, defStyleAttr, defStyleRes); try { if (a.hasValue(0)) { int backgroundResource = a.getResourceId(0, 0); if (backgroundResource != 0) { setBackgroundResource(backgroundResource); } else { setBackgroundColor(a.getColor(0, 0)); } } else { // fallback, if no background specified, fill with Facebook blue setBackgroundColor(a.getColor(0, R.color.com_facebook_blue)); } } finally { a.recycle(); } }
Example #10
Source File: ProfilePictureView.java From kognitivo with Apache License 2.0 | 5 votes |
private void parseAttributes(AttributeSet attrs) { TypedArray a = getContext().obtainStyledAttributes( attrs, R.styleable.com_facebook_profile_picture_view); setPresetSize(a.getInt(R.styleable.com_facebook_profile_picture_view_com_facebook_preset_size, CUSTOM)); isCropped = a.getBoolean( R.styleable.com_facebook_profile_picture_view_com_facebook_is_cropped, IS_CROPPED_DEFAULT_VALUE); a.recycle(); }
Example #11
Source File: ToolTipPopup.java From kognitivo with Apache License 2.0 | 5 votes |
private void init() { LayoutInflater inflater = LayoutInflater.from(getContext()); inflater.inflate(R.layout.com_facebook_tooltip_bubble, this); topArrow = (ImageView) findViewById(R.id.com_facebook_tooltip_bubble_view_top_pointer); bottomArrow = (ImageView) findViewById( R.id.com_facebook_tooltip_bubble_view_bottom_pointer); bodyFrame = findViewById(R.id.com_facebook_body_frame); xOut = (ImageView) findViewById(R.id.com_facebook_button_xout); }
Example #12
Source File: LoginFragment.java From kognitivo with Apache License 2.0 | 5 votes |
@Override public void onPause() { super.onPause(); getActivity().findViewById(R.id.com_facebook_login_activity_progress_bar).setVisibility( View.GONE); }
Example #13
Source File: LikeView.java From kognitivo with Apache License 2.0 | 5 votes |
private void initializeSocialSentenceView(Context context) { socialSentenceView = new TextView(context); socialSentenceView.setTextSize( TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.com_facebook_likeview_text_size)); socialSentenceView.setMaxLines(2); socialSentenceView.setTextColor(foregroundColor); socialSentenceView.setGravity(Gravity.CENTER); LinearLayout.LayoutParams socialSentenceViewLayout = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); socialSentenceView.setLayoutParams(socialSentenceViewLayout); }
Example #14
Source File: LikeView.java From kognitivo with Apache License 2.0 | 5 votes |
private void initialize(Context context) { edgePadding = getResources().getDimensionPixelSize(R.dimen.com_facebook_likeview_edge_padding); internalPadding = getResources().getDimensionPixelSize(R.dimen.com_facebook_likeview_internal_padding); if (foregroundColor == NO_FOREGROUND_COLOR) { foregroundColor = getResources().getColor(R.color.com_facebook_likeview_text_color); } setBackgroundColor(Color.TRANSPARENT); containerView = new LinearLayout(context); LayoutParams containerViewLayoutParams = new LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); containerView.setLayoutParams(containerViewLayoutParams); initializeLikeButton(context); initializeSocialSentenceView(context); initializeLikeCountView(context); containerView.addView(likeButton); containerView.addView(socialSentenceView); containerView.addView(likeBoxCountView); addView(containerView); setObjectIdAndTypeForced(this.objectId, this.objectType); updateLikeStateAndLayout(); }
Example #15
Source File: LikeButton.java From kognitivo with Apache License 2.0 | 5 votes |
private void updateForLikeStatus() { // the compound drawables don't support selectors, so we need to update for the status if (isSelected()) { this.setCompoundDrawablesWithIntrinsicBounds( R.drawable.com_facebook_button_like_icon_selected, 0, 0, 0); this.setText(getResources().getString(R.string.com_facebook_like_button_liked)); } else { this.setCompoundDrawablesWithIntrinsicBounds( R.drawable.com_facebook_button_icon, 0, 0, 0); this.setText(getResources().getString(R.string.com_facebook_like_button_not_liked)); } }
Example #16
Source File: FacebookButtonBase.java From kognitivo with Apache License 2.0 | 5 votes |
private void parseCompoundDrawableAttributes( final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) { final int attrsResources[] = { android.R.attr.drawableLeft, android.R.attr.drawableTop, android.R.attr.drawableRight, android.R.attr.drawableBottom, android.R.attr.drawablePadding, }; final TypedArray a = context.getTheme().obtainStyledAttributes( attrs, attrsResources, defStyleAttr, defStyleRes); try { setCompoundDrawablesWithIntrinsicBounds( a.getResourceId(0, 0), a.getResourceId(1, 0), a.getResourceId(2, 0), a.getResourceId(3, 0)); setCompoundDrawablePadding(a.getDimensionPixelSize(4, 0)); } finally { a.recycle(); } }
Example #17
Source File: FacebookButtonBase.java From kognitivo with Apache License 2.0 | 5 votes |
protected FacebookButtonBase( final Context context, final AttributeSet attrs, int defStyleAttr, int defStyleRes, final String analyticsButtonCreatedEventName, final String analyticsButtonTappedEventName) { super(context, attrs, 0); defStyleRes = (defStyleRes == 0 ? this.getDefaultStyleResource() : defStyleRes); defStyleRes = (defStyleRes == 0 ? R.style.com_facebook_button : defStyleRes); configureButton(context, attrs, defStyleAttr, defStyleRes); this.analyticsButtonCreatedEventName = analyticsButtonCreatedEventName; this.analyticsButtonTappedEventName = analyticsButtonTappedEventName; }
Example #18
Source File: SendButton.java From kognitivo with Apache License 2.0 | 4 votes |
@Override protected int getDefaultStyleResource() { return R.style.com_facebook_button_send; }
Example #19
Source File: LikeView.java From kognitivo with Apache License 2.0 | 4 votes |
private void parseAttributes(AttributeSet attrs) { if (attrs == null || getContext() == null) { return; } TypedArray a = getContext().obtainStyledAttributes( attrs, R.styleable.com_facebook_like_view); if (a == null) { return; } objectId = Utility.coerceValueIfNullOrEmpty( a.getString(R.styleable.com_facebook_like_view_com_facebook_object_id), null); objectType = ObjectType.fromInt( a.getInt(R.styleable.com_facebook_like_view_com_facebook_object_type, ObjectType.DEFAULT.getValue())); likeViewStyle = Style.fromInt( a.getInt(R.styleable.com_facebook_like_view_com_facebook_style, Style.DEFAULT.getValue())); if (likeViewStyle == null) { throw new IllegalArgumentException("Unsupported value for LikeView 'style'"); } auxiliaryViewPosition = AuxiliaryViewPosition.fromInt( a.getInt(R.styleable.com_facebook_like_view_com_facebook_auxiliary_view_position, AuxiliaryViewPosition.DEFAULT.getValue())); if (auxiliaryViewPosition == null) { throw new IllegalArgumentException( "Unsupported value for LikeView 'auxiliary_view_position'"); } horizontalAlignment = HorizontalAlignment.fromInt( a.getInt(R.styleable.com_facebook_like_view_com_facebook_horizontal_alignment, HorizontalAlignment.DEFAULT.getValue())); if (horizontalAlignment == null) { throw new IllegalArgumentException( "Unsupported value for LikeView 'horizontal_alignment'"); } foregroundColor = a.getColor( R.styleable.com_facebook_like_view_com_facebook_foreground_color, NO_FOREGROUND_COLOR); a.recycle(); }
Example #20
Source File: ShareButton.java From kognitivo with Apache License 2.0 | 4 votes |
@Override protected int getDefaultStyleResource() { return R.style.com_facebook_button_share; }
Example #21
Source File: LikeButton.java From kognitivo with Apache License 2.0 | 4 votes |
@Override protected int getDefaultStyleResource() { return R.style.com_facebook_button_like; }
Example #22
Source File: FacebookButtonBase.java From kognitivo with Apache License 2.0 | 4 votes |
private void parseTextAttributes( final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) { final int colorResources[] = { android.R.attr.textColor, }; final TypedArray colorAttrs = context.getTheme().obtainStyledAttributes( attrs, colorResources, defStyleAttr, defStyleRes); try { setTextColor(colorAttrs.getColor(0, Color.WHITE)); } finally { colorAttrs.recycle(); } final int gravityResources[] = { android.R.attr.gravity, }; final TypedArray gravityAttrs = context.getTheme().obtainStyledAttributes( attrs, gravityResources, defStyleAttr, defStyleRes); try { setGravity(gravityAttrs.getInt(0, Gravity.CENTER)); } finally { gravityAttrs.recycle(); } final int attrsResources[] = { android.R.attr.textSize, android.R.attr.textStyle, android.R.attr.text, }; final TypedArray a = context.getTheme().obtainStyledAttributes( attrs, attrsResources, defStyleAttr, defStyleRes); try { setTextSize(TypedValue.COMPLEX_UNIT_PX, a.getDimensionPixelSize(0, 0)); setTypeface(Typeface.defaultFromStyle(a.getInt(1, Typeface.BOLD))); setText(a.getString(2)); } finally { a.recycle(); } }
Example #23
Source File: WebDialog.java From kognitivo with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); spinner = new ProgressDialog(getContext()); spinner.requestWindowFeature(Window.FEATURE_NO_TITLE); spinner.setMessage(getContext().getString(R.string.com_facebook_loading)); spinner.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { cancel(); } }); requestWindowFeature(Window.FEATURE_NO_TITLE); contentFrameLayout = new FrameLayout(getContext()); // First calculate how big the frame layout should be resize(); getWindow().setGravity(Gravity.CENTER); // resize the dialog if the soft keyboard comes up getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); /* Create the 'x' image, but don't add to the contentFrameLayout layout yet * at this point, we only need to know its drawable width and height * to place the webview */ createCrossImage(); /* Now we know 'x' drawable width and height, * layout the webview and add it the contentFrameLayout layout */ int crossWidth = crossImageView.getDrawable().getIntrinsicWidth(); setUpWebView(crossWidth / 2 + 1); /* Finally add the 'x' image to the contentFrameLayout layout and * add contentFrameLayout to the Dialog view */ contentFrameLayout.addView(crossImageView, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); setContentView(contentFrameLayout); }
Example #24
Source File: LoginFragment.java From letv with Apache License 2.0 | 4 votes |
public void onPause() { super.onPause(); getActivity().findViewById(R.id.com_facebook_login_activity_progress_bar).setVisibility(8); }