From 7a5e5dca7ee07390202d67795c4cc8ef819abfe1 Mon Sep 17 00:00:00 2001 From: Zachary Epps Date: Thu, 6 Apr 2017 11:07:40 -0400 Subject: [PATCH] changed AccountActivity so that it shows FAB that allows a user to un/follow a user from it instead of the menu added an xml svg for unfollowing someone removed the useless line from build.gradle that I added in the last pull --- app/build.gradle | 1 - .../keylesspalace/tusky/AccountActivity.java | 19 ++++++++++++++++--- .../res/drawable/ic_person_minus_24px.xml | 12 ++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 app/src/main/res/drawable/ic_person_minus_24px.xml diff --git a/app/build.gradle b/app/build.gradle index 560e5f54d..b05e88672 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -44,7 +44,6 @@ dependencies { compile 'com.jakewharton:butterknife:8.4.0' compile 'com.google.firebase:firebase-messaging:10.0.1' compile 'com.google.firebase:firebase-crash:10.0.1' - compile 'com.github.bluzwong:swipeback:0.2.0@aar' testCompile 'junit:junit:4.12' annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' } diff --git a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java index 7c39f5d16..0c067cb8b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java @@ -294,14 +294,27 @@ public class AccountActivity extends BaseActivity { final FloatingActionButton floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn); - if(!isSelf && !blocking && !following) { + if(!isSelf && !blocking) { floatingBtn.show(); - floatingBtn.setImageResource(R.drawable.ic_person_add_24dp); + + if (following) { + floatingBtn.setImageResource(R.drawable.ic_person_minus_24px); + } else { + floatingBtn.setImageResource(R.drawable.ic_person_add_24dp); + } + floatingBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + follow(accountId); - floatingBtn.hide(); + + if (following) { + floatingBtn.setImageResource(R.drawable.ic_person_minus_24px); + } else { + floatingBtn.setImageResource(R.drawable.ic_person_add_24dp); + } + } }); } diff --git a/app/src/main/res/drawable/ic_person_minus_24px.xml b/app/src/main/res/drawable/ic_person_minus_24px.xml new file mode 100644 index 000000000..c8a7ea0b4 --- /dev/null +++ b/app/src/main/res/drawable/ic_person_minus_24px.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file