Permalink
Browse files

Added improved tablet support

  • Loading branch information...
1 parent f5a5e62 commit 027c04417f79ed85c6df386ed844b784c7784585 Tony Homer committed Jan 11, 2012
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,30 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
-<AbsoluteLayout
-xmlns:android="http://schemas.android.com/apk/res/android"
-android:orientation="vertical"
-android:layout_width="320dip"
-android:layout_height="544dip"
->
- <ImageView android:id="@+id/background"
- android:src="@drawable/splash_screen"
- android:layout_x="0dip"
- android:layout_y="0dip"
- android:layout_width="320dip"
- android:layout_height="544dip"
- android:visibility="visible"
- />
- <RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <ProgressBar android:id="@+android:id/progress_large"
- style="?android:attr/progressBarStyleLargeInverse"
- android:layout_centerInParent="true"
- android:paddingTop="85dip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- />
- </RelativeLayout>
-</AbsoluteLayout>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" >
+
+ <ImageView
+ android:id="@+id/background"
+ android:layout_width="320dip"
+ android:layout_height="544dip"
+ android:layout_gravity="center_horizontal"
+ android:src="@drawable/splash_screen"
+ android:visibility="visible" />
+
+ <ProgressBar
+ android:id="@+android:id/progress_large"
+ style="?android:attr/progressBarStyleLargeInverse"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:paddingTop="85dip" />
+
+</FrameLayout>
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" >
+
+ <ImageView
+ android:id="@+id/background"
+ android:layout_width="569dip"
+ android:layout_height="295dip"
+ android:layout_gravity="center_horizontal"
+ android:src="@drawable/splash_screen"
+ android:visibility="visible" />
+
+ <ProgressBar
+ android:id="@+android:id/progress_large"
+ style="?android:attr/progressBarStyleLargeInverse"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:paddingTop="85dip" />
+
+</FrameLayout>
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" >
+
+ <ImageView
+ android:id="@+id/background"
+ android:layout_width="800px"
+ android:layout_height="1255px"
+ android:layout_gravity="center_horizontal"
+ android:src="@drawable/splash_screen_tablet"
+ android:visibility="visible" />
+
+ <ProgressBar
+ android:id="@+android:id/progress_large"
+ style="?android:attr/progressBarStyleLargeInverse"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:paddingTop="85px" />
+
+</FrameLayout>
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" >
+
+ <ImageView
+ android:id="@+id/background"
+ android:layout_width="1280dip"
+ android:layout_height="775dip"
+ android:layout_gravity="center_horizontal"
+ android:src="@drawable/splash_screen_tablet"
+ android:visibility="visible" />
+
+ <ProgressBar
+ android:id="@+android:id/progress_large"
+ style="?android:attr/progressBarStyleLargeInverse"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:paddingTop="85dip" />
+
+</FrameLayout>
View
@@ -14,5 +14,6 @@
</attributes>
</classpathentry>
<classpathentry kind="lib" path="libs/commons-codec-1.3.jar"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,29 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
-<AbsoluteLayout
+<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
-android:orientation="vertical"
-android:layout_width="320dip"
-android:layout_height="544dip"
+android:layout_width="fill_parent"
+android:layout_height="fill_parent"
>
- <ImageView android:id="@+id/background"
- android:src="@drawable/splash_screen"
- android:layout_x="0dip"
- android:layout_y="0dip"
- android:layout_width="320dip"
- android:layout_height="544dip"
- android:visibility="visible"
- />
- <RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <ProgressBar android:id="@+android:id/progress_large"
- style="?android:attr/progressBarStyleLarge"
- android:layout_centerInParent="true"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- />
- </RelativeLayout>
-</AbsoluteLayout>
+<!-- place holder -->
+</FrameLayout>
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+xmlns:android="http://schemas.android.com/apk/res/android"
+android:layout_width="fill_parent"
+android:layout_height="fill_parent"
+>
+<!-- place holder -->
+</FrameLayout>
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+xmlns:android="http://schemas.android.com/apk/res/android"
+android:layout_width="fill_parent"
+android:layout_height="fill_parent"
+>
+<!-- place holder -->
+</FrameLayout>
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+xmlns:android="http://schemas.android.com/apk/res/android"
+android:layout_width="fill_parent"
+android:layout_height="fill_parent"
+>
+<!-- place holder -->
+</FrameLayout>
@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
-<AbsoluteLayout
+<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
-android:layout_width="320dip"
-android:layout_height="544dip"
+android:layout_width="fill_parent"
+android:layout_height="fill_parent"
>
<ImageView android:id="@+id/background"
android:src="@drawable/test_container_splash_screen"
- android:layout_x="0dip"
- android:layout_y="0dip"
android:layout_width="320dip"
android:layout_height="544dip"
+ android:layout_centerHorizontal="true"
android:visibility="visible"
/>
<RelativeLayout
@@ -22,8 +21,9 @@ android:layout_height="544dip"
<ProgressBar android:id="@+android:id/progress_large"
style="?android:attr/progressBarStyleLargeInverse"
android:layout_centerInParent="true"
+ android:paddingTop="85dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</RelativeLayout>
-</AbsoluteLayout>
+</RelativeLayout>
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+xmlns:android="http://schemas.android.com/apk/res/android"
+android:orientation="vertical"
+android:layout_width="fill_parent"
+android:layout_height="fill_parent"
+>
+ <ImageView android:id="@+id/background"
+ android:src="@drawable/test_container_splash_screen_tablet"
+ android:layout_width="800dip"
+ android:layout_height="1255dip"
+ android:layout_centerHorizontal="true"
+ android:visibility="visible"
+ />
+ <RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <ProgressBar android:id="@+android:id/progress_large"
+ style="?android:attr/progressBarStyleLargeInverse"
+ android:layout_centerInParent="true"
+ android:paddingTop="85dip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ />
+ </RelativeLayout>
+</RelativeLayout>
@@ -35,6 +35,8 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
+import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.graphics.Color;
@@ -48,16 +50,17 @@
import android.os.PowerManager;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
+import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.view.WindowManager;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup.LayoutParams;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
@@ -187,6 +190,13 @@ public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
+ DisplayMetrics dm = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(dm);
+ boolean isTablet = false;
+ if(dm.heightPixels>=1024 || dm.widthPixels>=600) {
+ isTablet = true;
+ }
+
if(!isMobius) {
//if (Build.VERSION.SDK_INT<Build.VERSION_CODES.HONEYCOMB) {
@@ -199,12 +209,37 @@ public void onCreate(Bundle savedInstanceState)
//check if launched from protocol handler
if (Intent.ACTION_VIEW.equals(getIntent().getAction())) {
- setContentView(R.layout.test_container_splash);
+ if(isTablet){
+ setContentView(R.layout.test_container_splash_tablet);
+ } else {
+ setContentView(R.layout.test_container_splash);
+ }
setProgressBarIndeterminateVisibility(true);
}
else if(!isTestContainer) {
if(Debug.isDebuggerConnected()) Log.i("[appMobi]", "splash");
- setContentView(R.layout.splash);
+
+ ActivityInfo ai = null;
+ try {
+ ai = getPackageManager().getActivityInfo( this.getComponentName(), PackageManager.GET_ACTIVITIES|PackageManager.GET_META_DATA);
+ } catch (NameNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ if(isTablet){
+ if(ai!=null && ai.screenOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE){
+ setContentView(R.layout.splash_tablet_ls);
+ } else {
+ setContentView(R.layout.splash_tablet);
+ }
+ } else {
+ if(ai!=null && ai.screenOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE){
+ setContentView(R.layout.splash_ls);
+ } else {
+ setContentView(R.layout.splash);
+ }
+ }
setProgressBarIndeterminateVisibility(true);
} else {
setContentView(R.layout.login);
@@ -478,7 +513,17 @@ public void run() {
//@Override
public void run()
{
- addContentView(getLayoutInflater().inflate(R.layout.test_container_splash, null), new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
+ DisplayMetrics dm = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(dm);
+ boolean isTablet = false;
+ if(dm.heightPixels>=1024 || dm.widthPixels>=600) {
+ isTablet = true;
+ }
+ if(isTablet){
+ addContentView(getLayoutInflater().inflate(R.layout.test_container_splash_tablet, null), new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
+ } else {
+ addContentView(getLayoutInflater().inflate(R.layout.test_container_splash, null), new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
+ }
setProgressBarIndeterminateVisibility(true);
}
});

0 comments on commit 027c044

Please sign in to comment.