Merge branch 'account-activity-improvements' of https://github.com/connyduck/Tusky into connyduck-account-activity-improvements

This commit is contained in:
Vavassor 2017-08-08 21:23:16 -04:00
commit ad399eedf1
13 changed files with 297 additions and 167 deletions

View file

@ -41,11 +41,13 @@ import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.keylesspalace.tusky.entity.Account; import com.keylesspalace.tusky.entity.Account;
import com.keylesspalace.tusky.entity.Relationship; import com.keylesspalace.tusky.entity.Relationship;
import com.keylesspalace.tusky.interfaces.ActionButtonActivity;
import com.keylesspalace.tusky.interfaces.LinkListener; import com.keylesspalace.tusky.interfaces.LinkListener;
import com.keylesspalace.tusky.pager.AccountPagerAdapter; import com.keylesspalace.tusky.pager.AccountPagerAdapter;
import com.keylesspalace.tusky.receiver.TimelineReceiver; import com.keylesspalace.tusky.receiver.TimelineReceiver;
@ -63,7 +65,7 @@ import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
public class AccountActivity extends BaseActivity { public class AccountActivity extends BaseActivity implements ActionButtonActivity {
private static final String TAG = "AccountActivity"; // logging tag private static final String TAG = "AccountActivity"; // logging tag
private enum FollowState { private enum FollowState {
@ -81,9 +83,13 @@ public class AccountActivity extends BaseActivity {
private CircularImageView avatar; private CircularImageView avatar;
private ImageView header; private ImageView header;
private FloatingActionButton floatingBtn; private FloatingActionButton floatingBtn;
private Button followBtn;
private TextView followsYouView;
private TabLayout tabLayout; private TabLayout tabLayout;
private ImageView accountLockedView; private ImageView accountLockedView;
private View container; private View container;
private boolean hideFab;
private int oldOffset;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -93,6 +99,8 @@ public class AccountActivity extends BaseActivity {
avatar = (CircularImageView) findViewById(R.id.account_avatar); avatar = (CircularImageView) findViewById(R.id.account_avatar);
header = (ImageView) findViewById(R.id.account_header); header = (ImageView) findViewById(R.id.account_header);
floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn); floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn);
followBtn = (Button) findViewById(R.id.follow_btn);
followsYouView = (TextView) findViewById(R.id.account_follows_you);
tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout = (TabLayout) findViewById(R.id.tab_layout);
accountLockedView = (ImageView) findViewById(R.id.account_locked); accountLockedView = (ImageView) findViewById(R.id.account_locked);
container = findViewById(R.id.activity_account); container = findViewById(R.id.activity_account);
@ -124,6 +132,8 @@ public class AccountActivity extends BaseActivity {
actionBar.setDisplayShowHomeEnabled(true); actionBar.setDisplayShowHomeEnabled(true);
} }
hideFab = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("fabHide", false);
// Add a listener to change the toolbar icon color when it enters/exits its collapsed state. // Add a listener to change the toolbar icon color when it enters/exits its collapsed state.
AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.account_app_bar_layout); AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.account_app_bar_layout);
final CollapsingToolbarLayout collapsingToolbar = final CollapsingToolbarLayout collapsingToolbar =
@ -155,11 +165,23 @@ public class AccountActivity extends BaseActivity {
ThemeUtils.setDrawableTint(context, toolbar.getNavigationIcon(), attribute); ThemeUtils.setDrawableTint(context, toolbar.getNavigationIcon(), attribute);
ThemeUtils.setDrawableTint(context, toolbar.getOverflowIcon(), attribute); ThemeUtils.setDrawableTint(context, toolbar.getOverflowIcon(), attribute);
} }
if(floatingBtn != null && hideFab && !isSelf && !blocking) {
if (verticalOffset > oldOffset) {
floatingBtn.show();
}
if (verticalOffset < oldOffset) {
floatingBtn.hide();
}
}
oldOffset = verticalOffset;
} }
}); });
// Initialise the default UI states. // Initialise the default UI states.
floatingBtn.hide(); floatingBtn.hide();
followBtn.setVisibility(View.GONE);
followsYouView.setVisibility(View.GONE);
// Obtain information to fill out the profile. // Obtain information to fill out the profile.
obtainAccount(); obtainAccount();
@ -321,8 +343,7 @@ public class AccountActivity extends BaseActivity {
Response<List<Relationship>> response) { Response<List<Relationship>> response) {
if (response.isSuccessful()) { if (response.isSuccessful()) {
Relationship relationship = response.body().get(0); Relationship relationship = response.body().get(0);
onObtainRelationshipsSuccess(relationship.requested, relationship.following, onObtainRelationshipsSuccess(relationship);
relationship.blocking, relationship.muting);
} else { } else {
onObtainRelationshipsFailure(new Exception(response.message())); onObtainRelationshipsFailure(new Exception(response.message()));
} }
@ -335,40 +356,38 @@ public class AccountActivity extends BaseActivity {
}); });
} }
private void onObtainRelationshipsSuccess(boolean followRequested, boolean following, private void onObtainRelationshipsSuccess(Relationship relation) {
boolean blocking, boolean muting) { if (relation.following) {
if (following) {
followState = FollowState.FOLLOWING; followState = FollowState.FOLLOWING;
} else if (followRequested) { } else if (relation.requested) {
followState = FollowState.REQUESTED; followState = FollowState.REQUESTED;
} else { } else {
followState = FollowState.NOT_FOLLOWING; followState = FollowState.NOT_FOLLOWING;
} }
this.blocking = blocking; this.blocking = relation.blocking;
this.muting = muting; this.muting = relation.muting;
if (followState != FollowState.NOT_FOLLOWING || !blocking || !muting) { if(relation.followedBy) {
invalidateOptionsMenu(); followsYouView.setVisibility(View.VISIBLE);
} else {
followsYouView.setVisibility(View.GONE);
} }
updateButtons(); updateButtons();
} }
private void updateFollowButton(FloatingActionButton button) { private void updateFollowButton(Button button) {
switch (followState) { switch (followState) {
case NOT_FOLLOWING: { case NOT_FOLLOWING: {
button.setImageResource(R.drawable.ic_person_add_24dp); button.setText(getString(R.string.action_follow));
button.setContentDescription(getString(R.string.action_follow));
break; break;
} }
case REQUESTED: { case REQUESTED: {
button.setImageResource(R.drawable.ic_hourglass_24dp); button.setText(getString(R.string.state_follow_requested));
button.setContentDescription(getString(R.string.state_follow_requested));
break; break;
} }
case FOLLOWING: { case FOLLOWING: {
button.setImageResource(R.drawable.ic_person_minus_24px); button.setText(getString(R.string.action_unfollow));
button.setContentDescription(getString(R.string.action_unfollow));
break; break;
} }
} }
@ -379,20 +398,31 @@ public class AccountActivity extends BaseActivity {
if(!isSelf && !blocking) { if(!isSelf && !blocking) {
floatingBtn.show(); floatingBtn.show();
followBtn.setVisibility(View.VISIBLE);
updateFollowButton(floatingBtn); updateFollowButton(followBtn);
floatingBtn.setOnClickListener(new View.OnClickListener() { floatingBtn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (followState != FollowState.REQUESTED) { mention();
}
});
followBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (followState != FollowState.REQUESTED) {
follow(accountId); follow(accountId);
} else { } else {
showFollowRequestPendingDialog(accountId); showFollowRequestPendingDialog(accountId);
} }
updateFollowButton(floatingBtn); updateFollowButton(followBtn);
} }
}); });
} else {
floatingBtn.hide();
followBtn.setVisibility(View.GONE);
} }
} }
@ -543,7 +573,6 @@ public class AccountActivity extends BaseActivity {
.show(); .show();
} }
private void mute(final String id) { private void mute(final String id) {
Callback<Relationship> cb = new Callback<Relationship>() { Callback<Relationship> cb = new Callback<Relationship>() {
@Override @Override
@ -582,6 +611,17 @@ public class AccountActivity extends BaseActivity {
.show(); .show();
} }
private boolean mention() {
if (loadedAccount == null) {
// If the account isn't loaded yet, eat the input.
return false;
}
Intent intent = new Intent(this, ComposeActivity.class);
intent.putExtra("mentioned_usernames", new String[] { loadedAccount.username });
startActivity(intent);
return true;
}
private void broadcast(String action, String id) { private void broadcast(String action, String id) {
Intent intent = new Intent(action); Intent intent = new Intent(action);
intent.putExtra("id", id); intent.putExtra("id", id);
@ -596,14 +636,7 @@ public class AccountActivity extends BaseActivity {
return true; return true;
} }
case R.id.action_mention: { case R.id.action_mention: {
if (loadedAccount == null) { return mention();
// If the account isn't loaded yet, eat the input.
return false;
}
Intent intent = new Intent(this, ComposeActivity.class);
intent.putExtra("mentioned_usernames", new String[] { loadedAccount.username });
startActivity(intent);
return true;
} }
case R.id.action_open_in_web: { case R.id.action_open_in_web: {
if (loadedAccount == null) { if (loadedAccount == null) {
@ -630,4 +663,14 @@ public class AccountActivity extends BaseActivity {
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@Nullable
@Override
public FloatingActionButton getActionButton() {
if(!isSelf && !blocking) {
return floatingBtn;
}
return null;
}
} }

View file

@ -23,6 +23,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.PersistableBundle; import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.graphics.drawable.VectorDrawableCompat; import android.support.graphics.drawable.VectorDrawableCompat;
@ -37,6 +38,7 @@ import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import com.keylesspalace.tusky.entity.Account; import com.keylesspalace.tusky.entity.Account;
import com.keylesspalace.tusky.interfaces.ActionButtonActivity;
import com.keylesspalace.tusky.pager.TimelinePagerAdapter; import com.keylesspalace.tusky.pager.TimelinePagerAdapter;
import com.keylesspalace.tusky.receiver.TimelineReceiver; import com.keylesspalace.tusky.receiver.TimelineReceiver;
import com.keylesspalace.tusky.util.ThemeUtils; import com.keylesspalace.tusky.util.ThemeUtils;
@ -63,7 +65,7 @@ import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
public class MainActivity extends BaseActivity { public class MainActivity extends BaseActivity implements ActionButtonActivity {
private static final String TAG = "MainActivity"; // logging tag private static final String TAG = "MainActivity"; // logging tag
private static final long DRAWER_ITEM_EDIT_PROFILE = 0; private static final long DRAWER_ITEM_EDIT_PROFILE = 0;
private static final long DRAWER_ITEM_FAVOURITES = 1; private static final long DRAWER_ITEM_FAVOURITES = 1;
@ -77,7 +79,8 @@ public class MainActivity extends BaseActivity {
private static final long DRAWER_ITEM_SAVED_TOOT = 9; private static final long DRAWER_ITEM_SAVED_TOOT = 9;
protected static int COMPOSE_RESULT = 1; protected static int COMPOSE_RESULT = 1;
public FloatingActionButton composeButton;
private FloatingActionButton composeButton;
private String loggedInAccountId; private String loggedInAccountId;
private String loggedInAccountUsername; private String loggedInAccountUsername;
private Stack<Integer> pageHistory; private Stack<Integer> pageHistory;
@ -493,4 +496,10 @@ public class MainActivity extends BaseActivity {
private void onFetchUserInfoFailure(Exception exception) { private void onFetchUserInfoFailure(Exception exception) {
Log.e(TAG, "Failed to fetch user info. " + exception.getMessage()); Log.e(TAG, "Failed to fetch user info. " + exception.getMessage());
} }
@Nullable
@Override
public FloatingActionButton getActionButton() {
return composeButton;
}
} }

View file

@ -17,9 +17,12 @@ package com.keylesspalace.tusky.fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.DividerItemDecoration;
@ -42,6 +45,7 @@ import com.keylesspalace.tusky.BaseActivity;
import com.keylesspalace.tusky.entity.Account; import com.keylesspalace.tusky.entity.Account;
import com.keylesspalace.tusky.entity.Relationship; import com.keylesspalace.tusky.entity.Relationship;
import com.keylesspalace.tusky.interfaces.AccountActionListener; import com.keylesspalace.tusky.interfaces.AccountActionListener;
import com.keylesspalace.tusky.interfaces.ActionButtonActivity;
import com.keylesspalace.tusky.network.MastodonApi; import com.keylesspalace.tusky.network.MastodonApi;
import com.keylesspalace.tusky.R; import com.keylesspalace.tusky.R;
import com.keylesspalace.tusky.util.HttpHeaderLink; import com.keylesspalace.tusky.util.HttpHeaderLink;
@ -77,6 +81,7 @@ public class AccountListFragment extends BaseFragment implements AccountActionLi
private int bottomFetches; private int bottomFetches;
private boolean topLoading; private boolean topLoading;
private int topFetches; private int topFetches;
private boolean hideFab;
public static AccountListFragment newInstance(Type type) { public static AccountListFragment newInstance(Type type) {
Bundle arguments = new Bundle(); Bundle arguments = new Bundle();
@ -168,15 +173,56 @@ public class AccountListFragment extends BaseFragment implements AccountActionLi
* activity is created, so everything needing to access the api object has to be delayed * activity is created, so everything needing to access the api object has to be delayed
* until here. */ * until here. */
api = activity.mastodonApi; api = activity.mastodonApi;
scrollListener = new EndlessOnScrollListener(layoutManager) {
@Override
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) { if (actionButtonPresent()) {
AccountListFragment.this.onLoadMore(view); /* Use a modified scroll listener that both loads more statuses as it goes, and hides
} * the follow button on down-scroll. */
}; SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
hideFab = preferences.getBoolean("fabHide", false);
scrollListener = new EndlessOnScrollListener(layoutManager) {
@Override
public void onScrolled(RecyclerView view, int dx, int dy) {
super.onScrolled(view, dx, dy);
ActionButtonActivity actionButtonActivity = (ActionButtonActivity) getActivity();
FloatingActionButton composeButton = actionButtonActivity.getActionButton();
if (composeButton != null) {
if (hideFab) {
if (dy > 0 && composeButton.isShown()) {
composeButton.hide(); // hides the button if we're scrolling down
} else if (dy < 0 && !composeButton.isShown()) {
composeButton.show(); // shows it if we are scrolling up
}
} else if (!composeButton.isShown()) {
composeButton.show();
}
}
}
@Override
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
AccountListFragment.this.onLoadMore(view);
}
};
} else {
// Just use the basic scroll listener to load more accounts.
scrollListener = new EndlessOnScrollListener(layoutManager) {
@Override
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
AccountListFragment.this.onLoadMore(view);
}
};
}
recyclerView.addOnScrollListener(scrollListener); recyclerView.addOnScrollListener(scrollListener);
} }
private boolean actionButtonPresent() {
return type == Type.FOLLOWS || type == Type.FOLLOWERS;
}
@Override @Override
public void onDestroyView() { public void onDestroyView() {
if (jumpToTopAllowed()) { if (jumpToTopAllowed()) {

View file

@ -40,6 +40,7 @@ import com.keylesspalace.tusky.adapter.NotificationsAdapter;
import com.keylesspalace.tusky.R; import com.keylesspalace.tusky.R;
import com.keylesspalace.tusky.entity.Notification; import com.keylesspalace.tusky.entity.Notification;
import com.keylesspalace.tusky.entity.Status; import com.keylesspalace.tusky.entity.Status;
import com.keylesspalace.tusky.interfaces.ActionButtonActivity;
import com.keylesspalace.tusky.interfaces.StatusActionListener; import com.keylesspalace.tusky.interfaces.StatusActionListener;
import com.keylesspalace.tusky.receiver.TimelineReceiver; import com.keylesspalace.tusky.receiver.TimelineReceiver;
import com.keylesspalace.tusky.util.HttpHeaderLink; import com.keylesspalace.tusky.util.HttpHeaderLink;
@ -172,9 +173,7 @@ public class NotificationsFragment extends SFragment implements
* guaranteed to be set until then. * guaranteed to be set until then.
* Use a modified scroll listener that both loads more notifications as it goes, and hides * Use a modified scroll listener that both loads more notifications as it goes, and hides
* the compose button on down-scroll. */ * the compose button on down-scroll. */
final FloatingActionButton composeButton = activity.composeButton; SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(
activity);
preferences.registerOnSharedPreferenceChangeListener(this); preferences.registerOnSharedPreferenceChangeListener(this);
hideFab = preferences.getBoolean("fabHide", false); hideFab = preferences.getBoolean("fabHide", false);
scrollListener = new EndlessOnScrollListener(layoutManager) { scrollListener = new EndlessOnScrollListener(layoutManager) {
@ -182,14 +181,19 @@ public class NotificationsFragment extends SFragment implements
public void onScrolled(RecyclerView view, int dx, int dy) { public void onScrolled(RecyclerView view, int dx, int dy) {
super.onScrolled(view, dx, dy); super.onScrolled(view, dx, dy);
if (hideFab) { ActionButtonActivity activity = (ActionButtonActivity) getActivity();
if (dy > 0 && composeButton.isShown()) { FloatingActionButton composeButton = activity.getActionButton();
composeButton.hide(); // hides the button if we're scrolling down
} else if (dy < 0 && !composeButton.isShown()) { if(composeButton != null) {
composeButton.show(); // shows it if we are scrolling up if (hideFab) {
if (dy > 0 && composeButton.isShown()) {
composeButton.hide(); // hides the button if we're scrolling down
} else if (dy < 0 && !composeButton.isShown()) {
composeButton.show(); // shows it if we are scrolling up
}
} else if (!composeButton.isShown()) {
composeButton.show();
} }
} else if (!composeButton.isShown()) {
composeButton.show();
} }
} }

View file

@ -34,11 +34,11 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.keylesspalace.tusky.BuildConfig; import com.keylesspalace.tusky.BuildConfig;
import com.keylesspalace.tusky.MainActivity;
import com.keylesspalace.tusky.R; import com.keylesspalace.tusky.R;
import com.keylesspalace.tusky.adapter.FooterViewHolder; import com.keylesspalace.tusky.adapter.FooterViewHolder;
import com.keylesspalace.tusky.adapter.TimelineAdapter; import com.keylesspalace.tusky.adapter.TimelineAdapter;
import com.keylesspalace.tusky.entity.Status; import com.keylesspalace.tusky.entity.Status;
import com.keylesspalace.tusky.interfaces.ActionButtonActivity;
import com.keylesspalace.tusky.interfaces.StatusActionListener; import com.keylesspalace.tusky.interfaces.StatusActionListener;
import com.keylesspalace.tusky.network.MastodonApi; import com.keylesspalace.tusky.network.MastodonApi;
import com.keylesspalace.tusky.receiver.TimelineReceiver; import com.keylesspalace.tusky.receiver.TimelineReceiver;
@ -195,28 +195,30 @@ public class TimelineFragment extends SFragment implements
/* This is delayed until onActivityCreated solely because MainActivity.composeButton isn't /* This is delayed until onActivityCreated solely because MainActivity.composeButton isn't
* guaranteed to be set until then. */ * guaranteed to be set until then. */
if (composeButtonPresent()) { if (actionButtonPresent()) {
/* Use a modified scroll listener that both loads more statuses as it goes, and hides /* Use a modified scroll listener that both loads more statuses as it goes, and hides
* the follow button on down-scroll. */ * the follow button on down-scroll. */
MainActivity activity = (MainActivity) getActivity(); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
final FloatingActionButton composeButton = activity.composeButton;
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(
activity);
hideFab = preferences.getBoolean("fabHide", false); hideFab = preferences.getBoolean("fabHide", false);
scrollListener = new EndlessOnScrollListener(layoutManager) { scrollListener = new EndlessOnScrollListener(layoutManager) {
@Override @Override
public void onScrolled(RecyclerView view, int dx, int dy) { public void onScrolled(RecyclerView view, int dx, int dy) {
super.onScrolled(view, dx, dy); super.onScrolled(view, dx, dy);
if (hideFab) { ActionButtonActivity activity = (ActionButtonActivity) getActivity();
if (dy > 0 && composeButton.isShown()) { FloatingActionButton composeButton = activity.getActionButton();
composeButton.hide(); // hides the button if we're scrolling down
} else if (dy < 0 && !composeButton.isShown()) { if (composeButton != null) {
composeButton.show(); // shows it if we are scrolling up if (hideFab) {
if (dy > 0 && composeButton.isShown()) {
composeButton.hide(); // hides the button if we're scrolling down
} else if (dy < 0 && !composeButton.isShown()) {
composeButton.show(); // shows it if we are scrolling up
}
} else if (!composeButton.isShown()) {
composeButton.show();
} }
} else if (!composeButton.isShown()) { }
composeButton.show();
}
} }
@Override @Override
@ -438,8 +440,8 @@ public class TimelineFragment extends SFragment implements
return kind != Kind.TAG && kind != Kind.FAVOURITES; return kind != Kind.TAG && kind != Kind.FAVOURITES;
} }
private boolean composeButtonPresent() { private boolean actionButtonPresent() {
return kind != Kind.TAG && kind != Kind.FAVOURITES && kind != Kind.USER; return kind != Kind.TAG && kind != Kind.FAVOURITES;
} }
private void jumpToTop() { private void jumpToTop() {

View file

@ -0,0 +1,26 @@
/* Copyright 2017 Andrew Dawson
*
* This file is a part of Tusky.
*
* This program 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.interfaces;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
public interface ActionButtonActivity {
/* return the ActionButton of the Activity to hide or show it on scroll */
@Nullable
FloatingActionButton getActionButton();
}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="false" android:color="?android:attr/textColorTertiary"/>
<item android:state_selected="true" android:color="?attr/colorAccent"/>
</selector>

View file

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M6,2v6h0.01L6,8.01 10,12l-4,4 0.01,0.01L6,16.01L6,22h12v-5.99h-0.01L18,16l-4,-4 4,-3.99 -0.01,-0.01L18,8L18,2L6,2zM16,16.5L16,20L8,20v-3.5l4,-4 4,4zM12,11.5l-4,-4L8,4h8v3.5l-4,4z"/>
</vector>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/toolbar_icon_dark"
android:pathData="M14.4,12c2.7,0.4,5-1.9,4.6-4.6c-0.3-1.7-1.6-3.1-3.3-3.3c-2.7-0.4-5,1.9-4.6,4.6C11.3,10.3,12.7,11.7,14.4,12z
M6,12h3v-2H6H4H1v2h3H6z M15,14c-2.7,0-8,1.3-8,4v2h16v-2C23,15.3,17.7,14,15,14z" />
</vector>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_account" android:id="@+id/activity_account"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -39,90 +40,97 @@
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:layout_collapseMode="pin" /> app:layout_collapseMode="pin" />
<LinearLayout <RelativeLayout
android:id="@+id/account_header_info" android:id="@+id/account_header_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/account_header_gradient" android:background="@drawable/account_header_gradient"
android:orientation="vertical" android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="?attr/actionBarSize" android:paddingTop="?attr/actionBarSize"
app:layout_collapseMode="parallax"> app:layout_collapseMode="parallax">
<RelativeLayout <com.pkmmte.view.CircularImageView
android:id="@+id/account_avatar"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@+id/follow_btn"
android:layout_toStartOf="@+id/follow_btn"
android:src="@drawable/avatar_default"
app:shadow="true" />
<Button
android:id="@+id/follow_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="6dp" />
<TextView
android:id="@+id/account_follows_you"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/follow_btn"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="@string/follows_you"
android:textColor="?android:textColorPrimary" />
<TextView
android:id="@+id/account_display_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="16dp" android:layout_below="@id/account_avatar"
android:paddingRight="16dp" android:ellipsize="end"
android:paddingTop="16dp"> android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="18sp"
android:textStyle="normal|bold"
tools:text="Tusky Mastodon Client" />
<com.pkmmte.view.CircularImageView <TextView
android:id="@+id/account_avatar" android:id="@+id/account_username"
android:layout_width="80dp" android:layout_width="wrap_content"
android:layout_height="80dp" android:layout_height="wrap_content"
android:layout_marginEnd="10dp" android:layout_below="@id/account_display_name"
android:layout_marginRight="10dp" android:ellipsize="end"
android:src="@drawable/avatar_default" android:maxLines="1"
app:shadow="true" /> android:textColor="?android:textColorSecondary"
tools:text="\@Tusky" />
<LinearLayout <ImageView
android:layout_width="wrap_content" android:id="@+id/account_locked"
android:layout_height="wrap_content" android:layout_width="16sp"
android:layout_alignParentEnd="true" android:layout_height="16sp"
android:layout_alignParentRight="true" android:layout_alignBottom="@id/account_username"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toEndOf="@id/account_avatar" android:layout_marginLeft="4dp"
android:layout_toRightOf="@id/account_avatar" android:layout_marginStart="4dp"
android:orientation="vertical"> android:layout_toEndOf="@id/account_username"
android:layout_toRightOf="@id/account_username"
<TextView android:contentDescription="@string/description_account_locked"
android:id="@+id/account_display_name" android:tint="?android:textColorSecondary"
android:layout_width="wrap_content" android:visibility="gone"
android:layout_height="wrap_content" app:srcCompat="@drawable/reblog_disabled_light" />
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="18sp"
android:textStyle="normal|bold" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/account_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary" />
<ImageView
android:id="@+id/account_locked"
android:layout_width="16sp"
android:layout_height="16sp"
android:layout_centerVertical="true"
android:layout_marginLeft="4dp"
android:layout_marginStart="4dp"
android:layout_toEndOf="@id/account_username"
android:layout_toRightOf="@id/account_username"
android:contentDescription="@string/description_account_locked"
android:tint="?android:textColorSecondary"
android:visibility="gone"
app:srcCompat="@drawable/reblog_disabled_light" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<TextView <TextView
android:id="@+id/account_note" android:id="@+id/account_note"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:layout_below="@id/account_username"
android:paddingBottom="16dp"
android:paddingTop="10dp" android:paddingTop="10dp"
android:textColor="?android:textColorTertiary" /> android:textColor="?android:textColorTertiary"
tools:text="This is a test description" />
</LinearLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
@ -150,7 +158,8 @@
android:id="@+id/tab_layout" android:id="@+id/tab_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:tabBackground="?android:colorBackground"> app:tabBackground="?android:colorBackground"
app:tabGravity="fill">
<android.support.design.widget.TabItem <android.support.design.widget.TabItem
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -168,11 +177,6 @@
</android.support.v4.view.ViewPager> </android.support.v4.view.ViewPager>
<FrameLayout
android:id="@+id/overlay_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View <View
android:id="@+id/tab_bottom_shadow" android:id="@+id/tab_bottom_shadow"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -188,7 +192,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_margin="16dp"
android:contentDescription="@string/action_follow" android:contentDescription="@string/action_mention"
app:srcCompat="@drawable/ic_person_add_24dp" /> app:srcCompat="@drawable/ic_create_24dp" />
<FrameLayout
android:id="@+id/overlay_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View file

@ -1,25 +1,26 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true"> android:layout_centerInParent="true">
<TextView <TextView
android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/title"
android:layout_marginTop="8dp"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="6dp"
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="@color/account_tab_font_color"
android:textStyle="normal|bold" /> android:textStyle="normal|bold" />
<TextView <TextView
android:id="@+id/total"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/total"
android:layout_centerHorizontal="true"
android:layout_below="@id/title" android:layout_below="@id/title"
android:textSize="10sp" /> android:layout_centerHorizontal="true"
android:textColor="@color/account_tab_font_color"
android:textSize="12sp" />
</RelativeLayout> </RelativeLayout>

View file

@ -192,5 +192,8 @@
<string name="pref_title_status_filter">Timeline-Filter</string> <string name="pref_title_status_filter">Timeline-Filter</string>
<string name="title_saved_toot">Gespeicherte Tröts</string> <string name="title_saved_toot">Gespeicherte Tröts</string>
<string name="follows_you">Folgt dir</string>
</resources> </resources>

View file

@ -161,7 +161,7 @@
<string name="pref_title_light_theme">Use the Light Theme</string> <string name="pref_title_light_theme">Use the Light Theme</string>
<string name="pref_title_browser_settings">Browser</string> <string name="pref_title_browser_settings">Browser</string>
<string name="pref_title_custom_tabs">Use Chrome Custom Tabs</string> <string name="pref_title_custom_tabs">Use Chrome Custom Tabs</string>
<string name="pref_title_hide_follow_button">Hide follow button while scrolling</string> <string name="pref_title_hide_follow_button">Hide compose button while scrolling</string>
<string name="pref_title_status_filter">Timeline filtering</string> <string name="pref_title_status_filter">Timeline filtering</string>
<string name="pref_title_status_tabs">Tabs</string> <string name="pref_title_status_tabs">Tabs</string>
<string name="pref_title_show_boosts">Show boosts</string> <string name="pref_title_show_boosts">Show boosts</string>
@ -211,4 +211,7 @@
<string name="abbreviated_minutes_ago">%dm</string> <string name="abbreviated_minutes_ago">%dm</string>
<string name="abbreviated_seconds_ago">%ds</string> <string name="abbreviated_seconds_ago">%ds</string>
<string name="follows_you">Follows you</string>
</resources> </resources>