From 53376da40655c0013c88d5902f56187be09049aa Mon Sep 17 00:00:00 2001 From: Vavassor Date: Thu, 30 Mar 2017 22:31:17 -0400 Subject: [PATCH] Adds the local timeline. --- .../com/keylesspalace/tusky/MainActivity.java | 8 +++--- .../keylesspalace/tusky/TimelineFragment.java | 9 +++++-- .../tusky/TimelinePagerAdapter.java | 7 +++-- app/src/main/res/drawable/ic_local_24dp.xml | 27 +++++++++++++++++++ app/src/main/res/values/strings.xml | 3 ++- 5 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/drawable/ic_local_24dp.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java index 50d63945..5dab697f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java @@ -111,7 +111,8 @@ public class MainActivity extends BaseActivity { String[] pageTitles = { getString(R.string.title_home), getString(R.string.title_notifications), - getString(R.string.title_public) + getString(R.string.title_public_federated), + getString(R.string.title_public_local), }; adapter.setPageTitles(pageTitles); @@ -126,7 +127,8 @@ public class MainActivity extends BaseActivity { tabLayout.getTabAt(0).setIcon(R.drawable.ic_home_24dp); tabLayout.getTabAt(1).setIcon(R.drawable.ic_notifications_24dp); - tabLayout.getTabAt(2).setIcon(R.drawable.ic_public_24dp); + tabLayout.getTabAt(2).setIcon(R.drawable.ic_local_24dp); + tabLayout.getTabAt(3).setIcon(R.drawable.ic_public_24dp); tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override @@ -167,7 +169,7 @@ public class MainActivity extends BaseActivity { } } } - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 4; i++) { tintTab(tabLayout.getTabAt(i), i == tabSelected); } diff --git a/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java b/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java index 2b58a710..27a96dc8 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java @@ -43,7 +43,8 @@ public class TimelineFragment extends SFragment implements enum Kind { HOME, - PUBLIC, + PUBLIC_LOCAL, + PUBLIC_FEDERATED, TAG, USER, FAVOURITES @@ -186,10 +187,14 @@ public class TimelineFragment extends SFragment implements listCall = api.homeTimeline(fromId, uptoId, null); break; } - case PUBLIC: { + case PUBLIC_FEDERATED: { listCall = api.publicTimeline(null, fromId, uptoId, null); break; } + case PUBLIC_LOCAL: { + listCall = api.publicTimeline(true, fromId, uptoId, null); + break; + } case TAG: { listCall = api.hashtagTimeline(hashtagOrId, null, fromId, uptoId, null); break; diff --git a/app/src/main/java/com/keylesspalace/tusky/TimelinePagerAdapter.java b/app/src/main/java/com/keylesspalace/tusky/TimelinePagerAdapter.java index d610df84..fdb5efb2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TimelinePagerAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/TimelinePagerAdapter.java @@ -40,7 +40,10 @@ class TimelinePagerAdapter extends FragmentPagerAdapter { return NotificationsFragment.newInstance(); } case 2: { - return TimelineFragment.newInstance(TimelineFragment.Kind.PUBLIC); + return TimelineFragment.newInstance(TimelineFragment.Kind.PUBLIC_LOCAL); + } + case 3: { + return TimelineFragment.newInstance(TimelineFragment.Kind.PUBLIC_FEDERATED); } default: { return null; @@ -50,7 +53,7 @@ class TimelinePagerAdapter extends FragmentPagerAdapter { @Override public int getCount() { - return 3; + return 4; } @Override diff --git a/app/src/main/res/drawable/ic_local_24dp.xml b/app/src/main/res/drawable/ic_local_24dp.xml new file mode 100644 index 00000000..0d95dd5e --- /dev/null +++ b/app/src/main/res/drawable/ic_local_24dp.xml @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b66585dc..75e0d85f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -23,7 +23,8 @@ Home Notifications - Public + Local + Federated Thread #%s Posts