some fixes

This commit is contained in:
tom79 2019-11-26 18:29:20 +01:00
parent 6d0d2a4a07
commit f536f462c9
5 changed files with 23 additions and 12 deletions

View File

@ -242,7 +242,7 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
new RetrieveRemoteDataAsyncTask(getApplicationContext(), "kasun", "toot.fedilab.app", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new RetrieveRemoteDataAsyncTask(getApplicationContext(), "fedilab", "oot.fedilab.app", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new RetrieveRemoteDataAsyncTask(getApplicationContext(), "fedilab", "toot.fedilab.app", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new RetrieveRemoteDataAsyncTask(getApplicationContext(), "mmarif", "mastodon.social", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new RetrieveRemoteDataAsyncTask(getApplicationContext(), "PhotonQyv", "mastodon.xyz", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new RetrieveRemoteDataAsyncTask(getApplicationContext(), "angrytux", "social.tchncs.de", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

View File

@ -1316,10 +1316,15 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
private void addNewMedia(JSONObject response, ArrayList<String> successfullyUploadedFiles) {
Attachment attachment;
//response = new JSONObject(serverResponse.getBodyAsString());
if (social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA)
if( response == null ){
Toasty.error(TootActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
return;
}
if (social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
attachment = API.parseAttachmentResponse(response);
else
} else {
attachment = GNUAPI.parseUploadedAttachmentResponse(response);
}
boolean alreadyAdded = false;
int index = 0;

View File

@ -827,7 +827,7 @@ public class PeertubeAPI {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
//This account is currently logged in, the token is updated
if (prefKeyOauthTokenT.equals(token)) {
if (prefKeyOauthTokenT != null && prefKeyOauthTokenT.equals(token)) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, targetedAccount.getToken());
editor.apply();

View File

@ -14,6 +14,7 @@ package app.fedilab.android.drawers;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
@ -54,7 +55,6 @@ import es.dmoral.toasty.Toasty;
public class AccountSearchDevAdapter extends BaseAdapter implements OnPostActionInterface {
private List<Account> accounts;
private LayoutInflater layoutInflater;
private Context context;
private ViewHolder holder;
@ -83,7 +83,7 @@ public class AccountSearchDevAdapter extends BaseAdapter implements OnPostAction
public View getView(final int position, View convertView, ViewGroup parent) {
context = parent.getContext();
layoutInflater = LayoutInflater.from(context);
LayoutInflater layoutInflater = LayoutInflater.from(context);
final Account account = accounts.get(position);
if (convertView == null) {
@ -132,9 +132,11 @@ public class AccountSearchDevAdapter extends BaseAdapter implements OnPostAction
//Profile picture
if (account.getAvatar().startsWith("http")) {
Glide.with(holder.account_pp.getContext())
.load(account.getAvatar())
.into(holder.account_pp);
if( !((Activity)context).isFinishing()) {
Glide.with(holder.account_pp.getContext())
.load(account.getAvatar())
.into(holder.account_pp);
}
} else if (account.getSocial() != null && account.getSocial().contains("OPENCOLLECTIVE")) {
Glide.with(holder.account_pp.getContext())
.load(R.drawable.missing)

View File

@ -178,12 +178,16 @@ public class ColorSettingsFragment extends PreferenceFragmentCompat implements S
if (key.compareTo("base_theme") == 0) {
SharedPreferences sharedpreferences = getActivity().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
SharedPreferences.Editor appEditor = sharedpreferences.edit();
appEditor.putInt(Helper.SET_THEME, Integer.parseInt(value));
if( value != null && value.matches("-?\\d+")) {
appEditor.putInt(Helper.SET_THEME, Integer.parseInt(value));
}
appEditor.commit();
} else if (key.compareTo("pref_color_navigation_bar") == 0 || key.compareTo("pref_color_status_bar") == 0) {
editor.putBoolean(key, Boolean.valueOf(value));
editor.putBoolean(key, Boolean.parseBoolean(value));
} else {
editor.putInt(key, Integer.valueOf(value));
if( value != null && value.matches("-?\\d+")) {
editor.putInt(key, Integer.parseInt(value));
}
}
}
}