mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-06 20:45:54 +01:00
add hasSmallScreen()
This commit is contained in:
parent
9827ea1b39
commit
4fc33fe4e5
1 changed files with 15 additions and 0 deletions
|
@ -32,6 +32,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.provider.ContactsContract.PhoneLookup;
|
||||
|
@ -56,6 +57,7 @@ public class Utils {
|
|||
private static HashMap<String,String> s_phonesHash =
|
||||
new HashMap<String,String>();
|
||||
private static int s_nextCode = 0; // keep PendingIntents unique
|
||||
private static Boolean s_hasSmallScreen = null;
|
||||
|
||||
private Utils() {}
|
||||
|
||||
|
@ -285,6 +287,19 @@ public class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean hasSmallScreen( Context context )
|
||||
{
|
||||
if ( null == s_hasSmallScreen ) {
|
||||
int screenLayout = context.getResources().
|
||||
getConfiguration().screenLayout;
|
||||
boolean hasSmallScreen =
|
||||
(screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
|
||||
== Configuration.SCREENLAYOUT_SIZE_SMALL;
|
||||
s_hasSmallScreen = new Boolean( hasSmallScreen );
|
||||
}
|
||||
return s_hasSmallScreen;
|
||||
}
|
||||
|
||||
public static String format( Context context, int id, Object... args )
|
||||
{
|
||||
String fmt = context.getString( id );
|
||||
|
|
Loading…
Add table
Reference in a new issue