Merge "revisions to NewsReader sample app for AndroidU. Clean up XML markup for clean rendering in HTML docs; Change string resources for two-pane mode to bools; Rename resource files w/ layout info from main.xml to layouts.xml. Add support lib Add HTML page" into ics-mr0
This commit is contained in:
@@ -19,6 +19,11 @@
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="14" />
|
||||
<supports-screens
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true" />
|
||||
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||
android:logo="@drawable/logo" android:theme="@style/NewsReaderStyle">
|
||||
@@ -31,10 +36,4 @@
|
||||
<activity android:name=".ArticleActivity"
|
||||
android:theme="@style/NewsReaderStyle_NoActionBar" />
|
||||
</application>
|
||||
<supports-screens
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"
|
||||
/>
|
||||
</manifest>
|
||||
|
||||
12
samples/training/multiscreen/newsreader/_index.html
Normal file
12
samples/training/multiscreen/newsreader/_index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<p>A sample app demonstrating best practices to support multiple screen sizes and densities.</p>
|
||||
<p>This sample is a companion to the Training class about <a
|
||||
href="../../../training/multiscreen/index.html">Designing for Multiple
|
||||
Screens</a>.</p>
|
||||
|
||||
<p class="note"><strong>Note:</strong> This sample uses the Android Support Library. To build the
|
||||
app, be sure to add the <code>libs/android-support-v4.jar</code> file to the project build path. In
|
||||
Eclipse, right-click the JAR file in the Package Explorer and select <b>Build Path > Add to Build
|
||||
Path</b>.</p>
|
||||
|
||||
|
||||
<img alt="" src="../images/NewsReader.png" />
|
||||
Binary file not shown.
@@ -14,11 +14,11 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#01511a"
|
||||
android:padding="5dp">
|
||||
</TextView>
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#01511a"
|
||||
android:padding="5dp" />
|
||||
<!-- END_INCLUDE(all) -->
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#01511a"
|
||||
android:padding="10dp">
|
||||
</TextView>
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#01511a"
|
||||
android:padding="10dp" />
|
||||
<!-- END_INCLUDE(all) -->
|
||||
|
||||
@@ -14,14 +14,15 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<fragment android:id="@+id/headlines" android:layout_height="fill_parent"
|
||||
android:name="com.example.android.newsreader.HeadlinesFragment"
|
||||
android:layout_width="match_parent" />
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<fragment android:id="@+id/headlines"
|
||||
android:layout_height="fill_parent"
|
||||
android:name="com.example.android.newsreader.HeadlinesFragment"
|
||||
android:layout_width="match_parent" />
|
||||
</LinearLayout>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
|
||||
@@ -14,19 +14,37 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:gravity="center" android:layout_height="50dp">
|
||||
<ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/logo" android:paddingRight="30dp" android:layout_gravity="left" android:layout_weight="0"></ImageView>
|
||||
<View android:layout_height="wrap_content" android:id="@+id/view1" android:layout_width="wrap_content" android:layout_weight="1"></View>
|
||||
<Button android:id="@+id/categorybutton" android:text="one" android:background="@drawable/button_bg" android:layout_height="match_parent" android:layout_weight="0" android:layout_width="120dp" style="@style/CategoryButtonStyle"/>
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:id="@+id/linearLayout1"
|
||||
android:gravity="center"
|
||||
android:layout_height="50dp">
|
||||
<ImageView android:id="@+id/imageView1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/logo"
|
||||
android:paddingRight="30dp"
|
||||
android:layout_gravity="left"
|
||||
android:layout_weight="0" />
|
||||
<View android:layout_height="wrap_content"
|
||||
android:id="@+id/view1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
<Button android:id="@+id/categorybutton"
|
||||
android:background="@drawable/button_bg"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:layout_width="120dp"
|
||||
style="@style/CategoryButtonStyle"/>
|
||||
</LinearLayout>
|
||||
|
||||
<fragment android:id="@+id/headlines" android:layout_height="fill_parent"
|
||||
<fragment android:id="@+id/headlines"
|
||||
android:layout_height="fill_parent"
|
||||
android:name="com.example.android.newsreader.HeadlinesFragment"
|
||||
android:layout_width="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
|
||||
@@ -14,14 +14,19 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:orientation="horizontal">
|
||||
<fragment android:id="@+id/headlines" android:layout_height="fill_parent"
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="horizontal">
|
||||
<fragment android:id="@+id/headlines"
|
||||
android:layout_height="fill_parent"
|
||||
android:name="com.example.android.newsreader.HeadlinesFragment"
|
||||
android:layout_width="400dp" android:layout_marginRight="10dp"/>
|
||||
<fragment android:id="@+id/article" android:layout_height="fill_parent"
|
||||
android:layout_width="400dp"
|
||||
android:layout_marginRight="10dp"/>
|
||||
<fragment android:id="@+id/article"
|
||||
android:layout_height="fill_parent"
|
||||
android:name="com.example.android.newsreader.ArticleFragment"
|
||||
android:layout_width="fill_parent" />
|
||||
</LinearLayout>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
|
||||
@@ -14,14 +14,19 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:orientation="horizontal">
|
||||
<fragment android:id="@+id/headlines" android:layout_height="fill_parent"
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="horizontal">
|
||||
<fragment android:id="@+id/headlines"
|
||||
android:layout_height="fill_parent"
|
||||
android:name="com.example.android.newsreader.HeadlinesFragment"
|
||||
android:layout_width="200dp" android:layout_marginRight="10dp"/>
|
||||
<fragment android:id="@+id/article" android:layout_height="fill_parent"
|
||||
android:layout_width="200dp"
|
||||
android:layout_marginRight="10dp"/>
|
||||
<fragment android:id="@+id/article"
|
||||
android:layout_height="fill_parent"
|
||||
android:name="com.example.android.newsreader.ArticleFragment"
|
||||
android:layout_width="fill_parent" />
|
||||
</LinearLayout>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<resources>
|
||||
<item name="main_layout" type="layout">@layout/twopanes</item>
|
||||
<string name="has_two_panes">true</string>
|
||||
<bool name="has_two_panes">true</bool>
|
||||
</resources>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
@@ -14,7 +14,9 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<resources>
|
||||
<item name="main_layout" type="layout">@layout/onepane</item>
|
||||
<string name="has_two_panes">false</string>
|
||||
<bool name="has_two_panes">false</bool>
|
||||
</resources>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
@@ -14,6 +14,9 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<resources>
|
||||
<item name="main_layout" type="layout">@layout/onepane</item>
|
||||
<bool name="has_two_panes">false</bool>
|
||||
</resources>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
@@ -14,7 +14,9 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<resources>
|
||||
<item name="main_layout" type="layout">@layout/twopanes</item>
|
||||
<string name="has_two_panes">true</string>
|
||||
<bool name="has_two_panes">true</bool>
|
||||
</resources>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
@@ -14,7 +14,9 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<resources>
|
||||
<item name="main_layout" type="layout">@layout/twopanes_narrow</item>
|
||||
<string name="has_two_panes">true</string>
|
||||
<bool name="has_two_panes">true</bool>
|
||||
</resources>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
@@ -14,7 +14,9 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- BEGIN_INCLUDE(all) -->
|
||||
<resources>
|
||||
<item name="main_layout" type="layout">@layout/onepane_with_bar</item>
|
||||
<string name="has_two_panes">false</string>
|
||||
<bool name="has_two_panes">false</bool>
|
||||
</resources>
|
||||
<!-- END_INCLUDE(all) -->
|
||||
@@ -47,11 +47,8 @@ public class ArticleActivity extends FragmentActivity {
|
||||
mCatIndex = getIntent().getExtras().getInt("catIndex", 0);
|
||||
mArtIndex = getIntent().getExtras().getInt("artIndex", 0);
|
||||
|
||||
// If we are in two-pane layout mode and the device is in landscape orientation, we are
|
||||
// no longer necessary
|
||||
if (getResources().getString(R.string.has_two_panes).equals("true") &&
|
||||
getResources().getConfiguration().orientation ==
|
||||
Configuration.ORIENTATION_LANDSCAPE) {
|
||||
// If we are in two-pane layout mode, this activity is no longer necessary
|
||||
if (getResources().getBoolean(R.bool.has_two_panes)) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user