Merged in develop (pull request #15)
This commit is contained in:
commit
4a9d109fff
|
@ -7,8 +7,8 @@ android {
|
|||
applicationId "fr.gouv.etalab.mastodon"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 25
|
||||
versionCode 17
|
||||
versionName "1.2.0"
|
||||
versionCode 18
|
||||
versionName "1.2.1"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
Binary file not shown.
|
@ -34,6 +34,7 @@ import android.support.v4.app.ActivityCompat;
|
|||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.Html;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -138,6 +139,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_account_username = (TextView) convertView.findViewById(R.id.status_account_username);
|
||||
holder.status_account_displayname = (TextView) convertView.findViewById(R.id.status_account_displayname);
|
||||
holder.status_account_profile = (ImageView) convertView.findViewById(R.id.status_account_profile);
|
||||
holder.status_account_profile_boost = (ImageView) convertView.findViewById(R.id.status_account_profile_boost);
|
||||
holder.status_favorite_count = (TextView) convertView.findViewById(R.id.status_favorite_count);
|
||||
holder.status_reblog_count = (TextView) convertView.findViewById(R.id.status_reblog_count);
|
||||
holder.status_toot_date = (TextView) convertView.findViewById(R.id.status_toot_date);
|
||||
|
@ -158,21 +160,25 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_content_container = (LinearLayout) convertView.findViewById(R.id.status_content_container);
|
||||
holder.status_spoiler = (TextView) convertView.findViewById(R.id.status_spoiler);
|
||||
holder.status_spoiler_button = (Button) convertView.findViewById(R.id.status_spoiler_button);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
if( status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 && !status.isSpoilerShown()){
|
||||
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
||||
holder.status_content_container.setVisibility(View.GONE);
|
||||
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
||||
holder.status_spoiler_button.setVisibility(View.VISIBLE);
|
||||
holder.status_spoiler.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
holder.status_spoiler_button.setVisibility(View.GONE);
|
||||
holder.status_content_container.setVisibility(View.VISIBLE);
|
||||
if( status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 )
|
||||
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.status_spoiler_container.setVisibility(View.GONE);
|
||||
}
|
||||
if( status.getSpoiler_text() != null)
|
||||
holder.status_spoiler.setText(status.getSpoiler_text());
|
||||
|
||||
//Spoiler opens
|
||||
holder.status_spoiler_button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -263,24 +269,54 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_toot_date.setText(Helper.dateDiff(context, status.getCreated_at()));
|
||||
|
||||
imageLoader.displayImage(ppurl, holder.status_account_profile, options);
|
||||
if( status.getMedia_attachments().size() < 1) {
|
||||
holder.status_document_container.setVisibility(View.GONE);
|
||||
holder.status_show_more.setVisibility(View.GONE);
|
||||
if( status.getReblog() != null) {
|
||||
imageLoader.displayImage(status.getAccount().getAvatar(), holder.status_account_profile_boost, options);
|
||||
holder.status_account_profile_boost.setVisibility(View.VISIBLE);
|
||||
}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);
|
||||
holder.status_account_profile_boost.setVisibility(View.GONE);
|
||||
}
|
||||
if( status.getReblog() == null) {
|
||||
if (status.getMedia_attachments().size() < 1) {
|
||||
holder.status_document_container.setVisibility(View.GONE);
|
||||
holder.status_show_more.setVisibility(View.GONE);
|
||||
status.setAttachmentShown(true);
|
||||
}else{
|
||||
//Text depending if toots is sensitive or not
|
||||
String textShowMore = (status.isSensitive())?context.getString(R.string.load_sensitive_attachment):context.getString(R.string.load_attachment);
|
||||
holder.status_show_more.setText(textShowMore);
|
||||
if( !status.isAttachmentShown() ) {
|
||||
holder.status_show_more.setVisibility(View.VISIBLE);
|
||||
holder.status_document_container.setVisibility(View.GONE);
|
||||
}else {
|
||||
} 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);
|
||||
holder.status_show_more.setVisibility(View.GONE);
|
||||
status.setAttachmentShown(true);
|
||||
} else {
|
||||
//Text depending if toots is sensitive or not
|
||||
String textShowMore = (status.isSensitive()) ? context.getString(R.string.load_sensitive_attachment) : context.getString(R.string.load_attachment);
|
||||
holder.status_show_more.setText(textShowMore);
|
||||
if (!status.isAttachmentShown()) {
|
||||
holder.status_show_more.setVisibility(View.VISIBLE);
|
||||
holder.status_document_container.setVisibility(View.GONE);
|
||||
} else {
|
||||
loadAttachments(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else { //Attachments for reblogs
|
||||
if (status.getReblog().getMedia_attachments().size() < 1) {
|
||||
holder.status_document_container.setVisibility(View.GONE);
|
||||
holder.status_show_more.setVisibility(View.GONE);
|
||||
} 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());
|
||||
holder.status_show_more.setVisibility(View.GONE);
|
||||
status.getReblog().setAttachmentShown(true);
|
||||
} else {
|
||||
//Text depending if toots is sensitive or not
|
||||
String textShowMore = (status.getReblog().isSensitive()) ? context.getString(R.string.load_sensitive_attachment) : context.getString(R.string.load_attachment);
|
||||
holder.status_show_more.setText(textShowMore);
|
||||
if (!status.getReblog().isAttachmentShown()) {
|
||||
holder.status_show_more.setVisibility(View.VISIBLE);
|
||||
holder.status_document_container.setVisibility(View.GONE);
|
||||
} else {
|
||||
loadAttachments(status.getReblog());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -595,6 +631,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
TextView status_account_username;
|
||||
TextView status_account_displayname;
|
||||
ImageView status_account_profile;
|
||||
ImageView status_account_profile_boost;
|
||||
TextView status_favorite_count;
|
||||
TextView status_reblog_count;
|
||||
TextView status_toot_date;
|
||||
|
|
|
@ -237,7 +237,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
||||
if( show_error_messages)
|
||||
Toast.makeText(getContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Account> accounts = apiResponse.getAccounts();
|
||||
|
|
|
@ -157,7 +157,7 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
|
|||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
||||
if( show_error_messages)
|
||||
Toast.makeText(getContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Account> accounts = apiResponse.getAccounts();
|
||||
|
|
|
@ -158,7 +158,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
||||
if( show_error_messages)
|
||||
Toast.makeText(getContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Notification> notifications = apiResponse.getNotifications();
|
||||
|
@ -179,7 +179,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
flag_loading = notifications != null && notifications.size() < notificationPerPage;
|
||||
//Store last notification id to avoid to notify for those that have been already seen
|
||||
if( notifications != null && notifications.size() > 0) {
|
||||
final SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
//acct is null as userId when used in Fragment, data need to be retrieved via shared preferences and db
|
||||
userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
|
|
|
@ -256,7 +256,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
||||
if( show_error_messages)
|
||||
Toast.makeText(getContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Status> statuses = apiResponse.getStatuses();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white" />
|
||||
<stroke android:width="1dp" android:color="@color/colorPrimary" />
|
||||
<padding android:left="1dp" android:top="1dp" android:right="1dp"
|
||||
android:bottom="1dp" />
|
||||
</shape>
|
|
@ -30,13 +30,30 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/status_account_profile"
|
||||
android:layout_height="50dp"
|
||||
android:layout_width="50dp"
|
||||
<RelativeLayout
|
||||
android:layout_height="60dp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:gravity="center_horizontal|top"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:gravity="center_horizontal|top">
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:id="@+id/status_account_profile"
|
||||
tools:ignore="ContentDescription" />
|
||||
<ImageView
|
||||
android:id="@+id/status_account_profile_boost"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/imageview_border"
|
||||
android:visibility="gone"
|
||||
tools:ignore="ContentDescription" />
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
|
||||
<string-array name="more_action_owner_confirm">
|
||||
<item>Supprimer ce pouet ?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
</string-array>
|
||||
<!-- Date -->
|
||||
<plurals name="date_seconds">
|
||||
|
|
Loading…
Reference in New Issue