Improvements with Friendica and GNU
This commit is contained in:
parent
70010afa92
commit
3c9c0a2057
|
@ -258,7 +258,6 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
social = UpdateAccountInfoAsyncTask.SOCIAL.GNU;
|
social = UpdateAccountInfoAsyncTask.SOCIAL.GNU;
|
||||||
else if( account.getSocial().equals("FRIENDICA"))
|
else if( account.getSocial().equals("FRIENDICA"))
|
||||||
social = UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA;
|
social = UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA;
|
||||||
Log.v(Helper.TAG, account.getSocial());
|
|
||||||
countNewStatus = 0;
|
countNewStatus = 0;
|
||||||
countNewNotifications = 0;
|
countNewNotifications = 0;
|
||||||
|
|
||||||
|
@ -469,6 +468,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
typePosition.put(i, RetrieveFeedsAsyncTask.Type.GNU_LOCAL);
|
typePosition.put(i, RetrieveFeedsAsyncTask.Type.GNU_LOCAL);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
if( social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
|
||||||
|
display_global = false;
|
||||||
if( display_global) {
|
if( display_global) {
|
||||||
tabLayout.addTab(tabPublic);
|
tabLayout.addTab(tabPublic);
|
||||||
tabPosition.put("global", i);
|
tabPosition.put("global", i);
|
||||||
|
@ -590,7 +591,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
countPage++;
|
countPage++;
|
||||||
if( sharedpreferences.getBoolean(Helper.SET_DISPLAY_LOCAL, true))
|
if( sharedpreferences.getBoolean(Helper.SET_DISPLAY_LOCAL, true))
|
||||||
countPage++;
|
countPage++;
|
||||||
if( sharedpreferences.getBoolean(Helper.SET_DISPLAY_GLOBAL, true))
|
if( sharedpreferences.getBoolean(Helper.SET_DISPLAY_GLOBAL, true) && social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA )
|
||||||
countPage++;
|
countPage++;
|
||||||
if( sharedpreferences.getBoolean(Helper.SET_DISPLAY_ART, true)&& social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
|
if( sharedpreferences.getBoolean(Helper.SET_DISPLAY_ART, true)&& social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
|
||||||
countPage++;
|
countPage++;
|
||||||
|
@ -1124,7 +1125,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
query= query.replaceAll("^#+", "");
|
query= query.replaceAll("^#+", "");
|
||||||
//It's not a peertube search
|
//It's not a peertube search
|
||||||
if(displayPeertube == null){
|
if(displayPeertube == null){
|
||||||
if( social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
if( social != UpdateAccountInfoAsyncTask.SOCIAL.GNU) {
|
||||||
Intent intent = new Intent(BaseMainActivity.this, SearchResultActivity.class);
|
Intent intent = new Intent(BaseMainActivity.this, SearchResultActivity.class);
|
||||||
intent.putExtra("search", query);
|
intent.putExtra("search", query);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -616,77 +616,78 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
toot_content.addTextChangedListener(new TextWatcher() {
|
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
|
||||||
@Override
|
toot_content.addTextChangedListener(new TextWatcher() {
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
@Override
|
||||||
}
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
if( toot_content.getSelectionStart() != 0)
|
|
||||||
currentCursorPosition = toot_content.getSelectionStart();
|
|
||||||
if( s.toString().length() == 0 )
|
|
||||||
currentCursorPosition = 0;
|
|
||||||
//Only check last 15 characters before cursor position to avoid lags
|
|
||||||
if( currentCursorPosition < 15 ){ //Less than 15 characters are written before the cursor position
|
|
||||||
searchLength = currentCursorPosition;
|
|
||||||
}else {
|
|
||||||
searchLength = 15;
|
|
||||||
}
|
}
|
||||||
int totalChar = toot_cw_content.length() + toot_content.length();
|
@Override
|
||||||
toot_space_left.setText(String.valueOf(totalChar));
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
if( currentCursorPosition- (searchLength-1) < 0 || currentCursorPosition == 0 || currentCursorPosition > s.toString().length())
|
|
||||||
return;
|
}
|
||||||
Matcher m, mt;
|
@Override
|
||||||
if( s.toString().charAt(0) == '@')
|
public void afterTextChanged(Editable s) {
|
||||||
m = sPattern.matcher(s.toString().substring(currentCursorPosition- searchLength, currentCursorPosition));
|
if( toot_content.getSelectionStart() != 0)
|
||||||
else
|
currentCursorPosition = toot_content.getSelectionStart();
|
||||||
m = sPattern.matcher(s.toString().substring(currentCursorPosition- (searchLength-1), currentCursorPosition));
|
if( s.toString().length() == 0 )
|
||||||
if(m.matches()) {
|
currentCursorPosition = 0;
|
||||||
String search = m.group(3);
|
//Only check last 15 characters before cursor position to avoid lags
|
||||||
if (pp_progress != null && pp_actionBar != null) {
|
if( currentCursorPosition < 15 ){ //Less than 15 characters are written before the cursor position
|
||||||
pp_progress.setVisibility(View.VISIBLE);
|
searchLength = currentCursorPosition;
|
||||||
pp_actionBar.setVisibility(View.GONE);
|
}else {
|
||||||
|
searchLength = 15;
|
||||||
}
|
}
|
||||||
new RetrieveSearchAccountsAsyncTask(getApplicationContext(),search,TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
int totalChar = toot_cw_content.length() + toot_content.length();
|
||||||
}else{
|
toot_space_left.setText(String.valueOf(totalChar));
|
||||||
if( s.toString().charAt(0) == '#')
|
if( currentCursorPosition- (searchLength-1) < 0 || currentCursorPosition == 0 || currentCursorPosition > s.toString().length())
|
||||||
mt = tPattern.matcher(s.toString().substring(currentCursorPosition- searchLength, currentCursorPosition));
|
return;
|
||||||
|
Matcher m, mt;
|
||||||
|
if( s.toString().charAt(0) == '@')
|
||||||
|
m = sPattern.matcher(s.toString().substring(currentCursorPosition- searchLength, currentCursorPosition));
|
||||||
else
|
else
|
||||||
mt = tPattern.matcher(s.toString().substring(currentCursorPosition- (searchLength-1), currentCursorPosition));
|
m = sPattern.matcher(s.toString().substring(currentCursorPosition- (searchLength-1), currentCursorPosition));
|
||||||
if(mt.matches()) {
|
if(m.matches()) {
|
||||||
String search = mt.group(3);
|
String search = m.group(3);
|
||||||
if (pp_progress != null && pp_actionBar != null) {
|
if (pp_progress != null && pp_actionBar != null) {
|
||||||
pp_progress.setVisibility(View.VISIBLE);
|
pp_progress.setVisibility(View.VISIBLE);
|
||||||
pp_actionBar.setVisibility(View.GONE);
|
pp_actionBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
new RetrieveSearchAsyncTask(getApplicationContext(),search,true, TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new RetrieveSearchAccountsAsyncTask(getApplicationContext(),search,TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}else{
|
}else{
|
||||||
if( s.toString().charAt(0) == ':')
|
if( s.toString().charAt(0) == '#')
|
||||||
mt = ePattern.matcher(s.toString().substring(currentCursorPosition- searchLength, currentCursorPosition));
|
mt = tPattern.matcher(s.toString().substring(currentCursorPosition- searchLength, currentCursorPosition));
|
||||||
else
|
else
|
||||||
mt = ePattern.matcher(s.toString().substring(currentCursorPosition- (searchLength-1), currentCursorPosition));
|
mt = tPattern.matcher(s.toString().substring(currentCursorPosition- (searchLength-1), currentCursorPosition));
|
||||||
if(mt.matches()) {
|
if(mt.matches()) {
|
||||||
String shortcode = mt.group(3);
|
String search = mt.group(3);
|
||||||
if (pp_progress != null && pp_actionBar != null) {
|
if (pp_progress != null && pp_actionBar != null) {
|
||||||
pp_progress.setVisibility(View.VISIBLE);
|
pp_progress.setVisibility(View.VISIBLE);
|
||||||
pp_actionBar.setVisibility(View.GONE);
|
pp_actionBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
new RetrieveEmojiAsyncTask(getApplicationContext(),shortcode,TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new RetrieveSearchAsyncTask(getApplicationContext(),search,true, TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}else {
|
}else{
|
||||||
toot_content.dismissDropDown();
|
if( s.toString().charAt(0) == ':')
|
||||||
|
mt = ePattern.matcher(s.toString().substring(currentCursorPosition- searchLength, currentCursorPosition));
|
||||||
|
else
|
||||||
|
mt = ePattern.matcher(s.toString().substring(currentCursorPosition- (searchLength-1), currentCursorPosition));
|
||||||
|
if(mt.matches()) {
|
||||||
|
String shortcode = mt.group(3);
|
||||||
|
if (pp_progress != null && pp_actionBar != null) {
|
||||||
|
pp_progress.setVisibility(View.VISIBLE);
|
||||||
|
pp_actionBar.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
new RetrieveEmojiAsyncTask(getApplicationContext(),shortcode,TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}else {
|
||||||
|
toot_content.dismissDropDown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
totalChar = toot_cw_content.length() + toot_content.length();
|
||||||
|
toot_space_left.setText(String.valueOf(totalChar));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
totalChar = toot_cw_content.length() + toot_content.length();
|
|
||||||
toot_space_left.setText(String.valueOf(totalChar));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if( scheduledstatus != null)
|
if( scheduledstatus != null)
|
||||||
restoreServerSchedule(scheduledstatus.getStatus());
|
restoreServerSchedule(scheduledstatus.getStatus());
|
||||||
|
|
|
@ -21,9 +21,11 @@ import android.os.AsyncTask;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||||
import fr.gouv.etalab.mastodon.client.API;
|
import fr.gouv.etalab.mastodon.client.API;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.Results;
|
import fr.gouv.etalab.mastodon.client.Entities.Results;
|
||||||
|
import fr.gouv.etalab.mastodon.client.GNUAPI;
|
||||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearchInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearchInterface;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||||
|
@ -59,32 +61,40 @@ public class RetrieveSearchAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
API api = new API(this.contextReference.get());
|
|
||||||
if (!tagsOnly)
|
if(MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||||
results = api.search(query);
|
API api = new API(this.contextReference.get());
|
||||||
else {
|
if (!tagsOnly)
|
||||||
//search tags only
|
results = api.search(query);
|
||||||
results = api.search(query);
|
else {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
//search tags only
|
||||||
List<String> cachedTags = new TagsCacheDAO(contextReference.get(), db).getBy(query);
|
results = api.search(query);
|
||||||
if (results != null && results.getHashtags() != null) {
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//If cache contains matching tags
|
List<String> cachedTags = new TagsCacheDAO(contextReference.get(), db).getBy(query);
|
||||||
if (cachedTags != null) {
|
if (results != null && results.getHashtags() != null) {
|
||||||
for (String apiTag : results.getHashtags()) {
|
//If cache contains matching tags
|
||||||
//Cache doesn't contain the tags coming from the api (case insensitive)
|
if (cachedTags != null) {
|
||||||
if (!Helper.containsCaseInsensitive(apiTag, cachedTags)) {
|
for (String apiTag : results.getHashtags()) {
|
||||||
cachedTags.add(apiTag); //It's added
|
//Cache doesn't contain the tags coming from the api (case insensitive)
|
||||||
|
if (!Helper.containsCaseInsensitive(apiTag, cachedTags)) {
|
||||||
|
cachedTags.add(apiTag); //It's added
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
results.setHashtags(cachedTags);
|
||||||
}
|
}
|
||||||
|
} else if (cachedTags != null) {
|
||||||
|
if (results == null)
|
||||||
|
results = new Results();
|
||||||
results.setHashtags(cachedTags);
|
results.setHashtags(cachedTags);
|
||||||
}
|
}
|
||||||
} else if (cachedTags != null) {
|
|
||||||
if (results == null)
|
|
||||||
results = new Results();
|
|
||||||
results.setHashtags(cachedTags);
|
|
||||||
}
|
}
|
||||||
|
error = api.getError();
|
||||||
|
}else {
|
||||||
|
GNUAPI gnuapi = new GNUAPI(this.contextReference.get());
|
||||||
|
results = gnuapi.search(query);
|
||||||
|
error = gnuapi.getError();
|
||||||
}
|
}
|
||||||
error = api.getError();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,11 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import fr.gouv.etalab.mastodon.R;
|
import fr.gouv.etalab.mastodon.R;
|
||||||
import fr.gouv.etalab.mastodon.activities.HashTagActivity;
|
import fr.gouv.etalab.mastodon.activities.HashTagActivity;
|
||||||
|
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.PeertubeActivity;
|
import fr.gouv.etalab.mastodon.activities.PeertubeActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
||||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
|
import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
|
||||||
|
import fr.gouv.etalab.mastodon.asynctasks.UpdateAccountInfoAsyncTask;
|
||||||
import fr.gouv.etalab.mastodon.helper.CrossActions;
|
import fr.gouv.etalab.mastodon.helper.CrossActions;
|
||||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveEmojiInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveEmojiInterface;
|
||||||
|
@ -1087,11 +1089,13 @@ public class Status implements Parcelable{
|
||||||
spannableStringT.setSpan(new ClickableSpan() {
|
spannableStringT.setSpan(new ClickableSpan() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(@NonNull View textView) {
|
public void onClick(@NonNull View textView) {
|
||||||
Intent intent = new Intent(context, HashTagActivity.class);
|
if(MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||||
Bundle b = new Bundle();
|
Intent intent = new Intent(context, HashTagActivity.class);
|
||||||
b.putString("tag", tag.substring(1));
|
Bundle b = new Bundle();
|
||||||
intent.putExtras(b);
|
b.putString("tag", tag.substring(1));
|
||||||
context.startActivity(intent);
|
intent.putExtras(b);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void updateDrawState(@NonNull TextPaint ds) {
|
public void updateDrawState(@NonNull TextPaint ds) {
|
||||||
|
|
|
@ -68,18 +68,15 @@ public class GNUAPI {
|
||||||
|
|
||||||
private Account account;
|
private Account account;
|
||||||
private Context context;
|
private Context context;
|
||||||
private Results results;
|
|
||||||
private Attachment attachment;
|
private Attachment attachment;
|
||||||
private List<Account> accounts;
|
private List<Account> accounts;
|
||||||
private List<Status> statuses;
|
private List<Status> statuses;
|
||||||
private List<Conversation> conversations;
|
|
||||||
private int tootPerPage, accountPerPage, notificationPerPage;
|
private int tootPerPage, accountPerPage, notificationPerPage;
|
||||||
private int actionCode;
|
private int actionCode;
|
||||||
private String instance;
|
private String instance;
|
||||||
private String prefKeyOauthTokenT;
|
private String prefKeyOauthTokenT;
|
||||||
private APIResponse apiResponse;
|
private APIResponse apiResponse;
|
||||||
private Error APIError;
|
private Error APIError;
|
||||||
private List<String> domains;
|
|
||||||
|
|
||||||
public enum accountPrivacy {
|
public enum accountPrivacy {
|
||||||
PUBLIC,
|
PUBLIC,
|
||||||
|
@ -248,7 +245,7 @@ public class GNUAPI {
|
||||||
response = new HttpsConnection(context).get(getAbsoluteUrl("/friendships/show.json"), 60, params, prefKeyOauthTokenT);
|
response = new HttpsConnection(context).get(getAbsoluteUrl("/friendships/show.json"), 60, params, prefKeyOauthTokenT);
|
||||||
relationship = parseRelationshipResponse(new JSONObject(response));
|
relationship = parseRelationshipResponse(new JSONObject(response));
|
||||||
}else if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
}else if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||||
params.put("target_id",accountId);
|
params.put("user_id",accountId);
|
||||||
response = new HttpsConnection(context).get(getAbsoluteUrl("/users/show.json"), 60, params, prefKeyOauthTokenT);
|
response = new HttpsConnection(context).get(getAbsoluteUrl("/users/show.json"), 60, params, prefKeyOauthTokenT);
|
||||||
JSONObject resobj = new JSONObject(response);
|
JSONObject resobj = new JSONObject(response);
|
||||||
try {
|
try {
|
||||||
|
@ -610,7 +607,7 @@ public class GNUAPI {
|
||||||
if (0 > limit || limit > 80)
|
if (0 > limit || limit > 80)
|
||||||
limit = 80;
|
limit = 80;
|
||||||
params.put("limit",String.valueOf(limit));
|
params.put("limit",String.valueOf(limit));
|
||||||
conversations = new ArrayList<>();
|
List<Conversation> conversations = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
HttpsConnection httpsConnection = new HttpsConnection(context);
|
HttpsConnection httpsConnection = new HttpsConnection(context);
|
||||||
String response = httpsConnection.get(getAbsoluteUrl("/conversations"), 60, params, prefKeyOauthTokenT);
|
String response = httpsConnection.get(getAbsoluteUrl("/conversations"), 60, params, prefKeyOauthTokenT);
|
||||||
|
@ -1572,6 +1569,44 @@ public class GNUAPI {
|
||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves Accounts and feeds when searching *synchronously*
|
||||||
|
*
|
||||||
|
* @param query String search
|
||||||
|
* @return Results
|
||||||
|
*/
|
||||||
|
public Results search(String query) {
|
||||||
|
Results results = new Results();
|
||||||
|
HashMap<String, String> params = new HashMap<>();
|
||||||
|
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
|
||||||
|
params.put("q", query);
|
||||||
|
else
|
||||||
|
try {
|
||||||
|
params.put("q", URLEncoder.encode(query, "UTF-8"));
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
params.put("q", query);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
HttpsConnection httpsConnection = new HttpsConnection(context);
|
||||||
|
String response = httpsConnection.get(getAbsoluteUrl("/users/search.json"), 60, params, prefKeyOauthTokenT);
|
||||||
|
List<Account> accounts = parseAccountResponse(new JSONArray(response));
|
||||||
|
results.setAccounts(accounts);
|
||||||
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
|
setError(e.getStatusCode(), e);
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (KeyManagementException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves Accounts and feeds when searching *synchronously*
|
* Retrieves Accounts and feeds when searching *synchronously*
|
||||||
*
|
*
|
||||||
|
|
|
@ -831,48 +831,49 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//Click on a conversation
|
//Click on a conversation
|
||||||
if ((getItemViewType(viewHolder.getAdapterPosition()) == DISPLAYED_STATUS || getItemViewType(viewHolder.getAdapterPosition()) == COMPACT_STATUS)) {
|
if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
|
||||||
holder.status_content.setOnClickListener(new View.OnClickListener() {
|
if ((getItemViewType(viewHolder.getAdapterPosition()) == DISPLAYED_STATUS || getItemViewType(viewHolder.getAdapterPosition()) == COMPACT_STATUS)) {
|
||||||
@Override
|
holder.status_content.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
@Override
|
||||||
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) {
|
||||||
Bundle b = new Bundle();
|
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||||
if (status.getReblog() == null)
|
Bundle b = new Bundle();
|
||||||
b.putParcelable("status", status);
|
if (status.getReblog() == null)
|
||||||
else
|
b.putParcelable("status", status);
|
||||||
b.putParcelable("status", status.getReblog());
|
else
|
||||||
intent.putExtras(b);
|
b.putParcelable("status", status.getReblog());
|
||||||
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
|
intent.putExtras(b);
|
||||||
((Activity) context).finish();
|
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
|
||||||
context.startActivity(intent);
|
((Activity) context).finish();
|
||||||
} else {
|
context.startActivity(intent);
|
||||||
if( social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
|
} else {
|
||||||
CrossActions.doCrossConversation(context, status);
|
if( social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
|
||||||
|
CrossActions.doCrossConversation(context, status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
holder.main_container.setOnClickListener(new View.OnClickListener() {
|
||||||
holder.main_container.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(View v) {
|
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) {
|
||||||
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE) {
|
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
Bundle b = new Bundle();
|
||||||
Bundle b = new Bundle();
|
if (status.getReblog() == null)
|
||||||
if (status.getReblog() == null)
|
b.putParcelable("status", status);
|
||||||
b.putParcelable("status", status);
|
else
|
||||||
else
|
b.putParcelable("status", status.getReblog());
|
||||||
b.putParcelable("status", status.getReblog());
|
intent.putExtras(b);
|
||||||
intent.putExtras(b);
|
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
|
||||||
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
|
((Activity) context).finish();
|
||||||
((Activity) context).finish();
|
context.startActivity(intent);
|
||||||
context.startActivity(intent);
|
} else {
|
||||||
} else {
|
if( social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
|
||||||
if( social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
|
CrossActions.doCrossConversation(context, status);
|
||||||
CrossActions.doCrossConversation(context, status);
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
holder.status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
holder.status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
||||||
if (truncate_toots_size > 0) {
|
if (truncate_toots_size > 0) {
|
||||||
holder.status_content.setMaxLines(truncate_toots_size);
|
holder.status_content.setMaxLines(truncate_toots_size);
|
||||||
|
|
Loading…
Reference in New Issue