Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added improved tablet support

  • Loading branch information...
commit 027c04417f79ed85c6df386ed844b784c7784585 1 parent f5a5e62
Tony Homer authored
View
BIN  AppLab/res/drawable/splash_screen_tablet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
50 AppLab/res/layout/splash.xml
@@ -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>
View
22 AppLab/res/layout/splash_ls.xml
@@ -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>
View
22 AppLab/res/layout/splash_tablet.xml
@@ -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>
View
22 AppLab/res/layout/splash_tablet_ls.xml
@@ -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
1  appMobiLib/.classpath
@@ -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>
View
BIN  appMobiLib/res/drawable/splash_screen_tablet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  appMobiLib/res/drawable/test_container_splash_screen_tablet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
31 appMobiLib/res/layout/splash.xml
@@ -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>
View
8 appMobiLib/res/layout/splash_ls.xml
@@ -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>
View
8 appMobiLib/res/layout/splash_tablet.xml
@@ -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>
View
8 appMobiLib/res/layout/splash_tablet_ls.xml
@@ -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>
View
12 appMobiLib/res/layout/test_container_splash.xml
@@ -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>
View
29 appMobiLib/res/layout/test_container_splash_tablet.xml
@@ -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>
View
55 appMobiLib/src/com/appMobi/appMobiLib/AppMobiActivity.java
@@ -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);
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.