From 8c3c30215df0c48697c00e4431c8513a1dfc28da Mon Sep 17 00:00:00 2001 From: tom79 Date: Tue, 25 Jul 2017 15:34:45 +0200 Subject: [PATCH 1/5] Fixes a bug with the double opening when clicking on a mentioned account. --- .../fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java | 4 ---- app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java index 553c145fb..79021d815 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java @@ -531,10 +531,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf } } }); - - - - //Profile picture return convertView; } 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 ca7b55910..5cb1c7586 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 @@ -1098,6 +1098,7 @@ public class Helper { }, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); } statusTV.setText(spannableString, TextView.BufferType.SPANNABLE); + statusTV.setMovementMethod(null); statusTV.setMovementMethod(LinkMovementMethod.getInstance()); return statusTV; } @@ -1166,6 +1167,7 @@ public class Helper { }, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); } statusTV.setText(spannableString, TextView.BufferType.SPANNABLE); + statusTV.setMovementMethod(null); statusTV.setMovementMethod(LinkMovementMethod.getInstance()); return statusTV; } From c608f0bdf06c5a0bf181fa49e1a3780b3cf70837 Mon Sep 17 00:00:00 2001 From: tom79 Date: Wed, 26 Jul 2017 09:21:47 +0200 Subject: [PATCH 2/5] Fixes menu selection issue --- .../mastodon/activities/MainActivity.java | 15 ++-- .../mastodon/drawers/StatusListAdapter.java | 1 - .../gouv/etalab/mastodon/helper/Helper.java | 71 ++++++++++--------- .../main/res/menu/activity_main_drawer.xml | 7 +- 4 files changed, 52 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java index 5d53f04ba..6632d139d 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java @@ -29,7 +29,6 @@ import android.support.v4.app.FragmentManager; import android.support.v4.view.ViewPager; import android.support.v7.app.AlertDialog; import android.support.v7.widget.SearchView; -import android.util.Log; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; @@ -105,7 +104,6 @@ public class MainActivity extends AppCompatActivity private ViewPager viewPager; private RelativeLayout main_app_container; private Stack stackBack = new Stack<>(); - public MainActivity() { } @@ -194,7 +192,7 @@ public class MainActivity extends AppCompatActivity if( item != null){ toolbarTitle.setText(item.getTitle()); populateTitleWithTag(fragmentTag, item.getTitle().toString(), item.getItemId()); - unCheckAllMenuItems(navigationView.getMenu()); + unCheckAllMenuItems(navigationView); item.setChecked(true); } if( tab.getPosition() < 3 ) @@ -365,17 +363,17 @@ public class MainActivity extends AppCompatActivity final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); userIdIntent = extras.getString(PREF_KEY_ID); //Id of the account in the intent if (extras.getInt(INTENT_ACTION) == NOTIFICATION_INTENT){ - unCheckAllMenuItems(navigationView.getMenu()); changeUser(MainActivity.this, userIdIntent, false); //Connects the account which is related to the notification + unCheckAllMenuItems(navigationView); tabLayout.getTabAt(3).select(); matchingIntent = true; }else if( extras.getInt(INTENT_ACTION) == HOME_TIMELINE_INTENT){ - unCheckAllMenuItems(navigationView.getMenu()); + unCheckAllMenuItems(navigationView); changeUser(MainActivity.this, userIdIntent, false); //Connects the account which is related to the notification tabLayout.getTabAt(0).select(); matchingIntent = true; }else if( extras.getInt(INTENT_ACTION) == CHANGE_THEME_INTENT){ - unCheckAllMenuItems(navigationView.getMenu()); + unCheckAllMenuItems(navigationView); navigationView.setCheckedItem(R.id.nav_settings); navigationView.getMenu().performIdentifierAction(R.id.nav_settings, 0); toolbarTitle.setText(R.string.settings); @@ -424,7 +422,7 @@ public class MainActivity extends AppCompatActivity tabLayout.setVisibility(View.VISIBLE); main_app_container.setVisibility(View.GONE); final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); - unCheckAllMenuItems(navigationView.getMenu()); + unCheckAllMenuItems(navigationView); toot.setVisibility(View.VISIBLE); switch (viewPager.getCurrentItem()){ @@ -526,6 +524,7 @@ public class MainActivity extends AppCompatActivity //Proceeds to update of the authenticated account if(Helper.isLoggedIn(getApplicationContext())) new UpdateAccountInfoByIDAsyncTask(getApplicationContext(), MainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } @@ -537,7 +536,7 @@ public class MainActivity extends AppCompatActivity // Handle navigation view item clicks here. int id = item.getItemId(); final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); - unCheckAllMenuItems(navigationView.getMenu()); + unCheckAllMenuItems(navigationView); item.setChecked(true); //Remove the search bar if( !toolbar_search.isIconified() ) { diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java index 79021d815..855ad8ee7 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java @@ -28,7 +28,6 @@ import android.os.Build; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.text.Html; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; 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 5cb1c7586..d0df96399 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 @@ -1029,21 +1029,21 @@ public class Helper { int matchEnd = matcher.end(); final String url = spannableString.toString().substring(matchStart, matchEnd); spannableString.setSpan(new ClickableSpan() { - @Override - public void onClick(View textView) { - Intent intent = new Intent(context, WebviewActivity.class); - Bundle b = new Bundle(); - b.putString("url", url); - intent.putExtras(b); - context.startActivity(intent); - } - @Override - public void updateDrawState(TextPaint ds) { - super.updateDrawState(ds); - } - }, - matchStart, matchEnd, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + @Override + public void onClick(View textView) { + Intent intent = new Intent(context, WebviewActivity.class); + Bundle b = new Bundle(); + b.putString("url", url); + intent.putExtras(b); + context.startActivity(intent); + } + @Override + public void updateDrawState(TextPaint ds) { + super.updateDrawState(ds); + } + }, + matchStart, matchEnd, + Spanned.SPAN_INCLUSIVE_EXCLUSIVE); } } @@ -1057,21 +1057,21 @@ public class Helper { int startPosition = spannableString.toString().indexOf(targetedAccount); int endPosition = spannableString.toString().lastIndexOf(targetedAccount) + targetedAccount.length(); spannableString.setSpan(new ClickableSpan() { - @Override - public void onClick(View textView) { - Intent intent = new Intent(context, ShowAccountActivity.class); - Bundle b = new Bundle(); - b.putString("accountId", mention.getId()); - intent.putExtras(b); - context.startActivity(intent); - } - @Override - public void updateDrawState(TextPaint ds) { - super.updateDrawState(ds); - } - }, - startPosition, endPosition, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + @Override + public void onClick(View textView) { + Intent intent = new Intent(context, ShowAccountActivity.class); + Bundle b = new Bundle(); + b.putString("accountId", mention.getId()); + intent.putExtras(b); + context.startActivity(intent); + } + @Override + public void updateDrawState(TextPaint ds) { + super.updateDrawState(ds); + } + }, + startPosition, endPosition, + Spanned.SPAN_INCLUSIVE_EXCLUSIVE); } @@ -1373,12 +1373,19 @@ public class Helper { return false; } - public static void unCheckAllMenuItems(@NonNull final Menu menu) { + + + public static void unCheckAllMenuItems(NavigationView navigationView){ + navigationView.setCheckedItem(R.id.menu_none); + unCheckAllMenuItemsRec(navigationView.getMenu()); + } + + private static void unCheckAllMenuItemsRec(@NonNull final Menu menu) { int size = menu.size(); for (int i = 0; i < size; i++) { final MenuItem item = menu.getItem(i); if(item.hasSubMenu()) { - unCheckAllMenuItems(item.getSubMenu()); + unCheckAllMenuItemsRec(item.getSubMenu()); } else { item.setChecked(false); } diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml index 02c2be495..2389caccc 100644 --- a/app/src/main/res/menu/activity_main_drawer.xml +++ b/app/src/main/res/menu/activity_main_drawer.xml @@ -1,19 +1,24 @@ + - + + Date: Wed, 26 Jul 2017 18:31:26 +0200 Subject: [PATCH 3/5] Fixes issue with menu selection --- .../mastodon/activities/MainActivity.java | 17 ++++++++++------- .../fr/gouv/etalab/mastodon/helper/Helper.java | 18 +++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java index 6632d139d..98d439c22 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java @@ -74,6 +74,7 @@ import fr.gouv.etalab.mastodon.sqlite.AccountDAO; import mastodon.etalab.gouv.fr.mastodon.R; import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_THEME_INTENT; +import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_USER_INTENT; 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.NOTIFICATION_INTENT; @@ -173,8 +174,8 @@ public class MainActivity extends AppCompatActivity tabLayout.setVisibility(View.VISIBLE); switch (tab.getPosition()){ case 0: - fragmentTag = "HOME_TIMELINE"; item = navigationView.getMenu().findItem(R.id.nav_home); + fragmentTag = "HOME_TIMELINE"; break; case 1: fragmentTag = "LOCAL_TIMELINE"; @@ -368,16 +369,19 @@ public class MainActivity extends AppCompatActivity tabLayout.getTabAt(3).select(); matchingIntent = true; }else if( extras.getInt(INTENT_ACTION) == HOME_TIMELINE_INTENT){ - unCheckAllMenuItems(navigationView); - changeUser(MainActivity.this, userIdIntent, false); //Connects the account which is related to the notification - tabLayout.getTabAt(0).select(); - matchingIntent = true; + changeUser(MainActivity.this, userIdIntent, true); //Connects the account which is related to the notification }else if( extras.getInt(INTENT_ACTION) == CHANGE_THEME_INTENT){ unCheckAllMenuItems(navigationView); navigationView.setCheckedItem(R.id.nav_settings); navigationView.getMenu().performIdentifierAction(R.id.nav_settings, 0); toolbarTitle.setText(R.string.settings); matchingIntent = true; + }else if( extras.getInt(INTENT_ACTION) == CHANGE_USER_INTENT){ + unCheckAllMenuItems(navigationView); + navigationView.setCheckedItem(R.id.nav_home); + navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0); + toolbarTitle.setText(R.string.home_menu); + matchingIntent = true; } }else if( Intent.ACTION_SEND.equals(action) && type != null ){ if ("text/plain".equals(type)) { @@ -524,7 +528,6 @@ public class MainActivity extends AppCompatActivity //Proceeds to update of the authenticated account if(Helper.isLoggedIn(getApplicationContext())) new UpdateAccountInfoByIDAsyncTask(getApplicationContext(), MainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } @@ -660,7 +663,7 @@ public class MainActivity extends AppCompatActivity /** * Page Adapter for settings */ - private class PagerAdapter extends FragmentStatePagerAdapter { + private class PagerAdapter extends FragmentStatePagerAdapter { int mNumOfTabs; private PagerAdapter(FragmentManager fm, int NumOfTabs) { 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 d0df96399..377ff3114 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 @@ -17,7 +17,6 @@ package fr.gouv.etalab.mastodon.helper; -import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.DownloadManager; @@ -53,10 +52,10 @@ import android.text.Html; import android.text.SpannableString; import android.text.Spanned; import android.text.TextPaint; +import android.text.method.ArrowKeyMovementMethod; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.util.DisplayMetrics; -import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.SubMenu; @@ -117,7 +116,6 @@ import fr.gouv.etalab.mastodon.asynctasks.RemoveAccountAsyncTask; import fr.gouv.etalab.mastodon.client.Entities.Account; import fr.gouv.etalab.mastodon.client.Entities.Mention; import fr.gouv.etalab.mastodon.client.Entities.Status; -import fr.gouv.etalab.mastodon.client.Entities.Tag; import fr.gouv.etalab.mastodon.client.PatchBaseImageDownloader; import fr.gouv.etalab.mastodon.sqlite.AccountDAO; import fr.gouv.etalab.mastodon.sqlite.Sqlite; @@ -171,6 +169,7 @@ public class Helper { public static final int NOTIFICATION_INTENT = 1; public static final int HOME_TIMELINE_INTENT = 2; public static final int CHANGE_THEME_INTENT = 3; + public static final int CHANGE_USER_INTENT = 4; //Settings public static final String SET_TOOTS_PER_PAGE = "set_toots_per_page"; public static final String SET_ACCOUNTS_PER_PAGE = "set_accounts_per_page"; @@ -587,6 +586,7 @@ public class Helper { File file; if( bitmap != null) { file = new File(myDir, fileName); + //noinspection ResultOfMethodCallIgnored file.createNewFile(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); @@ -852,10 +852,6 @@ public class Helper { final NavigationView navigationView = (NavigationView) activity.findViewById(R.id.nav_view); navigationView.getMenu().clear(); navigationView.inflateMenu(R.menu.activity_main_drawer); - if( checkItem ) { - navigationView.setCheckedItem(R.id.nav_home); - navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0); - } SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); Account account = new AccountDAO(activity,db).getAccountByID(userID); //Can happen when an account has been deleted and there is a click on an old notification @@ -873,6 +869,11 @@ public class Helper { editor.putString(Helper.PREF_KEY_ID, account.getId()); editor.apply(); activity.recreate(); + if( checkItem ) { + Intent intent = new Intent(activity, MainActivity.class); + intent.putExtra(INTENT_ACTION, CHANGE_USER_INTENT); + activity.startActivity(intent); + } } @@ -1100,6 +1101,9 @@ public class Helper { statusTV.setText(spannableString, TextView.BufferType.SPANNABLE); statusTV.setMovementMethod(null); statusTV.setMovementMethod(LinkMovementMethod.getInstance()); + statusTV.setMovementMethod(ArrowKeyMovementMethod.getInstance()); + statusTV.setFocusable(true); + statusTV.setFocusableInTouchMode(true); return statusTV; } From 706f4673c0a0b025aa16916e6ada428af653b618 Mon Sep 17 00:00:00 2001 From: tom79 Date: Wed, 26 Jul 2017 19:59:08 +0200 Subject: [PATCH 4/5] Improves the behavior with the remaining characters when writing toots. --- .../mastodon/activities/TootActivity.java | 61 +++++++++++++------ app/src/main/res/layout/activity_toot.xml | 1 + 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java index 683318de4..9a299f9b0 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java @@ -25,21 +25,20 @@ import android.content.IntentFilter; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; import android.graphics.Bitmap; +import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Build; 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.support.v7.widget.Toolbar; 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; @@ -108,7 +107,6 @@ 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.loadPPInActionBar; /** * Created by Thomas on 01/05/2017. @@ -145,12 +143,14 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc private long restored; private TextView title; private ImageView pp_actionBar; + private Toast mToast; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); - int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); + final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); if( theme == Helper.THEME_LIGHT){ setTheme(R.style.AppTheme); }else { @@ -430,15 +430,21 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc }else{ toot_show_accounts.setVisibility(View.GONE); } - if( s.length() + charsInCw > maxChar){ - String content = s.toString().substring(0,(maxChar - charsInCw)); - toot_content.setText(content); - charsInToot = content.length(); - toot_content.setSelection(toot_content.getText().length()); - Toast.makeText(getApplicationContext(),R.string.toot_no_space,Toast.LENGTH_LONG).show(); - } int totalChar = toot_cw_content.length() + toot_content.length(); - toot_space_left.setText(String.valueOf((maxChar - totalChar))); + int remainChar = (maxChar - totalChar); + if( remainChar >= 0){ + toot_it.setEnabled(true); + if( theme == Helper.THEME_LIGHT){ + toot_space_left.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorAccent)); + }else { + toot_space_left.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorAccentD)); + } + }else { + toot_it.setEnabled(false); + showAToast(getString(R.string.toot_no_space)); + toot_space_left.setTextColor( Color.RED); + } + toot_space_left.setText(String.valueOf(remainChar)); } }); //Allow scroll of the EditText though it's embedded in a scrollview @@ -464,14 +470,22 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void afterTextChanged(Editable s) { - if( s.length() + charsInToot > maxChar){ - String content = s.toString().substring(0,(maxChar - charsInToot)); - toot_cw_content.setText(content); - toot_cw_content.setSelection(toot_cw_content.getText().length()); - Toast.makeText(getApplicationContext(),R.string.toot_no_space,Toast.LENGTH_LONG).show(); - } int totalChar = toot_cw_content.length() + toot_content.length(); - toot_space_left.setText(String.valueOf((maxChar - totalChar))); + int remainChar = (maxChar - totalChar); + if( remainChar >= 0){ + toot_it.setEnabled(true); + if( theme == Helper.THEME_LIGHT){ + toot_space_left.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorAccent)); + }else { + toot_space_left.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorAccentD)); + } + }else { + toot_it.setEnabled(false); + showAToast(getString(R.string.toot_no_space)); + toot_space_left.setTextColor(Color.RED); + + } + toot_space_left.setText(String.valueOf(remainChar)); } }); if( restored != -1 ){ @@ -481,6 +495,13 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc } + public void showAToast (String message){ + if (mToast != null) { + mToast.cancel(); + } + mToast = Toast.makeText(this, message, Toast.LENGTH_SHORT); + mToast.show(); + } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { diff --git a/app/src/main/res/layout/activity_toot.xml b/app/src/main/res/layout/activity_toot.xml index e103b72ce..d29e13e6f 100644 --- a/app/src/main/res/layout/activity_toot.xml +++ b/app/src/main/res/layout/activity_toot.xml @@ -159,6 +159,7 @@ Date: Thu, 27 Jul 2017 19:23:53 +0200 Subject: [PATCH 5/5] Fixes an issue with emoji in bio + prepares release 1.3.8 --- app/{build.gradle => mastodon-etalab-v1.3.8.apk} | 4 ++-- .../gouv/etalab/mastodon/activities/ShowAccountActivity.java | 5 ----- app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java | 2 ++ 3 files changed, 4 insertions(+), 7 deletions(-) rename app/{build.gradle => mastodon-etalab-v1.3.8.apk} (95%) diff --git a/app/build.gradle b/app/mastodon-etalab-v1.3.8.apk similarity index 95% rename from app/build.gradle rename to app/mastodon-etalab-v1.3.8.apk index 6ddeab3cc..7decfe055 100644 --- a/app/build.gradle +++ b/app/mastodon-etalab-v1.3.8.apk @@ -7,8 +7,8 @@ android { applicationId "fr.gouv.etalab.mastodon" minSdkVersion 15 targetSdkVersion 25 - versionCode 34 - versionName "1.3.7" + versionCode 35 + versionName "1.3.8" } buildTypes { release { 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 d0c0ffe91..3bab2c880 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 @@ -298,11 +298,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi account_ac.setVisibility(View.GONE); else account_ac.setText(account.getAcct()); - /*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) - account_note.setText(Html.fromHtml(Helper.shortnameToUnicode(account.getNote(),true), Html.FROM_HTML_MODE_COMPACT)); - else - //noinspection deprecation - account_note.setText(Html.fromHtml(Helper.shortnameToUnicode(account.getNote(), true)));*/ account_note = Helper.clickableElementsDescription(ShowAccountActivity.this, account_note,account.getNote()); tabLayout.getTabAt(0).setText(getString(R.string.status_cnt, account.getStatuses_count())); tabLayout.getTabAt(1).setText(getString(R.string.following_cnt, account.getFollowing_count())); 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 377ff3114..c827a88ee 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 @@ -1121,6 +1121,7 @@ public class Helper { public static TextView clickableElementsDescription(final Context context, TextView statusTV, String fullContent) { SpannableString spannableString; + fullContent = Helper.shortnameToUnicode(fullContent, true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) spannableString = new SpannableString(Html.fromHtml(fullContent, Html.FROM_HTML_MODE_COMPACT)); else @@ -1170,6 +1171,7 @@ public class Helper { } }, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); } + statusTV.setText(spannableString, TextView.BufferType.SPANNABLE); statusTV.setMovementMethod(null); statusTV.setMovementMethod(LinkMovementMethod.getInstance());