Some fixes

This commit is contained in:
stom79 2018-12-16 14:29:23 +01:00
parent 27e78391d1
commit a36b57feb7
11 changed files with 23 additions and 52 deletions

View File

@ -126,7 +126,7 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte
mainLoader.setVisibility(View.VISIBLE); mainLoader.setVisibility(View.VISIBLE);
nextElementLoader.setVisibility(View.GONE); nextElementLoader.setVisibility(View.GONE);
int positionSpinnerTrans = (sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX)); int positionSpinnerTrans = (sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX));
statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses); statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, null, isOnWifi, 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() {

View File

@ -21,6 +21,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
@ -116,10 +117,8 @@ public class ListActivity extends BaseActivity implements OnListActionInterface
mainLoader.setVisibility(View.VISIBLE); mainLoader.setVisibility(View.VISIBLE);
nextElementLoader.setVisibility(View.GONE); nextElementLoader.setVisibility(View.GONE);
boolean isOnWifi = Helper.isOnWIFI(ListActivity.this); boolean isOnWifi = Helper.isOnWIFI(ListActivity.this);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
statusListAdapter = new StatusListAdapter(ListActivity.this, RetrieveFeedsAsyncTask.Type.LIST, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses); statusListAdapter = new StatusListAdapter(ListActivity.this, RetrieveFeedsAsyncTask.Type.LIST, null, isOnWifi, this.statuses);
lv_status.setAdapter(statusListAdapter); lv_status.setAdapter(statusListAdapter);
mLayoutManager = new LinearLayoutManager(ListActivity.this); mLayoutManager = new LinearLayoutManager(ListActivity.this);
@ -139,7 +138,7 @@ public class ListActivity extends BaseActivity implements OnListActionInterface
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(RecyclerView recyclerView, int dx, int dy) public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy)
{ {
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
if(dy > 0){ if(dy > 0){

View File

@ -164,11 +164,9 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
firstLoad = true; firstLoad = true;
swiped = false; swiped = false;
boolean isOnWifi = Helper.isOnWIFI(OwnerStatusActivity.this); boolean isOnWifi = Helper.isOnWIFI(OwnerStatusActivity.this);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
lv_status.addItemDecoration(new DividerItemDecoration(OwnerStatusActivity.this, DividerItemDecoration.VERTICAL)); lv_status.addItemDecoration(new DividerItemDecoration(OwnerStatusActivity.this, DividerItemDecoration.VERTICAL));
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
statusListAdapter = new StatusListAdapter(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, userId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses); statusListAdapter = new StatusListAdapter(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, userId, isOnWifi, this.statuses);
lv_status.setAdapter(statusListAdapter); lv_status.setAdapter(statusListAdapter);
mLayoutManager = new LinearLayoutManager(OwnerStatusActivity.this); mLayoutManager = new LinearLayoutManager(OwnerStatusActivity.this);
lv_status.setLayoutManager(mLayoutManager); lv_status.setLayoutManager(mLayoutManager);

View File

@ -398,10 +398,8 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
}else { }else {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean isOnWifi = Helper.isOnWIFI(PeertubeActivity.this); boolean isOnWifi = Helper.isOnWIFI(PeertubeActivity.this);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
StatusListAdapter statusListAdapter = new StatusListAdapter(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, userId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses); StatusListAdapter statusListAdapter = new StatusListAdapter(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, userId, isOnWifi, statuses);
RecyclerView lv_comments = findViewById(R.id.peertube_comments); RecyclerView lv_comments = findViewById(R.id.peertube_comments);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this); LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
lv_comments.setLayoutManager(mLayoutManager); lv_comments.setLayoutManager(mLayoutManager);

View File

@ -199,10 +199,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
statuses = new ArrayList<>(); statuses = new ArrayList<>();
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext()); 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, 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);
showMediaOnly = false; showMediaOnly = false;
showPinned = false; showPinned = false;

View File

@ -198,13 +198,11 @@ public class ShowConversationActivity extends BaseActivity implements OnRetriev
swipeRefreshLayout = findViewById(R.id.swipeContainer); swipeRefreshLayout = findViewById(R.id.swipeContainer);
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext()); boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
if( initialStatus != null) if( initialStatus != null)
statuses.add(initialStatus); statuses.add(initialStatus);
else else
statuses.add(detailsStatus); statuses.add(detailsStatus);
statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, 0, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses); statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, 0, null, isOnWifi, statuses);
final LinearLayoutManager mLayoutManager; final LinearLayoutManager mLayoutManager;
mLayoutManager = new LinearLayoutManager(this); mLayoutManager = new LinearLayoutManager(this);

View File

@ -118,7 +118,6 @@ import fr.gouv.etalab.mastodon.client.Entities.Results;
import fr.gouv.etalab.mastodon.client.Entities.Status; import fr.gouv.etalab.mastodon.client.Entities.Status;
import fr.gouv.etalab.mastodon.client.Entities.StoredStatus; import fr.gouv.etalab.mastodon.client.Entities.StoredStatus;
import fr.gouv.etalab.mastodon.client.Entities.Version; import fr.gouv.etalab.mastodon.client.Entities.Version;
import fr.gouv.etalab.mastodon.client.Glide.GlideApp;
import fr.gouv.etalab.mastodon.client.HttpsConnection; import fr.gouv.etalab.mastodon.client.HttpsConnection;
import fr.gouv.etalab.mastodon.drawers.AccountsReplyAdapter; import fr.gouv.etalab.mastodon.drawers.AccountsReplyAdapter;
import fr.gouv.etalab.mastodon.drawers.AccountsSearchAdapter; import fr.gouv.etalab.mastodon.drawers.AccountsSearchAdapter;
@ -1477,7 +1476,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
final EditText input = popup_media_description.findViewById(R.id.media_description); final EditText input = popup_media_description.findViewById(R.id.media_description);
input.setFilters(new InputFilter[]{new InputFilter.LengthFilter(420)}); input.setFilters(new InputFilter[]{new InputFilter.LengthFilter(420)});
final ImageView media_picture = popup_media_description.findViewById(R.id.media_picture); final ImageView media_picture = popup_media_description.findViewById(R.id.media_picture);
GlideApp.with(getApplicationContext()) Glide.with(getApplicationContext())
.asBitmap() .asBitmap()
.load(attachment.getUrl()) .load(attachment.getUrl())
.into(new SimpleTarget<Bitmap>() { .into(new SimpleTarget<Bitmap>() {

View File

@ -140,61 +140,53 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
private List<Status> statuses; private List<Status> statuses;
private LayoutInflater layoutInflater; private LayoutInflater layoutInflater;
private boolean isOnWifi; private boolean isOnWifi;
private int translator;
private int behaviorWithAttachments;
private StatusListAdapter statusListAdapter; private StatusListAdapter statusListAdapter;
private RetrieveFeedsAsyncTask.Type type; private RetrieveFeedsAsyncTask.Type type;
private String targetedId; private String targetedId;
private final int HIDDEN_STATUS = 0; private final int HIDDEN_STATUS = 0;
public static final int DISPLAYED_STATUS = 1; private static final int DISPLAYED_STATUS = 1;
public static final int FOCUSED_STATUS = 2; static final int FOCUSED_STATUS = 2;
public static final int COMPACT_STATUS = 3; private static final int COMPACT_STATUS = 3;
private int conversationPosition; private int conversationPosition;
private List<String> timedMute; private List<String> timedMute;
private boolean redraft; private boolean redraft;
private Status toot; private Status toot;
private TagTimeline tagTimeline; private TagTimeline tagTimeline;
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){ public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, List<Status> statuses){
super(); super();
this.context = context; this.context = context;
this.statuses = statuses; this.statuses = statuses;
this.isOnWifi = isOnWifi; this.isOnWifi = isOnWifi;
this.behaviorWithAttachments = behaviorWithAttachments;
layoutInflater = LayoutInflater.from(this.context); layoutInflater = LayoutInflater.from(this.context);
statusListAdapter = this; statusListAdapter = this;
this.type = type; this.type = type;
this.targetedId = targetedId; this.targetedId = targetedId;
this.translator = translator;
redraft = false; redraft = false;
} }
public StatusListAdapter(Context context, TagTimeline tagTimeline, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){ public StatusListAdapter(Context context, TagTimeline tagTimeline, String targetedId, boolean isOnWifi, List<Status> statuses){
super(); super();
this.context = context; this.context = context;
this.statuses = statuses; this.statuses = statuses;
this.isOnWifi = isOnWifi; this.isOnWifi = isOnWifi;
this.behaviorWithAttachments = behaviorWithAttachments;
layoutInflater = LayoutInflater.from(this.context); layoutInflater = LayoutInflater.from(this.context);
statusListAdapter = this; statusListAdapter = this;
this.type = RetrieveFeedsAsyncTask.Type.TAG; this.type = RetrieveFeedsAsyncTask.Type.TAG;
this.targetedId = targetedId; this.targetedId = targetedId;
this.translator = translator;
redraft = false; redraft = false;
this.tagTimeline = tagTimeline; this.tagTimeline = tagTimeline;
} }
public StatusListAdapter(Context context, int position, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){ public StatusListAdapter(Context context, int position, String targetedId, boolean isOnWifi, List<Status> statuses){
this.context = context; this.context = context;
this.statuses = statuses; this.statuses = statuses;
this.isOnWifi = isOnWifi; this.isOnWifi = isOnWifi;
this.behaviorWithAttachments = behaviorWithAttachments;
layoutInflater = LayoutInflater.from(this.context); layoutInflater = LayoutInflater.from(this.context);
statusListAdapter = this; statusListAdapter = this;
this.type = RetrieveFeedsAsyncTask.Type.CONTEXT; this.type = RetrieveFeedsAsyncTask.Type.CONTEXT;
this.conversationPosition = position; this.conversationPosition = position;
this.targetedId = targetedId; this.targetedId = targetedId;
this.translator = translator;
redraft = false; redraft = false;
} }
@ -542,7 +534,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
boolean share_details = sharedpreferences.getBoolean(Helper.SET_SHARE_DETAILS, true); boolean share_details = sharedpreferences.getBoolean(Helper.SET_SHARE_DETAILS, true);
boolean confirmFav = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false); boolean confirmFav = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
boolean confirmBoost = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true); boolean confirmBoost = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true);
int translator = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
if( type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && !isCompactMode && displayBookmarkButton) if( type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && !isCompactMode && displayBookmarkButton)
holder.status_bookmark.setVisibility(View.VISIBLE); holder.status_bookmark.setVisibility(View.VISIBLE);
else else

View File

@ -102,12 +102,10 @@ public class DisplayBookmarksFragment extends Fragment implements OnRetrieveFeed
}catch (Exception ignored){} }catch (Exception ignored){}
final boolean isOnWifi = Helper.isOnWIFI(context); final boolean isOnWifi = Helper.isOnWIFI(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
final int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
final int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
statuses = apiResponse.getStatuses(); statuses = apiResponse.getStatuses();
if( statuses != null && statuses.size() > 0) { if( statuses != null && statuses.size() > 0) {
LinearLayoutManager mLayoutManager = new LinearLayoutManager(context); LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses); statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, this.statuses);
lv_status.setAdapter(statusListAdapter); lv_status.setAdapter(statusListAdapter);
lv_status.setLayoutManager(mLayoutManager); lv_status.setLayoutManager(mLayoutManager);
}else { }else {
@ -138,7 +136,7 @@ public class DisplayBookmarksFragment extends Fragment implements OnRetrieveFeed
new StatusCacheDAO(context, db).removeAllStatus(StatusCacheDAO.STATUS_CACHE); new StatusCacheDAO(context, db).removeAllStatus(StatusCacheDAO.STATUS_CACHE);
statuses = new ArrayList<>(); statuses = new ArrayList<>();
statuses.clear(); statuses.clear();
statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses); statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, statuses);
lv_status.setAdapter(statusListAdapter); lv_status.setAdapter(statusListAdapter);
statusListAdapter.notifyDataSetChanged(); statusListAdapter.notifyDataSetChanged();
textviewNoAction.setVisibility(View.VISIBLE); textviewNoAction.setVisibility(View.VISIBLE);

View File

@ -146,9 +146,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
assert context != null; assert context != null;
sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean isOnWifi = Helper.isOnWIFI(context); boolean isOnWifi = Helper.isOnWIFI(context);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer); swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
lv_status = rootView.findViewById(R.id.lv_status); lv_status = rootView.findViewById(R.id.lv_status);
mainLoader = rootView.findViewById(R.id.loader); mainLoader = rootView.findViewById(R.id.loader);
nextElementLoader = rootView.findViewById(R.id.loading_next_status); nextElementLoader = rootView.findViewById(R.id.loading_next_status);
@ -165,12 +163,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
List<TagTimeline> tagTimelines = new SearchDAO(context, db).getTimelineInfo(tag); List<TagTimeline> tagTimelines = new SearchDAO(context, db).getTimelineInfo(tag);
if( tagTimelines != null && tagTimelines.size() > 0) { if( tagTimelines != null && tagTimelines.size() > 0) {
tagTimeline = tagTimelines.get(0); tagTimeline = tagTimelines.get(0);
statusListAdapter = new StatusListAdapter(context, tagTimeline, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses); statusListAdapter = new StatusListAdapter(context, tagTimeline, targetedId, isOnWifi, this.statuses);
lv_status.setAdapter(statusListAdapter); lv_status.setAdapter(statusListAdapter);
} }
}else if( search_peertube == null && (instanceType == null || instanceType.equals("MASTODON"))) { }else if( search_peertube == null && (instanceType == null || instanceType.equals("MASTODON"))) {
BaseMainActivity.displayPeertube = null; BaseMainActivity.displayPeertube = null;
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses); statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, this.statuses);
lv_status.setAdapter(statusListAdapter); lv_status.setAdapter(statusListAdapter);
}else { }else {
BaseMainActivity.displayPeertube = remoteInstance; BaseMainActivity.displayPeertube = remoteInstance;

View File

@ -341,6 +341,7 @@ public class Helper {
public static final String SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE = "set_automatically_split_toots_size"; public static final String SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE = "set_automatically_split_toots_size";
public static final String SET_TRUNCATE_TOOTS_SIZE = "set_truncate_toots_size"; public static final String SET_TRUNCATE_TOOTS_SIZE = "set_truncate_toots_size";
public static final String SET_ART_WITH_NSFW = "set_art_with_nsfw"; public static final String SET_ART_WITH_NSFW = "set_art_with_nsfw";
//End points //End points
public static final String EP_AUTHORIZE = "/oauth/authorize"; public static final String EP_AUTHORIZE = "/oauth/authorize";
@ -1050,15 +1051,7 @@ public class Helper {
*/ */
public static String getLiveInstance(Context context){ public static String getLiveInstance(Context context){
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); return sharedpreferences.getString(Helper.PREF_INSTANCE, null);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
if( userId == null) //User not authenticated
return null;
Account account = new AccountDAO(context, db).getAccountByID(userId);
if( account != null){
return account.getInstance().trim();
} //User not in db
return null;
} }
public static String getLiveInstanceWithProtocol(Context context) { public static String getLiveInstanceWithProtocol(Context context) {