Browse Source

default user icon switch

pull/61/merge
oogee 6 years ago
parent
commit
3de864e6eb
  1. 31
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java
  2. 46
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  3. 2
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  4. 5
      app/src/main/res/drawable/ic_default_user_thumbnail_white_24dp.xml
  5. 1
      app/src/main/res/layout-v21/activity_profile.xml
  6. 1
      app/src/main/res/layout-v21/activity_topic_post_row.xml
  7. 1
      app/src/main/res/layout/activity_profile.xml
  8. 3
      app/src/main/res/layout/activity_topic_edit_row.xml
  9. 3
      app/src/main/res/layout/activity_topic_post_row.xml
  10. 3
      app/src/main/res/layout/activity_topic_quick_reply_row.xml

31
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.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout; 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 com.squareup.picasso.Picasso;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
@ -32,6 +34,7 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
@ -133,10 +136,16 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
.load(thumbnailUrl) .load(thumbnailUrl)
.resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE)
.centerCrop() .centerCrop()
.error(ResourcesCompat.getDrawable(this.getResources() .error(new IconicsDrawable(ProfileActivity.this)
, R.drawable.ic_default_user_thumbnail_white_24dp, null)) .icon(FontAwesome.Icon.faw_user_circle)
.placeholder(ResourcesCompat.getDrawable(this.getResources() .color(ContextCompat.getColor(ProfileActivity.this, R.color.iron))
, R.drawable.ic_default_user_thumbnail_white_24dp, null)) .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()) .transform(new CircleTransform())
.into(thumbnailView); .into(thumbnailView);
usernameView = findViewById(R.id.profile_activity_username); usernameView = findViewById(R.id.profile_activity_username);
@ -307,10 +316,16 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
.load(thumbnailUrl) .load(thumbnailUrl)
.resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE)
.centerCrop() .centerCrop()
.error(ResourcesCompat.getDrawable(getResources() .error(new IconicsDrawable(ProfileActivity.this)
, R.drawable.ic_default_user_thumbnail_white_24dp, null)) .icon(FontAwesome.Icon.faw_user_circle)
.placeholder(ResourcesCompat.getDrawable(getResources() .color(ContextCompat.getColor(ProfileActivity.this, R.color.iron))
, R.drawable.ic_default_user_thumbnail_white_24dp, null)) .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()) .transform(new CircleTransform())
.into(thumbnailView); .into(thumbnailView);
if (personalText != null) { if (personalText != null) {

46
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.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; 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.BarData;
import com.github.mikephil.charting.data.BarDataSet; import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry; 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 com.squareup.picasso.Picasso;
import java.util.ArrayList; import java.util.ArrayList;
@ -50,6 +53,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.AppCompatButton; import androidx.appcompat.widget.AppCompatButton;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import androidx.lifecycle.ViewModelProviders; import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -317,11 +321,17 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
.load(currentPost.getThumbnailURL()) .load(currentPost.getThumbnailURL())
.resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE)
.centerCrop() .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()) .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); .into(holder.thumbnail);
//Sets username,submit date, index number, subject, post's and attached files texts //Sets username,submit date, index number, subject, post's and attached files texts
@ -607,10 +617,16 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
.load(getSessionManager().getAvatarLink()) .load(getSessionManager().getAvatarLink())
.resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE)
.centerCrop() .centerCrop()
.error(ResourcesCompat.getDrawable(context.getResources() .error(new IconicsDrawable(context)
, R.drawable.ic_default_user_thumbnail_white_24dp, null)) .icon(FontAwesome.Icon.faw_user_circle)
.placeholder(ResourcesCompat.getDrawable(context.getResources() .color(ContextCompat.getColor(context, R.color.iron))
, R.drawable.ic_default_user_thumbnail_white_24dp, null)) .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()) .transform(new CircleTransform())
.into(holder.thumbnail); .into(holder.thumbnail);
holder.username.setText(getSessionManager().getUsername()); holder.username.setText(getSessionManager().getUsername());
@ -663,10 +679,16 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
.load(getSessionManager().getAvatarLink()) .load(getSessionManager().getAvatarLink())
.resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE)
.centerCrop() .centerCrop()
.error(ResourcesCompat.getDrawable(context.getResources() .error(new IconicsDrawable(context)
, R.drawable.ic_default_user_thumbnail_white_24dp, null)) .icon(FontAwesome.Icon.faw_user_circle)
.placeholder(ResourcesCompat.getDrawable(context.getResources() .color(ContextCompat.getColor(context, R.color.iron))
, R.drawable.ic_default_user_thumbnail_white_24dp, null)) .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()) .transform(new CircleTransform())
.into(holder.thumbnail); .into(holder.thumbnail);
holder.username.setText(getSessionManager().getUsername()); holder.username.setText(getSessionManager().getUsername());

2
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -455,7 +455,7 @@ public abstract class BaseActivity extends AppCompatActivity {
private void setDefaultAvatar() { private void setDefaultAvatar() {
profileDrawerItem.withIcon(new IconicsDrawable(this) profileDrawerItem.withIcon(new IconicsDrawable(this)
.icon(FontAwesome.Icon.faw_user) .icon(FontAwesome.Icon.faw_user_circle)
.paddingDp(10) .paddingDp(10)
.color(ContextCompat.getColor(this, R.color.iron)) .color(ContextCompat.getColor(this, R.color.iron))
.backgroundColor(ContextCompat.getColor(this, R.color.primary_light))); .backgroundColor(ContextCompat.getColor(this, R.color.primary_light)));

5
app/src/main/res/drawable/ic_default_user_thumbnail_white_24dp.xml

@ -1,5 +0,0 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
</vector>

1
app/src/main/res/layout-v21/activity_profile.xml

@ -41,7 +41,6 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:contentDescription="@string/post_thumbnail" android:contentDescription="@string/post_thumbnail"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp"
android:transitionName="user_thumbnail" android:transitionName="user_thumbnail"
app:layout_collapseMode="parallax"/> app:layout_collapseMode="parallax"/>

1
app/src/main/res/layout-v21/activity_topic_post_row.xml

@ -60,7 +60,6 @@
android:contentDescription="@string/post_thumbnail" android:contentDescription="@string/post_thumbnail"
android:maxHeight="@dimen/thumbnail_size" android:maxHeight="@dimen/thumbnail_size"
android:maxWidth="@dimen/thumbnail_size" android:maxWidth="@dimen/thumbnail_size"
app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp"
android:transitionName="user_thumbnail" /> android:transitionName="user_thumbnail" />
</FrameLayout> </FrameLayout>

1
app/src/main/res/layout/activity_profile.xml

@ -41,7 +41,6 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:contentDescription="@string/post_thumbnail" android:contentDescription="@string/post_thumbnail"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp"
app:layout_collapseMode="parallax"/> app:layout_collapseMode="parallax"/>
<TextView <TextView

3
app/src/main/res/layout/activity_topic_edit_row.xml

@ -52,8 +52,7 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:contentDescription="@string/post_thumbnail" android:contentDescription="@string/post_thumbnail"
android:maxHeight="@dimen/thumbnail_size" android:maxHeight="@dimen/thumbnail_size"
android:maxWidth="@dimen/thumbnail_size" android:maxWidth="@dimen/thumbnail_size" />
app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp" />
</FrameLayout> </FrameLayout>
<TextView <TextView

3
app/src/main/res/layout/activity_topic_post_row.xml

@ -59,8 +59,7 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:contentDescription="@string/post_thumbnail" android:contentDescription="@string/post_thumbnail"
android:maxHeight="@dimen/thumbnail_size" android:maxHeight="@dimen/thumbnail_size"
android:maxWidth="@dimen/thumbnail_size" android:maxWidth="@dimen/thumbnail_size" />
app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp" />
</FrameLayout> </FrameLayout>
<TextView <TextView

3
app/src/main/res/layout/activity_topic_quick_reply_row.xml

@ -52,8 +52,7 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:contentDescription="@string/post_thumbnail" android:contentDescription="@string/post_thumbnail"
android:maxHeight="@dimen/thumbnail_size" android:maxHeight="@dimen/thumbnail_size"
android:maxWidth="@dimen/thumbnail_size" android:maxWidth="@dimen/thumbnail_size" />
app:srcCompat="@drawable/ic_default_user_thumbnail_white_24dp" />
</FrameLayout> </FrameLayout>
<TextView <TextView

Loading…
Cancel
Save