Display more replies in context
This commit is contained in:
parent
f36ddba6f9
commit
90d7e6e3a6
|
@ -75,7 +75,6 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
|
||||
private String statusId;
|
||||
private Status initialStatus;
|
||||
public static int position;
|
||||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
private ListView lv_status;
|
||||
private boolean isRefreshed;
|
||||
|
@ -100,10 +99,10 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
View view = inflater.inflate(R.layout.conversation_action_bar, null);
|
||||
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
TextView title = (TextView) actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||
pp_actionBar = (ImageView) actionBar.getCustomView().findViewById(R.id.pp_actionBar);
|
||||
TextView title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||
pp_actionBar = actionBar.getCustomView().findViewById(R.id.pp_actionBar);
|
||||
title.setText(R.string.conversation);
|
||||
ImageView close_conversation = (ImageView) actionBar.getCustomView().findViewById(R.id.close_conversation);
|
||||
ImageView close_conversation = actionBar.getCustomView().findViewById(R.id.close_conversation);
|
||||
if( close_conversation != null){
|
||||
close_conversation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -159,7 +158,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
finish();
|
||||
isRefreshed = false;
|
||||
|
||||
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeContainer);
|
||||
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false,false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||
|
@ -172,7 +171,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false,false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
lv_status = (ListView) findViewById(R.id.lv_status);
|
||||
lv_status = findViewById(R.id.lv_status);
|
||||
lv_status.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
|
@ -238,21 +237,28 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||
position = 0;
|
||||
int position = 0;
|
||||
boolean positionFound = false;
|
||||
List<Status> statuses = new ArrayList<>();
|
||||
if( context.getAncestors() != null && context.getAncestors().size() > 0){
|
||||
for(Status status: context.getAncestors()){
|
||||
statuses.add(status);
|
||||
position++;
|
||||
if( status.getId().equals(initialStatus.getId()))
|
||||
positionFound =true;
|
||||
if( !positionFound)
|
||||
position++;
|
||||
}
|
||||
}
|
||||
statuses.add(initialStatus);
|
||||
if( context.getDescendants() != null && context.getDescendants().size() > 0){
|
||||
for(Status status: context.getDescendants()){
|
||||
statuses.add(status);
|
||||
if( status.getId().equals(initialStatus.getId()))
|
||||
positionFound =true;
|
||||
if( !positionFound)
|
||||
position++;
|
||||
}
|
||||
}
|
||||
RelativeLayout loader = (RelativeLayout) findViewById(R.id.loader);
|
||||
RelativeLayout loader = findViewById(R.id.loader);
|
||||
StatusListAdapter statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, RetrieveFeedsAsyncTask.Type.CONTEXT, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
|
|
|
@ -44,6 +44,10 @@ public class RetrieveContextAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
protected Void doInBackground(Void... params) {
|
||||
api = new API(context);
|
||||
statusContext = api.getStatusContext(statusId);
|
||||
//Retrieves the first toot
|
||||
if( statusContext.getDescendants().size() > 0 ) {
|
||||
statusContext = api.getStatusContext(statusContext.getAncestors().get(0).getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue