Skip to content

Commit

Permalink
Added improved tablet support
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Homer committed Jan 11, 2012
1 parent f5a5e62 commit 027c044
Show file tree
Hide file tree
Showing 15 changed files with 202 additions and 66 deletions.
Binary file added AppLab/res/drawable/splash_screen_tablet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 21 additions & 29 deletions AppLab/res/layout/splash.xml
Original file line number Original file line Diff line number Diff line change
@@ -1,30 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
android:orientation="vertical" android:layout_height="fill_parent" >
android:layout_width="320dip"
android:layout_height="544dip" <ImageView
> android:id="@+id/background"
<ImageView android:id="@+id/background" android:layout_width="320dip"
android:src="@drawable/splash_screen" android:layout_height="544dip"
android:layout_x="0dip" android:layout_gravity="center_horizontal"
android:layout_y="0dip" android:src="@drawable/splash_screen"
android:layout_width="320dip" android:visibility="visible" />
android:layout_height="544dip"
android:visibility="visible" <ProgressBar
/> android:id="@+android:id/progress_large"
<RelativeLayout style="?android:attr/progressBarStyleLargeInverse"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content"
android:orientation="vertical" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_gravity="center"
android:layout_height="fill_parent" android:paddingTop="85dip" />
>
<ProgressBar android:id="@+android:id/progress_large" </FrameLayout>
style="?android:attr/progressBarStyleLargeInverse"
android:layout_centerInParent="true"
android:paddingTop="85dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</RelativeLayout>
</AbsoluteLayout>
22 changes: 22 additions & 0 deletions AppLab/res/layout/splash_ls.xml
Original file line number Original file line Diff line number Diff line change
@@ -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>
22 changes: 22 additions & 0 deletions AppLab/res/layout/splash_tablet.xml
Original file line number Original file line Diff line number Diff line change
@@ -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>
22 changes: 22 additions & 0 deletions AppLab/res/layout/splash_tablet_ls.xml
Original file line number Original file line Diff line number Diff line change
@@ -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>
1 change: 1 addition & 0 deletions appMobiLib/.classpath
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="libs/commons-codec-1.3.jar"/> <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"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>
Binary file added appMobiLib/res/drawable/splash_screen_tablet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 5 additions & 26 deletions appMobiLib/res/layout/splash.xml
Original file line number Original file line Diff line number Diff line change
@@ -1,29 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout <FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_width="320dip" android:layout_height="fill_parent"
android:layout_height="544dip"
> >
<ImageView android:id="@+id/background" <!-- place holder -->
android:src="@drawable/splash_screen" </FrameLayout>
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>
8 changes: 8 additions & 0 deletions appMobiLib/res/layout/splash_ls.xml
Original file line number Original file line Diff line number Diff line change
@@ -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>
8 changes: 8 additions & 0 deletions appMobiLib/res/layout/splash_tablet.xml
Original file line number Original file line Diff line number Diff line change
@@ -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>
8 changes: 8 additions & 0 deletions appMobiLib/res/layout/splash_tablet_ls.xml
Original file line number Original file line Diff line number Diff line change
@@ -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>
12 changes: 6 additions & 6 deletions appMobiLib/res/layout/test_container_splash.xml
Original file line number Original file line Diff line number Diff line change
@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="320dip" android:layout_width="fill_parent"
android:layout_height="544dip" android:layout_height="fill_parent"
> >
<ImageView android:id="@+id/background" <ImageView android:id="@+id/background"
android:src="@drawable/test_container_splash_screen" android:src="@drawable/test_container_splash_screen"
android:layout_x="0dip"
android:layout_y="0dip"
android:layout_width="320dip" android:layout_width="320dip"
android:layout_height="544dip" android:layout_height="544dip"
android:layout_centerHorizontal="true"
android:visibility="visible" android:visibility="visible"
/> />
<RelativeLayout <RelativeLayout
Expand All @@ -22,8 +21,9 @@ android:layout_height="544dip"
<ProgressBar android:id="@+android:id/progress_large" <ProgressBar android:id="@+android:id/progress_large"
style="?android:attr/progressBarStyleLargeInverse" style="?android:attr/progressBarStyleLargeInverse"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:paddingTop="85dip"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
/> />
</RelativeLayout> </RelativeLayout>
</AbsoluteLayout> </RelativeLayout>
29 changes: 29 additions & 0 deletions appMobiLib/res/layout/test_container_splash_tablet.xml
Original file line number Original file line Diff line number Diff line change
@@ -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>
55 changes: 50 additions & 5 deletions appMobiLib/src/com/appMobi/appMobiLib/AppMobiActivity.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Color; import android.graphics.Color;
Expand All @@ -48,16 +50,17 @@
import android.os.PowerManager; import android.os.PowerManager;
import android.provider.Settings.Secure; import android.provider.Settings.Secure;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
Expand Down Expand Up @@ -187,6 +190,13 @@ public void onCreate(Bundle savedInstanceState)


super.onCreate(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(!isMobius) {


//if (Build.VERSION.SDK_INT<Build.VERSION_CODES.HONEYCOMB) { //if (Build.VERSION.SDK_INT<Build.VERSION_CODES.HONEYCOMB) {
Expand All @@ -199,12 +209,37 @@ public void onCreate(Bundle savedInstanceState)


//check if launched from protocol handler //check if launched from protocol handler
if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { 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); setProgressBarIndeterminateVisibility(true);
} }
else if(!isTestContainer) { else if(!isTestContainer) {
if(Debug.isDebuggerConnected()) Log.i("[appMobi]", "splash"); 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); setProgressBarIndeterminateVisibility(true);
} else { } else {
setContentView(R.layout.login); setContentView(R.layout.login);
Expand Down Expand Up @@ -478,7 +513,17 @@ public void run() {
//@Override //@Override
public void run() 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); setProgressBarIndeterminateVisibility(true);
} }
}); });
Expand Down

0 comments on commit 027c044

Please sign in to comment.