Improve compact mode + fix issue with emoji
This commit is contained in:
parent
8ba9564269
commit
cbf748ea59
|
@ -192,7 +192,6 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
|
|||
progess_action.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1923,9 +1923,6 @@ public class API {
|
|||
*/
|
||||
public ArrayList<String> getCommunitywikiList(String name) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
try {
|
||||
name = URLEncoder.encode(name, "UTF-8");
|
||||
} catch (UnsupportedEncodingException ignored) {}
|
||||
try {
|
||||
HttpsConnection httpsConnection = new HttpsConnection(context);
|
||||
String response = httpsConnection.get(getAbsoluteUrlCommunitywiki(String.format("/list/%s", name)), 60, null, prefKeyOauthTokenT);
|
||||
|
|
|
@ -36,6 +36,7 @@ import android.text.style.ClickableSpan;
|
|||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.View;
|
||||
|
||||
|
@ -58,6 +59,8 @@ import fr.gouv.etalab.mastodon.activities.HashTagActivity;
|
|||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.drawers.NotificationsListAdapter;
|
||||
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
|
||||
import fr.gouv.etalab.mastodon.helper.CrossActions;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveEmojiInterface;
|
||||
|
@ -533,6 +536,7 @@ public class Status implements Parcelable{
|
|||
}else {
|
||||
displayName = String.format("@%s",status.getAccount().getAcct());
|
||||
}
|
||||
Log.v(Helper.TAG,"displayName: " + displayName);
|
||||
displayNameSpan = new SpannableString(displayName);
|
||||
|
||||
if( emojisAccounts != null)
|
||||
|
@ -727,16 +731,16 @@ public class Status implements Parcelable{
|
|||
}
|
||||
boolean isCompactMode = sharedpreferences.getBoolean(Helper.SET_COMPACT_MODE, false);
|
||||
int mode;
|
||||
if( isCompactMode)
|
||||
/*if( isCompactMode)
|
||||
mode = Html.FROM_HTML_MODE_COMPACT;
|
||||
else
|
||||
else*/
|
||||
mode = Html.FROM_HTML_MODE_LEGACY;
|
||||
SpannableString spannableStringT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString(), mode));
|
||||
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString().replaceAll("^<p>","").replaceAll("<p>","<br/><br/>").replaceAll("</p>",""), mode));
|
||||
else
|
||||
//noinspection deprecation
|
||||
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString()));
|
||||
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString().replaceAll("^<p>","").replaceAll("<p>","<br/><br/>").replaceAll("</p>","")));
|
||||
|
||||
|
||||
matcher = Helper.twitterPattern.matcher(spannableStringT);
|
||||
|
|
|
@ -103,6 +103,7 @@ import fr.gouv.etalab.mastodon.helper.CustomTextView;
|
|||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnPostActionInterface;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveCardInterface;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveEmojiAccountInterface;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveEmojiInterface;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRepliesInterface;
|
||||
|
@ -122,7 +123,7 @@ import static fr.gouv.etalab.mastodon.helper.Helper.getLiveInstance;
|
|||
* Created by Thomas on 24/04/2017.
|
||||
* Adapter for Status
|
||||
*/
|
||||
public class StatusListAdapter extends RecyclerView.Adapter implements OnPostActionInterface, OnRetrieveFeedsInterface, OnRetrieveEmojiInterface, OnRetrieveRepliesInterface, OnRetrieveCardInterface {
|
||||
public class StatusListAdapter extends RecyclerView.Adapter implements OnPostActionInterface, OnRetrieveFeedsInterface, OnRetrieveEmojiInterface, OnRetrieveRepliesInterface, OnRetrieveCardInterface, OnRetrieveEmojiAccountInterface {
|
||||
|
||||
private Context context;
|
||||
private List<Status> statuses;
|
||||
|
@ -214,6 +215,11 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
notifyStatusChanged(modifiedStatus.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveEmojiAccount(Account account) {
|
||||
|
||||
}
|
||||
|
||||
private class ViewHolderEmpty extends RecyclerView.ViewHolder{
|
||||
ViewHolderEmpty(View itemView) {
|
||||
super(itemView);
|
||||
|
@ -652,7 +658,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
//-------- END -> Manages translations
|
||||
|
||||
|
||||
|
||||
status.getAccount().makeEmojisAccount(context, StatusListAdapter.this);
|
||||
//Displays name & emoji in toot header
|
||||
final String ppurl;
|
||||
if( status.getReblog() != null){
|
||||
|
@ -660,7 +666,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.status_account_displayname.setText(context.getResources().getString(R.string.reblog_by, status.getAccount().getUsername()));
|
||||
}else {
|
||||
ppurl = status.getAccount().getAvatar();
|
||||
holder.status_account_displayname.setText(Helper.shortnameToUnicode(status.getAccount().getDisplay_name(), true));
|
||||
holder.status_account_displayname.setText(status.getAccount().getdisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
||||
}
|
||||
//-------- END -> Displays name & emoji in toot header
|
||||
|
||||
|
|
|
@ -80,23 +80,17 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/status_account_displayname"
|
||||
android:maxLines="1"
|
||||
android:drawablePadding="2dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:textSize="12sp"
|
||||
android:id="@+id/status_account_displayname"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:drawablePadding="2dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/status_account_username"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginStart="2dp"
|
||||
|
@ -110,6 +104,13 @@
|
|||
android:gravity="end"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:textSize="12sp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/status_account_username"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
|
@ -146,6 +147,7 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/status_content_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
<fr.gouv.etalab.mastodon.helper.CustomTextView
|
||||
|
@ -204,7 +206,6 @@
|
|||
android:id="@+id/status_cardview"
|
||||
android:padding="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/card_border"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -254,6 +255,7 @@
|
|||
android:id="@+id/status_cardview_video"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="220dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_margin="10dp"
|
||||
>
|
||||
<WebView
|
||||
|
@ -264,6 +266,7 @@
|
|||
<RelativeLayout
|
||||
android:id="@+id/status_horizontal_document_container"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp">
|
||||
|
||||
|
@ -382,7 +385,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:baselineAligned="false">
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
|
|
Loading…
Reference in New Issue