Prepares drawers

This commit is contained in:
tom79 2017-08-25 16:08:40 +02:00
parent 1c1ab6a4e6
commit d192777f38
5 changed files with 22 additions and 13 deletions

View File

@ -101,7 +101,8 @@ 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, null, isOnWifi, behaviorWithAttachments, this.statuses);
int positionSpinnerTrans = (sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX));
statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
lv_status.setAdapter(statusListAdapter);
setTitle(String.format("#%s", tag));
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

View File

@ -163,7 +163,9 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
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);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
statusListAdapter = new StatusListAdapter(getApplicationContext(), RetrieveFeedsAsyncTask.Type.USER, accountId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
options = new DisplayImageOptions.Builder().displayer(new RoundedBitmapDisplayer(80)).cacheInMemory(false)
.cacheOnDisk(true).resetViewBeforeLoading(true).build();

View File

@ -244,6 +244,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
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;
List<Status> statuses = new ArrayList<>();
if( context.getAncestors() != null && context.getAncestors().size() > 0){
@ -259,7 +260,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
}
}
RelativeLayout loader = (RelativeLayout) findViewById(R.id.loader);
StatusListAdapter statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, RetrieveFeedsAsyncTask.Type.CONTEXT, null, isOnWifi, behaviorWithAttachments, statuses);
StatusListAdapter statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, RetrieveFeedsAsyncTask.Type.CONTEXT, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
lv_status.setAdapter(statusListAdapter);
statusListAdapter.notifyDataSetChanged();
loader.setVisibility(View.GONE);

View File

@ -103,6 +103,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
private ImageLoader imageLoader;
private DisplayImageOptions options;
private boolean isOnWifi;
private int translator;
private int behaviorWithAttachments;
private StatusListAdapter statusListAdapter;
private final int REBLOG = 1;
@ -112,7 +113,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
private HashMap<String, String> urlConversion;
private HashMap<String, String> tagConversion;
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, List<Status> statuses){
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
this.context = context;
this.statuses = statuses;
this.isOnWifi = isOnWifi;
@ -121,6 +122,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
statusListAdapter = this;
this.type = type;
this.targetedId = targetedId;
this.translator = translator;
}

View File

@ -76,7 +76,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
private boolean showMediaOnly;
private DisplayStatusFragment displayStatusFragment;
private TextView new_data;
private int positionSpinnerTrans;
public DisplayStatusFragment(){
displayStatusFragment = this;
@ -112,10 +112,10 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
firstLoad = true;
swiped = false;
isOnWifi = Helper.isOnWIFI(context);
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
isOnWifi = Helper.isOnWIFI(context);
positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
lv_status = (ListView) rootView.findViewById(R.id.lv_status);
@ -124,7 +124,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, targetedId, isOnWifi, behaviorWithAttachments, this.statuses);
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
lv_status.setAdapter(statusListAdapter);
new_data = (TextView) rootView.findViewById(R.id.new_data);
if( !comesFromSearch){
@ -203,7 +203,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
for(Status status: statusesTmp){
statuses.add(status);
}
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, statuses);
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
lv_status.setAdapter(statusListAdapter);
statusesTmp = new ArrayList<>();
}
@ -231,11 +231,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean isOnWifi = Helper.isOnWIFI(context);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
statuses = new ArrayList<>();
for(Status status: statusesTmp){
statuses.add(status);
}
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, statuses);
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
lv_status.setAdapter(statusListAdapter);
statusesTmp = new ArrayList<>();
}
@ -340,7 +341,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
else
textviewNoAction.setVisibility(View.GONE);
if( swiped ){
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, this.statuses);
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
lv_status.setAdapter(statusListAdapter);
swiped = false;
}
@ -408,11 +409,13 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean isOnWifi = Helper.isOnWIFI(context);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
statuses = new ArrayList<>();
for(Status status: statusesTmp){
statuses.add(status);
}
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, statuses);
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
lv_status.setAdapter(statusListAdapter);
statusesTmp = new ArrayList<>();
}