Quick fix for autocomplete bug + typo in string-fr
This commit is contained in:
parent
6791f80b76
commit
dd9bcee721
|
@ -17,11 +17,9 @@ package fr.gouv.etalab.mastodon.activities;
|
|||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Bitmap;
|
||||
|
@ -33,13 +31,11 @@ import android.os.Bundle;
|
|||
import android.speech.RecognizerIntent;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.Html;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -48,6 +44,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
|
@ -60,7 +57,6 @@ import android.widget.ImageButton;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
import android.widget.Toast;
|
||||
|
@ -135,7 +131,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
private AutoCompleteTextView toot_content;
|
||||
private EditText toot_cw_content;
|
||||
private LinearLayout toot_reply_content_container;
|
||||
private BroadcastReceiver search_validate;
|
||||
private Status tootReply = null;
|
||||
private String sharedContent, sharedSubject;
|
||||
private CheckBox toot_sensitive;
|
||||
|
@ -147,6 +142,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
private Toast mToast;
|
||||
private LinearLayout drawer_layout;
|
||||
private HorizontalScrollView picture_scrollview;
|
||||
private String search;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -289,28 +285,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
int charsInToot = 0;
|
||||
maxChar = 500;
|
||||
|
||||
//Register LocalBroadcast to receive selected accounts after search
|
||||
search_validate = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String acct = intent.getStringExtra("acct");
|
||||
if( acct != null){
|
||||
acct = "@" + acct;
|
||||
String content = toot_content.getText().toString();
|
||||
String[] splitContent = content.split("@");
|
||||
String newContent = "";
|
||||
for(int i = 0 ; i < (splitContent.length -1) ; i++){
|
||||
newContent += splitContent[i];
|
||||
}
|
||||
newContent += acct + " ";
|
||||
toot_content.setText(newContent);
|
||||
toot_content.setSelection(toot_content.getText().length());
|
||||
}
|
||||
// manageShowUsers(searchAction.CLOSE, false);
|
||||
}
|
||||
};
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(search_validate, new IntentFilter(Helper.SEARCH_VALIDATE_ACCOUNT));
|
||||
|
||||
|
||||
boolean isAccountPrivate = account.isLocked();
|
||||
|
||||
|
@ -434,7 +408,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
}
|
||||
Matcher m = sPattern.matcher(s.toString().substring(s.toString().length()- length, s.toString().length()));
|
||||
if(m.matches()) {
|
||||
String search = m.group(3);
|
||||
search = m.group(3);
|
||||
if( pp_progress != null && pp_actionBar != null) {
|
||||
pp_progress.setVisibility(View.VISIBLE);
|
||||
pp_actionBar.setVisibility(View.GONE);
|
||||
|
@ -745,12 +719,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(){
|
||||
super.onDestroy();
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(search_validate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveAttachment(final Attachment attachment, Error error) {
|
||||
loading_picture.setVisibility(View.GONE);
|
||||
|
@ -948,13 +916,26 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
Toast.makeText(getApplicationContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Account> accounts = apiResponse.getAccounts();
|
||||
|
||||
final List<Account> accounts = apiResponse.getAccounts();
|
||||
if( accounts != null && accounts.size() > 0){
|
||||
AccountsSearchAdapter accountsListAdapter = new AccountsSearchAdapter(TootActivity.this, accounts);
|
||||
toot_content.showDropDown();
|
||||
toot_content.setThreshold(0);
|
||||
toot_content.setAdapter(accountsListAdapter);
|
||||
final String toot_content_str = toot_content.getText().toString().replace("@"+search,"");
|
||||
toot_content.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Account account = accounts.get(position);
|
||||
toot_content.setText(toot_content_str + " @" + account.getAcct() + " ");
|
||||
toot_content.setSelection(toot_content.getText().length()-1);
|
||||
toot_content.dismissDropDown();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void restoreToot(long id){
|
||||
|
|
|
@ -16,9 +16,7 @@ package fr.gouv.etalab.mastodon.drawers;
|
|||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.annotation.NonNull;;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -50,7 +48,6 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
|||
private LayoutInflater layoutInflater;
|
||||
private ImageLoader imageLoader;
|
||||
private DisplayImageOptions options;
|
||||
private Context context;
|
||||
|
||||
public AccountsSearchAdapter(Context context, List<Account> accounts){
|
||||
super(context, android.R.layout.simple_list_item_1, accounts);
|
||||
|
@ -59,7 +56,6 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
|||
this.suggestions = new ArrayList<>(accounts);
|
||||
layoutInflater = LayoutInflater.from(context);
|
||||
imageLoader = ImageLoader.getInstance();
|
||||
this.context = context;
|
||||
options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
}
|
||||
|
@ -103,14 +99,6 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
|||
//Profile picture
|
||||
imageLoader.displayImage(account.getAvatar(), holder.account_pp, options);
|
||||
|
||||
holder.account_container.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Helper.SEARCH_VALIDATE_ACCOUNT);
|
||||
intent.putExtra("acct", account.getAcct());
|
||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
|
||||
}
|
||||
});
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
@ -125,7 +113,7 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
|||
@Override
|
||||
public CharSequence convertResultToString(Object resultValue) {
|
||||
Account account = (Account) resultValue;
|
||||
return account.getDisplay_name() + " " + account.getUsername();
|
||||
return "@" + account.getAcct();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -153,8 +141,7 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
|||
add(cust);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else{
|
||||
clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@
|
|||
<string name="no_draft">Aucun brouillon !</string>
|
||||
<string name="choose_toot">Choisissez un pouet</string>
|
||||
<string name="remove_draft">Supprimer le brouillon ?</string>
|
||||
<string name="show_reply">Cliquer sur le boutton pour afficher le pouet d\'origine</string>
|
||||
<string name="show_reply">Cliquer sur le bouton pour afficher le pouet d\'origine</string>
|
||||
<!-- Instance -->
|
||||
<string name="instance_no_description">Aucune description !</string>
|
||||
|
||||
|
|
Loading…
Reference in New Issue