Only put text for mentions

This commit is contained in:
stom79 2018-01-26 08:10:37 +01:00
parent 0d9238b8a3
commit b98e08fac7
2 changed files with 204 additions and 227 deletions

View File

@ -687,17 +687,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.status_account_profile_boost_by.setVisibility(View.GONE);
holder.status_account_profile.setVisibility(View.VISIBLE);
}
if( status.isTakingScreenShot()){
holder.status_document_container.setVisibility(View.GONE);
holder.status_content.setVisibility(View.VISIBLE);
holder.status_content_translated_container.setVisibility(View.GONE);
holder.status_spoiler_button.setVisibility(View.GONE);
holder.status_spoiler_mention_container.setVisibility(View.GONE);
holder.status_content_container.setVisibility(View.VISIBLE);
holder.status_translate.setVisibility(View.GONE);
holder.status_show_more.setVisibility(View.GONE);
holder.status_action_container.setVisibility(View.INVISIBLE);
}else {
holder.status_action_container.setVisibility(View.VISIBLE);
if( trans_forced || (translator != Helper.TRANS_NONE && currentLocale != null && status.getLanguage() != null && !status.getLanguage().trim().equals(currentLocale))){
holder.status_translate.setVisibility(View.VISIBLE);
@ -894,7 +883,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
else {
holder.status_pin.setVisibility(View.GONE);
}
}
holder.status_content.setOnTouchListener(new View.OnTouchListener() {
@Override
@ -1300,16 +1289,12 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
return true;
case R.id.action_mention:
status.setTakingScreenShot(true);
notifyStatusChanged(status);
// Get a handler that can be used to post to the main thread
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Bitmap bitmap = Helper.convertTootIntoBitmap(context, holder.getView());
status.setTakingScreenShot(false);
notifyStatusChanged(status);
Bitmap bitmap = Helper.convertTootIntoBitmap(context, holder.status_content);
Intent intent = new Intent(context, TootActivity.class);
Bundle b = new Bundle();
String fname = "tootmention_" + status.getId() +".jpg";

View File

@ -1687,26 +1687,22 @@ public class Helper {
*/
public static Bitmap convertTootIntoBitmap(Context context, View view) {
int new_element_v = View.VISIBLE, notification_delete_v = View.VISIBLE;
//Removes some elements
ImageView new_element = view.findViewById(R.id.new_element);
if( new_element != null) {
new_element_v = new_element.getVisibility();
new_element.setVisibility(View.GONE);
}
ImageView notification_delete = view.findViewById(R.id.notification_delete);
if( notification_delete != null) {
notification_delete_v = notification_delete.getVisibility();
notification_delete.setVisibility(View.GONE);
}
Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth()+10, view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(returnedBitmap);
canvas.drawBitmap(returnedBitmap, 10, 0, null);
Drawable bgDrawable =view.getBackground();
if (bgDrawable!=null)
bgDrawable.draw(canvas);
else
else {
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if (theme == Helper.THEME_DARK) {
canvas.drawColor(ContextCompat.getColor(context, R.color.mastodonC1));
}else {
canvas.drawColor(Color.WHITE);
}
}
view.draw(canvas);
Paint paint = new Paint();
int mastodonC4 = ContextCompat.getColor(context, R.color.mastodonC4);
@ -1716,10 +1712,6 @@ public class Helper {
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
canvas.drawText("Via #Mastalab", view.getWidth()-230, view.getHeight() -50, paint);
if( new_element != null)
new_element.setVisibility(new_element_v);
if( notification_delete != null)
notification_delete.setVisibility(notification_delete_v);
return returnedBitmap;
}