Avoid to reopen same account details when consulting an account...
This commit is contained in:
parent
b5063e3eb9
commit
1b28c06be0
|
@ -101,7 +101,7 @@ public class HashTagActivity extends AppCompatActivity implements OnRetrieveFeed
|
|||
textviewNoAction = (RelativeLayout) findViewById(R.id.no_action);
|
||||
mainLoader.setVisibility(View.VISIBLE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, null, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
setTitle(String.format("#%s", tag));
|
||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
|
|
|
@ -115,16 +115,9 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
}
|
||||
setContentView(R.layout.activity_show_account);
|
||||
instanceValue += 1;
|
||||
imageLoader = ImageLoader.getInstance();
|
||||
statuses = new ArrayList<>();
|
||||
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
statusListAdapter = new StatusListAdapter(getApplicationContext(), RetrieveFeedsAsyncTask.Type.USER, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
Bundle b = getIntent().getExtras();
|
||||
account_follow = (Button) findViewById(R.id.account_follow);
|
||||
account_follow.setEnabled(false);
|
||||
Bundle b = getIntent().getExtras();
|
||||
if(b != null){
|
||||
accountId = b.getString("accountId");
|
||||
new RetrieveRelationshipAsyncTask(getApplicationContext(), accountId,ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
@ -136,6 +129,15 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
}else{
|
||||
Toast.makeText(this,R.string.toast_error_loading_account,Toast.LENGTH_LONG).show();
|
||||
}
|
||||
imageLoader = ImageLoader.getInstance();
|
||||
statuses = new ArrayList<>();
|
||||
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
statusListAdapter = new StatusListAdapter(getApplicationContext(), RetrieveFeedsAsyncTask.Type.USER, accountId, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
|
||||
|
||||
if( getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
}
|
||||
}
|
||||
RelativeLayout loader = (RelativeLayout) findViewById(R.id.loader);
|
||||
StatusListAdapter statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, RetrieveFeedsAsyncTask.Type.CONTEXT, isOnWifi, behaviorWithAttachments, statuses);
|
||||
StatusListAdapter statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, RetrieveFeedsAsyncTask.Type.CONTEXT, null, isOnWifi, behaviorWithAttachments, statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
loader.setVisibility(View.GONE);
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.os.Bundle;
|
|||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.text.Html;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -65,8 +66,9 @@ public class AccountsListAdapter extends BaseAdapter implements OnPostActionInte
|
|||
private RetrieveAccountsAsyncTask.Type action;
|
||||
private Context context;
|
||||
private AccountsListAdapter accountsListAdapter;
|
||||
private String targetedId;
|
||||
|
||||
public AccountsListAdapter(Context context, RetrieveAccountsAsyncTask.Type action, List<Account> accounts){
|
||||
public AccountsListAdapter(Context context, RetrieveAccountsAsyncTask.Type action, String targetedId, List<Account> accounts){
|
||||
this.context = context;
|
||||
this.accounts = accounts;
|
||||
layoutInflater = LayoutInflater.from(context);
|
||||
|
@ -75,6 +77,7 @@ public class AccountsListAdapter extends BaseAdapter implements OnPostActionInte
|
|||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
this.action = action;
|
||||
this.accountsListAdapter = this;
|
||||
this.targetedId = targetedId;
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,11 +177,15 @@ public class AccountsListAdapter extends BaseAdapter implements OnPostActionInte
|
|||
holder.account_pp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("accountId", account.getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
//Avoid to reopen details about the current account
|
||||
if( targetedId == null || !targetedId.equals(account.getId())){
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("accountId", account.getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return convertView;
|
||||
|
|
|
@ -94,8 +94,9 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
private final int FAVOURITE = 2;
|
||||
private ViewHolder holder;
|
||||
private RetrieveFeedsAsyncTask.Type type;
|
||||
private String targetedId;
|
||||
|
||||
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, boolean isOnWifi, int behaviorWithAttachments, List<Status> statuses){
|
||||
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, List<Status> statuses){
|
||||
this.context = context;
|
||||
this.statuses = statuses;
|
||||
this.isOnWifi = isOnWifi;
|
||||
|
@ -106,6 +107,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
statusListAdapter = this;
|
||||
this.type = type;
|
||||
this.targetedId = targetedId;
|
||||
}
|
||||
|
||||
|
||||
|
@ -505,22 +507,27 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_account_profile.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("accountId", status.getAccount().getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
|
||||
if( targetedId == null || !targetedId.equals(status.getAccount().getId())){
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("accountId", status.getAccount().getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
holder.status_account_profile_boost.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("accountId", status.getReblog().getAccount().getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
if( targetedId == null || !targetedId.equals(status.getReblog().getAccount().getId())){
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("accountId", status.getReblog().getAccount().getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import android.os.Parcelable;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -103,7 +102,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
textviewNoAction = (RelativeLayout) rootView.findViewById(R.id.no_action);
|
||||
mainLoader.setVisibility(View.VISIBLE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
accountsListAdapter = new AccountsListAdapter(context, type, this.accounts);
|
||||
accountsListAdapter = new AccountsListAdapter(context, type, targetedId, this.accounts);
|
||||
lv_accounts.setAdapter(accountsListAdapter);
|
||||
|
||||
if( !comesFromSearch) {
|
||||
|
@ -257,7 +256,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
textviewNoAction.setVisibility(View.GONE);
|
||||
max_id = apiResponse.getMax_id();
|
||||
if( swiped ){
|
||||
accountsListAdapter = new AccountsListAdapter(context, type, this.accounts);
|
||||
accountsListAdapter = new AccountsListAdapter(context, type,targetedId, this.accounts);
|
||||
lv_accounts.setAdapter(accountsListAdapter);
|
||||
swiped = false;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
textviewNoAction = (RelativeLayout) rootView.findViewById(R.id.no_action);
|
||||
mainLoader.setVisibility(View.VISIBLE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
statusListAdapter = new StatusListAdapter(context, type, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
|
||||
if( !comesFromSearch){
|
||||
|
@ -279,7 +279,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
else
|
||||
textviewNoAction.setVisibility(View.GONE);
|
||||
if( swiped ){
|
||||
statusListAdapter = new StatusListAdapter(context, type, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
swiped = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue