GithubHelp home page GithubHelp logo

Comments (4)

Korriged avatar Korriged commented on April 20, 2024

A patch:

1/ change the declaration of attributes DEFAULT_LANDSCAPE and DEFAULT_PORTRAIT in FbDialog with:

// Patch bug #30 - BEGIN
// Refer to http://github.com/facebook/facebook-android-sdk/issues/issue/30
static LayoutParams DEFAULT_LANDSCAPE = null;
static LayoutParams DEFAULT_PORTRAIT = null;
// Patch bug #30 - END

2/ Add the following code to method FbDialog.onCreate(Bundle savedInstanceState), just after super.onCreate(savedInstanceState);

// Patch bug #30 - BEGIN
// Refer to http://github.com/facebook/facebook-android-sdk/issues/issue/30
// Gets screen size (depends on screen orientation):
int height = ((WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight();
int width = ((WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth();
if(width > height) {
// Landscape
int temp = height;
height = width;
width = temp;
}
// Height = larger dimension
// Sets screen size: height-60; width-20
LayoutParams DEFAULT_LANDSCAPE = new LayoutParams(height-60, width-20);
// Sets screen size: height-40; width-60
LayoutParams DEFAULT_PORTRAIT = new LayoutParams(width-60, height-40);
// Patch bug #30 - END

from facebook-android-sdk.

Pretz avatar Pretz commented on April 20, 2024

I have a slightly different solution than Korriged in my fork of facebook-android-sdk:
http://github.com/Pretz/facebook-android-sdk/commit/4d6d0f0d583c49c804b67c93073ef82e159b50b6
I've sent a pull request to Facebook so hopefully my changes will get merged upstream.

I scale the pixel values by the resolution density, but Korriged solution which insets the dialog from the screen size is also viable. However, it will be inset differently on high and low resolution screens, since 60px will be a different physical difference on an hdpi screen as opposed to an mdpi screen; probably the best solution would scale those values based on the screen density.

from facebook-android-sdk.

soneff avatar soneff commented on April 20, 2024

Hey, sorry for not being able to look into this sooner. I just read up on Android screen configurations, and I think that Pretz's solution is more robust (essentially density independent pixels approach). I'll pull your branch, test it, and try to push a change today.

from facebook-android-sdk.

soneff avatar soneff commented on April 20, 2024

I've tested on all the devices I have and it looks alright, so I've push this out. Thanks Alex! Let me know if you have any more problems / fixes.

from facebook-android-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.