layout fix

This commit is contained in:
NudeDude 2018-09-19 15:51:55 +02:00
parent 850076b215
commit 94e920630e
11 changed files with 70 additions and 21 deletions

View File

@ -39,6 +39,7 @@ public class MessageLoader extends AsyncTask<Void, Void, Boolean> {
if (mAdapter == null) { if (mAdapter == null) {
mAdapter = new MessageAdapter(context); mAdapter = new MessageAdapter(context);
mAdapter.setColor(settings.getFontColor());
mAdapter.setImageLoad(settings.loadImages()); mAdapter.setImageLoad(settings.loadImages());
dm_list.setAdapter(mAdapter); dm_list.setAdapter(mAdapter);
} }

View File

@ -33,9 +33,6 @@ public class UserLists extends AsyncTask<Long, Void, Boolean> {
public UserLists(UserDetail context) { public UserLists(UserDetail context) {
GlobalSettings settings = GlobalSettings.getInstance(context);
boolean imageLoad = settings.loadImages();
ui = new WeakReference<>(context); ui = new WeakReference<>(context);
mTwitter = TwitterEngine.getInstance(context); mTwitter = TwitterEngine.getInstance(context);
RecyclerView userList = context.findViewById(R.id.userlist); RecyclerView userList = context.findViewById(R.id.userlist);
@ -43,8 +40,10 @@ public class UserLists extends AsyncTask<Long, Void, Boolean> {
usrAdp = (UserAdapter) userList.getAdapter(); usrAdp = (UserAdapter) userList.getAdapter();
if (usrAdp == null) { if (usrAdp == null) {
GlobalSettings settings = GlobalSettings.getInstance(context);
usrAdp = new UserAdapter(context); usrAdp = new UserAdapter(context);
usrAdp.toggleImage(imageLoad); usrAdp.toggleImage(settings.loadImages());
usrAdp.setColor(settings.getFontColor());
userList.setAdapter(usrAdp); userList.setAdapter(usrAdp);
} }
} }

View File

@ -25,6 +25,7 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
private List<Message> messages; private List<Message> messages;
private OnItemSelected mListener; private OnItemSelected mListener;
private boolean loadImage = true; private boolean loadImage = true;
private int color = 0xFFFFFFFF;
public MessageAdapter(OnItemSelected listener) { public MessageAdapter(OnItemSelected listener) {
@ -48,6 +49,11 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
} }
public void setColor(int color) {
this.color = color;
}
@Override @Override
public long getItemId(int pos) { public long getItemId(int pos) {
return messages.get(pos).messageId; return messages.get(pos).messageId;
@ -83,6 +89,12 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
vh.username.setText(message.sender.username); vh.username.setText(message.sender.username);
vh.screenname.setText(message.sender.screenname); vh.screenname.setText(message.sender.screenname);
vh.createdAt.setText(stringTime(message.time)); vh.createdAt.setText(stringTime(message.time));
vh.message.setTextColor(color);
vh.username.setTextColor(color);
vh.screenname.setTextColor(color);
vh.createdAt.setTextColor(color);
if (loadImage) if (loadImage)
Picasso.get().load(message.sender.profileImg + "_mini").into(vh.profile_img); Picasso.get().load(message.sender.profileImg + "_mini").into(vh.profile_img);
} }

View File

@ -107,13 +107,19 @@ public class TimelineAdapter extends Adapter<TimelineAdapter.ItemHolder> {
} else { } else {
vh.retweeter.setText(""); vh.retweeter.setText("");
} }
vh.tweet.setTextColor(font_color);
vh.username.setText(tweet.user.username); vh.username.setText(tweet.user.username);
vh.screenname.setText(tweet.user.screenname); vh.screenname.setText(tweet.user.screenname);
vh.tweet.setText(highlight(tweet.tweet)); vh.tweet.setText(highlight(tweet.tweet));
vh.retweet.setText(retweet); vh.retweet.setText(retweet);
vh.favorite.setText(favorit); vh.favorite.setText(favorit);
vh.time.setText(stringTime(tweet.time)); vh.time.setText(stringTime(tweet.time));
vh.username.setTextColor(font_color);
vh.screenname.setTextColor(font_color);
vh.tweet.setTextColor(font_color);
vh.time.setTextColor(font_color);
if (img_ldr) { if (img_ldr) {
Picasso.get().load(tweet.user.profileImg + "_mini").into(vh.profile); Picasso.get().load(tweet.user.profileImg + "_mini").into(vh.profile);
} }

View File

@ -23,6 +23,7 @@ public class UserAdapter extends Adapter<UserAdapter.ItemHolder> {
private List<TwitterUser> mUser; private List<TwitterUser> mUser;
private OnItemClicked mListener; private OnItemClicked mListener;
private int font_color = 0xFFFFFFFF;
private boolean loadImage = true; private boolean loadImage = true;
@ -47,6 +48,11 @@ public class UserAdapter extends Adapter<UserAdapter.ItemHolder> {
} }
public void setColor(int font_color) {
this.font_color = font_color;
}
@Override @Override
public int getItemCount() { public int getItemCount() {
return mUser.size(); return mUser.size();
@ -80,6 +86,11 @@ public class UserAdapter extends Adapter<UserAdapter.ItemHolder> {
TwitterUser user = mUser.get(index); TwitterUser user = mUser.get(index);
vh.screenname.setText(user.screenname); vh.screenname.setText(user.screenname);
vh.username.setText(user.username); vh.username.setText(user.username);
vh.screenname.setTextColor(font_color);
vh.username.setTextColor(font_color);
if (loadImage) { if (loadImage) {
Picasso.get().load(user.profileImg + "_mini").into(vh.profileImg); Picasso.get().load(user.profileImg + "_mini").into(vh.profileImg);
} }

View File

@ -21,6 +21,11 @@ import org.nuclearfog.twidda.viewadapter.MessageAdapter.OnItemSelected;
import static android.os.AsyncTask.Status.RUNNING; import static android.os.AsyncTask.Status.RUNNING;
/**
* Direct Message page
*
* @see MessageLoader
*/
public class DirectMessage extends AppCompatActivity implements OnItemSelected, OnRefreshListener { public class DirectMessage extends AppCompatActivity implements OnItemSelected, OnRefreshListener {
private MessageLoader mLoader; private MessageLoader mLoader;
@ -32,6 +37,7 @@ public class DirectMessage extends AppCompatActivity implements OnItemSelected,
protected void onCreate(Bundle b) { protected void onCreate(Bundle b) {
super.onCreate(b); super.onCreate(b);
setContentView(R.layout.page_dm); setContentView(R.layout.page_dm);
Toolbar tool = findViewById(R.id.dm_toolbar); Toolbar tool = findViewById(R.id.dm_toolbar);
setSupportActionBar(tool); setSupportActionBar(tool);
if (getSupportActionBar() != null) if (getSupportActionBar() != null)

View File

@ -14,9 +14,11 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="fill_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
style="@style/ProfileImageCardView"
android:layout_width="@dimen/profile_small" android:layout_width="@dimen/profile_small"
android:layout_height="@dimen/profile_small" android:layout_height="@dimen/profile_small"
app:cardCornerRadius="5dp"> app:cardCornerRadius="5dp">

View File

@ -17,11 +17,13 @@
android:orientation="horizontal"> android:orientation="horizontal">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
style="@style/ProfileImageCardView"
android:layout_width="@dimen/profile_small" android:layout_width="@dimen/profile_small"
android:layout_height="@dimen/profile_small"> android:layout_height="@dimen/profile_small">
<ImageView <ImageView
android:id="@+id/tweetPb" android:id="@+id/tweetPb"
style="@style/ProfileImageCardView"
android:layout_width="@dimen/profile_small" android:layout_width="@dimen/profile_small"
android:layout_height="@dimen/profile_small" android:layout_height="@dimen/profile_small"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View File

@ -12,6 +12,7 @@
android:padding="5dp"> android:padding="5dp">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
style="@style/ProfileImageCardView"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_marginEnd="10dp"> android:layout_marginEnd="10dp">
@ -31,44 +32,48 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/verified" android:id="@+id/verified"
android:layout_width="16dp" android:layout_width="12dp"
android:layout_height="16dp" android:layout_height="12dp"
android:layout_margin="2dp" android:layout_marginEnd="3dp"
android:background="@drawable/verify" android:background="@drawable/verify"
android:contentDescription="@string/verify" android:contentDescription="@string/verify"
android:visibility="gone" /> android:visibility="visible" />
<TextView <TextView
android:id="@+id/username_detail" android:id="@+id/username_detail"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="20dp"
android:layout_weight="1"
android:singleLine="true" /> android:singleLine="true" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/locked_profile" android:id="@+id/locked_profile"
android:layout_width="16dp" android:layout_width="12dp"
android:layout_height="16dp" android:layout_height="12dp"
android:layout_margin="2dp" android:layout_marginEnd="3dp"
android:background="@drawable/lock" android:background="@drawable/lock"
android:contentDescription="@string/profile_locked" android:contentDescription="@string/profile_locked"
android:visibility="gone" /> android:visibility="visible" />
<TextView <TextView
android:id="@+id/screenname_detail" android:id="@+id/screenname_detail"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="20dp"
android:layout_weight="1"
android:singleLine="true" /> android:singleLine="true" />
</LinearLayout> </LinearLayout>

View File

@ -40,6 +40,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
style="@style/ProfileImageCardView"
android:layout_width="@dimen/profile_image" android:layout_width="@dimen/profile_image"
android:layout_height="@dimen/profile_image"> android:layout_height="@dimen/profile_image">

View File

@ -4,9 +4,9 @@
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/soylentgreen</item> <item name="colorAccent">@color/soylentgreen</item>
<item name="android:colorBackground">@color/DarkBlue</item> <item name="android:colorBackground">@android:color/black</item>
<item name="android:windowAnimationStyle">@style/TransactionPending</item>
<item name="android:statusBarColor">@android:color/black</item> <item name="android:statusBarColor">@android:color/black</item>
<item name="android:windowAnimationStyle">@style/TransactionPending</item>
<item name="android:textViewStyle">@style/RobotoTextView</item> <item name="android:textViewStyle">@style/RobotoTextView</item>
<item name="buttonStyle">@style/CustomButton</item> <item name="buttonStyle">@style/CustomButton</item>
</style> </style>
@ -31,6 +31,10 @@
<item name="cardUseCompatPadding">true</item> <item name="cardUseCompatPadding">true</item>
</style> </style>
<style name="ProfileImageCardView" parent="CardView">
<item name="cardCornerRadius">5dp</item>
</style>
<style name="CustomButton" parent="Widget.AppCompat.Button"> <style name="CustomButton" parent="Widget.AppCompat.Button">
<item name="android:textAllCaps">false</item> <item name="android:textAllCaps">false</item>
<item name="android:fontFamily">RobotoTextView</item> <item name="android:fontFamily">RobotoTextView</item>