Screenshots managed with drawers
This commit is contained in:
parent
8ef7a2cfd1
commit
6faf3b5780
|
@ -57,6 +57,7 @@ public class Status implements Parcelable {
|
||||||
private boolean isTranslated = false;
|
private boolean isTranslated = false;
|
||||||
private boolean isTranslationShown = false;
|
private boolean isTranslationShown = false;
|
||||||
private boolean isNew = false;
|
private boolean isNew = false;
|
||||||
|
private boolean isTakingScreenShot = false;
|
||||||
|
|
||||||
protected Status(Parcel in) {
|
protected Status(Parcel in) {
|
||||||
id = in.readString();
|
id = in.readString();
|
||||||
|
@ -361,4 +362,12 @@ public class Status implements Parcelable {
|
||||||
public void setNew(boolean aNew) {
|
public void setNew(boolean aNew) {
|
||||||
isNew = aNew;
|
isNew = aNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTakingScreenShot() {
|
||||||
|
return isTakingScreenShot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTakingScreenShot(boolean takingScreenShot) {
|
||||||
|
isTakingScreenShot = takingScreenShot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.status_show_more = (Button) convertView.findViewById(R.id.status_show_more);
|
holder.status_show_more = (Button) convertView.findViewById(R.id.status_show_more);
|
||||||
holder.status_more = (ImageView) convertView.findViewById(R.id.status_more);
|
holder.status_more = (ImageView) convertView.findViewById(R.id.status_more);
|
||||||
holder.status_reblog_user = (TextView) convertView.findViewById(R.id.status_reblog_user);
|
holder.status_reblog_user = (TextView) convertView.findViewById(R.id.status_reblog_user);
|
||||||
holder.status_action_container = (LinearLayout) convertView.findViewById(R.id.status_action_container);
|
|
||||||
holder.status_prev1 = (ImageView) convertView.findViewById(R.id.status_prev1);
|
holder.status_prev1 = (ImageView) convertView.findViewById(R.id.status_prev1);
|
||||||
holder.status_prev2 = (ImageView) convertView.findViewById(R.id.status_prev2);
|
holder.status_prev2 = (ImageView) convertView.findViewById(R.id.status_prev2);
|
||||||
holder.status_prev3 = (ImageView) convertView.findViewById(R.id.status_prev3);
|
holder.status_prev3 = (ImageView) convertView.findViewById(R.id.status_prev3);
|
||||||
|
@ -278,7 +277,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.loader_replies.setVisibility(View.GONE);
|
holder.loader_replies.setVisibility(View.GONE);
|
||||||
holder.status_replies.setVisibility(View.GONE);
|
holder.status_replies.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
changeDrawableColor(context, R.drawable.ic_fiber_new,R.color.mastodonC4);
|
changeDrawableColor(context, R.drawable.ic_fiber_new,R.color.mastodonC4);
|
||||||
if( status.isNew())
|
if( status.isNew())
|
||||||
|
@ -287,14 +285,12 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.new_element.setVisibility(View.INVISIBLE);
|
holder.new_element.setVisibility(View.INVISIBLE);
|
||||||
int iconSizePercent = sharedpreferences.getInt(Helper.SET_ICON_SIZE, 130);
|
int iconSizePercent = sharedpreferences.getInt(Helper.SET_ICON_SIZE, 130);
|
||||||
int textSizePercent = sharedpreferences.getInt(Helper.SET_TEXT_SIZE, 110);
|
int textSizePercent = sharedpreferences.getInt(Helper.SET_TEXT_SIZE, 110);
|
||||||
|
|
||||||
holder.status_more.getLayoutParams().height = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
holder.status_more.getLayoutParams().height = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
||||||
holder.status_more.getLayoutParams().width = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
holder.status_more.getLayoutParams().width = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
||||||
holder.status_privacy.getLayoutParams().height = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
holder.status_privacy.getLayoutParams().height = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
||||||
holder.status_privacy.getLayoutParams().width = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
holder.status_privacy.getLayoutParams().width = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
||||||
holder.status_reply.getLayoutParams().height = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
holder.status_reply.getLayoutParams().height = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
||||||
holder.status_reply.getLayoutParams().width = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
holder.status_reply.getLayoutParams().width = (int) Helper.convertDpToPixel((20*iconSizePercent/100), context);
|
||||||
|
|
||||||
holder.status_content.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
|
holder.status_content.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
|
||||||
holder.status_account_displayname.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
|
holder.status_account_displayname.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
|
||||||
holder.status_account_username.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12*textSizePercent/100);
|
holder.status_account_username.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12*textSizePercent/100);
|
||||||
|
@ -303,35 +299,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.status_spoiler.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
|
holder.status_spoiler.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
|
||||||
holder.status_content_translated.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
|
holder.status_content_translated.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14*textSizePercent/100);
|
||||||
|
|
||||||
if( status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 && !status.isSpoilerShown()){
|
|
||||||
holder.status_content_container.setVisibility(View.GONE);
|
|
||||||
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
|
||||||
holder.status_spoiler_button.setVisibility(View.VISIBLE);
|
|
||||||
holder.status_spoiler.setVisibility(View.VISIBLE);
|
|
||||||
}else {
|
|
||||||
holder.status_spoiler_button.setVisibility(View.GONE);
|
|
||||||
holder.status_content_container.setVisibility(View.VISIBLE);
|
|
||||||
if( status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 )
|
|
||||||
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
|
||||||
else
|
|
||||||
holder.status_spoiler_container.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
if( status.getSpoiler_text() != null)
|
|
||||||
holder.status_spoiler.setText(status.getSpoiler_text());
|
|
||||||
//Spoiler opens
|
|
||||||
holder.status_spoiler_button.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
status.setSpoilerShown(true);
|
|
||||||
holder.status_spoiler_button.setVisibility(View.GONE);
|
|
||||||
statusListAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if( translator != Helper.TRANS_NONE && currentLocale != null && status.getLanguage() != null && !status.getLanguage().trim().equals(currentLocale)){
|
|
||||||
holder.status_translate.setVisibility(View.VISIBLE);
|
|
||||||
}else {
|
|
||||||
holder.status_translate.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (translator)
|
switch (translator)
|
||||||
{
|
{
|
||||||
|
@ -353,96 +321,8 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.status_translate.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
try {
|
|
||||||
SpannableString spannableString;
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
|
||||||
spannableString = new SpannableString(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
|
||||||
else
|
|
||||||
//noinspection deprecation
|
|
||||||
spannableString = new SpannableString(Html.fromHtml(status.getContent()));
|
|
||||||
String text = spannableString.toString();
|
|
||||||
if( !status.isTranslated() ){
|
|
||||||
tagConversion = new HashMap<>();
|
|
||||||
urlConversion = new HashMap<>();
|
|
||||||
Matcher matcher;
|
|
||||||
//Extracts urls
|
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
|
|
||||||
matcher = Patterns.WEB_URL.matcher(spannableString.toString());
|
|
||||||
else
|
|
||||||
matcher = Helper.urlPattern.matcher(spannableString.toString());
|
|
||||||
int i = 0;
|
|
||||||
//replaces them by a kind of variable which shouldn't be translated ie: __u0__, __u1__, etc.
|
|
||||||
while (matcher.find()){
|
|
||||||
String key = "__u" + String.valueOf(i) + "__";
|
|
||||||
String value = matcher.group(0);
|
|
||||||
int end = matcher.end();
|
|
||||||
if (spannableString.charAt(end) == '/') {
|
|
||||||
text = spannableString.toString().substring(0, end).
|
|
||||||
concat(spannableString.toString().substring(end+1, spannableString.length()));
|
|
||||||
}
|
|
||||||
if( value != null) {
|
|
||||||
urlConversion.put(key, value);
|
|
||||||
text = text.replace(value, key);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
//Same for tags with __t0__, __t1__, etc.
|
|
||||||
matcher = Helper.hashtagPattern.matcher(text);
|
|
||||||
while (matcher.find()){
|
|
||||||
String key = "__t" + String.valueOf(i) + "__";
|
|
||||||
String value = matcher.group(0);
|
|
||||||
tagConversion.put(key, value);
|
|
||||||
if( value != null) {
|
|
||||||
tagConversion.put(key, value);
|
|
||||||
text = text.replace(value, key);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (translator == Helper.TRANS_YANDEX)
|
|
||||||
new YandexQuery(StatusListAdapter.this).getYandexTextview(position, text, currentLocale);
|
|
||||||
else if( translator == Helper.TRANS_GOOGLE) {
|
|
||||||
|
|
||||||
while( text.charAt(text.length() -1) == '\n' && text.length() > 0)
|
|
||||||
text = text.substring(0, text.length() -1);
|
|
||||||
text += ".";
|
|
||||||
new GoogleTranslateQuery(StatusListAdapter.this).getGoogleTextview(position, text.trim(), currentLocale);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
status.setTranslationShown(!status.isTranslationShown());
|
|
||||||
statusListAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
} catch (JSONException e) {
|
|
||||||
Toast.makeText(context, R.string.toast_error_translate, Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.yandex_translate.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://translate.yandex.com/"));
|
|
||||||
context.startActivity(browserIntent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
holder.google_translate.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://translate.google.com/"));
|
|
||||||
context.startActivity(browserIntent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//Toot was translated and user asked to see it
|
|
||||||
if( status.isTranslationShown()){
|
|
||||||
holder.status_content.setVisibility(View.GONE);
|
|
||||||
holder.status_content_translated_container.setVisibility(View.VISIBLE);
|
|
||||||
}else { //Toot is not translated
|
|
||||||
holder.status_content.setVisibility(View.VISIBLE);
|
|
||||||
holder.status_content_translated_container.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Manages theme for icon colors
|
//Manages theme for icon colors
|
||||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
|
@ -488,49 +368,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.status_account_displayname.setCompoundDrawables( null, null, null, null);
|
holder.status_account_displayname.setCompoundDrawables( null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Click on a conversation
|
|
||||||
if( type != RetrieveFeedsAsyncTask.Type.CONTEXT ){
|
|
||||||
holder.status_content.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
if( status.getReblog() == null)
|
|
||||||
b.putString("statusId", status.getId());
|
|
||||||
else
|
|
||||||
b.putString("statusId", status.getReblog().getId());
|
|
||||||
intent.putExtras(b);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
holder.card_status_container.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
if( status.getReblog() == null)
|
|
||||||
b.putString("statusId", status.getId());
|
|
||||||
else
|
|
||||||
b.putString("statusId", status.getReblog().getId());
|
|
||||||
intent.putExtras(b);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else {
|
|
||||||
if( theme == Helper.THEME_LIGHT){
|
|
||||||
if( position == ShowConversationActivity.position){
|
|
||||||
holder.main_container.setBackgroundResource(R.color.mastodonC3_);
|
|
||||||
}else {
|
|
||||||
holder.main_container.setBackgroundResource(R.color.mastodonC3__);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
if( position == ShowConversationActivity.position){
|
|
||||||
holder.main_container.setBackgroundResource(R.color.mastodonC1_);
|
|
||||||
}else {
|
|
||||||
holder.main_container.setBackgroundResource(R.color.mastodonC1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String content;
|
String content;
|
||||||
final String displayName;
|
final String displayName;
|
||||||
|
@ -555,26 +393,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.status_account_username.setText(String.format("@%s",username));
|
holder.status_account_username.setText(String.format("@%s",username));
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.status_reply.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Intent intent = new Intent(context, TootActivity.class);
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
if( status.getReblog() != null )
|
|
||||||
b.putParcelable("tootReply", status.getReblog());
|
|
||||||
else
|
|
||||||
b.putParcelable("tootReply", status);
|
|
||||||
intent.putExtras(b); //Put your id to your next Intent
|
|
||||||
context.startActivity(intent);
|
|
||||||
if( type == RetrieveFeedsAsyncTask.Type.CONTEXT ){
|
|
||||||
try {
|
|
||||||
//Avoid to open multi activities when replying in a conversation
|
|
||||||
((ShowConversationActivity)context).finish();
|
|
||||||
}catch (Exception ignored){}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -654,115 +473,325 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.status_account_profile_boost_by.setVisibility(View.GONE);
|
holder.status_account_profile_boost_by.setVisibility(View.GONE);
|
||||||
holder.status_account_profile.setVisibility(View.VISIBLE);
|
holder.status_account_profile.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if( status.getReblog() == null) {
|
if( status.isTakingScreenShot()){
|
||||||
if (status.getMedia_attachments().size() < 1) {
|
holder.status_document_container.setVisibility(View.GONE);
|
||||||
holder.status_document_container.setVisibility(View.GONE);
|
holder.status_content.setVisibility(View.VISIBLE);
|
||||||
holder.status_show_more.setVisibility(View.GONE);
|
holder.status_content_translated_container.setVisibility(View.GONE);
|
||||||
} else {
|
holder.status_spoiler_button.setVisibility(View.GONE);
|
||||||
//If medias are loaded without any conditions or if device is on wifi
|
holder.status_content_container.setVisibility(View.VISIBLE);
|
||||||
if (!status.isSensitive() && (behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi))) {
|
holder.status_translate.setVisibility(View.GONE);
|
||||||
loadAttachments(status, holder);
|
holder.status_show_more.setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
|
||||||
|
if( translator != Helper.TRANS_NONE && currentLocale != null && status.getLanguage() != null && !status.getLanguage().trim().equals(currentLocale)){
|
||||||
|
holder.status_translate.setVisibility(View.VISIBLE);
|
||||||
|
}else {
|
||||||
|
holder.status_translate.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if( status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 && !status.isSpoilerShown()){
|
||||||
|
holder.status_content_container.setVisibility(View.GONE);
|
||||||
|
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
||||||
|
holder.status_spoiler_button.setVisibility(View.VISIBLE);
|
||||||
|
holder.status_spoiler.setVisibility(View.VISIBLE);
|
||||||
|
}else {
|
||||||
|
holder.status_spoiler_button.setVisibility(View.GONE);
|
||||||
|
holder.status_content_container.setVisibility(View.VISIBLE);
|
||||||
|
if( status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 )
|
||||||
|
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
||||||
|
else
|
||||||
|
holder.status_spoiler_container.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if( status.getSpoiler_text() != null)
|
||||||
|
holder.status_spoiler.setText(status.getSpoiler_text());
|
||||||
|
if( status.getReblog() == null) {
|
||||||
|
if (status.getMedia_attachments().size() < 1) {
|
||||||
|
holder.status_document_container.setVisibility(View.GONE);
|
||||||
holder.status_show_more.setVisibility(View.GONE);
|
holder.status_show_more.setVisibility(View.GONE);
|
||||||
status.setAttachmentShown(true);
|
|
||||||
} else {
|
} else {
|
||||||
//Text depending if toots is sensitive or not
|
//If medias are loaded without any conditions or if device is on wifi
|
||||||
String textShowMore = (status.isSensitive()) ? context.getString(R.string.load_sensitive_attachment) : context.getString(R.string.load_attachment);
|
if (!status.isSensitive() && (behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi))) {
|
||||||
holder.status_show_more.setText(textShowMore);
|
|
||||||
if (!status.isAttachmentShown()) {
|
|
||||||
holder.status_show_more.setVisibility(View.VISIBLE);
|
|
||||||
holder.status_document_container.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
loadAttachments(status, holder);
|
loadAttachments(status, holder);
|
||||||
}
|
holder.status_show_more.setVisibility(View.GONE);
|
||||||
}
|
status.setAttachmentShown(true);
|
||||||
}
|
|
||||||
}else { //Attachments for reblogs
|
|
||||||
if (status.getReblog().getMedia_attachments().size() < 1) {
|
|
||||||
holder.status_document_container.setVisibility(View.GONE);
|
|
||||||
holder.status_show_more.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
//If medias are loaded without any conditions or if device is on wifi
|
|
||||||
if (!status.getReblog().isSensitive() && (behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi))) {
|
|
||||||
loadAttachments(status.getReblog(), holder);
|
|
||||||
holder.status_show_more.setVisibility(View.GONE);
|
|
||||||
status.getReblog().setAttachmentShown(true);
|
|
||||||
} else {
|
|
||||||
//Text depending if toots is sensitive or not
|
|
||||||
String textShowMore = (status.getReblog().isSensitive()) ? context.getString(R.string.load_sensitive_attachment) : context.getString(R.string.load_attachment);
|
|
||||||
holder.status_show_more.setText(textShowMore);
|
|
||||||
if (!status.isAttachmentShown()) {
|
|
||||||
holder.status_show_more.setVisibility(View.VISIBLE);
|
|
||||||
holder.status_document_container.setVisibility(View.GONE);
|
|
||||||
} else {
|
} else {
|
||||||
|
//Text depending if toots is sensitive or not
|
||||||
|
String textShowMore = (status.isSensitive()) ? context.getString(R.string.load_sensitive_attachment) : context.getString(R.string.load_attachment);
|
||||||
|
holder.status_show_more.setText(textShowMore);
|
||||||
|
if (!status.isAttachmentShown()) {
|
||||||
|
holder.status_show_more.setVisibility(View.VISIBLE);
|
||||||
|
holder.status_document_container.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
loadAttachments(status, holder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else { //Attachments for reblogs
|
||||||
|
if (status.getReblog().getMedia_attachments().size() < 1) {
|
||||||
|
holder.status_document_container.setVisibility(View.GONE);
|
||||||
|
holder.status_show_more.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
//If medias are loaded without any conditions or if device is on wifi
|
||||||
|
if (!status.getReblog().isSensitive() && (behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi))) {
|
||||||
loadAttachments(status.getReblog(), holder);
|
loadAttachments(status.getReblog(), holder);
|
||||||
|
holder.status_show_more.setVisibility(View.GONE);
|
||||||
|
status.getReblog().setAttachmentShown(true);
|
||||||
|
} else {
|
||||||
|
//Text depending if toots is sensitive or not
|
||||||
|
String textShowMore = (status.getReblog().isSensitive()) ? context.getString(R.string.load_sensitive_attachment) : context.getString(R.string.load_attachment);
|
||||||
|
holder.status_show_more.setText(textShowMore);
|
||||||
|
if (!status.isAttachmentShown()) {
|
||||||
|
holder.status_show_more.setVisibility(View.VISIBLE);
|
||||||
|
holder.status_document_container.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
loadAttachments(status.getReblog(), holder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//Toot was translated and user asked to see it
|
||||||
|
if( status.isTranslationShown()){
|
||||||
|
holder.status_content.setVisibility(View.GONE);
|
||||||
|
holder.status_content_translated_container.setVisibility(View.VISIBLE);
|
||||||
|
}else { //Toot is not translated
|
||||||
|
holder.status_content.setVisibility(View.VISIBLE);
|
||||||
|
holder.status_content_translated_container.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
switch (status.getVisibility()){
|
switch (status.getVisibility()){
|
||||||
case "public":
|
case "direct":
|
||||||
holder.status_privacy.setImageResource(R.drawable.ic_action_globe);
|
case "private":
|
||||||
break;
|
holder.status_reblog_count.setVisibility(View.GONE);
|
||||||
case "unlisted":
|
break;
|
||||||
holder.status_privacy.setImageResource(R.drawable.ic_action_lock_open);
|
case "public":
|
||||||
break;
|
case "unlisted":
|
||||||
case "private":
|
holder.status_reblog_count.setVisibility(View.VISIBLE);
|
||||||
holder.status_privacy.setImageResource(R.drawable.ic_action_lock_closed);
|
break;
|
||||||
break;
|
default:
|
||||||
case "direct":
|
holder.status_reblog_count.setVisibility(View.VISIBLE);
|
||||||
holder.status_privacy.setImageResource(R.drawable.ic_local_post_office);
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
Drawable imgFav, imgReblog;
|
|
||||||
if( status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited()))
|
|
||||||
imgFav = ContextCompat.getDrawable(context, R.drawable.ic_fav_yellow);
|
|
||||||
else
|
|
||||||
imgFav = ContextCompat.getDrawable(context, R.drawable.ic_fav_black);
|
|
||||||
|
|
||||||
if( status.isReblogged()|| (status.getReblog() != null && status.getReblog().isReblogged()))
|
switch (status.getVisibility()){
|
||||||
imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_retweet_yellow);
|
case "public":
|
||||||
else
|
holder.status_privacy.setImageResource(R.drawable.ic_action_globe);
|
||||||
imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_retweet_black);
|
break;
|
||||||
|
case "unlisted":
|
||||||
|
holder.status_privacy.setImageResource(R.drawable.ic_action_lock_open);
|
||||||
|
break;
|
||||||
|
case "private":
|
||||||
|
holder.status_privacy.setImageResource(R.drawable.ic_action_lock_closed);
|
||||||
|
break;
|
||||||
|
case "direct":
|
||||||
|
holder.status_privacy.setImageResource(R.drawable.ic_local_post_office);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
imgFav.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
|
Drawable imgFav, imgReblog;
|
||||||
imgReblog.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
|
if( status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited()))
|
||||||
|
imgFav = ContextCompat.getDrawable(context, R.drawable.ic_fav_yellow);
|
||||||
holder.status_favorite_count.setCompoundDrawables(imgFav, null, null, null);
|
|
||||||
holder.status_reblog_count.setCompoundDrawables(imgReblog, null, null, null);
|
|
||||||
|
|
||||||
if( theme == Helper.THEME_LIGHT) {
|
|
||||||
holder.status_show_more.setTextColor(ContextCompat.getColor(context, R.color.white));
|
|
||||||
holder.status_spoiler_button.setTextColor(ContextCompat.getColor(context, R.color.white));
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isOwner = status.getAccount().getId().equals(userId);
|
|
||||||
|
|
||||||
// Pinning toots is only available on Mastodon 1._6_.0 instances.
|
|
||||||
if (isOwner && Helper.canPin && (status.getVisibility().equals("public") || status.getVisibility().equals("unlisted"))) {
|
|
||||||
Drawable imgPin;
|
|
||||||
if( status.isPinned())
|
|
||||||
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_action_pin_yellow);
|
|
||||||
else
|
else
|
||||||
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_action_pin_dark);
|
imgFav = ContextCompat.getDrawable(context, R.drawable.ic_fav_black);
|
||||||
imgPin.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
|
|
||||||
holder.status_pin.setImageDrawable(imgPin);
|
if( status.isReblogged()|| (status.getReblog() != null && status.getReblog().isReblogged()))
|
||||||
holder.status_pin.setOnClickListener(new View.OnClickListener() {
|
imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_retweet_yellow);
|
||||||
|
else
|
||||||
|
imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_retweet_black);
|
||||||
|
|
||||||
|
imgFav.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
|
||||||
|
imgReblog.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
|
||||||
|
|
||||||
|
holder.status_favorite_count.setCompoundDrawables(imgFav, null, null, null);
|
||||||
|
holder.status_reblog_count.setCompoundDrawables(imgReblog, null, null, null);
|
||||||
|
|
||||||
|
if( theme == Helper.THEME_LIGHT) {
|
||||||
|
holder.status_show_more.setTextColor(ContextCompat.getColor(context, R.color.white));
|
||||||
|
holder.status_spoiler_button.setTextColor(ContextCompat.getColor(context, R.color.white));
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isOwner = status.getAccount().getId().equals(userId);
|
||||||
|
|
||||||
|
// Pinning toots is only available on Mastodon 1._6_.0 instances.
|
||||||
|
if (isOwner && Helper.canPin && (status.getVisibility().equals("public") || status.getVisibility().equals("unlisted"))) {
|
||||||
|
Drawable imgPin;
|
||||||
|
if( status.isPinned())
|
||||||
|
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_action_pin_yellow);
|
||||||
|
else
|
||||||
|
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_action_pin_dark);
|
||||||
|
imgPin.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f));
|
||||||
|
holder.status_pin.setImageDrawable(imgPin);
|
||||||
|
|
||||||
|
holder.status_pin.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
holder.status_pin.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Click on a conversation
|
||||||
|
if( type != RetrieveFeedsAsyncTask.Type.CONTEXT ){
|
||||||
|
holder.status_content.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
/* Code is in for displayConfirmationDialog() but we don't call it.
|
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||||
* Need to make sure we can successfully get a pinned toots list by
|
Bundle b = new Bundle();
|
||||||
* this point, after async call earlier.
|
if( status.getReblog() == null)
|
||||||
*/
|
b.putString("statusId", status.getId());
|
||||||
pinAction(status);
|
else
|
||||||
|
b.putString("statusId", status.getReblog().getId());
|
||||||
|
intent.putExtras(b);
|
||||||
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
holder.status_pin.setVisibility(View.VISIBLE);
|
holder.card_status_container.setOnClickListener(new View.OnClickListener() {
|
||||||
}
|
@Override
|
||||||
else {
|
public void onClick(View v) {
|
||||||
holder.status_pin.setVisibility(View.GONE);
|
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
if( status.getReblog() == null)
|
||||||
|
b.putString("statusId", status.getId());
|
||||||
|
else
|
||||||
|
b.putString("statusId", status.getReblog().getId());
|
||||||
|
intent.putExtras(b);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
if( theme == Helper.THEME_LIGHT){
|
||||||
|
if( position == ShowConversationActivity.position){
|
||||||
|
holder.main_container.setBackgroundResource(R.color.mastodonC3_);
|
||||||
|
}else {
|
||||||
|
holder.main_container.setBackgroundResource(R.color.mastodonC3__);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if( position == ShowConversationActivity.position){
|
||||||
|
holder.main_container.setBackgroundResource(R.color.mastodonC1_);
|
||||||
|
}else {
|
||||||
|
holder.main_container.setBackgroundResource(R.color.mastodonC1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
holder.status_reply.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(context, TootActivity.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
if( status.getReblog() != null )
|
||||||
|
b.putParcelable("tootReply", status.getReblog());
|
||||||
|
else
|
||||||
|
b.putParcelable("tootReply", status);
|
||||||
|
intent.putExtras(b); //Put your id to your next Intent
|
||||||
|
context.startActivity(intent);
|
||||||
|
if( type == RetrieveFeedsAsyncTask.Type.CONTEXT ){
|
||||||
|
try {
|
||||||
|
//Avoid to open multi activities when replying in a conversation
|
||||||
|
((ShowConversationActivity)context).finish();
|
||||||
|
}catch (Exception ignored){}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.status_translate.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
try {
|
||||||
|
SpannableString spannableString;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
spannableString = new SpannableString(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
||||||
|
else
|
||||||
|
//noinspection deprecation
|
||||||
|
spannableString = new SpannableString(Html.fromHtml(status.getContent()));
|
||||||
|
String text = spannableString.toString();
|
||||||
|
if( !status.isTranslated() ){
|
||||||
|
tagConversion = new HashMap<>();
|
||||||
|
urlConversion = new HashMap<>();
|
||||||
|
Matcher matcher;
|
||||||
|
//Extracts urls
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
|
||||||
|
matcher = Patterns.WEB_URL.matcher(spannableString.toString());
|
||||||
|
else
|
||||||
|
matcher = Helper.urlPattern.matcher(spannableString.toString());
|
||||||
|
int i = 0;
|
||||||
|
//replaces them by a kind of variable which shouldn't be translated ie: __u0__, __u1__, etc.
|
||||||
|
while (matcher.find()){
|
||||||
|
String key = "__u" + String.valueOf(i) + "__";
|
||||||
|
String value = matcher.group(0);
|
||||||
|
int end = matcher.end();
|
||||||
|
if (spannableString.charAt(end) == '/') {
|
||||||
|
text = spannableString.toString().substring(0, end).
|
||||||
|
concat(spannableString.toString().substring(end+1, spannableString.length()));
|
||||||
|
}
|
||||||
|
if( value != null) {
|
||||||
|
urlConversion.put(key, value);
|
||||||
|
text = text.replace(value, key);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
//Same for tags with __t0__, __t1__, etc.
|
||||||
|
matcher = Helper.hashtagPattern.matcher(text);
|
||||||
|
while (matcher.find()){
|
||||||
|
String key = "__t" + String.valueOf(i) + "__";
|
||||||
|
String value = matcher.group(0);
|
||||||
|
tagConversion.put(key, value);
|
||||||
|
if( value != null) {
|
||||||
|
tagConversion.put(key, value);
|
||||||
|
text = text.replace(value, key);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (translator == Helper.TRANS_YANDEX)
|
||||||
|
new YandexQuery(StatusListAdapter.this).getYandexTextview(position, text, currentLocale);
|
||||||
|
else if( translator == Helper.TRANS_GOOGLE) {
|
||||||
|
|
||||||
|
while( text.charAt(text.length() -1) == '\n' && text.length() > 0)
|
||||||
|
text = text.substring(0, text.length() -1);
|
||||||
|
text += ".";
|
||||||
|
new GoogleTranslateQuery(StatusListAdapter.this).getGoogleTextview(position, text.trim(), currentLocale);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
status.setTranslationShown(!status.isTranslationShown());
|
||||||
|
statusListAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Toast.makeText(context, R.string.toast_error_translate, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.yandex_translate.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://translate.yandex.com/"));
|
||||||
|
context.startActivity(browserIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
holder.google_translate.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://translate.google.com/"));
|
||||||
|
context.startActivity(browserIntent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//Spoiler opens
|
||||||
|
holder.status_spoiler_button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
status.setSpoilerShown(true);
|
||||||
|
holder.status_spoiler_button.setVisibility(View.GONE);
|
||||||
|
statusListAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
holder.status_pin.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
/* Code is in for displayConfirmationDialog() but we don't call it.
|
||||||
|
* Need to make sure we can successfully get a pinned toots list by
|
||||||
|
* this point, after async call earlier.
|
||||||
|
*/
|
||||||
|
pinAction(status);
|
||||||
|
}
|
||||||
|
});
|
||||||
holder.status_show_more.setOnClickListener(new View.OnClickListener() {
|
holder.status_show_more.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -801,7 +830,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.status_favorite_count.setOnClickListener(new View.OnClickListener() {
|
holder.status_favorite_count.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
boolean confirmation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
|
boolean confirmation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
|
||||||
if( confirmation )
|
if( confirmation )
|
||||||
displayConfirmationDialog(FAVOURITE,status);
|
displayConfirmationDialog(FAVOURITE,status);
|
||||||
|
@ -809,7 +837,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
favouriteAction(status);
|
favouriteAction(status);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
holder.status_reblog_count.setOnClickListener(new View.OnClickListener() {
|
holder.status_reblog_count.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -822,18 +849,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
switch (status.getVisibility()){
|
|
||||||
case "direct":
|
|
||||||
case "private":
|
|
||||||
holder.status_reblog_count.setVisibility(View.GONE);
|
|
||||||
break;
|
|
||||||
case "public":
|
|
||||||
case "unlisted":
|
|
||||||
holder.status_reblog_count.setVisibility(View.VISIBLE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
holder.status_reblog_count.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
final View finalConvertView = convertView;
|
final View finalConvertView = convertView;
|
||||||
holder.status_more.setOnClickListener(new View.OnClickListener() {
|
holder.status_more.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -1225,7 +1241,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
TextView status_reblog_user;
|
TextView status_reblog_user;
|
||||||
Button status_show_more;
|
Button status_show_more;
|
||||||
ImageView status_more;
|
ImageView status_more;
|
||||||
LinearLayout status_action_container;
|
|
||||||
LinearLayout status_document_container;
|
LinearLayout status_document_container;
|
||||||
ImageView status_prev1;
|
ImageView status_prev1;
|
||||||
ImageView status_prev2;
|
ImageView status_prev2;
|
||||||
|
@ -1400,7 +1415,11 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
||||||
return;
|
return;
|
||||||
}else if( which == 3) {
|
}else if( which == 3) {
|
||||||
|
status.setTakingScreenShot(true);
|
||||||
|
statusListAdapter.notifyDataSetChanged();
|
||||||
Bitmap bitmap = Helper.convertTootIntoBitmap(context, view);
|
Bitmap bitmap = Helper.convertTootIntoBitmap(context, view);
|
||||||
|
status.setTakingScreenShot(false);
|
||||||
|
statusListAdapter.notifyDataSetChanged();
|
||||||
Intent intent = new Intent(context, TootActivity.class);
|
Intent intent = new Intent(context, TootActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
String fname = "tootmention_" + status.getId() +".jpg";
|
String fname = "tootmention_" + status.getId() +".jpg";
|
||||||
|
@ -1452,7 +1471,11 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
||||||
return;
|
return;
|
||||||
}else if( which == 5 ){
|
}else if( which == 5 ){
|
||||||
|
status.setTakingScreenShot(true);
|
||||||
|
statusListAdapter.notifyDataSetChanged();
|
||||||
Bitmap bitmap = Helper.convertTootIntoBitmap(context, view);
|
Bitmap bitmap = Helper.convertTootIntoBitmap(context, view);
|
||||||
|
status.setTakingScreenShot(false);
|
||||||
|
statusListAdapter.notifyDataSetChanged();
|
||||||
Intent intent = new Intent(context, TootActivity.class);
|
Intent intent = new Intent(context, TootActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
String fname = "tootmention_" + status.getId() +".jpg";
|
String fname = "tootmention_" + status.getId() +".jpg";
|
||||||
|
|
|
@ -1610,64 +1610,8 @@ public class Helper {
|
||||||
*/
|
*/
|
||||||
public static Bitmap convertTootIntoBitmap(Context context, View view) {
|
public static Bitmap convertTootIntoBitmap(Context context, View view) {
|
||||||
|
|
||||||
int status_content_v = 0, status_content_translated_v = 0, yandex_translate_v = 0, google_translate_v = 0, status_content_translated_container_v = 0;
|
int new_element_v = 0, notification_delete_v = 0;
|
||||||
int status_spoiler_button_v = 0, status_show_more_v = 0, status_action_container_v = 0, status_content_container_v = 0, status_translate_v = 0, new_element_v = 0, notification_delete_v = 0;
|
|
||||||
//Removes some elements
|
//Removes some elements
|
||||||
|
|
||||||
TextView status_content = (TextView) view.findViewById(R.id.status_content);
|
|
||||||
if( status_content != null) {
|
|
||||||
status_content_v = status_content.getVisibility();
|
|
||||||
status_content.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView status_content_translated = (TextView) view.findViewById(R.id.status_content_translated);
|
|
||||||
if( status_content_translated != null) {
|
|
||||||
status_content_translated_v = status_content_translated.getVisibility();
|
|
||||||
status_content_translated.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView yandex_translate = (TextView) view.findViewById(R.id.yandex_translate);
|
|
||||||
if( yandex_translate != null) {
|
|
||||||
yandex_translate_v = yandex_translate.getVisibility();
|
|
||||||
yandex_translate.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView google_translate = (TextView) view.findViewById(R.id.google_translate);
|
|
||||||
if( google_translate != null) {
|
|
||||||
google_translate_v = google_translate.getVisibility();
|
|
||||||
google_translate.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Button status_spoiler_button = (Button) view.findViewById(R.id.status_spoiler_button) ;
|
|
||||||
if( status_spoiler_button != null) {
|
|
||||||
status_spoiler_button_v = status_spoiler_button.getVisibility();
|
|
||||||
status_spoiler_button.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
LinearLayout status_content_translated_container = (LinearLayout) view.findViewById(R.id.status_content_translated_container);
|
|
||||||
if( status_content_translated_container != null) {
|
|
||||||
status_content_translated_container_v = status_content_translated_container.getVisibility();
|
|
||||||
status_content_translated_container.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
LinearLayout status_action_container = (LinearLayout) view.findViewById(R.id.status_action_container);
|
|
||||||
if( status_action_container != null) {
|
|
||||||
status_action_container_v = status_action_container.getVisibility();
|
|
||||||
status_action_container.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
LinearLayout status_content_container = (LinearLayout) view.findViewById(R.id.status_content_container);
|
|
||||||
if( status_content_container != null) {
|
|
||||||
status_content_container_v = status_content_container.getVisibility();
|
|
||||||
status_content_container.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
FloatingActionButton status_translate = (FloatingActionButton) view.findViewById(R.id.status_translate);
|
|
||||||
if( status_translate != null) {
|
|
||||||
status_translate_v = status_translate.getVisibility();
|
|
||||||
status_translate.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageView new_element = (ImageView) view.findViewById(R.id.new_element);
|
ImageView new_element = (ImageView) view.findViewById(R.id.new_element);
|
||||||
if( new_element != null) {
|
if( new_element != null) {
|
||||||
new_element_v = new_element.getVisibility();
|
new_element_v = new_element.getVisibility();
|
||||||
|
@ -1679,12 +1623,6 @@ public class Helper {
|
||||||
notification_delete_v = notification_delete.getVisibility();
|
notification_delete_v = notification_delete.getVisibility();
|
||||||
notification_delete.setVisibility(View.GONE);
|
notification_delete.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
Button status_show_more = (Button) view.findViewById(R.id.status_show_more);
|
|
||||||
if( status_show_more != null){
|
|
||||||
status_show_more_v = status_show_more.getVisibility();
|
|
||||||
status_show_more.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
|
Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
Canvas canvas = new Canvas(returnedBitmap);
|
Canvas canvas = new Canvas(returnedBitmap);
|
||||||
Drawable bgDrawable =view.getBackground();
|
Drawable bgDrawable =view.getBackground();
|
||||||
|
@ -1701,31 +1639,10 @@ public class Helper {
|
||||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
||||||
canvas.drawText("Via #Mastalab", view.getWidth()-230, view.getHeight() - 35, paint);
|
canvas.drawText("Via #Mastalab", view.getWidth()-230, view.getHeight() - 35, paint);
|
||||||
|
|
||||||
//Restores initial visibilities
|
|
||||||
if( status_content != null)
|
|
||||||
status_content.setVisibility(status_content_v);
|
|
||||||
if( status_content_translated != null)
|
|
||||||
status_content_translated.setVisibility(status_content_translated_v);
|
|
||||||
if( yandex_translate != null)
|
|
||||||
yandex_translate.setVisibility(yandex_translate_v);
|
|
||||||
if( google_translate != null)
|
|
||||||
google_translate.setVisibility(google_translate_v);
|
|
||||||
if( status_content_translated_container != null)
|
|
||||||
status_content_translated_container.setVisibility(status_content_translated_container_v);
|
|
||||||
if( status_action_container != null)
|
|
||||||
status_action_container.setVisibility(status_action_container_v);
|
|
||||||
if( status_content_container != null)
|
|
||||||
status_content_container.setVisibility(status_content_container_v);
|
|
||||||
if( status_translate != null)
|
|
||||||
status_translate.setVisibility(status_translate_v);
|
|
||||||
if( new_element != null)
|
if( new_element != null)
|
||||||
new_element.setVisibility(new_element_v);
|
new_element.setVisibility(new_element_v);
|
||||||
if( notification_delete != null)
|
if( notification_delete != null)
|
||||||
notification_delete.setVisibility(notification_delete_v);
|
notification_delete.setVisibility(notification_delete_v);
|
||||||
if( status_spoiler_button != null)
|
|
||||||
status_spoiler_button.setVisibility(status_spoiler_button_v);
|
|
||||||
if( status_show_more != null)
|
|
||||||
status_show_more.setVisibility(status_show_more_v);
|
|
||||||
return returnedBitmap;
|
return returnedBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue