Skip to content

Commit a91723c

Browse files
committed
NOS+Bible: Center text content in 600dp container on tablets
1 parent 686c21e commit a91723c

File tree

11 files changed

+42
-5
lines changed

11 files changed

+42
-5
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
style="@style/ChapterView"/>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
style="@style/SongView"/>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Chapter View -->
4+
<style name="ChapterView">
5+
<item name="android:layout_width">600dp</item>
6+
<item name="android:layout_height">match_parent</item>
7+
<item name="android:layout_gravity">center_horizontal</item>
8+
<item name="android:orientation">vertical</item>
9+
<item name="android:paddingTop">8dp</item>
10+
<item name="android:paddingLeft">16dp</item>
11+
<item name="android:paddingRight">16dp</item>
12+
<item name="android:paddingBottom">8dp</item>
13+
</style>
14+
15+
<!-- Song View -->
16+
<style name="SongView" parent="ChapterView"></style>
17+
</resources>

bin/bible/res/values/styles.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@
184184

185185
<!-- Chapter View -->
186186
<style name="ChapterView">
187+
<item name="android:layout_width">match_parent</item>
188+
<item name="android:layout_height">match_parent</item>
187189
<item name="android:orientation">vertical</item>
188190
<item name="android:paddingTop">8dp</item>
189191
<item name="android:paddingLeft">16dp</item>

bin/bible/src/nl/plaatsoft/bible/views/ChapterView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import android.text.style.ForegroundColorSpan;
1818
import android.text.style.RelativeSizeSpan;
1919
import android.util.AttributeSet;
20+
import android.view.LayoutInflater;
2021
import android.view.View;
2122
import android.widget.ImageButton;
2223
import android.widget.LinearLayout;
@@ -48,7 +49,7 @@ public static interface OnNextListener {
4849
@SuppressWarnings("this-escape")
4950
public ChapterView(Context context, @Nullable AttributeSet attrs) {
5051
super(context, attrs);
51-
root = new LinearLayout(context, null, 0, R.style.ChapterView);
52+
root = (LinearLayout)LayoutInflater.from(getContext()).inflate(R.layout.item_chapter_view, this, false);
5253
addView(root);
5354
}
5455

bin/bible/src/nl/plaatsoft/bible/views/SongView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import android.text.style.ForegroundColorSpan;
1515
import android.text.style.RelativeSizeSpan;
1616
import android.util.AttributeSet;
17+
import android.view.LayoutInflater;
1718
import android.view.View;
1819
import android.widget.ImageButton;
1920
import android.widget.LinearLayout;
@@ -44,7 +45,7 @@ public static interface OnNextListener {
4445
@SuppressWarnings("this-escape")
4546
public SongView(Context context, @Nullable AttributeSet attrs) {
4647
super(context, attrs);
47-
root = new LinearLayout(context, null, 0, R.style.SongView);
48+
root = (LinearLayout)LayoutInflater.from(getContext()).inflate(R.layout.item_song_view, this, false);
4849
addView(root);
4950
}
5051

bin/nos/res/layout/activity_article.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<ScrollView android:id="@+id/article_scroll"
1818
style="@style/Flex">
1919

20-
<LinearLayout style="@style/Fill">
20+
<LinearLayout style="@style/Container">
2121
<ImageView android:id="@+id/article_image"
2222
style="@style/ArticleActivityImage" />
2323

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Containers -->
4+
<style name="Container" parent="Fill">
5+
<item name="android:layout_width">600dp</item>
6+
<item name="android:layout_gravity">center_horizontal</item>
7+
</style>
8+
</resources>

bin/nos/res/values/styles.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<item name="android:fillViewport">true</item>
1717
</style>
1818

19+
<style name="Container" parent="Fill"></style>
20+
1921
<!-- Action bar -->
2022
<style name="ActionBar">
2123
<item name="android:layout_width">match_parent</item>

bin/nos/src/nl/plaatsoft/nos/android/activities/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
import nl.plaatsoft.android.fetch.FetchDataTask;
3737
import nl.plaatsoft.nos.android.R;
3838
import nl.plaatsoft.nos.android.RssParser;
39-
import nl.plaatsoft.nos.android.components.ArticlesAdapter;
4039
import nl.plaatsoft.nos.android.models.Article;
40+
import nl.plaatsoft.nos.android.views.ArticlesAdapter;
4141

4242
import org.json.JSONArray;
4343
import org.json.JSONObject;

0 commit comments

Comments
 (0)