Close panels

This commit is contained in:
tom79 2019-06-11 18:27:54 +02:00
parent 61fc9bde87
commit e902e3a1f0
1 changed files with 15 additions and 9 deletions

View File

@ -55,7 +55,6 @@ import android.view.MenuItem;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window;
import android.webkit.URLUtil; import android.webkit.URLUtil;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
@ -1000,8 +999,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.fedilab_features.setOnClickListener(new View.OnClickListener() { holder.fedilab_features.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
boolean state = status.isCustomFeaturesDisplayed();
closePanels(); closePanels();
status.setCustomFeaturesDisplayed(!status.isCustomFeaturesDisplayed()); status.setCustomFeaturesDisplayed(!state);
notifyStatusChanged(status); notifyStatusChanged(status);
} }
}); });
@ -1155,7 +1155,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
public void onClick(View v) { public void onClick(View v) {
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) { if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) {
Intent intent = new Intent(context, ShowConversationActivity.class); Intent intent = new Intent(context, ShowConversationActivity.class);
closePanels(); int position = closePanels();
if( holder.getAdapterPosition() == position)
return;
Bundle b = new Bundle(); Bundle b = new Bundle();
if( social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) if( social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
b.putString("conversationId", status.getConversationId()); b.putString("conversationId", status.getConversationId());
@ -1178,7 +1180,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
public void onClick(View v) { public void onClick(View v) {
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) { if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) {
Intent intent = new Intent(context, ShowConversationActivity.class); Intent intent = new Intent(context, ShowConversationActivity.class);
closePanels(); int position = closePanels();
if( holder.getAdapterPosition() == position)
return;
Bundle b = new Bundle(); Bundle b = new Bundle();
if( social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) if( social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
b.putString("conversationId", status.getConversationId()); b.putString("conversationId", status.getConversationId());
@ -1201,7 +1205,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
public void onClick(View v) { public void onClick(View v) {
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) { if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) {
Intent intent = new Intent(context, ShowConversationActivity.class); Intent intent = new Intent(context, ShowConversationActivity.class);
closePanels(); int position = closePanels();
if( holder.getAdapterPosition() == position)
return;
Bundle b = new Bundle(); Bundle b = new Bundle();
if( social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) if( social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
b.putString("conversationId", status.getConversationId()); b.putString("conversationId", status.getConversationId());
@ -3043,19 +3049,19 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
} }
private void closePanels(){ private int closePanels(){
int position = -1;
if( statuses != null && statuses.size() > 0){ if( statuses != null && statuses.size() > 0){
int position = 0;
for(Status status: statuses){ for(Status status: statuses){
position++;
if( status.isCustomFeaturesDisplayed()) { if( status.isCustomFeaturesDisplayed()) {
status.setCustomFeaturesDisplayed(false); status.setCustomFeaturesDisplayed(false);
notifyItemChanged(position); notifyItemChanged(position);
break; break;
} }
position++;
} }
} }
return position;
} }
private void timedMuteAction(Status status){ private void timedMuteAction(Status status){