diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 480c07b6c..a929daa3a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -37,6 +37,7 @@
+
. */
+
+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();
+ }
+}
diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java
index 23426aa04..7a2ee6a57 100644
--- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java
+++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java
@@ -161,37 +161,6 @@ 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);
- }
-
- private void viewProfile() {
- Intent intent = new Intent(this, AccountActivity.class);
- intent.putExtra("id", loggedInAccountId);
- startActivity(intent);
- }
-
- private void viewPreferences() {
- Intent intent = new Intent(this, PreferencesActivity.class);
- startActivity(intent);
- }
-
- private void logOut() {
- if (notificationServiceEnabled) {
- alarmManager.cancel(serviceAlarmIntent);
- }
- SharedPreferences preferences = getSharedPreferences(
- getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = preferences.edit();
- editor.remove("domain");
- editor.remove("accessToken");
- editor.apply();
- Intent intent = new Intent(this, SplashActivity.class);
- startActivity(intent);
- finish();
- }
-
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_toolbar, menu);
@@ -202,19 +171,39 @@ public class MainActivity extends BaseActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_compose: {
- compose();
+ Intent intent = new Intent(this, ComposeActivity.class);
+ startActivity(intent);
return true;
}
case R.id.action_profile: {
- viewProfile();
+ Intent intent = new Intent(this, AccountActivity.class);
+ intent.putExtra("id", loggedInAccountId);
+ startActivity(intent);
return true;
}
case R.id.action_preferences: {
- viewPreferences();
+ Intent intent = new Intent(this, PreferencesActivity.class);
+ startActivity(intent);
+ return true;
+ }
+ case R.id.action_favourites: {
+ Intent intent = new Intent(this, FavouritesActivity.class);
+ startActivity(intent);
return true;
}
case R.id.action_logout: {
- logOut();
+ if (notificationServiceEnabled) {
+ alarmManager.cancel(serviceAlarmIntent);
+ }
+ SharedPreferences preferences = getSharedPreferences(
+ getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.remove("domain");
+ editor.remove("accessToken");
+ editor.apply();
+ Intent intent = new Intent(this, SplashActivity.class);
+ startActivity(intent);
+ finish();
return true;
}
}
diff --git a/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java b/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java
index f13756d37..50a62c2d6 100644
--- a/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java
+++ b/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java
@@ -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) {
diff --git a/app/src/main/res/layout/activity_favourites.xml b/app/src/main/res/layout/activity_favourites.xml
new file mode 100644
index 000000000..f64acdbfc
--- /dev/null
+++ b/app/src/main/res/layout/activity_favourites.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/main_toolbar.xml b/app/src/main/res/menu/main_toolbar.xml
index 6da838bb4..57ee72a22 100644
--- a/app/src/main/res/menu/main_toolbar.xml
+++ b/app/src/main/res/menu/main_toolbar.xml
@@ -19,6 +19,11 @@
android:title="@string/action_preferences"
app:showAsAction="never" />
+
+
- Posts
Follows
Followers
+ Favourites
\@%s
%s boosted
@@ -103,6 +104,7 @@
Open In Web
Preferences
Set
+ Favourites
Toot!