diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java index a9b11c7f..a7729cd7 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java @@ -20,6 +20,8 @@ import android.widget.Toast; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.tabs.TabLayout; +import com.mikepenz.fontawesome_typeface_library.FontAwesome; +import com.mikepenz.iconics.IconicsDrawable; import com.squareup.picasso.Picasso; import org.jsoup.Jsoup; @@ -32,6 +34,7 @@ import java.util.List; import java.util.Objects; import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; import androidx.core.content.res.ResourcesCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; @@ -133,10 +136,16 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment .load(thumbnailUrl) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() - .error(ResourcesCompat.getDrawable(this.getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) - .placeholder(ResourcesCompat.getDrawable(this.getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) + .error(new IconicsDrawable(ProfileActivity.this) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(ProfileActivity.this, R.color.iron)) + .backgroundColor(ContextCompat.getColor(ProfileActivity.this, R.color.primary)) + .sizePx(THUMBNAIL_SIZE)) + .placeholder(new IconicsDrawable(ProfileActivity.this) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(ProfileActivity.this, R.color.iron)) + .backgroundColor(ContextCompat.getColor(ProfileActivity.this, R.color.primary)) + .sizePx(THUMBNAIL_SIZE)) .transform(new CircleTransform()) .into(thumbnailView); usernameView = findViewById(R.id.profile_activity_username); @@ -307,10 +316,16 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment .load(thumbnailUrl) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() - .error(ResourcesCompat.getDrawable(getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) - .placeholder(ResourcesCompat.getDrawable(getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) + .error(new IconicsDrawable(ProfileActivity.this) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(ProfileActivity.this, R.color.iron)) + .backgroundColor(ContextCompat.getColor(ProfileActivity.this, R.color.primary)) + .sizePx(THUMBNAIL_SIZE)) + .placeholder(new IconicsDrawable(ProfileActivity.this) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(ProfileActivity.this, R.color.iron)) + .backgroundColor(ContextCompat.getColor(ProfileActivity.this, R.color.primary)) + .sizePx(THUMBNAIL_SIZE)) .transform(new CircleTransform()) .into(thumbnailView); if (personalText != null) { diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index fa56eec1..d890a30a 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -4,6 +4,7 @@ import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.Context; import android.content.Intent; +import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.Drawable; @@ -40,6 +41,8 @@ import com.github.mikephil.charting.components.YAxis; import com.github.mikephil.charting.data.BarData; import com.github.mikephil.charting.data.BarDataSet; import com.github.mikephil.charting.data.BarEntry; +import com.mikepenz.fontawesome_typeface_library.FontAwesome; +import com.mikepenz.iconics.IconicsDrawable; import com.squareup.picasso.Picasso; import java.util.ArrayList; @@ -50,6 +53,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatButton; +import androidx.core.content.ContextCompat; import androidx.core.content.res.ResourcesCompat; import androidx.lifecycle.ViewModelProviders; import androidx.recyclerview.widget.RecyclerView; @@ -317,11 +321,17 @@ class TopicAdapter extends RecyclerView.Adapter { .load(currentPost.getThumbnailURL()) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() - .error(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) - .placeholder(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) .transform(new CircleTransform()) + .error(new IconicsDrawable(context) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(context, R.color.iron)) + .backgroundColor(ContextCompat.getColor(context, R.color.primary_light)) + .sizeDp(THUMBNAIL_SIZE)) + .placeholder(new IconicsDrawable(context) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(context, R.color.iron)) + .backgroundColor(ContextCompat.getColor(context, R.color.primary_light)) + .sizeDp(THUMBNAIL_SIZE)) .into(holder.thumbnail); //Sets username,submit date, index number, subject, post's and attached files texts @@ -607,10 +617,16 @@ class TopicAdapter extends RecyclerView.Adapter { .load(getSessionManager().getAvatarLink()) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() - .error(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) - .placeholder(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) + .error(new IconicsDrawable(context) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(context, R.color.iron)) + .backgroundColor(ContextCompat.getColor(context, R.color.primary_light)) + .sizeDp(THUMBNAIL_SIZE)) + .placeholder(new IconicsDrawable(context) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(context, R.color.iron)) + .backgroundColor(ContextCompat.getColor(context, R.color.primary_light)) + .sizeDp(THUMBNAIL_SIZE)) .transform(new CircleTransform()) .into(holder.thumbnail); holder.username.setText(getSessionManager().getUsername()); @@ -663,10 +679,16 @@ class TopicAdapter extends RecyclerView.Adapter { .load(getSessionManager().getAvatarLink()) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() - .error(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) - .placeholder(ResourcesCompat.getDrawable(context.getResources() - , R.drawable.ic_default_user_thumbnail_white_24dp, null)) + .error(new IconicsDrawable(context) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(context, R.color.iron)) + .backgroundColor(ContextCompat.getColor(context, R.color.primary_light)) + .sizeDp(THUMBNAIL_SIZE)) + .placeholder(new IconicsDrawable(context) + .icon(FontAwesome.Icon.faw_user_circle) + .color(ContextCompat.getColor(context, R.color.iron)) + .backgroundColor(ContextCompat.getColor(context, R.color.primary_light)) + .sizeDp(THUMBNAIL_SIZE)) .transform(new CircleTransform()) .into(holder.thumbnail); holder.username.setText(getSessionManager().getUsername()); diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java index 75c7d081..ee81418c 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java @@ -455,7 +455,7 @@ public abstract class BaseActivity extends AppCompatActivity { private void setDefaultAvatar() { profileDrawerItem.withIcon(new IconicsDrawable(this) - .icon(FontAwesome.Icon.faw_user) + .icon(FontAwesome.Icon.faw_user_circle) .paddingDp(10) .color(ContextCompat.getColor(this, R.color.iron)) .backgroundColor(ContextCompat.getColor(this, R.color.primary_light))); diff --git a/app/src/main/res/drawable/ic_default_user_thumbnail_white_24dp.xml b/app/src/main/res/drawable/ic_default_user_thumbnail_white_24dp.xml deleted file mode 100644 index d7366bda..00000000 --- a/app/src/main/res/drawable/ic_default_user_thumbnail_white_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/app/src/main/res/layout-v21/activity_profile.xml b/app/src/main/res/layout-v21/activity_profile.xml index 85b16af6..00fc8430 100644 --- a/app/src/main/res/layout-v21/activity_profile.xml +++ b/app/src/main/res/layout-v21/activity_profile.xml @@ -41,7 +41,6 @@ android:adjustViewBounds="true" android:contentDescription="@string/post_thumbnail" android:fitsSystemWindows="true" - app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp" android:transitionName="user_thumbnail" app:layout_collapseMode="parallax"/> diff --git a/app/src/main/res/layout-v21/activity_topic_post_row.xml b/app/src/main/res/layout-v21/activity_topic_post_row.xml index a71a353d..6218e2ff 100644 --- a/app/src/main/res/layout-v21/activity_topic_post_row.xml +++ b/app/src/main/res/layout-v21/activity_topic_post_row.xml @@ -60,7 +60,6 @@ android:contentDescription="@string/post_thumbnail" android:maxHeight="@dimen/thumbnail_size" android:maxWidth="@dimen/thumbnail_size" - app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp" android:transitionName="user_thumbnail" /> diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml index 1c6cdb6d..e5a935cf 100644 --- a/app/src/main/res/layout/activity_profile.xml +++ b/app/src/main/res/layout/activity_profile.xml @@ -41,7 +41,6 @@ android:adjustViewBounds="true" android:contentDescription="@string/post_thumbnail" android:fitsSystemWindows="true" - app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp" app:layout_collapseMode="parallax"/> + android:maxWidth="@dimen/thumbnail_size" /> + android:maxWidth="@dimen/thumbnail_size" /> + android:maxWidth="@dimen/thumbnail_size" />