Merged original_master into PhotonQyv-Baseline
This commit is contained in:
commit
a14763e60c
|
@ -7,8 +7,8 @@ android {
|
||||||
applicationId "fr.gouv.etalab.mastodon"
|
applicationId "fr.gouv.etalab.mastodon"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 62
|
versionCode 63
|
||||||
versionName "1.5.2"
|
versionName "1.5.3"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
|
|
@ -1214,35 +1214,37 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
||||||
toot_content.setAdapter(accountsListAdapter);
|
toot_content.setAdapter(accountsListAdapter);
|
||||||
final String oldContent = toot_content.getText().toString();
|
final String oldContent = toot_content.getText().toString();
|
||||||
String[] searchA = oldContent.substring(0,currentCursorPosition).split("@");
|
String[] searchA = oldContent.substring(0,currentCursorPosition).split("@");
|
||||||
final String search = searchA[searchA.length-1];
|
if( searchA.length > 0 ) {
|
||||||
toot_content.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
final String search = searchA[searchA.length - 1];
|
||||||
@Override
|
toot_content.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
@Override
|
||||||
Account account = accounts.get(position);
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
String deltaSearch = "";
|
Account account = accounts.get(position);
|
||||||
if( currentCursorPosition-searchLength > 0 && currentCursorPosition < oldContent.length() )
|
String deltaSearch = "";
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition-searchLength, currentCursorPosition);
|
if (currentCursorPosition - searchLength > 0 && currentCursorPosition < oldContent.length())
|
||||||
else {
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength, currentCursorPosition);
|
||||||
if( currentCursorPosition >= oldContent.length() )
|
else {
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition-searchLength, oldContent.length());
|
if (currentCursorPosition >= oldContent.length())
|
||||||
}
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength, oldContent.length());
|
||||||
|
}
|
||||||
|
|
||||||
if( !search.equals(""))
|
if (!search.equals(""))
|
||||||
deltaSearch = deltaSearch.replace("@"+search,"");
|
deltaSearch = deltaSearch.replace("@" + search, "");
|
||||||
String newContent = oldContent.substring(0,currentCursorPosition-searchLength);
|
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
||||||
newContent += deltaSearch;
|
newContent += deltaSearch;
|
||||||
newContent += "@" + account.getAcct() + " ";
|
newContent += "@" + account.getAcct() + " ";
|
||||||
int newPosition = newContent.length();
|
int newPosition = newContent.length();
|
||||||
if( currentCursorPosition < oldContent.length() - 1)
|
if (currentCursorPosition < oldContent.length() - 1)
|
||||||
newContent += oldContent.substring(currentCursorPosition, oldContent.length()-1);
|
newContent += oldContent.substring(currentCursorPosition, oldContent.length() - 1);
|
||||||
toot_content.setText(newContent);
|
toot_content.setText(newContent);
|
||||||
toot_space_left.setText(String.valueOf(toot_content.length()));
|
toot_space_left.setText(String.valueOf(toot_content.length()));
|
||||||
toot_content.setSelection(newPosition);
|
toot_content.setSelection(newPosition);
|
||||||
AccountsSearchAdapter accountsListAdapter = new AccountsSearchAdapter(TootActivity.this, new ArrayList<Account>());
|
AccountsSearchAdapter accountsListAdapter = new AccountsSearchAdapter(TootActivity.this, new ArrayList<Account>());
|
||||||
toot_content.setThreshold(1);
|
toot_content.setThreshold(1);
|
||||||
toot_content.setAdapter(accountsListAdapter);
|
toot_content.setAdapter(accountsListAdapter);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class RetrieveSearchAccountsAsyncTask extends AsyncTask<Void, Void, Void>
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
API api = new API(context);
|
API api = new API(context);
|
||||||
apiResponse = api.searchAccounts(query, 10);
|
apiResponse = api.searchAccounts(query, 20);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
||||||
holder.account_un.setText(String.format("@%s", account.getUsername() + "@" + instance));
|
holder.account_un.setText(String.format("@%s", account.getUsername() + "@" + instance));
|
||||||
holder.account_dn.setVisibility(View.GONE);
|
holder.account_dn.setVisibility(View.GONE);
|
||||||
}else {
|
}else {
|
||||||
holder.account_un.setText(String.format("@%s", account.getUsername()));
|
holder.account_un.setText(String.format("@%s", account.getAcct()));
|
||||||
holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
|
holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
|
||||||
holder.account_dn.setVisibility(View.VISIBLE);
|
holder.account_dn.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,6 +385,11 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
retrieveMissingToots(statuses.get(0).getId());
|
retrieveMissingToots(statuses.get(0).getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int index = lv_status.getFirstVisiblePosition();
|
||||||
|
View v = lv_status.getChildAt(0);
|
||||||
|
int top = (v == null) ? 0 : v.getTop();
|
||||||
|
statusListAdapter.notifyDataSetChanged();
|
||||||
|
lv_status.setSelectionFromTop(index, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue