Fix SparkButtons (#608)

* fix the SparkButtons

* dont notify adapter after boost/fav
This commit is contained in:
Konrad Pozniak 2018-04-28 22:59:46 +02:00 committed by GitHub
parent ae6c0f291a
commit ae41bdc75b
9 changed files with 44 additions and 39 deletions

View File

@ -63,7 +63,7 @@ dependencies {
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.pkmmte.view:circularimageview:1.1'
implementation 'com.github.varunest:sparkbutton:1.0.5'
implementation 'com.github.connyduck:sparkbutton:1.0.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.mikepenz:google-material-typeface:3.0.1.2.original@aar'
implementation('com.theartofdev.edmodo:android-image-cropper:2.7.0') {

View File

@ -114,7 +114,7 @@ import com.keylesspalace.tusky.view.TootButton;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.IconicsDrawable;
import com.squareup.picasso.Picasso;
import com.varunest.sparkbutton.helpers.Utils;
import at.connyduck.sparkbutton.helpers.Utils;
import org.jetbrains.annotations.NotNull;

View File

@ -31,8 +31,8 @@ import com.keylesspalace.tusky.view.RoundedTransformation;
import com.keylesspalace.tusky.viewdata.StatusViewData;
import com.mikepenz.iconics.utils.Utils;
import com.squareup.picasso.Picasso;
import com.varunest.sparkbutton.SparkButton;
import com.varunest.sparkbutton.SparkEventListener;
import at.connyduck.sparkbutton.SparkButton;
import at.connyduck.sparkbutton.SparkEventListener;
import java.util.Date;
import java.util.List;

View File

@ -28,7 +28,7 @@ import com.keylesspalace.tusky.util.ThemeUtils;
import com.keylesspalace.tusky.view.RoundedTransformation;
import com.keylesspalace.tusky.viewdata.StatusViewData;
import com.squareup.picasso.Picasso;
import com.varunest.sparkbutton.helpers.Utils;
import at.connyduck.sparkbutton.helpers.Utils;
public class StatusViewHolder extends StatusBaseViewHolder {
private ImageView avatarReblog;

View File

@ -216,7 +216,7 @@ public final class ViewThreadFragment extends SFragment implements
StatusViewData.Concrete newViewData = viewDataBuilder.createStatusViewData();
statuses.setPairedItem(position, newViewData);
adapter.setItem(position, newViewData, true);
adapter.setItem(position, newViewData, false);
}
}
@ -249,7 +249,7 @@ public final class ViewThreadFragment extends SFragment implements
StatusViewData.Concrete newViewData = viewDataBuilder.createStatusViewData();
statuses.setPairedItem(position, newViewData);
adapter.setItem(position, newViewData, true);
adapter.setItem(position, newViewData, false);
}
}

View File

@ -28,7 +28,7 @@ import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
import com.keylesspalace.tusky.R;
import com.varunest.sparkbutton.helpers.Utils;
import at.connyduck.sparkbutton.helpers.Utils;
public final class ProgressImageView extends AppCompatImageView {

View File

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:sparkbutton="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/status_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingLeft="14dp"
android:paddingRight="14dp">
@ -124,7 +127,6 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_below="@+id/status_name_bar"
android:layout_marginBottom="4dp"
android:layout_toEndOf="@+id/status_avatar"
android:focusable="true"
android:lineSpacingMultiplier="1.1"
@ -137,7 +139,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/status_content"
android:layout_marginBottom="4dp"
android:layout_marginTop="@dimen/status_media_preview_margin_top"
android:layout_toEndOf="@+id/status_avatar">
@ -285,12 +286,13 @@
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingBottom="4dp">
android:paddingBottom="4dp"
android:paddingTop="4dp">
<ImageButton
android:id="@+id/status_reply"
style="?attr/image_button_style"
android:layout_width="24dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_reply"
@ -303,34 +305,34 @@
android:layout_height="match_parent"
android:layout_weight="1" />
<com.varunest.sparkbutton.SparkButton
<at.connyduck.sparkbutton.SparkButton
android:id="@+id/status_reblog"
android:layout_width="24dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:contentDescription="@string/action_reblog"
app:sparkbutton_activeImage="@drawable/reblog_active"
app:sparkbutton_iconSize="24dp"
app:sparkbutton_inActiveImage="?attr/status_reblog_inactive_drawable"
app:sparkbutton_primaryColor="@color/status_reblog_button_marked_dark"
app:sparkbutton_secondaryColor="@color/status_reblog_button_marked_light" />
sparkbutton:activeImage="@drawable/reblog_active"
sparkbutton:iconSize="24dp"
sparkbutton:inactiveImage="?attr/status_reblog_inactive_drawable"
sparkbutton:primaryColor="@color/status_reblog_button_marked_dark"
sparkbutton:secondaryColor="@color/status_reblog_button_marked_light" />
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.varunest.sparkbutton.SparkButton
<at.connyduck.sparkbutton.SparkButton
android:id="@+id/status_favourite"
android:layout_width="24dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:contentDescription="@string/action_favourite"
app:sparkbutton_activeImage="?attr/status_favourite_active_drawable"
app:sparkbutton_iconSize="24dp"
app:sparkbutton_inActiveImage="?attr/status_favourite_inactive_drawable"
app:sparkbutton_primaryColor="@color/status_favourite_button_marked_dark"
app:sparkbutton_secondaryColor="@color/status_favourite_button_marked_light" />
sparkbutton:activeImage="?attr/status_favourite_active_drawable"
sparkbutton:iconSize="24dp"
sparkbutton:inactiveImage="?attr/status_favourite_inactive_drawable"
sparkbutton:primaryColor="@color/status_favourite_button_marked_dark"
sparkbutton:secondaryColor="@color/status_favourite_button_marked_light" />
<Space
android:layout_width="0dp"

View File

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:sparkbutton="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/status_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingLeft="14dp"
android:paddingRight="14dp">
@ -330,18 +333,18 @@
android:layout_height="match_parent"
android:layout_weight="1" />
<com.varunest.sparkbutton.SparkButton
<at.connyduck.sparkbutton.SparkButton
android:id="@+id/status_reblog"
android:layout_width="40dp"
android:layout_height="40dp"
android:clipToPadding="false"
android:contentDescription="@string/action_reblog"
android:padding="4dp"
app:sparkbutton_activeImage="@drawable/reblog_active"
app:sparkbutton_iconSize="28dp"
app:sparkbutton_inActiveImage="?attr/status_reblog_inactive_drawable"
app:sparkbutton_primaryColor="@color/status_reblog_button_marked_dark"
app:sparkbutton_secondaryColor="@color/status_reblog_button_marked_light" />
sparkbutton:activeImage="@drawable/reblog_active"
sparkbutton:iconSize="28dp"
sparkbutton:inactiveImage="?attr/status_reblog_inactive_drawable"
sparkbutton:primaryColor="@color/status_reblog_button_marked_dark"
sparkbutton:secondaryColor="@color/status_reblog_button_marked_light" />
<TextView
android:id="@+id/status_reblogs"
@ -354,18 +357,18 @@
android:layout_height="match_parent"
android:layout_weight="1" />
<com.varunest.sparkbutton.SparkButton
<at.connyduck.sparkbutton.SparkButton
android:id="@+id/status_favourite"
android:layout_width="40dp"
android:layout_height="40dp"
android:clipToPadding="false"
android:contentDescription="@string/action_favourite"
android:padding="4dp"
app:sparkbutton_activeImage="?attr/status_favourite_active_drawable"
app:sparkbutton_iconSize="28dp"
app:sparkbutton_inActiveImage="?attr/status_favourite_inactive_drawable"
app:sparkbutton_primaryColor="@color/status_favourite_button_marked_dark"
app:sparkbutton_secondaryColor="@color/status_favourite_button_marked_light" />
sparkbutton:activeImage="?attr/status_favourite_active_drawable"
sparkbutton:iconSize="28dp"
sparkbutton:inactiveImage="?attr/status_favourite_inactive_drawable"
sparkbutton:primaryColor="@color/status_favourite_button_marked_dark"
sparkbutton:secondaryColor="@color/status_favourite_button_marked_light" />
<TextView
android:id="@+id/status_favourites"

View File

@ -2,7 +2,7 @@
<dimen name="status_display_name_padding_end">4dp</dimen>
<dimen name="status_avatar_padding">10dp</dimen>
<dimen name="status_reblogged_bar_padding_top">8dp</dimen>
<dimen name="status_media_preview_margin_top">4dp</dimen>
<dimen name="status_media_preview_margin_top">8dp</dimen>
<dimen name="status_media_preview_height">100dp</dimen>
<dimen name="status_detail_media_preview_height">130dp</dimen>
<dimen name="compose_media_preview_margin">8dp</dimen>