diff --git a/app/build.gradle b/app/build.gradle index 4a3c25f1b..110820407 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "fr.gouv.etalab.mastodon" minSdkVersion 15 targetSdkVersion 27 - versionCode 90 - versionName "1.6.7-rc-1" + versionCode 93 + versionName "1.6.7.2" } flavorDimensions "default" diff --git a/app/fdroid/release/app-fdroid-release-1.4.9-beta-4.apk b/app/fdroid/release/app-fdroid-release-1.4.9-beta-4.apk deleted file mode 100644 index 7882416a3..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.4.9-beta-4.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.4.9-beta-6.apk b/app/fdroid/release/app-fdroid-release-1.4.9-beta-6.apk deleted file mode 100644 index 246002bfc..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.4.9-beta-6.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.4.9-beta-7.apk b/app/fdroid/release/app-fdroid-release-1.4.9-beta-7.apk deleted file mode 100644 index 0d584b2ec..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.4.9-beta-7.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.4.9-rc-1.apk b/app/fdroid/release/app-fdroid-release-1.4.9-rc-1.apk deleted file mode 100644 index b9e273c6f..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.4.9-rc-1.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.5.0.apk b/app/fdroid/release/app-fdroid-release-1.5.0.apk deleted file mode 100644 index 97c9bf61e..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.5.0.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.5.8-BT27.apk b/app/fdroid/release/app-fdroid-release-1.5.8-BT27.apk deleted file mode 100644 index 0486b7b40..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.5.8-BT27.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.5.8-new.apk b/app/fdroid/release/app-fdroid-release-1.5.8-new.apk deleted file mode 100644 index 006035373..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.5.8-new.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.5.8.apk b/app/fdroid/release/app-fdroid-release-1.5.8.apk deleted file mode 100644 index 006035373..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.5.8.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.6.0-beta-1.apk b/app/fdroid/release/app-fdroid-release-1.6.0-beta-1.apk deleted file mode 100644 index 1f813ef66..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.6.0-beta-1.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.6.0-rc-1-fix.apk b/app/fdroid/release/app-fdroid-release-1.6.0-rc-1-fix.apk deleted file mode 100644 index 41e24a4b2..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.6.0-rc-1-fix.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.6.0-rc-1-fix2.apk b/app/fdroid/release/app-fdroid-release-1.6.0-rc-1-fix2.apk deleted file mode 100644 index c7b7a5112..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.6.0-rc-1-fix2.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.6.0-rc-1-fix3.apk b/app/fdroid/release/app-fdroid-release-1.6.0-rc-1-fix3.apk deleted file mode 100644 index 64144b1a5..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.6.0-rc-1-fix3.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.6.0-rc-1.apk b/app/fdroid/release/app-fdroid-release-1.6.0-rc-1.apk deleted file mode 100644 index 97392123f..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.6.0-rc-1.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.6.3-test-1.apk b/app/fdroid/release/app-fdroid-release-1.6.3-test-1.apk deleted file mode 100644 index 73fbd0f80..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.6.3-test-1.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-1.6.4.1-fix.apk b/app/fdroid/release/app-fdroid-release-1.6.4.1-fix.apk deleted file mode 100644 index 2bc80d38d..000000000 Binary files a/app/fdroid/release/app-fdroid-release-1.6.4.1-fix.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-bookmark-2.apk b/app/fdroid/release/app-fdroid-release-bookmark-2.apk deleted file mode 100644 index 218ae407e..000000000 Binary files a/app/fdroid/release/app-fdroid-release-bookmark-2.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-bookmark-3.apk b/app/fdroid/release/app-fdroid-release-bookmark-3.apk deleted file mode 100644 index 0d716588a..000000000 Binary files a/app/fdroid/release/app-fdroid-release-bookmark-3.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-bookmark-4.apk b/app/fdroid/release/app-fdroid-release-bookmark-4.apk deleted file mode 100644 index 32cc7b395..000000000 Binary files a/app/fdroid/release/app-fdroid-release-bookmark-4.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-bookmark-5.apk b/app/fdroid/release/app-fdroid-release-bookmark-5.apk deleted file mode 100644 index 4dc988b3f..000000000 Binary files a/app/fdroid/release/app-fdroid-release-bookmark-5.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-bookmark.apk b/app/fdroid/release/app-fdroid-release-bookmark.apk deleted file mode 100644 index 72f687ec5..000000000 Binary files a/app/fdroid/release/app-fdroid-release-bookmark.apk and /dev/null differ diff --git a/app/fdroid/release/app-fdroid-release-federatedtm-stream.apk b/app/fdroid/release/app-fdroid-release-federatedtm-stream.apk deleted file mode 100644 index 03fc59def..000000000 Binary files a/app/fdroid/release/app-fdroid-release-federatedtm-stream.apk and /dev/null differ diff --git a/app/playstore/release/app-playstore-release-1.6.7-beta-1.apk b/app/playstore/release/app-playstore-release-1.6.7-beta-1.apk deleted file mode 100644 index e7d31946e..000000000 Binary files a/app/playstore/release/app-playstore-release-1.6.7-beta-1.apk and /dev/null differ diff --git a/app/playstore/release/app-playstore-release-1.6.7-beta-2.apk b/app/playstore/release/app-playstore-release-1.6.7-beta-2.apk deleted file mode 100644 index 0da455d03..000000000 Binary files a/app/playstore/release/app-playstore-release-1.6.7-beta-2.apk and /dev/null differ diff --git a/app/playstore/release/app-playstore-release-1.6.7-beta-3.apk b/app/playstore/release/app-playstore-release-1.6.7-beta-3.apk deleted file mode 100644 index f416ca520..000000000 Binary files a/app/playstore/release/app-playstore-release-1.6.7-beta-3.apk and /dev/null differ diff --git a/app/playstore/release/app-playstore-release-1.6.7-rc-1.apk b/app/playstore/release/app-playstore-release-1.6.7-rc-1.apk deleted file mode 100644 index 3d1c66998..000000000 Binary files a/app/playstore/release/app-playstore-release-1.6.7-rc-1.apk and /dev/null differ diff --git a/app/safetynet/release/app-safetynet-release-for-tests.apk b/app/safetynet/release/app-safetynet-release-for-tests.apk deleted file mode 100644 index cedbd01cd..000000000 Binary files a/app/safetynet/release/app-safetynet-release-for-tests.apk and /dev/null differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index be64508a7..bcf372e63 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -179,6 +179,7 @@ android:theme="@style/Base.V7.Theme.AppCompat.Dialog" android:excludeFromRecents="true"/> diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/EditProfileActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/EditProfileActivity.java index f3f9ca3d0..bebd09fc6 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/EditProfileActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/EditProfileActivity.java @@ -34,7 +34,6 @@ import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.ActionBar; import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.text.Html; import android.text.TextWatcher; @@ -197,6 +196,7 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou return; } set_profile_name.setText(account.getDisplay_name()); + set_profile_name.setSelection(set_profile_name.getText().length()); final String content; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java index 42b36b3a8..eb63a087f 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java @@ -91,6 +91,8 @@ import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsAccountInterface; import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface; import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRelationshipInterface; import fr.gouv.etalab.mastodon.client.Entities.Relationship; + +import static fr.gouv.etalab.mastodon.helper.Helper.THEME_DARK; import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor; import static fr.gouv.etalab.mastodon.helper.Helper.withSuffix; @@ -494,6 +496,24 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt startActivity(intent); } }); + //This account was moved to another one + if( account.getMoved_to_account() != null){ + TextView account_moved = findViewById(R.id.account_moved); + account_moved.setVisibility(View.VISIBLE); + if( theme == THEME_DARK) + changeDrawableColor(ShowAccountActivity.this, R.drawable.ic_card_travel,R.color.dark_icon); + else + changeDrawableColor(ShowAccountActivity.this, R.drawable.ic_card_travel,R.color.black); + Drawable imgTravel = ContextCompat.getDrawable(ShowAccountActivity.this, R.drawable.ic_card_travel); + assert imgTravel != null; + imgTravel.setBounds(0,0,(int) (20 * scale + 0.5f),(int) (20 * scale + 0.5f)); + account_moved.setCompoundDrawables(imgTravel, null, null, null); + //Retrieves content and make account names clickable + SpannableString spannableString = account.moveToText(ShowAccountActivity.this); + account_moved.setText(spannableString, TextView.BufferType.SPANNABLE); + account_moved.setMovementMethod(LinkMovementMethod.getInstance()); + } + if( account.getAcct().contains("@") ) warning_message.setVisibility(View.VISIBLE); else diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/API.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/API.java index 5bb7a470c..8ba3ecd66 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/client/API.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/API.java @@ -134,18 +134,36 @@ public class API { HashMap requestParams = new HashMap<>(); if( display_name != null) - requestParams.put("display_name",display_name); + try { + requestParams.put("display_name",URLEncoder.encode(display_name, "UTF-8")); + } catch (UnsupportedEncodingException e) { + requestParams.put("display_name",display_name); + } if( note != null) - requestParams.put("note",note); + try { + requestParams.put("note",URLEncoder.encode(note, "UTF-8")); + } catch (UnsupportedEncodingException e) { + requestParams.put("note",note); + } if( avatar != null) - requestParams.put("avatar",avatar); + try { + requestParams.put("avatar",URLEncoder.encode(avatar, "UTF-8")); + } catch (UnsupportedEncodingException e) { + requestParams.put("avatar",avatar); + } if( header != null) - requestParams.put("header",header); + try { + requestParams.put("header",URLEncoder.encode(header, "UTF-8")); + } catch (UnsupportedEncodingException e) { + requestParams.put("header",header); + } try { new HttpsConnection().patch(getAbsoluteUrl("/accounts/update_credentials"), 60, requestParams, prefKeyOauthTokenT); } catch (HttpsConnection.HttpsConnectionException e) { + e.printStackTrace(); setError(e.getStatusCode(), e); }catch (Exception e) { + e.printStackTrace(); setDefaultError(); } return apiResponse; @@ -1718,6 +1736,7 @@ public class API { * @param resobj JSONObject * @return Account */ + @SuppressWarnings("InfiniteRecursion") private static Account parseAccountResponse(Context context, JSONObject resobj){ Account account = new Account(); @@ -1732,6 +1751,9 @@ public class API { account.setFollowing_count(Integer.valueOf(resobj.get("following_count").toString())); account.setStatuses_count(Integer.valueOf(resobj.get("statuses_count").toString())); account.setNote(resobj.get("note").toString()); + try{ + account.setMoved_to_account(parseAccountResponse(context, resobj.getJSONObject("moved"))); + }catch (Exception ignored){ignored.printStackTrace();} account.setUrl(resobj.get("url").toString()); account.setAvatar(resobj.get("avatar").toString()); account.setAvatar_static(resobj.get("avatar_static").toString()); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java index db9874db3..e42eeb358 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java @@ -14,12 +14,22 @@ * see . */ package fr.gouv.etalab.mastodon.client.Entities; +import android.content.*; +import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; +import android.text.SpannableString; +import android.text.Spanned; +import android.text.TextPaint; +import android.text.style.ClickableSpan; +import android.view.View; import java.io.Serializable; import java.util.Date; +import fr.gouv.etalab.mastodon.R; +import fr.gouv.etalab.mastodon.activities.ShowAccountActivity; + /** * Created by Thomas on 23/04/2017. * Manage accounts @@ -50,6 +60,8 @@ public class Account implements Parcelable { private boolean isFollowing; private followAction followType = followAction.NOTHING; private boolean isMakingAction = false; + private Account moved_to_account; + public followAction getFollowType() { return followType; @@ -67,6 +79,14 @@ public class Account implements Parcelable { isMakingAction = makingAction; } + public Account getMoved_to_account() { + return moved_to_account; + } + + public void setMoved_to_account(Account moved_to_account) { + this.moved_to_account = moved_to_account; + } + public enum followAction{ FOLLOW, NOT_FOLLOW, @@ -83,6 +103,7 @@ public class Account implements Parcelable { acct = in.readString(); display_name = in.readString(); locked = in.readByte() != 0; + moved_to_account = in.readParcelable(Account.class.getClassLoader()); followers_count = in.readInt(); following_count = in.readInt(); statuses_count = in.readInt(); @@ -257,6 +278,7 @@ public class Account implements Parcelable { dest.writeString(username); dest.writeString(acct); dest.writeString(display_name); + dest.writeParcelable(moved_to_account, flags); dest.writeByte((byte) (locked ? 1 : 0)); dest.writeInt(followers_count); dest.writeInt(following_count); @@ -302,4 +324,36 @@ public class Account implements Parcelable { public void setStatuses_count_str(String statuses_count_str) { this.statuses_count_str = statuses_count_str; } + + /** + * Makes the move to account clickable + * @param context Context + * @return SpannableString + */ + public SpannableString moveToText(final android.content.Context context){ + SpannableString spannableString = null; + if( this.getMoved_to_account() != null) { + spannableString = new SpannableString(context.getString(R.string.account_moved_to, this.getAcct(), "@"+this.getMoved_to_account().getAcct())); + int startPositionTar = spannableString.toString().indexOf("@"+this.getMoved_to_account().getAcct()); + int endPositionTar = startPositionTar + ("@"+this.getMoved_to_account().getAcct()).length(); + final String idTar = this.getMoved_to_account().getId(); + spannableString.setSpan(new ClickableSpan() { + @Override + public void onClick(View textView) { + Intent intent = new Intent(context, ShowAccountActivity.class); + Bundle b = new Bundle(); + b.putString("accountId", idTar); + intent.putExtras(b); + context.startActivity(intent); + } + @Override + public void updateDrawState(TextPaint ds) { + super.updateDrawState(ds); + } + }, + startPositionTar, endPositionTar, + Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + } + return spannableString; + } } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Version.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Version.java index d2b185ce5..59aacf32d 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Version.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Version.java @@ -17,10 +17,12 @@ public class Version implements Comparable { public Version(String version) { if(version == null) - version = "2.0"; + version = "2.1"; + if( version.endsWith(".")) + version = version.substring(0, version.length() - 1); version = version.replaceAll("[^\\d.]", ""); if(!version.matches("[0-9]+(\\.[0-9]+)*")) - version = "2.0"; + version = "2.1"; this.version = version; } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsInAListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsInAListAdapter.java index 3e9e2da35..ca2a21c08 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsInAListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsInAListAdapter.java @@ -89,13 +89,6 @@ public class AccountsInAListAdapter extends RecyclerView.Adapter implements OnLi //Profile picture Helper.loadGiF(context, account.getAvatar(), holder.account_pp); - //Follow button - holder.account_action.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - - } - }); if( actionType == type.CURRENT){ holder.account_action.setImageResource(R.drawable.ic_close); }else if(actionType == type.SEARCH){ diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/ListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/ListAdapter.java index 9d2a4623c..eab8eab3e 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/ListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/ListAdapter.java @@ -19,8 +19,10 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; +import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; @@ -94,6 +96,7 @@ public class ListAdapter extends BaseAdapter implements OnListActionInterface { } SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); + if( theme == Helper.THEME_LIGHT){ holder.search_container.setBackgroundResource(R.color.mastodonC3__); changeDrawableColor(context, R.drawable.ic_keyboard_arrow_right,R.color.black); @@ -101,7 +104,13 @@ public class ListAdapter extends BaseAdapter implements OnListActionInterface { holder.search_container.setBackgroundResource(R.color.mastodonC1_); changeDrawableColor(context, R.drawable.ic_keyboard_arrow_right,R.color.dark_text); } + Drawable next = ContextCompat.getDrawable(context, R.drawable.ic_keyboard_arrow_right); holder.search_title.setText(list.getTitle()); + assert next != null; + final float scale = context.getResources().getDisplayMetrics().density; + next.setBounds(0,0,(int) (30 * scale + 0.5f),(int) (30 * scale + 0.5f)); + holder.search_title.setCompoundDrawables(null, null, next, null); + holder.search_container.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java index 678b07b35..26dc58e50 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java @@ -247,7 +247,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/DroidSans-Regular.ttf"); holder.notification_status_content.setTypeface(tf); - + holder.status_reply.setText(""); if( !status.isClickable()) status.makeClickable(context); if( !status.isEmojiFound()) @@ -301,7 +301,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On holder.status_action_container.setVisibility(View.VISIBLE); - Drawable imgFav, imgReblog; + Drawable imgFav, imgReblog, imgReply; if( status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited())) { changeDrawableColor(context, R.drawable.ic_star,R.color.marked_icon); imgFav = ContextCompat.getDrawable(context, R.drawable.ic_star); @@ -323,6 +323,11 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On changeDrawableColor(context, R.drawable.ic_repeat,R.color.black); imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_repeat); } + if( theme == THEME_DARK) + changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_icon); + else + changeDrawableColor(context, R.drawable.ic_reply,R.color.black); + imgReply = ContextCompat.getDrawable(context, R.drawable.ic_reply); if( status.getReblog() == null) { if (status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 && !status.isSpoilerShown()) { @@ -364,14 +369,21 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On imgFav.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f)); assert imgReblog != null; imgReblog.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f)); + assert imgReply != null; + imgReply.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (20 * iconSizePercent/100 * scale + 0.5f)); + holder.status_favorite_count.setCompoundDrawables(imgFav, null, null, null); holder.status_reblog_count.setCompoundDrawables(imgReblog, null, null, null); + holder.status_reply.setCompoundDrawables(imgReply, null, null, null); + if( theme == THEME_DARK){ holder.status_favorite_count.setTextColor(ContextCompat.getColor(context, R.color.dark_icon)); holder.status_reblog_count.setTextColor(ContextCompat.getColor(context, R.color.dark_icon)); + holder.status_reply.setTextColor(ContextCompat.getColor(context, R.color.dark_icon)); }else { holder.status_favorite_count.setTextColor(ContextCompat.getColor(context, R.color.black)); holder.status_reblog_count.setTextColor(ContextCompat.getColor(context, R.color.black)); + holder.status_reply.setTextColor(ContextCompat.getColor(context, R.color.black)); } if( type.equals("favourite") || type.equals("reblog")){ holder.status_document_container.setVisibility(View.GONE); @@ -981,7 +993,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On TextView status_favorite_count; TextView status_reblog_count; TextView status_date; - ImageView status_reply; + TextView status_reply; LinearLayout status_document_container; LinearLayout status_action_container; Button status_show_more; diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/SearchTootsListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/SearchTootsListAdapter.java index 1aa61d4a2..56f2def44 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/SearchTootsListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/SearchTootsListAdapter.java @@ -20,7 +20,9 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; +import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; @@ -99,7 +101,13 @@ public class SearchTootsListAdapter extends BaseAdapter { holder.search_container.setBackgroundResource(R.color.mastodonC1_); changeDrawableColor(context, R.drawable.ic_keyboard_arrow_right,R.color.dark_text); } + Drawable next = ContextCompat.getDrawable(context, R.drawable.ic_keyboard_arrow_right); holder.search_title.setText(search); + final float scale = context.getResources().getDisplayMetrics().density; + assert next != null; + next.setBounds(0,0,(int) (30 * scale + 0.5f),(int) (30 * scale + 0.5f)); + holder.search_title.setCompoundDrawables(null, null, next, null); + holder.search_container.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java index c82001be0..b91dcf3a2 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java @@ -316,14 +316,18 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn tmpStatuses.add(tmpStatus); } } - - if (tmpStatuses.size() > 0 && Long.parseLong(tmpStatuses.get(tmpStatuses.size()-1).getId()) > Long.parseLong(bookmark)) { - tmpStatuses.get(tmpStatuses.size()-1).setFetchMore(true); + int tootPerPage = sharedpreferences.getInt(Helper.SET_TOOTS_PER_PAGE, 40); + if( tmpStatuses.size() >= tootPerPage) { + if (tmpStatuses.size() > 0 && Long.parseLong(tmpStatuses.get(tmpStatuses.size() - 1).getId()) > Long.parseLong(bookmark)) { + tmpStatuses.get(tmpStatuses.size() - 1).setFetchMore(true); + } } this.statuses.addAll(position, tmpStatuses); statusListAdapter.notifyItemRangeInserted(position, tmpStatuses.size()); - - lv_status.scrollToPosition(position+tmpStatuses.size()); + if( tmpStatuses.size() < 3) //If new toots are only two + lv_status.scrollToPosition(0); + else + lv_status.scrollToPosition(position+tmpStatuses.size()); } }else { diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java index 3afa7015f..4868d461c 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java @@ -1771,7 +1771,7 @@ public class Helper { } public static void installProvider(){ - Security.addProvider(Conscrypt.newProvider()); + Security.insertProviderAt(Conscrypt.newProvider(),1); } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/sqlite/CustomEmojiDAO.java b/app/src/main/java/fr/gouv/etalab/mastodon/sqlite/CustomEmojiDAO.java index 061801334..ac8305e05 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/sqlite/CustomEmojiDAO.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/sqlite/CustomEmojiDAO.java @@ -109,7 +109,7 @@ public class CustomEmojiDAO { public List getAllEmojis(){ String instance = Helper.getLiveInstance(context); try { - Cursor c = db.query(Sqlite.TABLE_CUSTOM_EMOJI, null, Sqlite.COL_INSTANCE + " = '" + instance+ "'", null, null, null, Sqlite.COL_SHORTCODE + " ASC", null); + Cursor c = db.query(Sqlite.TABLE_CUSTOM_EMOJI, null, Sqlite.COL_INSTANCE + " = '" + instance+ "'", null, Sqlite.COL_SHORTCODE , null, Sqlite.COL_SHORTCODE + " ASC", null); return cursorToListEmojis(c); } catch (Exception e) { return null; @@ -139,7 +139,7 @@ public class CustomEmojiDAO { public List getEmojiStartingBy(String shortCode){ try { String instance = Helper.getLiveInstance(context); - Cursor c = db.query(Sqlite.TABLE_CUSTOM_EMOJI, null, Sqlite.COL_SHORTCODE + " LIKE \"%" + shortCode + "%\" AND " + Sqlite.COL_INSTANCE + " = \"" + instance+ "\"", null, null, null, null, null); + Cursor c = db.query(Sqlite.TABLE_CUSTOM_EMOJI, null, Sqlite.COL_SHORTCODE + " LIKE \"%" + shortCode + "%\" AND " + Sqlite.COL_INSTANCE + " = \"" + instance+ "\"", null, Sqlite.COL_SHORTCODE , null, null, null); return cursorToListEmojis(c); } catch (Exception e) { return null; diff --git a/app/src/main/res/drawable-anydpi/ic_card_travel.xml b/app/src/main/res/drawable-anydpi/ic_card_travel.xml new file mode 100644 index 000000000..29cd27ee2 --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_card_travel.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout-sw600dp/activity_show_account.xml b/app/src/main/res/layout-sw600dp/activity_show_account.xml index cebf63edd..3528685be 100644 --- a/app/src/main/res/layout-sw600dp/activity_show_account.xml +++ b/app/src/main/res/layout-sw600dp/activity_show_account.xml @@ -186,6 +186,16 @@ android:layout_height="wrap_content" /> + diff --git a/app/src/main/res/layout/activity_manage_accounts_list.xml b/app/src/main/res/layout/activity_manage_accounts_list.xml index 5a1f4ac66..01cdb556c 100644 --- a/app/src/main/res/layout/activity_manage_accounts_list.xml +++ b/app/src/main/res/layout/activity_manage_accounts_list.xml @@ -8,11 +8,10 @@ android:id="@+id/container" android:orientation="vertical" android:layout_width="match_parent" - android:layout_height="300dp"> + android:layout_height="wrap_content"> @@ -22,7 +21,7 @@ android:textColor="@color/titleb" android:layout_gravity="center" android:gravity="center" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" /> + + + - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_show_account.xml b/app/src/main/res/layout/activity_show_account.xml index 688d0bf4c..e22c2cc23 100644 --- a/app/src/main/res/layout/activity_show_account.xml +++ b/app/src/main/res/layout/activity_show_account.xml @@ -120,14 +120,15 @@ android:gravity="center" android:orientation="horizontal" android:layout_height="wrap_content" - > + android:baselineAligned="false"> + android:layout_height="wrap_content" + tools:ignore="UselessParent"> - + diff --git a/app/src/main/res/layout/drawer_notification.xml b/app/src/main/res/layout/drawer_notification.xml index cf4b8a90b..4f18ce153 100644 --- a/app/src/main/res/layout/drawer_notification.xml +++ b/app/src/main/res/layout/drawer_notification.xml @@ -282,13 +282,13 @@ android:layout_marginEnd="@dimen/activity_vertical_margin" android:layout_marginRight="@dimen/activity_vertical_margin" android:orientation="horizontal"> - + android:gravity="center_vertical" + android:id="@+id/status_reply" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> New list title Search among people you follow Your lists + + + %1$s has moved to %2$s \ No newline at end of file