Java 类com.facebook.R 实例源码

项目:kognitivo    文件:FacebookButtonBase.java   
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();
    }
}
项目:kognitivo    文件:LikeBoxCountView.java   
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);
}
项目:kognitivo    文件:LikeBoxCountView.java   
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);
}
项目:kognitivo    文件:LoginClient.java   
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;
}
项目:kognitivo    文件:LoginFragment.java   
@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;
}
项目:kognitivo    文件:ProfilePictureView.java   
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);
    }
}
项目:kognitivo    文件:ProfilePictureView.java   
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);
}
项目:kognitivo    文件:WebDialog.java   
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);
}
项目:Move-Alarm_ORCA    文件:FacebookButtonBase.java   
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();
    }
}
项目:Move-Alarm_ORCA    文件:LikeBoxCountView.java   
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);
}
项目:Move-Alarm_ORCA    文件:LikeBoxCountView.java   
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);
}
项目:Move-Alarm_ORCA    文件:LoginClient.java   
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;
}
项目:Move-Alarm_ORCA    文件:LoginFragment.java   
@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;
}
项目:Move-Alarm_ORCA    文件:ProfilePictureView.java   
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);
    }
}
项目:Move-Alarm_ORCA    文件:ProfilePictureView.java   
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);
}
项目:Move-Alarm_ORCA    文件:LoginButton.java   
private void checkNuxSettings() {
    if (nuxMode == ToolTipMode.DISPLAY_ALWAYS) {
        String nuxString = getResources().getString(R.string.com_facebook_tooltip_default);
        displayNux(nuxString);
    } else {
        // kick off an async request
        final String appId = Utility.getMetadataApplicationId(getContext());
        AsyncTask<Void, Void, FetchedAppSettings> task =
                new AsyncTask<Void, Void, Utility.FetchedAppSettings>() {
                    @Override
                    protected FetchedAppSettings doInBackground(Void... params) {
                        FetchedAppSettings settings = Utility.queryAppSettings(appId, false);
                        return settings;
                    }

                    @Override
                    protected void onPostExecute(FetchedAppSettings result) {
                        showNuxPerSettings(result);
                    }
                };
        task.execute((Void[]) null);
    }

}
项目:Move-Alarm_ORCA    文件:LoginButton.java   
private void parseLoginButtonAttributes(
        final Context context,
        final AttributeSet attrs,
        final int defStyleAttr,
        final int defStyleRes) {
    final TypedArray a = context.getTheme().obtainStyledAttributes(
            attrs,
            R.styleable.com_facebook_login_view,
            defStyleAttr,
            defStyleRes);
    try {
        confirmLogout = a.getBoolean(R.styleable.com_facebook_login_view_confirm_logout, true);
        loginText = a.getString(R.styleable.com_facebook_login_view_login_text);
        logoutText = a.getString(R.styleable.com_facebook_login_view_logout_text);
    } finally {
        a.recycle();
    }
}
项目:Move-Alarm_ORCA    文件:WebDialog.java   
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);
}
项目:SocioBlood    文件:FacebookButtonBase.java   
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();
    }
}
项目:SocioBlood    文件:LikeBoxCountView.java   
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);
}
项目:SocioBlood    文件:LikeBoxCountView.java   
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);
}
项目:SocioBlood    文件:LoginClient.java   
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;
}
项目:SocioBlood    文件:LoginFragment.java   
@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;
}
项目:SocioBlood    文件:ProfilePictureView.java   
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);
    }
}
项目:SocioBlood    文件:ProfilePictureView.java   
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);
}
项目:SocioBlood    文件:LoginButton.java   
private void parseLoginButtonAttributes(
        final Context context,
        final AttributeSet attrs,
        final int defStyleAttr,
        final int defStyleRes) {
    this.toolTipMode = ToolTipMode.DEFAULT;
    final TypedArray a = context.getTheme().obtainStyledAttributes(
            attrs,
            R.styleable.com_facebook_login_view,
            defStyleAttr,
            defStyleRes);
    try {
        confirmLogout = a.getBoolean(R.styleable.com_facebook_login_view_com_facebook_confirm_logout, true);
        loginText = a.getString(R.styleable.com_facebook_login_view_com_facebook_login_text);
        logoutText = a.getString(R.styleable.com_facebook_login_view_com_facebook_logout_text);
        toolTipMode = ToolTipMode.fromInt(a.getInt(
                R.styleable.com_facebook_login_view_com_facebook_tooltip_mode,
                ToolTipMode.DEFAULT.getValue()));
    } finally {
        a.recycle();
    }
}
项目:SocioBlood    文件:LoginButton.java   
private void setButtonText() {
    final Resources resources = getResources();
    if (AccessToken.getCurrentAccessToken() != null) {
        setText((logoutText != null) ?
                logoutText :
                resources.getString(R.string.com_facebook_loginview_log_out_button));
    } else {
        if (loginText != null) {
            setText(loginText);
        } else {
            String text = resources.getString(
                    R.string.com_facebook_loginview_log_in_button_long);
            int width = getWidth();
            // if the width is 0, we are going to measure size, so use the long text
            if (width != 0) {
                // we have a specific width, check if the long text fits
                int measuredWidth = measureButtonWidth(text);
                if (measuredWidth > width) {
                    // it doesn't fit, use the shorter text
                    text = resources.getString(R.string.com_facebook_loginview_log_in_button);
                }
            }
            setText(text);
        }
    }
}
项目:SocioBlood    文件:WebDialog.java   
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);
}
项目:kognitivo    文件:FacebookButtonBase.java   
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;
}
项目:kognitivo    文件:FacebookButtonBase.java   
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();
    }
}
项目:kognitivo    文件:FacebookButtonBase.java   
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();
    }
}
项目:kognitivo    文件:LikeButton.java   
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));
    }
}
项目:kognitivo    文件:LikeView.java   
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();
}
项目:kognitivo    文件:LikeView.java   
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);
}
项目:kognitivo    文件:LoginFragment.java   
@Override
public void onPause() {
    super.onPause();

    getActivity().findViewById(R.id.com_facebook_login_activity_progress_bar).setVisibility(
            View.GONE);
}
项目:kognitivo    文件:ToolTipPopup.java   
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);
}
项目:kognitivo    文件:ProfilePictureView.java   
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();
}
项目:Move-Alarm_ORCA    文件:FacebookButtonBase.java   
protected FacebookButtonBase(
        final Context context,
        final AttributeSet attrs,
        int defStyleAttr,
        int defStyleRes,
        final String analyticsButtonCreatedEventName,
        final int requestCode) {
    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.requestCode = requestCode;
}
项目:Move-Alarm_ORCA    文件:FacebookButtonBase.java   
private void parseBackgroundAttributes(
        final Context context,
        final AttributeSet attrs,
        final int defStyleAttr,
        final int defStyleRes) {
    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();
    }
}
项目:Move-Alarm_ORCA    文件:FacebookButtonBase.java   
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();
    }
}