Improve notifications tab

This commit is contained in:
stom79 2018-09-15 17:45:33 +02:00
parent 8fd4e41206
commit 2304d5a963
3 changed files with 56 additions and 46 deletions

View File

@ -34,9 +34,11 @@ import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
@ -767,6 +769,15 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
}
});
holder.notification_status_content.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_UP && !view.hasFocus()) {
try{view.requestFocus();}catch (Exception ignored){}
}
return false;
}
});
if( theme == Helper.THEME_LIGHT) {
holder.status_show_more.setTextColor(ContextCompat.getColor(context, R.color.white));
}

View File

@ -607,7 +607,48 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
if( !status.isEmojiFound())
status.makeEmojis(context, StatusListAdapter.this);
holder.status_content.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_UP && !view.hasFocus()) {
try{view.requestFocus();}catch (Exception ignored){}
}
return false;
}
});
//Click on a conversation
if( type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && (getItemViewType(position) == DISPLAYED_STATUS || getItemViewType(position) == COMPACT_STATUS)) {
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);
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
((Activity) context).finish();
context.startActivity(intent);
}
});
holder.main_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);
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
((Activity) context).finish();
context.startActivity(intent);
}
});
}
holder.status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
@ -998,48 +1039,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
holder.status_content.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_UP && !view.hasFocus()) {
try{view.requestFocus();}catch (Exception ignored){}
}
return false;
}
});
//Click on a conversation
if( type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && (getItemViewType(position) == DISPLAYED_STATUS || getItemViewType(position) == COMPACT_STATUS)) {
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);
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
((Activity) context).finish();
context.startActivity(intent);
}
});
holder.main_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);
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
((Activity) context).finish();
context.startActivity(intent);
}
});
}
if( theme == Helper.THEME_LIGHT){
holder.main_container.setBackgroundResource(R.color.mastodonC3__);
}else if (theme == Helper.THEME_DARK){

View File

@ -31,9 +31,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:divider="@null"
>
</android.support.v7.widget.RecyclerView>
/>
</android.support.v4.widget.SwipeRefreshLayout>
<RelativeLayout
android:id="@+id/no_action"