mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-31 19:34:55 +01:00
bug fix
This commit is contained in:
parent
023cadfbdd
commit
cf4e21d829
@ -55,15 +55,13 @@ public class CardHolder extends ViewHolder implements OnClickListener {
|
||||
|
||||
public CardHolder(ViewGroup parent, GlobalSettings settings, Picasso picasso, OnHolderClickListener listener) {
|
||||
super(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_card, parent, false));
|
||||
linkText = itemView.findViewById(R.id.link_preview_text);
|
||||
preview = itemView.findViewById(R.id.link_preview_image);
|
||||
this.picasso = picasso;
|
||||
this.settings = settings;
|
||||
this.listener = listener;
|
||||
|
||||
linkText = itemView.findViewById(R.id.link_preview_text);
|
||||
preview = itemView.findViewById(R.id.link_preview_image);
|
||||
|
||||
itemView.getLayoutParams().width = parent.getMeasuredHeight() * 16 / 9;
|
||||
|
||||
linkText.setTypeface(settings.getTypeFace());
|
||||
linkText.setTextColor(settings.getFontColor());
|
||||
linkText.setBackgroundColor(settings.getBackgroundColor() & TEXT_TRANSPARENCY);
|
||||
|
@ -35,20 +35,21 @@ public class Optionholder extends ViewHolder implements OnClickListener {
|
||||
|
||||
public Optionholder(ViewGroup parent, GlobalSettings settings, OnHolderClickListener listener) {
|
||||
super(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_option, parent, false));
|
||||
this.settings = settings;
|
||||
this.listener = listener;
|
||||
|
||||
name = itemView.findViewById(R.id.item_option_name);
|
||||
checked = itemView.findViewById(R.id.item_option_voted_icon);
|
||||
voteProgress = itemView.findViewById(R.id.item_option_count_bar);
|
||||
votes = itemView.findViewById(R.id.item_option_count_text);
|
||||
this.settings = settings;
|
||||
this.listener = listener;
|
||||
|
||||
name.setTextColor(settings.getFontColor());
|
||||
name.setTypeface(settings.getTypeFace());
|
||||
votes.setTextColor(settings.getFontColor());
|
||||
votes.setTypeface(settings.getTypeFace());
|
||||
AppStyles.setSeekBarColor(voteProgress, settings);
|
||||
checked.setColorFilter(settings.getIconColor());
|
||||
|
||||
checked.setOnClickListener(this);
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,17 +33,17 @@ public class PollHolder extends ViewHolder implements OnOptionClickListener {
|
||||
*/
|
||||
public PollHolder(ViewGroup parent, GlobalSettings settings, OnHolderClickListener listener) {
|
||||
super(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_poll, parent, false));
|
||||
this.listener = listener;
|
||||
|
||||
CardView cardBackground = (CardView) itemView;
|
||||
RecyclerView optionsList = itemView.findViewById(R.id.item_poll_options_list);
|
||||
votesCount = itemView.findViewById(R.id.item_poll_votes_count);
|
||||
adapter = new OptionsAdapter(settings, this);
|
||||
this.listener = listener;
|
||||
|
||||
cardBackground.setCardBackgroundColor(settings.getCardColor());
|
||||
votesCount.setTextColor(settings.getFontColor());
|
||||
itemView.getLayoutParams().width = parent.getMeasuredHeight() * 2;
|
||||
votesCount.setTypeface(settings.getTypeFace());
|
||||
itemView.getLayoutParams().width = parent.getMeasuredHeight() * 16 / 9;
|
||||
|
||||
adapter = new OptionsAdapter(settings, this);
|
||||
optionsList.setAdapter(adapter);
|
||||
optionsList.setLayoutManager(new LinearLayoutManager(parent.getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class MainActivity extends AppCompatActivity implements OnTabSelectedList
|
||||
}
|
||||
// initialize lists
|
||||
else if (adapter.isEmpty()) {
|
||||
setupAdapter();
|
||||
setupAdapter(true);
|
||||
// check if there is a Twitter link
|
||||
if (getIntent().getData() != null) {
|
||||
LinkLoader linkLoader = new LinkLoader(this);
|
||||
@ -143,7 +143,7 @@ public class MainActivity extends AppCompatActivity implements OnTabSelectedList
|
||||
}
|
||||
// check if account changed
|
||||
else if (returnCode == LoginActivity.RETURN_LOGIN_SUCCESSFUL) {
|
||||
setupAdapter();
|
||||
setupAdapter(true);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -151,26 +151,26 @@ public class MainActivity extends AppCompatActivity implements OnTabSelectedList
|
||||
// check if account or theme changed
|
||||
if (returnCode == AccountActivity.RETURN_SETTINGS_CHANGED) {
|
||||
adapter.notifySettingsChanged();
|
||||
} else if (returnCode == AccountActivity.RETURN_ACCOUNT_CHANGED) {
|
||||
setupAdapter();
|
||||
}
|
||||
// check if a new account is selected
|
||||
else if (returnCode == AccountActivity.RETURN_ACCOUNT_CHANGED) {
|
||||
setupAdapter(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case REQUEST_APP_SETTINGS:
|
||||
// check if an account was removed
|
||||
// check if current login is closed
|
||||
if (returnCode == SettingsActivity.RETURN_APP_LOGOUT) {
|
||||
// clear old login fragments
|
||||
adapter.clear();
|
||||
pager.setAdapter(adapter);
|
||||
}
|
||||
// reset fragments to apply changes
|
||||
else {
|
||||
adapter.notifySettingsChanged();
|
||||
setupAdapter(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
AppStyles.setTheme(root);
|
||||
AppStyles.setOverflowIcon(toolbar, settings.getIconColor());
|
||||
}
|
||||
|
||||
|
||||
@ -299,9 +299,13 @@ public class MainActivity extends AppCompatActivity implements OnTabSelectedList
|
||||
/**
|
||||
* initialize pager content
|
||||
*/
|
||||
private void setupAdapter() {
|
||||
adapter.setupForHomePage();
|
||||
pager.setAdapter(adapter);
|
||||
private void setupAdapter(boolean resetFragments) {
|
||||
AppStyles.setTheme(root);
|
||||
AppStyles.setOverflowIcon(toolbar, settings.getIconColor());
|
||||
if (resetFragments) {
|
||||
adapter.setupForHomePage();
|
||||
pager.setAdapter(adapter);
|
||||
}
|
||||
switch (settings.getLogin().getConfiguration()) {
|
||||
case TWITTER1:
|
||||
case TWITTER2:
|
||||
|
@ -37,7 +37,7 @@
|
||||
<dimen name="page_status_textsize">18sp</dimen>
|
||||
<dimen name="page_status_textsize_locale">12sp</dimen>
|
||||
<dimen name="page_status_cards_list_margin">5dp</dimen>
|
||||
<dimen name="page_status_card_height">120sp</dimen>
|
||||
<dimen name="page_status_card_height">130sp</dimen>
|
||||
<integer name="page_status_text_max_lines">5</integer>
|
||||
|
||||
<!--dimens of page_profile.xml-->
|
||||
|
Loading…
x
Reference in New Issue
Block a user