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