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