Displays translation button only when enabled.
This commit is contained in:
parent
d192777f38
commit
498a96f468
|
@ -84,6 +84,7 @@ import fr.gouv.etalab.mastodon.client.PatchBaseImageDownloader;
|
||||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnPostActionInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnPostActionInterface;
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnTranslatedInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnTranslatedInterface;
|
||||||
|
import fr.gouv.etalab.mastodon.translation.GoogleTranslateQuery;
|
||||||
import fr.gouv.etalab.mastodon.translation.YandexQuery;
|
import fr.gouv.etalab.mastodon.translation.YandexQuery;
|
||||||
import mastodon.etalab.gouv.fr.mastodon.R;
|
import mastodon.etalab.gouv.fr.mastodon.R;
|
||||||
|
|
||||||
|
@ -301,11 +302,19 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if( currentLocale != null && status.getLanguage() != null && !status.getLanguage().trim().equals(currentLocale) && !status.getLanguage().trim().equals("null")){
|
if( currentLocale != null && status.getLanguage() != null && !status.getLanguage().trim().equals(currentLocale) && !status.getLanguage().trim().equals("null")){
|
||||||
holder.status_translate.setVisibility(View.VISIBLE);
|
if (translator != Helper.TRANS_NONE)
|
||||||
|
holder.status_translate.setVisibility(View.VISIBLE);
|
||||||
|
else
|
||||||
|
holder.status_translate.setVisibility(View.GONE);
|
||||||
}else {
|
}else {
|
||||||
holder.status_translate.setVisibility(View.GONE);
|
holder.status_translate.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( translator == Helper.TRANS_YANDEX)
|
||||||
|
holder.yandex_translate.setVisibility(View.VISIBLE);
|
||||||
|
else
|
||||||
|
holder.yandex_translate.setVisibility(View.GONE);
|
||||||
|
|
||||||
holder.status_translate.setOnClickListener(new View.OnClickListener() {
|
holder.status_translate.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -350,7 +359,11 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
new YandexQuery(StatusListAdapter.this).getYandexTextview(position, text, currentLocale);
|
if (translator == Helper.TRANS_YANDEX)
|
||||||
|
new YandexQuery(StatusListAdapter.this).getYandexTextview(position, text, currentLocale);
|
||||||
|
else if( translator == Helper.TRANS_GOOGLE)
|
||||||
|
new GoogleTranslateQuery(StatusListAdapter.this).getGoogleTextview(position, text, currentLocale);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
status.setTranslationShown(!status.isTranslationShown());
|
status.setTranslationShown(!status.isTranslationShown());
|
||||||
statusListAdapter.notifyDataSetChanged();
|
statusListAdapter.notifyDataSetChanged();
|
||||||
|
|
Loading…
Reference in New Issue