Merged in develop (pull request #37)
|
@ -5,10 +5,10 @@ android {
|
|||
buildToolsVersion "25.0.3"
|
||||
defaultConfig {
|
||||
applicationId "fr.gouv.etalab.mastodon"
|
||||
minSdkVersion 16
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 25
|
||||
versionCode 39
|
||||
versionName "1.3.9.1"
|
||||
versionCode 40
|
||||
versionName "1.4.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
|
@ -19,11 +19,11 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
|
@ -32,12 +32,13 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -46,7 +47,7 @@ import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
|
|||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
|
||||
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
|
||||
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
|
@ -74,6 +75,8 @@ import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRelationshipInterface;
|
|||
import mastodon.etalab.gouv.fr.mastodon.R;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Relationship;
|
||||
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 01/05/2017.
|
||||
|
@ -87,17 +90,18 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
private DisplayImageOptions options;
|
||||
private List<Status> statuses;
|
||||
private StatusListAdapter statusListAdapter;
|
||||
private Button account_follow;
|
||||
private FloatingActionButton account_follow;
|
||||
|
||||
private static final int NUM_PAGES = 3;
|
||||
private ViewPager mPager;
|
||||
private String accountId;
|
||||
private TabLayout tabLayout;
|
||||
private BroadcastReceiver hide_header;
|
||||
private TextView account_note;
|
||||
private TextView account_note, account_follow_request;
|
||||
private String userId;
|
||||
private boolean isHiddingShowing = false;
|
||||
private static int instanceValue = 0;
|
||||
private Relationship relationship;
|
||||
|
||||
public enum action{
|
||||
FOLLOW,
|
||||
|
@ -118,10 +122,12 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
}else {
|
||||
setTheme(R.style.AppThemeDark);
|
||||
}
|
||||
setTitle("");
|
||||
setContentView(R.layout.activity_show_account);
|
||||
instanceValue += 1;
|
||||
Bundle b = getIntent().getExtras();
|
||||
account_follow = (Button) findViewById(R.id.account_follow);
|
||||
account_follow = (FloatingActionButton) findViewById(R.id.account_follow);
|
||||
account_follow_request = (TextView) findViewById(R.id.account_follow_request);
|
||||
account_follow.setEnabled(false);
|
||||
if(b != null){
|
||||
accountId = b.getString("accountId");
|
||||
|
@ -148,7 +154,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
statusListAdapter = new StatusListAdapter(getApplicationContext(), RetrieveFeedsAsyncTask.Type.USER, accountId, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||
options = new DisplayImageOptions.Builder().displayer(new RoundedBitmapDisplayer(80)).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
|
||||
|
||||
|
@ -210,21 +216,18 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
if( !isHiddingShowing ){
|
||||
isHiddingShowing = true;
|
||||
ImageView account_pp = (ImageView) findViewById(R.id.account_pp);
|
||||
TextView account_ac = (TextView) findViewById(R.id.account_ac);
|
||||
boolean hide = intent.getBooleanExtra("hide", false);
|
||||
if( hide){
|
||||
account_follow.setVisibility(View.GONE);
|
||||
account_note.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
account_ac.setVisibility(View.GONE);
|
||||
account_pp.getLayoutParams().width = (int) Helper.convertDpToPixel(50, context);
|
||||
account_pp.getLayoutParams().height = (int) Helper.convertDpToPixel(50, context);
|
||||
}else {
|
||||
account_follow.setVisibility(View.VISIBLE);
|
||||
manageButtonVisibility();
|
||||
if( accountId != null && accountId.equals(userId)){
|
||||
account_follow.setVisibility(View.GONE);
|
||||
}
|
||||
account_ac.setVisibility(View.VISIBLE);
|
||||
account_pp.getLayoutParams().width = (int) Helper.convertDpToPixel(80, context);
|
||||
account_pp.getLayoutParams().height = (int) Helper.convertDpToPixel(80, context);
|
||||
tabLayout.setVisibility(View.VISIBLE);
|
||||
|
@ -301,17 +304,42 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
ImageView account_pp = (ImageView) findViewById(R.id.account_pp);
|
||||
TextView account_dn = (TextView) findViewById(R.id.account_dn);
|
||||
TextView account_un = (TextView) findViewById(R.id.account_un);
|
||||
TextView account_ac = (TextView) findViewById(R.id.account_ac);
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
if( theme == Helper.THEME_DARK){
|
||||
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_lock_closed,R.color.dark_text);
|
||||
}else {
|
||||
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_lock_closed,R.color.black);
|
||||
}
|
||||
//Redraws icon for locked accounts
|
||||
final float scale = getResources().getDisplayMetrics().density;
|
||||
if( account != null && account.isLocked()){
|
||||
Drawable img = ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_action_lock_closed);
|
||||
img.setBounds(0,0,(int) (20 * scale + 0.5f),(int) (20 * scale + 0.5f));
|
||||
account_dn.setCompoundDrawables( img, null, null, null);
|
||||
}else{
|
||||
account_dn.setCompoundDrawables( null, null, null, null);
|
||||
}
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
LayoutInflater mInflater = LayoutInflater.from(ShowAccountActivity.this);
|
||||
if( actionBar != null){
|
||||
View show_account_actionbar = mInflater.inflate(R.layout.showaccount_actionbar, null);
|
||||
TextView actionbar_title = (TextView) show_account_actionbar.findViewById(R.id.show_account_title);
|
||||
if( account != null && account.getAcct() != null)
|
||||
actionbar_title.setText(account.getAcct());
|
||||
actionBar.setCustomView(show_account_actionbar);
|
||||
actionBar.setDisplayShowCustomEnabled(true);
|
||||
}else {
|
||||
if( account != null && account.getAcct() != null)
|
||||
setTitle(account.getAcct());
|
||||
}
|
||||
if( account != null){
|
||||
setTitle(account.getAcct());
|
||||
account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
|
||||
account_un.setText(String.format("@%s", account.getUsername()));
|
||||
if( account.getAcct() != null && account.getAcct().equals(account.getUsername()))
|
||||
account_ac.setVisibility(View.GONE);
|
||||
else
|
||||
account_ac.setText(account.getAcct());
|
||||
account_note = Helper.clickableElementsDescription(ShowAccountActivity.this, account_note,account.getNote());
|
||||
SpannableString spannableString = Helper.clickableElementsDescription(ShowAccountActivity.this, account.getNote());
|
||||
account_note.setText(spannableString, TextView.BufferType.SPANNABLE);
|
||||
account_note.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tabLayout.getTabAt(0).setText(getString(R.string.status_cnt, account.getStatuses_count()));
|
||||
tabLayout.getTabAt(1).setText(getString(R.string.following_cnt, account.getFollowing_count()));
|
||||
tabLayout.getTabAt(2).setText(getString(R.string.followers_cnt, account.getFollowers_count()));
|
||||
|
@ -345,26 +373,8 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
Toast.makeText(getApplicationContext(), error.getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
account_follow.setEnabled(true);
|
||||
if( relationship.isBlocking()){
|
||||
account_follow.setText(R.string.action_unblock);
|
||||
doAction = action.UNBLOCK;
|
||||
}else if( relationship.isRequested()){
|
||||
account_follow.setText(R.string.request_sent);
|
||||
account_follow.getBackground().setColorFilter(ContextCompat.getColor(this, R.color.colorPrimary), PorterDuff.Mode.MULTIPLY);
|
||||
doAction = action.NOTHING;
|
||||
}else if( relationship.isFollowing()){
|
||||
account_follow.setText(R.string.action_unfollow);
|
||||
doAction = action.UNFOLLOW;
|
||||
}else if( !relationship.isFollowing()){
|
||||
account_follow.setText(R.string.action_follow);
|
||||
doAction = action.FOLLOW;
|
||||
}else{
|
||||
account_follow.setText(R.string.action_no_action);
|
||||
account_follow.getBackground().setColorFilter(ContextCompat.getColor(this, R.color.red_1), PorterDuff.Mode.MULTIPLY);
|
||||
doAction = action.NOTHING;
|
||||
}
|
||||
|
||||
this.relationship = relationship;
|
||||
manageButtonVisibility();
|
||||
|
||||
|
||||
//The authenticated account is followed by the account
|
||||
|
@ -375,6 +385,32 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
|
||||
}
|
||||
|
||||
//Manages the visibility of the button
|
||||
private void manageButtonVisibility(){
|
||||
if( relationship == null)
|
||||
return;
|
||||
account_follow.setEnabled(true);
|
||||
if( relationship.isBlocking()){
|
||||
account_follow.setImageResource(R.drawable.ic_unlock_alt);
|
||||
doAction = action.UNBLOCK;
|
||||
account_follow.setVisibility(View.VISIBLE);
|
||||
}else if( relationship.isRequested()){
|
||||
account_follow_request.setVisibility(View.VISIBLE);
|
||||
account_follow.setVisibility(View.GONE);
|
||||
doAction = action.NOTHING;
|
||||
}else if( relationship.isFollowing()){
|
||||
account_follow.setImageResource(R.drawable.ic_user_times);
|
||||
doAction = action.UNFOLLOW;
|
||||
account_follow.setVisibility(View.VISIBLE);
|
||||
}else if( !relationship.isFollowing()){
|
||||
account_follow.setImageResource(R.drawable.ic_user_plus);
|
||||
doAction = action.FOLLOW;
|
||||
account_follow.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
account_follow.setVisibility(View.GONE);
|
||||
doAction = action.NOTHING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pager adapter for the 3 fragments
|
||||
|
|
|
@ -24,8 +24,6 @@ import java.security.KeyStoreException;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
|
||||
import static fr.gouv.etalab.mastodon.helper.Helper.USER_AGENT;
|
||||
|
||||
/**
|
||||
|
@ -75,4 +73,4 @@ public class OauthClient {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -109,7 +109,8 @@ public class AccountsListAdapter extends BaseAdapter implements OnPostActionInte
|
|||
.denyCacheImageMultipleSizesInMemory()
|
||||
.diskCache(new UnlimitedDiskCache(cacheDir))
|
||||
.build();
|
||||
imageLoader.init(configImg);
|
||||
if( !imageLoader.isInited())
|
||||
imageLoader.init(configImg);
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
final Account account = accounts.get(position);
|
||||
|
|
|
@ -24,7 +24,10 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -110,12 +113,12 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
if (convertView == null) {
|
||||
convertView = layoutInflater.inflate(R.layout.drawer_notification, parent, false);
|
||||
holder = new ViewHolder();
|
||||
holder.card_status_container = (CardView) convertView.findViewById(R.id.card_status_container);
|
||||
holder.notification_status_container = (LinearLayout) convertView.findViewById(R.id.notification_status_container);
|
||||
holder.status_document_container = (LinearLayout) convertView.findViewById(R.id.status_document_container);
|
||||
holder.notification_status_content = (TextView) convertView.findViewById(R.id.notification_status_content);
|
||||
holder.notification_account_username = (TextView) convertView.findViewById(R.id.notification_account_username);
|
||||
holder.notification_type = (TextView) convertView.findViewById(R.id.notification_type);
|
||||
holder.notification_account_displayname = (TextView) convertView.findViewById(R.id.notification_account_displayname);
|
||||
holder.notification_account_profile = (ImageView) convertView.findViewById(R.id.notification_account_profile);
|
||||
holder.status_favorite_count = (TextView) convertView.findViewById(R.id.status_favorite_count);
|
||||
holder.status_reblog_count = (TextView) convertView.findViewById(R.id.status_reblog_count);
|
||||
|
@ -132,16 +135,28 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
String typeString = "";
|
||||
switch (type){
|
||||
case "mention":
|
||||
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_mention));
|
||||
if( notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
|
||||
typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_mention));
|
||||
else
|
||||
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_mention));
|
||||
break;
|
||||
case "reblog":
|
||||
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_reblog));
|
||||
if( notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
|
||||
typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_reblog));
|
||||
else
|
||||
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_reblog));
|
||||
break;
|
||||
case "favourite":
|
||||
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_favourite));
|
||||
if( notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
|
||||
typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_favourite));
|
||||
else
|
||||
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_favourite));
|
||||
break;
|
||||
case "follow":
|
||||
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_follow));
|
||||
if( notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
|
||||
typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),context.getString(R.string.notif_follow));
|
||||
else
|
||||
typeString = String.format("@%s %s", notification.getAccount().getAcct(),context.getString(R.string.notif_follow));
|
||||
break;
|
||||
}
|
||||
holder.notification_type.setText(typeString);
|
||||
|
@ -187,17 +202,20 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
if( (status.getIn_reply_to_account_id() != null && !status.getIn_reply_to_account_id().equals("null")) || (status.getIn_reply_to_id() != null && !status.getIn_reply_to_id().equals("null")) ){
|
||||
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_reply);
|
||||
img.setBounds(0,0,(int) (20 * scale + 0.5f),(int) (15 * scale + 0.5f));
|
||||
holder.notification_account_displayname.setCompoundDrawables( img, null, null, null);
|
||||
holder.notification_account_username.setCompoundDrawables( img, null, null, null);
|
||||
}else if( status.isReblogged()){
|
||||
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_retweet);
|
||||
img.setBounds(0,0,(int) (20 * scale + 0.5f),(int) (15 * scale + 0.5f));
|
||||
holder.notification_account_displayname.setCompoundDrawables( img, null, null, null);
|
||||
holder.notification_account_username.setCompoundDrawables( img, null, null, null);
|
||||
}else{
|
||||
holder.notification_account_displayname.setCompoundDrawables( null, null, null, null);
|
||||
holder.notification_account_username.setCompoundDrawables( null, null, null, null);
|
||||
}
|
||||
|
||||
holder.notification_status_content = Helper.clickableElements(context, holder.notification_status_content,status.getContent(),
|
||||
SpannableString spannableString = Helper.clickableElements(context, status.getContent(),
|
||||
status.getReblog() != null?status.getReblog().getMentions():status.getMentions());
|
||||
holder.notification_status_content.setText(spannableString, TextView.BufferType.SPANNABLE);
|
||||
holder.notification_status_content.setMovementMethod(null);
|
||||
holder.notification_status_content.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
holder.status_favorite_count.setText(String.valueOf(status.getFavourites_count()));
|
||||
holder.status_reblog_count.setText(String.valueOf(status.getReblogs_count()));
|
||||
holder.status_date.setText(Helper.dateDiff(context, status.getCreated_at()));
|
||||
|
@ -205,6 +223,16 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
//Adds attachment -> disabled, to enable them uncomment the line below
|
||||
//loadAttachments(status, holder);
|
||||
holder.notification_status_container.setVisibility(View.VISIBLE);
|
||||
holder.card_status_container.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("statusId", status.getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
holder.notification_status_content.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -312,7 +340,6 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
displayConfirmationNotificationDialog(notification);
|
||||
}
|
||||
});
|
||||
holder.notification_account_displayname.setText(Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true));
|
||||
holder.notification_account_username.setText( String.format("@%s",notification.getAccount().getUsername()));
|
||||
//Profile picture
|
||||
imageLoader.displayImage(notification.getAccount().getAvatar(), holder.notification_account_profile, options);
|
||||
|
@ -466,10 +493,10 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
|
||||
|
||||
private class ViewHolder {
|
||||
CardView card_status_container;
|
||||
TextView notification_status_content;
|
||||
TextView notification_type;
|
||||
TextView notification_account_username;
|
||||
TextView notification_account_displayname;
|
||||
ImageView notification_account_profile;
|
||||
ImageView notification_delete;
|
||||
TextView status_favorite_count;
|
||||
|
|
|
@ -123,7 +123,8 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
.denyCacheImageMultipleSizesInMemory()
|
||||
.diskCache(new UnlimitedDiskCache(cacheDir))
|
||||
.build();
|
||||
imageLoader.init(configImg);
|
||||
if( !imageLoader.isInited())
|
||||
imageLoader.init(configImg);
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
int type = getItemViewType(position);
|
||||
|
|
|
@ -27,7 +27,11 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -94,7 +98,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
private StatusListAdapter statusListAdapter;
|
||||
private final int REBLOG = 1;
|
||||
private final int FAVOURITE = 2;
|
||||
private ViewHolder holder;
|
||||
private RetrieveFeedsAsyncTask.Type type;
|
||||
private String targetedId;
|
||||
|
||||
|
@ -140,14 +143,17 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
.denyCacheImageMultipleSizesInMemory()
|
||||
.diskCache(new UnlimitedDiskCache(cacheDir))
|
||||
.build();
|
||||
imageLoader.init(configImg);
|
||||
if( !imageLoader.isInited())
|
||||
imageLoader.init(configImg);
|
||||
options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
|
||||
final Status status = statuses.get(position);
|
||||
final ViewHolder holder;
|
||||
if (convertView == null) {
|
||||
convertView = layoutInflater.inflate(R.layout.drawer_status, parent, false);
|
||||
holder = new ViewHolder();
|
||||
holder.card_status_container = (CardView) convertView.findViewById(R.id.card_status_container);
|
||||
holder.status_document_container = (LinearLayout) convertView.findViewById(R.id.status_document_container);
|
||||
holder.status_content = (TextView) convertView.findViewById(R.id.status_content);
|
||||
holder.status_content_translated = (TextView) convertView.findViewById(R.id.status_content_translated);
|
||||
|
@ -309,6 +315,16 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
holder.card_status_container.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("statusId", status.getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}else {
|
||||
if( theme == Helper.THEME_LIGHT){
|
||||
if( position == ShowConversationActivity.position){
|
||||
|
@ -363,16 +379,28 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
holder.status_content = Helper.clickableElements(context, holder.status_content,content,
|
||||
SpannableString spannableString = Helper.clickableElements(context,content,
|
||||
status.getReblog() != null?status.getReblog().getMentions():status.getMentions());
|
||||
holder.status_content.setText(spannableString, TextView.BufferType.SPANNABLE);
|
||||
|
||||
if( status.getContent_translated() != null && status.getContent_translated().length() > 0){
|
||||
holder.status_content_translated = Helper.clickableElements(context, holder.status_content_translated,status.getContent_translated(),
|
||||
SpannableString spannableStringTrans = Helper.clickableElements(context, status.getContent_translated(),
|
||||
status.getReblog() != null?status.getReblog().getMentions():status.getMentions());
|
||||
holder.status_content_translated.setText(spannableStringTrans, TextView.BufferType.SPANNABLE);
|
||||
holder.status_content_translated.setMovementMethod(null);
|
||||
holder.status_content_translated.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
holder.status_favorite_count.setText(String.valueOf(status.getFavourites_count()));
|
||||
holder.status_reblog_count.setText(String.valueOf(status.getReblogs_count()));
|
||||
holder.status_content.setMovementMethod(null);
|
||||
holder.status_content.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
if( status.getReblog() == null)
|
||||
holder.status_favorite_count.setText(String.valueOf(status.getFavourites_count()));
|
||||
else
|
||||
holder.status_favorite_count.setText(String.valueOf(status.getReblog().getFavourites_count()));
|
||||
if( status.getReblog() == null)
|
||||
holder.status_reblog_count.setText(String.valueOf(status.getReblogs_count()));
|
||||
else
|
||||
holder.status_reblog_count.setText(String.valueOf(status.getReblog().getReblogs_count()));
|
||||
|
||||
holder.status_toot_date.setText(Helper.dateDiff(context, status.getCreated_at()));
|
||||
|
||||
|
||||
|
@ -395,7 +423,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
} else {
|
||||
//If medias are loaded without any conditions or if device is on wifi
|
||||
if (!status.isSensitive() && (behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi))) {
|
||||
loadAttachments(status);
|
||||
loadAttachments(status, holder);
|
||||
holder.status_show_more.setVisibility(View.GONE);
|
||||
status.setAttachmentShown(true);
|
||||
} else {
|
||||
|
@ -406,7 +434,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_show_more.setVisibility(View.VISIBLE);
|
||||
holder.status_document_container.setVisibility(View.GONE);
|
||||
} else {
|
||||
loadAttachments(status);
|
||||
loadAttachments(status, holder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -417,7 +445,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
} else {
|
||||
//If medias are loaded without any conditions or if device is on wifi
|
||||
if (!status.getReblog().isSensitive() && (behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi))) {
|
||||
loadAttachments(status.getReblog());
|
||||
loadAttachments(status.getReblog(), holder);
|
||||
holder.status_show_more.setVisibility(View.GONE);
|
||||
status.getReblog().setAttachmentShown(true);
|
||||
} else {
|
||||
|
@ -428,7 +456,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_show_more.setVisibility(View.VISIBLE);
|
||||
holder.status_document_container.setVisibility(View.GONE);
|
||||
} else {
|
||||
loadAttachments(status.getReblog());
|
||||
loadAttachments(status.getReblog(), holder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -448,14 +476,13 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_privacy.setImageResource(R.drawable.ic_local_post_office);
|
||||
break;
|
||||
}
|
||||
|
||||
Drawable imgFav, imgReblog;
|
||||
if( status.isFavourited())
|
||||
if( status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited()))
|
||||
imgFav = ContextCompat.getDrawable(context, R.drawable.ic_fav_yellow);
|
||||
else
|
||||
imgFav = ContextCompat.getDrawable(context, R.drawable.ic_fav_black);
|
||||
|
||||
if( status.isReblogged())
|
||||
if( status.isReblogged()|| (status.getReblog() != null && status.getReblog().isReblogged()))
|
||||
imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_retweet_yellow);
|
||||
else
|
||||
imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_retweet_black);
|
||||
|
@ -468,7 +495,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_show_more.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
loadAttachments(status);
|
||||
loadAttachments(status, holder);
|
||||
holder.status_show_more.setVisibility(View.GONE);
|
||||
status.setAttachmentShown(true);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
|
@ -553,7 +580,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
* @param status Status
|
||||
*/
|
||||
private void favouriteAction(Status status){
|
||||
if( status.isFavourited()){
|
||||
if( status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited())){
|
||||
new PostActionAsyncTask(context, API.StatusAction.UNFAVOURITE, status.getId(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
status.setFavourited(false);
|
||||
}else{
|
||||
|
@ -568,7 +595,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
* @param status Status
|
||||
*/
|
||||
private void reblogAction(Status status){
|
||||
if( status.isReblogged()){
|
||||
if( status.isReblogged() || (status.getReblog()!= null && status.getReblog().isReblogged())){
|
||||
new PostActionAsyncTask(context, API.StatusAction.UNREBLOG, status.getId(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
status.setReblogged(false);
|
||||
}else{
|
||||
|
@ -580,7 +607,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
|
||||
|
||||
|
||||
private void loadAttachments(final Status status){
|
||||
private void loadAttachments(final Status status, ViewHolder holder){
|
||||
List<Attachment> attachments = status.getMedia_attachments();
|
||||
if( attachments != null && attachments.size() > 0){
|
||||
int i = 0;
|
||||
|
@ -746,7 +773,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
LinearLayout status_spoiler_container;
|
||||
TextView status_spoiler;
|
||||
Button status_spoiler_button;
|
||||
|
||||
CardView card_status_container;
|
||||
TextView status_content;
|
||||
TextView status_content_translated;
|
||||
LinearLayout status_content_translated_container;
|
||||
|
@ -791,12 +818,12 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
|
||||
String title = null;
|
||||
if( action == FAVOURITE){
|
||||
if( status.isFavourited())
|
||||
if( status.isFavourited() || ( status.getReblog() != null && status.getReblog().isFavourited()))
|
||||
title = context.getString(R.string.favourite_remove);
|
||||
else
|
||||
title = context.getString(R.string.favourite_add);
|
||||
}else if( action == REBLOG ){
|
||||
if( status.isReblogged())
|
||||
if( status.isReblogged() || (status.getReblog() != null && status.getReblog().isReblogged()))
|
||||
title = context.getString(R.string.reblog_remove);
|
||||
else
|
||||
title = context.getString(R.string.reblog_add);
|
||||
|
|
|
@ -118,7 +118,11 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
|
||||
if (view.getId() == lv_accounts.getId() && totalItemCount > visibleItemCount) {
|
||||
if(firstVisibleItem == 0 && Helper.listIsAtTop(lv_accounts)){
|
||||
Intent intent = new Intent(Helper.HEADER_ACCOUNT+instanceValue);
|
||||
intent.putExtra("hide", false);
|
||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
|
||||
}else if (view.getId() == lv_accounts.getId() && totalItemCount > visibleItemCount) {
|
||||
final int currentFirstVisibleItem = lv_accounts.getFirstVisiblePosition();
|
||||
|
||||
if (currentFirstVisibleItem > lastFirstVisibleItem) {
|
||||
|
|
|
@ -128,9 +128,13 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
if (view.getId() == lv_status.getId() && totalItemCount > visibleItemCount) {
|
||||
final int currentFirstVisibleItem = lv_status.getFirstVisiblePosition();
|
||||
|
||||
if(firstVisibleItem == 0 && Helper.listIsAtTop(lv_status)){
|
||||
Intent intent = new Intent(Helper.HEADER_ACCOUNT+instanceValue);
|
||||
intent.putExtra("hide", false);
|
||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
|
||||
}else if (view.getId() == lv_status.getId() && totalItemCount > visibleItemCount) {
|
||||
final int currentFirstVisibleItem = lv_status.getFirstVisiblePosition();
|
||||
if (currentFirstVisibleItem > lastFirstVisibleItem) {
|
||||
Intent intent = new Intent(Helper.HEADER_ACCOUNT+instanceValue);
|
||||
intent.putExtra("hide", true);
|
||||
|
@ -231,7 +235,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle saveInstance)
|
||||
{
|
||||
|
|
|
@ -56,6 +56,7 @@ import android.text.method.ArrowKeyMovementMethod;
|
|||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Patterns;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
|
@ -67,6 +68,7 @@ import android.webkit.URLUtil;
|
|||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -226,7 +228,7 @@ public class Helper {
|
|||
private static final Pattern SHORTNAME_PATTERN = Pattern.compile(":([-+\\w]+):");
|
||||
|
||||
private static final Pattern urlPattern = Pattern.compile(
|
||||
"(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))",
|
||||
"(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,10}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
|
||||
private static final Pattern hashtagPattern = Pattern.compile("(#[\\w_À-ú-]{1,})");
|
||||
|
@ -1008,12 +1010,11 @@ public class Helper {
|
|||
* Click on account => ShowAccountActivity
|
||||
* Click on tag => HashTagActivity
|
||||
* @param context Context
|
||||
* @param statusTV Textview
|
||||
* @param fullContent String, should be the st
|
||||
* @param mentions List<Mention>
|
||||
* @return TextView
|
||||
*/
|
||||
public static TextView clickableElements(final Context context, TextView statusTV, String fullContent, List<Mention> mentions) {
|
||||
public static SpannableString clickableElements(final Context context, String fullContent, List<Mention> mentions) {
|
||||
|
||||
SpannableString spannableString;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
|
@ -1024,7 +1025,11 @@ public class Helper {
|
|||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean embedded_browser = sharedpreferences.getBoolean(Helper.SET_EMBEDDED_BROWSER, true);
|
||||
if( embedded_browser){
|
||||
Matcher matcher = urlPattern.matcher(spannableString);
|
||||
Matcher matcher;
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
|
||||
matcher = Patterns.WEB_URL.matcher(spannableString);
|
||||
else
|
||||
matcher = urlPattern.matcher(spannableString);
|
||||
while (matcher.find()){
|
||||
int matchStart = matcher.start(1);
|
||||
int matchEnd = matcher.end();
|
||||
|
@ -1034,7 +1039,10 @@ public class Helper {
|
|||
public void onClick(View textView) {
|
||||
Intent intent = new Intent(context, WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("url", url);
|
||||
String finalUrl = url;
|
||||
if( !url.startsWith("http://") && ! url.startsWith("https://"))
|
||||
finalUrl = "http://" + url;
|
||||
b.putString("url", finalUrl);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
@ -1098,13 +1106,7 @@ public class Helper {
|
|||
}
|
||||
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
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;
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1114,11 +1116,10 @@ public class Helper {
|
|||
* Click on url => webview or external app
|
||||
* Click on tag => HashTagActivity
|
||||
* @param context Context
|
||||
* @param statusTV Textview
|
||||
* @param fullContent String, should be the st
|
||||
* @return TextView
|
||||
*/
|
||||
public static TextView clickableElementsDescription(final Context context, TextView statusTV, String fullContent) {
|
||||
public static SpannableString clickableElementsDescription(final Context context, String fullContent) {
|
||||
|
||||
SpannableString spannableString;
|
||||
fullContent = Helper.shortnameToUnicode(fullContent, true);
|
||||
|
@ -1130,7 +1131,11 @@ public class Helper {
|
|||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean embedded_browser = sharedpreferences.getBoolean(Helper.SET_EMBEDDED_BROWSER, true);
|
||||
if( embedded_browser){
|
||||
Matcher matcher = urlPattern.matcher(spannableString);
|
||||
Matcher matcher;
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
|
||||
matcher = Patterns.WEB_URL.matcher(spannableString);
|
||||
else
|
||||
matcher = urlPattern.matcher(spannableString);
|
||||
while (matcher.find()){
|
||||
int matchStart = matcher.start(1);
|
||||
int matchEnd = matcher.end();
|
||||
|
@ -1171,11 +1176,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;
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1397,4 +1398,13 @@ public class Helper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a ListView is at its top position
|
||||
* @param listView ListView
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean listIsAtTop(ListView listView) {
|
||||
return listView.getChildCount() == 0 || listView.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,13 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe
|
|||
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
|
||||
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
|
||||
final String finalMessage = message;
|
||||
final String finalTitle = getContext().getResources().getString(R.string.notif_pouet, status.getAccount().getUsername());
|
||||
String title;
|
||||
if( status.getAccount().getDisplay_name() != null && status.getAccount().getDisplay_name().length() > 0 )
|
||||
title = getContext().getResources().getString(R.string.notif_pouet, Helper.shortnameToUnicode(status.getAccount().getDisplay_name(), true));
|
||||
else
|
||||
title = getContext().getResources().getString(R.string.notif_pouet, status.getAccount().getUsername());
|
||||
final String finalTitle = title;
|
||||
|
||||
imageLoaderNoty.loadImage(notificationUrl, options, new SimpleImageLoadingListener(){
|
||||
@Override
|
||||
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
||||
|
|
|
@ -164,7 +164,10 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
|||
newMentions++;
|
||||
if( notificationUrl == null){
|
||||
notificationUrl = notification.getAccount().getAvatar();
|
||||
title = String.format("@%s %s", notification.getAccount().getUsername(),getContext().getString(R.string.notif_mention));
|
||||
if( notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0 )
|
||||
title = String.format("@%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),getContext().getString(R.string.notif_mention));
|
||||
else
|
||||
title = String.format("@%s %s", notification.getAccount().getUsername(),getContext().getString(R.string.notif_mention));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -173,7 +176,11 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
|||
newShare++;
|
||||
if( notificationUrl == null){
|
||||
notificationUrl = notification.getAccount().getAvatar();
|
||||
title = String.format("@%s %s", notification.getAccount().getUsername(),getContext().getString(R.string.notif_reblog));
|
||||
if( notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0 )
|
||||
title = String.format("@%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),getContext().getString(R.string.notif_reblog));
|
||||
else
|
||||
title = String.format("@%s %s", notification.getAccount().getUsername(),getContext().getString(R.string.notif_reblog));
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -182,7 +189,10 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
|||
newAdds++;
|
||||
if( notificationUrl == null){
|
||||
notificationUrl = notification.getAccount().getAvatar();
|
||||
title = String.format("@%s %s", notification.getAccount().getUsername(),getContext().getString(R.string.notif_favourite));
|
||||
if( notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0 )
|
||||
title = String.format("@%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),getContext().getString(R.string.notif_favourite));
|
||||
else
|
||||
title = String.format("@%s %s", notification.getAccount().getUsername(),getContext().getString(R.string.notif_favourite));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -191,7 +201,10 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
|||
newFollows++;
|
||||
if( notificationUrl == null){
|
||||
notificationUrl = notification.getAccount().getAvatar();
|
||||
title = String.format("@%s %s", notification.getAccount().getUsername(),getContext().getString(R.string.notif_follow));
|
||||
if( notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0 )
|
||||
title = String.format("@%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true),getContext().getString(R.string.notif_follow));
|
||||
else
|
||||
title = String.format("@%s %s", notification.getAccount().getUsername(),getContext().getString(R.string.notif_follow));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
After Width: | Height: | Size: 855 B |
After Width: | Height: | Size: 939 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 451 B |
After Width: | Height: | Size: 556 B |
After Width: | Height: | Size: 640 B |
After Width: | Height: | Size: 776 B |
After Width: | Height: | Size: 606 B |
After Width: | Height: | Size: 602 B |
After Width: | Height: | Size: 683 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 3.2 KiB |
|
@ -17,96 +17,115 @@
|
|||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<ImageView
|
||||
android:padding="10dp"
|
||||
android:id="@+id/account_pp"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
android:id="@+id/header_container"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<ImageView
|
||||
android:padding="10dp"
|
||||
android:id="@+id/account_pp"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/account_dn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
<TextView
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:id="@+id/account_un"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/account_dn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
<TextView
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:id="@+id/account_un"
|
||||
android:maxLines="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14sp"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:layout_gravity="top|end"
|
||||
android:visibility="gone"
|
||||
app:fabSize="mini"
|
||||
android:id="@+id/account_follow"
|
||||
android:textAllCaps="false"
|
||||
android:gravity="center"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/account_followed_by"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/followed_by"
|
||||
android:maxLines="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/account_follow_request"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/request_sent"
|
||||
android:maxLines="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/account_followed_by"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/followed_by"
|
||||
android:maxLines="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/account_ac"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/account_follow"
|
||||
android:textAllCaps="false"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginBottom="10dp"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:text="@string/action_follow" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/account_note"
|
||||
android:padding="10dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:maxLines="4"
|
||||
android:autoLink="web"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/account_note"
|
||||
android:padding="5dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:maxLines="3"
|
||||
android:autoLink="web"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
xmlns:card_view="http://schemas.android.com/tools"
|
||||
android:layout_marginTop="10dp"
|
||||
style="?attr/cardStyle"
|
||||
android:id="@+id/card_status_container"
|
||||
card_view:cardPreventCornerOverlap="true"
|
||||
app:cardUseCompatPadding="true">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -63,29 +64,19 @@
|
|||
<TextView
|
||||
android:padding="5dp"
|
||||
android:id="@+id/notification_type"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
android:textSize="14sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/notification_account_displayname"
|
||||
android:drawablePadding="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:id="@+id/notification_account_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:id="@+id/notification_account_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/status_date"
|
||||
android:layout_width="match_parent"
|
||||
android:textSize="12sp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_gravity="end"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/card_status_container"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:card_view="http://schemas.android.com/tools"
|
||||
style="?attr/cardStyle"
|
||||
|
@ -100,7 +101,7 @@
|
|||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/status_account_displayname"
|
||||
android:textSize="16sp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:drawablePadding="2dp"
|
||||
|
@ -109,8 +110,7 @@
|
|||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="12sp"
|
||||
android:maxLines="1"
|
||||
android:id="@+id/status_account_username"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -129,6 +129,7 @@
|
|||
android:id="@+id/status_toot_date"
|
||||
android:layout_width="match_parent"
|
||||
android:paddingRight="10dp"
|
||||
android:textSize="12sp"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="end"
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2017 Thomas Schneider
|
||||
|
||||
This file is a part of Mastalab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with Thomas Schneider; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/show_account_title"
|
||||
android:maxLines="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
/>
|
||||
</LinearLayout>
|