- Adds redirect after writing a toot: Reply -> conversation | Toot -> home timeline
- Fixes issue with missing pp on some instances
This commit is contained in:
parent
272f8c3bfd
commit
29127282a8
|
@ -39,6 +39,7 @@ import android.support.v7.widget.Toolbar;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -78,6 +79,7 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import fr.gouv.etalab.mastodon.asynctasks.PostActionAsyncTask;
|
import fr.gouv.etalab.mastodon.asynctasks.PostActionAsyncTask;
|
||||||
|
import fr.gouv.etalab.mastodon.asynctasks.PostStatusAsyncTask;
|
||||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveSearchAccountsAsyncTask;
|
import fr.gouv.etalab.mastodon.asynctasks.RetrieveSearchAccountsAsyncTask;
|
||||||
import fr.gouv.etalab.mastodon.asynctasks.UploadActionAsyncTask;
|
import fr.gouv.etalab.mastodon.asynctasks.UploadActionAsyncTask;
|
||||||
import fr.gouv.etalab.mastodon.client.API;
|
import fr.gouv.etalab.mastodon.client.API;
|
||||||
|
@ -92,6 +94,7 @@ import fr.gouv.etalab.mastodon.drawers.AccountsSearchAdapter;
|
||||||
import fr.gouv.etalab.mastodon.drawers.DraftsListAdapter;
|
import fr.gouv.etalab.mastodon.drawers.DraftsListAdapter;
|
||||||
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.OnPostStatusActionInterface;
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveAttachmentInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveAttachmentInterface;
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearcAccountshInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearcAccountshInterface;
|
||||||
import fr.gouv.etalab.mastodon.jobs.ScheduledTootsSyncJob;
|
import fr.gouv.etalab.mastodon.jobs.ScheduledTootsSyncJob;
|
||||||
|
@ -100,6 +103,8 @@ import fr.gouv.etalab.mastodon.sqlite.StatusStoredDAO;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||||
import mastodon.etalab.gouv.fr.mastodon.R;
|
import mastodon.etalab.gouv.fr.mastodon.R;
|
||||||
|
|
||||||
|
import static fr.gouv.etalab.mastodon.helper.Helper.HOME_TIMELINE_INTENT;
|
||||||
|
import static fr.gouv.etalab.mastodon.helper.Helper.INTENT_ACTION;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
||||||
import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
|
import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
|
||||||
|
|
||||||
|
@ -108,7 +113,7 @@ import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
|
||||||
* Toot activity class
|
* Toot activity class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAccountshInterface, OnRetrieveAttachmentInterface, OnPostActionInterface {
|
public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAccountshInterface, OnRetrieveAttachmentInterface, OnPostStatusActionInterface {
|
||||||
|
|
||||||
|
|
||||||
private int charsInCw;
|
private int charsInCw;
|
||||||
|
@ -238,11 +243,11 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
Account account = new AccountDAO(getApplicationContext(),db).getAccountByID(userId);
|
Account account = new AccountDAO(getApplicationContext(),db).getAccountByID(userId);
|
||||||
ImageLoader imageLoader;
|
String url = account.getAvatar();
|
||||||
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
if( url.startsWith("/") ){
|
||||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
url = "https://" + Helper.getLiveInstance(getApplicationContext()) + account.getAvatar();
|
||||||
imageLoader = ImageLoader.getInstance();
|
}
|
||||||
imageLoader.loadImage(account.getAvatar(), options, new SimpleImageLoadingListener(){
|
imageLoader.loadImage(url, options, new SimpleImageLoadingListener(){
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
||||||
super.onLoadingComplete(imageUri, view, loadedImage);
|
super.onLoadingComplete(imageUri, view, loadedImage);
|
||||||
|
@ -370,7 +375,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
||||||
toot.setContent(toot_content.getText().toString().trim());
|
toot.setContent(toot_content.getText().toString().trim());
|
||||||
if( tootReply != null)
|
if( tootReply != null)
|
||||||
toot.setIn_reply_to_id(tootReply.getId());
|
toot.setIn_reply_to_id(tootReply.getId());
|
||||||
new PostActionAsyncTask(getApplicationContext(), API.StatusAction.CREATESTATUS, null, toot, null, TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostStatusAsyncTask(getApplicationContext(), toot, TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -818,40 +823,57 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
||||||
storeToot(true);
|
storeToot(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPostAction(int statusCode, API.StatusAction statusAction, String userId, Error error) {
|
public void onPostStatusAction(APIResponse apiResponse) {
|
||||||
if( error != null){
|
if( apiResponse.getError() != null){
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
||||||
if( show_error_messages)
|
if( show_error_messages)
|
||||||
Toast.makeText(getApplicationContext(), error.getError(),Toast.LENGTH_LONG).show();
|
Toast.makeText(getApplicationContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( statusCode == 200){
|
//Clear the toot
|
||||||
//Clear the toot
|
toot_content.setText("");
|
||||||
toot_content.setText("");
|
toot_cw_content.setText("");
|
||||||
toot_cw_content.setText("");
|
if( attachments != null) {
|
||||||
if( attachments != null) {
|
for (Attachment attachment : attachments) {
|
||||||
for (Attachment attachment : attachments) {
|
View namebar = findViewById(Integer.parseInt(attachment.getId()));
|
||||||
View namebar = findViewById(Integer.parseInt(attachment.getId()));
|
if (namebar != null && namebar.getParent() != null)
|
||||||
if (namebar != null && namebar.getParent() != null)
|
((ViewGroup) namebar.getParent()).removeView(namebar);
|
||||||
((ViewGroup) namebar.getParent()).removeView(namebar);
|
|
||||||
}
|
|
||||||
List<Attachment> tmp_attachment = new ArrayList<>();
|
|
||||||
tmp_attachment.addAll(attachments);
|
|
||||||
attachments.removeAll(tmp_attachment);
|
|
||||||
tmp_attachment.clear();
|
|
||||||
}
|
}
|
||||||
isSensitive = false;
|
List<Attachment> tmp_attachment = new ArrayList<>();
|
||||||
toot_sensitive.setVisibility(View.GONE);
|
tmp_attachment.addAll(attachments);
|
||||||
currentToId = -1;
|
attachments.removeAll(tmp_attachment);
|
||||||
Toast.makeText(TootActivity.this,R.string.toot_sent, Toast.LENGTH_LONG).show();
|
tmp_attachment.clear();
|
||||||
}else {
|
|
||||||
Toast.makeText(TootActivity.this,R.string.toast_error, Toast.LENGTH_LONG).show();
|
|
||||||
}
|
}
|
||||||
|
isSensitive = false;
|
||||||
|
toot_sensitive.setVisibility(View.GONE);
|
||||||
|
currentToId = -1;
|
||||||
|
Toast.makeText(TootActivity.this,R.string.toot_sent, Toast.LENGTH_LONG).show();
|
||||||
toot_it.setEnabled(true);
|
toot_it.setEnabled(true);
|
||||||
}
|
//It's a reply, so the user will be redirect to its answer
|
||||||
|
if( tootReply != null){
|
||||||
|
List<Status> statuses = apiResponse.getStatuses();
|
||||||
|
if( statuses != null && statuses.size() > 0 ){
|
||||||
|
Status status = statuses.get(0);
|
||||||
|
if( status != null ) {
|
||||||
|
Intent intent = new Intent(getApplicationContext(), ShowConversationActivity.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putString("statusId", status.getId());
|
||||||
|
intent.putExtras(b);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
|
||||||
|
intent.putExtra(INTENT_ACTION, HOME_TIMELINE_INTENT);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRetrieveSearchAccounts(APIResponse apiResponse) {
|
public void onRetrieveSearchAccounts(APIResponse apiResponse) {
|
||||||
|
@ -1075,4 +1097,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ package fr.gouv.etalab.mastodon.asynctasks;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import fr.gouv.etalab.mastodon.client.API;
|
import fr.gouv.etalab.mastodon.client.API;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnPostActionInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnPostActionInterface;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/* Copyright 2017 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Mastalab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with Thomas Schneider; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
package fr.gouv.etalab.mastodon.asynctasks;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
|
import fr.gouv.etalab.mastodon.client.API;
|
||||||
|
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||||
|
import fr.gouv.etalab.mastodon.interfaces.OnPostStatusActionInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Thomas on 21/07/2017.
|
||||||
|
* Posts status (live version) - scheduled toots are sent via classic post feature in api
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PostStatusAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private OnPostStatusActionInterface listener;
|
||||||
|
private APIResponse apiResponse;
|
||||||
|
private fr.gouv.etalab.mastodon.client.Entities.Status status;
|
||||||
|
|
||||||
|
public PostStatusAsyncTask(Context context, fr.gouv.etalab.mastodon.client.Entities.Status status, OnPostStatusActionInterface onPostStatusActionInterface){
|
||||||
|
this.context = context;
|
||||||
|
this.listener = onPostStatusActionInterface;
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... params) {
|
||||||
|
apiResponse = new API(context).postStatusAction(status);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Void result) {
|
||||||
|
listener.onPostStatusAction(apiResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -898,6 +898,58 @@ public class API {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Posts a status
|
||||||
|
* @param status Status object related to the status
|
||||||
|
* @return APIResponse
|
||||||
|
*/
|
||||||
|
public APIResponse postStatusAction(Status status){
|
||||||
|
|
||||||
|
String action;
|
||||||
|
RequestParams params;
|
||||||
|
params = new RequestParams();
|
||||||
|
action = "/statuses";
|
||||||
|
params.put("status", status.getContent());
|
||||||
|
if( status.getIn_reply_to_id() != null)
|
||||||
|
params.put("in_reply_to_id", status.getIn_reply_to_id());
|
||||||
|
if( status.getMedia_attachments() != null && status.getMedia_attachments().size() > 0 ) {
|
||||||
|
for(Attachment attachment: status.getMedia_attachments()) {
|
||||||
|
params.add("media_ids[]", attachment.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( status.isSensitive())
|
||||||
|
params.put("sensitive", Boolean.toString(status.isSensitive()));
|
||||||
|
if( status.getSpoiler_text() != null)
|
||||||
|
params.put("spoiler_text", status.getSpoiler_text());
|
||||||
|
params.put("visibility", status.getVisibility());
|
||||||
|
statuses = new ArrayList<>();
|
||||||
|
post(action, 30000, params, new JsonHttpResponseHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||||
|
Status statusreturned = parseStatuses(response);
|
||||||
|
statuses.add(statusreturned);
|
||||||
|
apiResponse.setSince_id(findSinceId(headers));
|
||||||
|
apiResponse.setMax_id(findMaxId(headers));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||||
|
statuses = parseStatuses(response);
|
||||||
|
apiResponse.setSince_id(findSinceId(headers));
|
||||||
|
apiResponse.setMax_id(findMaxId(headers));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onFailure(int statusCode, Header[] headers, Throwable error, JSONObject response) {
|
||||||
|
actionCode = statusCode;
|
||||||
|
setError(statusCode, error);
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
apiResponse.setStatuses(statuses);
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves notifications for the authenticated account since an id*synchronously*
|
* Retrieves notifications for the authenticated account since an id*synchronously*
|
||||||
* @param since_id String since max
|
* @param since_id String since max
|
||||||
|
|
|
@ -294,8 +294,8 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putString("statusId", status.getId()); //Your id
|
b.putString("statusId", status.getId());
|
||||||
intent.putExtras(b); //Put your id to your next Intent
|
intent.putExtras(b);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -335,7 +335,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.status_account_username.setText(String.format("@%s",username));
|
holder.status_account_username.setText(String.format("@%s",username));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
holder.status_reply.setOnClickListener(new View.OnClickListener() {
|
holder.status_reply.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -344,6 +343,13 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
b.putParcelable("tootReply", status);
|
b.putParcelable("tootReply", status);
|
||||||
intent.putExtras(b); //Put your id to your next Intent
|
intent.putExtras(b); //Put your id to your next Intent
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
|
if( type == RetrieveFeedsAsyncTask.Type.CONTEXT ){
|
||||||
|
try {
|
||||||
|
//Avoid to open multi activities when replying in a conversation
|
||||||
|
((ShowConversationActivity)context).finish();
|
||||||
|
}catch (Exception ignored){}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -745,7 +745,11 @@ public class Helper {
|
||||||
imageLoader = ImageLoader.getInstance();
|
imageLoader = ImageLoader.getInstance();
|
||||||
final ImageView imageView = new ImageView(activity);
|
final ImageView imageView = new ImageView(activity);
|
||||||
item.setIcon(R.drawable.ic_person);
|
item.setIcon(R.drawable.ic_person);
|
||||||
imageLoader.displayImage(account.getAvatar(), imageView, options, new ImageLoadingListener() {
|
String url = account.getAvatar();
|
||||||
|
if( url.startsWith("/") ){
|
||||||
|
url = "https://" + Helper.getLiveInstance(activity) + account.getAvatar();
|
||||||
|
}
|
||||||
|
imageLoader.displayImage(url, imageView, options, new ImageLoadingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingStarted(String s, View view) {
|
public void onLoadingStarted(String s, View view) {
|
||||||
}
|
}
|
||||||
|
@ -865,14 +869,7 @@ public class Helper {
|
||||||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, account.getToken());
|
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, account.getToken());
|
||||||
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
ImageLoader imageLoader;
|
activity.recreate();
|
||||||
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
|
||||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
|
||||||
imageLoader = ImageLoader.getInstance();
|
|
||||||
View headerLayout = navigationView.getHeaderView(0);
|
|
||||||
updateHeaderAccountInfo(activity, account, headerLayout, imageLoader, options);
|
|
||||||
//Adds the profile picture as an icon
|
|
||||||
loadPPInActionBar(activity, account.getAvatar());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -886,6 +883,9 @@ public class Helper {
|
||||||
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||||
imageLoader = ImageLoader.getInstance();
|
imageLoader = ImageLoader.getInstance();
|
||||||
|
if( url.startsWith("/") ){
|
||||||
|
url = "https://" + Helper.getLiveInstance(activity) + url;
|
||||||
|
}
|
||||||
imageLoader.loadImage(url, options, new SimpleImageLoadingListener(){
|
imageLoader.loadImage(url, options, new SimpleImageLoadingListener(){
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
||||||
|
@ -939,7 +939,11 @@ public class Helper {
|
||||||
ownerFollowing.setText(String.valueOf(account.getFollowing_count()));
|
ownerFollowing.setText(String.valueOf(account.getFollowing_count()));
|
||||||
username.setText(String.format("@%s",account.getUsername()));
|
username.setText(String.format("@%s",account.getUsername()));
|
||||||
displayedName.setText(account.getDisplay_name());
|
displayedName.setText(account.getDisplay_name());
|
||||||
imageLoader.displayImage(account.getAvatar(), profilePicture, options);
|
String url = account.getAvatar();
|
||||||
|
if( url.startsWith("/") ){
|
||||||
|
url = "https://" + Helper.getLiveInstance(activity) + account.getAvatar();
|
||||||
|
}
|
||||||
|
imageLoader.displayImage(url, profilePicture, options);
|
||||||
}
|
}
|
||||||
profilePicture.setOnClickListener(null);
|
profilePicture.setOnClickListener(null);
|
||||||
profilePicture.setOnClickListener(new View.OnClickListener() {
|
profilePicture.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* Copyright 2017 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Mastalab
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with Thomas Schneider; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
package fr.gouv.etalab.mastodon.interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Thomas on 21/07/2017.
|
||||||
|
* Interface when posting a status
|
||||||
|
*/
|
||||||
|
public interface OnPostStatusActionInterface {
|
||||||
|
void onPostStatusAction(APIResponse apiResponse);
|
||||||
|
}
|
Loading…
Reference in New Issue