BiDiTestActivity.java revision 88f9fd2316d764e792a84c43aef67816ac02ef14
19f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio/* 29f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * Copyright (C) 2011 The Android Open Source Project 39f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * 49f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * Licensed under the Apache License, Version 2.0 (the "License"); 59f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * you may not use this file except in compliance with the License. 69f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * You may obtain a copy of the License at 79f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * 89f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * http://www.apache.org/licenses/LICENSE-2.0 99f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * 109f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * Unless required by applicable law or agreed to in writing, software 119f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * distributed under the License is distributed on an "AS IS" BASIS, 129f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * See the License for the specific language governing permissions and 149f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio * limitations under the License. 159f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio */ 169f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio 179f82b580d744ce4baf057b061994394dcf239eedFabrice Di Megliopackage com.android.bidi; 189f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio 191e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglioimport android.app.TabActivity; 201e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglioimport android.content.Intent; 219f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglioimport android.os.Bundle; 221e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglioimport android.widget.TabHost; 23eee49c699c035ffba188417489f40d34f587d65cFabrice Di Meglio 241e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Megliopublic class BiDiTestActivity extends TabActivity { 25eee49c699c035ffba188417489f40d34f587d65cFabrice Di Meglio 269f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio @Override 279f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio protected void onCreate(Bundle savedInstanceState) { 289f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio super.onCreate(savedInstanceState); 299f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio 301e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio setContentView(R.layout.main); 31eee49c699c035ffba188417489f40d34f587d65cFabrice Di Meglio 321e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio TabHost tabHost = getTabHost(); 331e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio TabHost.TabSpec spec; 341e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio Intent intent; 35eee49c699c035ffba188417489f40d34f587d65cFabrice Di Meglio 361e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio // Create an Intent to launch an Activity for the tab (to be reused) 371e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestBasicActivity.class); 38eee49c699c035ffba188417489f40d34f587d65cFabrice Di Meglio 391e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio // Initialize a TabSpec for each tab and add it to the TabHost 40de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio spec = tabHost.newTabSpec("basic").setIndicator("Basic"). 41de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio setContent(intent); 421e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio tabHost.addTab(spec); 43eee49c699c035ffba188417489f40d34f587d65cFabrice Di Meglio 441e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio // Do the same for the other tabs 451e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestCanvasActivity.class); 46de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio spec = tabHost.newTabSpec("canvas").setIndicator("Canvas"). 47de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio setContent(intent); 481e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio tabHost.addTab(spec); 49eee49c699c035ffba188417489f40d34f587d65cFabrice Di Meglio 501e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestLinearLayoutLtrActivity.class); 51c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio spec = tabHost.newTabSpec("linear-layout-ltr").setIndicator("Linear LTR"). 52de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio setContent(intent); 531e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio tabHost.addTab(spec); 549f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio 551e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestLinearLayoutRtlActivity.class); 56c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio spec = tabHost.newTabSpec("linear-layout-rtl").setIndicator("Linear RTL"). 57de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio setContent(intent); 58de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio tabHost.addTab(spec); 59de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio 60de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestFrameLayoutLtrActivity.class); 61c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio spec = tabHost.newTabSpec("frame-layout-ltr").setIndicator("Frame LTR"). 62de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio setContent(intent); 63de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio tabHost.addTab(spec); 64de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio 65de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestFrameLayoutRtlActivity.class); 66c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio spec = tabHost.newTabSpec("frame-layout-rtl").setIndicator("Frame RTL"). 67de35ceeeb9f8855c72dfd70593e917aa75b43770Fabrice Di Meglio setContent(intent); 681e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio tabHost.addTab(spec); 699f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio 70c2e989021e74593ce98680bce0c28b592b1ff843Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity.class); 71c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio spec = tabHost.newTabSpec("relative-layout-ltr").setIndicator("Relative LTR"). 72c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio setContent(intent); 73c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio tabHost.addTab(spec); 74c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio 75c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestRelativeLayoutRtlActivity.class); 76c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio spec = tabHost.newTabSpec("relative-layout-rtl").setIndicator("Relative RTL"). 77c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio setContent(intent); 78c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio tabHost.addTab(spec); 79c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio 80c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity2.class); 81c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio spec = tabHost.newTabSpec("relative-layout-ltr-2").setIndicator("Relative2 LTR"). 82c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio setContent(intent); 83c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio tabHost.addTab(spec); 84c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio 85c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestRelativeLayoutRtlActivity2.class); 86c715528c9657e5848021a27a600a0e8e5100fb34Fabrice Di Meglio spec = tabHost.newTabSpec("relative-layout-rtl-2").setIndicator("Relative2 RTL"). 87c2e989021e74593ce98680bce0c28b592b1ff843Fabrice Di Meglio setContent(intent); 88c2e989021e74593ce98680bce0c28b592b1ff843Fabrice Di Meglio tabHost.addTab(spec); 89c2e989021e74593ce98680bce0c28b592b1ff843Fabrice Di Meglio 9088f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestTableLayoutLtrActivity.class); 9188f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio spec = tabHost.newTabSpec("table-layout-ltr").setIndicator("Table LTR"). 9288f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio setContent(intent); 9388f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio tabHost.addTab(spec); 9488f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio 9588f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio intent = new Intent().setClass(this, BiDiTestTableLayoutRtlActivity.class); 9688f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio spec = tabHost.newTabSpec("table-layout-rtl").setIndicator("Table RTL"). 9788f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio setContent(intent); 9888f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio tabHost.addTab(spec); 9988f9fd2316d764e792a84c43aef67816ac02ef14Fabrice Di Meglio 1001e4cfbeba54898373c852097d1519a1d966c0854Fabrice Di Meglio tabHost.setCurrentTab(0); 1019f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio } 1029f82b580d744ce4baf057b061994394dcf239eedFabrice Di Meglio}