Viewing your favourites is now accessible on the main menu.
This commit is contained in:
parent
dab6807bff
commit
e59c0534c7
|
@ -37,6 +37,7 @@
|
|||
<activity android:name=".ViewTagActivity" />
|
||||
<activity android:name=".AccountActivity" />
|
||||
<activity android:name=".PreferencesActivity" />
|
||||
<activity android:name=".FavouritesActivity" />
|
||||
<service
|
||||
android:name=".PullNotificationService"
|
||||
android:description="@string/notification_service_description"
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/* Copyright 2017 Andrew Dawson
|
||||
*
|
||||
* This file is part of Tusky.
|
||||
*
|
||||
* Tusky is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with Tusky. If not, see
|
||||
* <http://www.gnu.org/licenses/>. */
|
||||
|
||||
package com.keylesspalace.tusky;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
||||
public class FavouritesActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_favourites);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
ActionBar bar = getSupportActionBar();
|
||||
if (bar != null) {
|
||||
bar.setTitle(getString(R.string.title_favourites));
|
||||
}
|
||||
|
||||
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
|
||||
Fragment fragment = TimelineFragment.newInstance(TimelineFragment.Kind.FAVOURITES);
|
||||
fragmentTransaction.add(R.id.fragment_container, fragment);
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
}
|
|
@ -161,23 +161,37 @@ public class MainActivity extends BaseActivity {
|
|||
Log.e(TAG, "Failed to fetch user info. " + exception.getMessage());
|
||||
}
|
||||
|
||||
private void compose() {
|
||||
Intent intent = new Intent(this, ComposeActivity.class);
|
||||
startActivity(intent);
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.main_toolbar, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
private void viewProfile() {
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_compose: {
|
||||
Intent intent = new Intent(this, ComposeActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
case R.id.action_profile: {
|
||||
Intent intent = new Intent(this, AccountActivity.class);
|
||||
intent.putExtra("id", loggedInAccountId);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void viewPreferences() {
|
||||
case R.id.action_preferences: {
|
||||
Intent intent = new Intent(this, PreferencesActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void logOut() {
|
||||
case R.id.action_favourites: {
|
||||
Intent intent = new Intent(this, FavouritesActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
case R.id.action_logout: {
|
||||
if (notificationServiceEnabled) {
|
||||
alarmManager.cancel(serviceAlarmIntent);
|
||||
}
|
||||
|
@ -190,31 +204,6 @@ public class MainActivity extends BaseActivity {
|
|||
Intent intent = new Intent(this, SplashActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.main_toolbar, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_compose: {
|
||||
compose();
|
||||
return true;
|
||||
}
|
||||
case R.id.action_profile: {
|
||||
viewProfile();
|
||||
return true;
|
||||
}
|
||||
case R.id.action_preferences: {
|
||||
viewPreferences();
|
||||
return true;
|
||||
}
|
||||
case R.id.action_logout: {
|
||||
logOut();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class TimelineFragment extends SFragment implements
|
|||
PUBLIC,
|
||||
TAG,
|
||||
USER,
|
||||
FAVOURITES
|
||||
}
|
||||
|
||||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
|
@ -154,7 +155,7 @@ public class TimelineFragment extends SFragment implements
|
|||
}
|
||||
|
||||
private boolean jumpToTopAllowed() {
|
||||
return kind != Kind.TAG;
|
||||
return kind != Kind.TAG && kind != Kind.FAVOURITES;
|
||||
}
|
||||
|
||||
private void jumpToTop() {
|
||||
|
@ -186,6 +187,10 @@ public class TimelineFragment extends SFragment implements
|
|||
endpoint = String.format(getString(R.string.endpoint_statuses), hashtagOrId);
|
||||
break;
|
||||
}
|
||||
case FAVOURITES: {
|
||||
endpoint = getString(R.string.endpoint_favourites);
|
||||
break;
|
||||
}
|
||||
}
|
||||
String url = "https://" + domain + endpoint;
|
||||
if (fromId != null) {
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_view_thread"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.keylesspalace.tusky.FavouritesActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:elevation="4dp"
|
||||
android:background="?attr/toolbar_background_color" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/overlay_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -19,6 +19,11 @@
|
|||
android:title="@string/action_preferences"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_favourites"
|
||||
android:title="@string/action_favourites"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_logout"
|
||||
android:title="@string/action_logout"
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
<string name="title_statuses">Posts</string>
|
||||
<string name="title_follows">Follows</string>
|
||||
<string name="title_followers">Followers</string>
|
||||
<string name="title_favourites">Favourites</string>
|
||||
|
||||
<string name="status_username_format">\@%s</string>
|
||||
<string name="status_boosted_format">%s boosted</string>
|
||||
|
@ -103,6 +104,7 @@
|
|||
<string name="action_open_in_web">Open In Web</string>
|
||||
<string name="action_preferences">Preferences</string>
|
||||
<string name="action_set_time">Set</string>
|
||||
<string name="action_favourites">Favourites</string>
|
||||
|
||||
<string name="confirmation_send">Toot!</string>
|
||||
|
||||
|
|
Loading…
Reference in New Issue