diff --git a/app/build.gradle b/app/build.gradle index acbf9ee9..c9c6c400 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,5 +32,7 @@ dependencies { compile 'com.android.volley:volley:1.0.0' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.pkmmte.view:circularimageview:1.1' + compile 'com.github.peter9870:sparkbutton:master' testCompile 'junit:junit:4.12' + compile 'com.mikhaellopez:circularfillableloaders:1.2.0' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2601bee2..4bdc081e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ android:theme="@style/AppTheme"> + android:theme="@android:style/Theme.Black.NoTitleBar"> diff --git a/app/src/main/java/com/keylesspalace/tusky/SplashActivity.java b/app/src/main/java/com/keylesspalace/tusky/SplashActivity.java index 1297196c..c3e38c03 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SplashActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/SplashActivity.java @@ -15,29 +15,43 @@ package com.keylesspalace.tusky; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; +import android.os.Handler; import android.support.v7.app.AppCompatActivity; -public class SplashActivity extends AppCompatActivity { +public class SplashActivity extends Activity { + private static int SPLASH_TIME_OUT = 2000; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setContentView(R.layout.activity_splash); /* Determine whether the user is currently logged in, and if so go ahead and load the * timeline. Otherwise, start the activity_login screen. */ SharedPreferences preferences = getSharedPreferences( getString(R.string.preferences_file_key), Context.MODE_PRIVATE); String domain = preferences.getString("domain", null); String accessToken = preferences.getString("accessToken", null); - Intent intent; + + + final Intent intent; + if (domain != null && accessToken != null) { intent = new Intent(this, MainActivity.class); } else { intent = new Intent(this, LoginActivity.class); } - startActivity(intent); - finish(); + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + startActivity(intent); + finish(); + } + }, SPLASH_TIME_OUT); } } diff --git a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java index 3f30299b..12eee0ab 100644 --- a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java @@ -34,6 +34,9 @@ import android.widget.ToggleButton; import com.android.volley.toolbox.ImageLoader; import com.android.volley.toolbox.NetworkImageView; import com.squareup.picasso.Picasso; +import com.varunest.sparkbutton.SparkButton; +import com.varunest.sparkbutton.SparkButtonBuilder; +import com.varunest.sparkbutton.SparkEventListener; import java.util.Date; @@ -47,8 +50,8 @@ class StatusViewHolder extends RecyclerView.ViewHolder { private View rebloggedBar; private TextView rebloggedByDisplayName; private ImageButton replyButton; - private ImageButton reblogButton; - private ImageButton favouriteButton; + private SparkButton reblogButton; + private SparkButton favouriteButton; private ImageButton moreButton; private boolean favourited; private boolean reblogged; @@ -72,8 +75,8 @@ class StatusViewHolder extends RecyclerView.ViewHolder { rebloggedBar = itemView.findViewById(R.id.status_reblogged_bar); rebloggedByDisplayName = (TextView) itemView.findViewById(R.id.status_reblogged); replyButton = (ImageButton) itemView.findViewById(R.id.status_reply); - reblogButton = (ImageButton) itemView.findViewById(R.id.status_reblog); - favouriteButton = (ImageButton) itemView.findViewById(R.id.status_favourite); + reblogButton = (SparkButton) itemView.findViewById(R.id.status_reblog); + favouriteButton = (SparkButton) itemView.findViewById(R.id.status_favourite); moreButton = (ImageButton) itemView.findViewById(R.id.status_more); reblogged = false; favourited = false; @@ -187,35 +190,25 @@ class StatusViewHolder extends RecyclerView.ViewHolder { private void setReblogged(boolean reblogged) { this.reblogged = reblogged; - int attribute; - if (reblogged) { - attribute = R.attr.status_reblog_button_marked_tint; - } else { - attribute = R.attr.status_reblog_button_tint; - } - ThemeUtils.setImageViewTint(reblogButton, attribute); + reblogButton.setChecked(reblogged); } /** This should only be called after setReblogged, in order to override the tint correctly. */ private void setRebloggingEnabled(boolean enabled) { reblogButton.setEnabled(enabled); + if (enabled) { - reblogButton.setImageResource(R.drawable.ic_repeat_24dp); + reblogButton.setInactiveImage(R.drawable.reblog_inactive); + reblogButton.setActiveImage(R.drawable.reblog_active); } else { - ThemeUtils.setImageViewTint(reblogButton, R.attr.status_reblog_button_disabled_tint); - reblogButton.setImageResource(R.drawable.ic_lock_24dp); + reblogButton.setInactiveImage(R.drawable.reblog_disabled); + reblogButton.setActiveImage(R.drawable.reblog_disabled); } } private void setFavourited(boolean favourited) { this.favourited = favourited; - int attribute; - if (favourited) { - attribute = R.attr.status_favourite_button_marked_tint; - } else { - attribute = R.attr.status_favourite_button_tint; - } - ThemeUtils.setImageViewTint(favouriteButton, attribute); + favouriteButton.setChecked(favourited); } private void setMediaPreviews(final Status.MediaAttachment[] attachments, @@ -313,15 +306,15 @@ class StatusViewHolder extends RecyclerView.ViewHolder { listener.onReply(getAdapterPosition()); } }); - reblogButton.setOnClickListener(new View.OnClickListener() { + reblogButton.setEventListener(new SparkEventListener() { @Override - public void onClick(View v) { + public void onEvent(ImageView button, boolean buttonState) { listener.onReblog(!reblogged, getAdapterPosition()); } }); - favouriteButton.setOnClickListener(new View.OnClickListener() { + favouriteButton.setEventListener(new SparkEventListener() { @Override - public void onClick(View v) { + public void onEvent(ImageView button, boolean buttonState) { listener.onFavourite(!favourited, getAdapterPosition()); } }); diff --git a/app/src/main/res/drawable/favourite_active.xml b/app/src/main/res/drawable/favourite_active.xml new file mode 100644 index 00000000..2d53859f --- /dev/null +++ b/app/src/main/res/drawable/favourite_active.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/favourite_inactive.xml b/app/src/main/res/drawable/favourite_inactive.xml new file mode 100644 index 00000000..24b69ac3 --- /dev/null +++ b/app/src/main/res/drawable/favourite_inactive.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/reblog_active.xml b/app/src/main/res/drawable/reblog_active.xml new file mode 100644 index 00000000..c23ed9a9 --- /dev/null +++ b/app/src/main/res/drawable/reblog_active.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/reblog_disabled.xml b/app/src/main/res/drawable/reblog_disabled.xml new file mode 100644 index 00000000..59db1759 --- /dev/null +++ b/app/src/main/res/drawable/reblog_disabled.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/reblog_inactive.xml b/app/src/main/res/drawable/reblog_inactive.xml new file mode 100644 index 00000000..74d6b8fe --- /dev/null +++ b/app/src/main/res/drawable/reblog_inactive.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/splash_background.xml b/app/src/main/res/drawable/splash_background.xml deleted file mode 100644 index fb783fdf..00000000 --- a/app/src/main/res/drawable/splash_background.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml new file mode 100644 index 00000000..11c059c1 --- /dev/null +++ b/app/src/main/res/layout/activity_splash.xml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index cfbb9262..fce82c2b 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -231,6 +231,8 @@ android:layout_height="wrap_content" android:layout_below="@id/status_media_preview_container" android:layout_toRightOf="@+id/status_avatar" + android:clipChildren="false" + android:clipToPadding="false" android:paddingBottom="8dp" android:paddingTop="6dp"> @@ -246,10 +248,14 @@ android:layout_height="match_parent" android:layout_weight="1" /> - @@ -258,11 +264,15 @@ android:layout_height="match_parent" android:layout_weight="1" /> - #000000 #2F2F2F #4F4F4F - #009F6F + #56a7e1 #BFBFBF #4F4F4F - #ffec21 + #fab207 #B0B0B0 #CFCFCF #34444C diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 1574f158..a62b68a7 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,9 +1,5 @@ - - diff --git a/build.gradle b/build.gradle index 1ea4bd05..83a6ca5a 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ buildscript { allprojects { repositories { jcenter() + maven { url "https://jitpack.io" } } }