Merged in develop (pull request #16)

This commit is contained in:
tom79 2017-06-17 06:16:19 +00:00
commit 2f9ae8571a
15 changed files with 168 additions and 43 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId "fr.gouv.etalab.mastodon"
minSdkVersion 15
targetSdkVersion 25
versionCode 18
versionName "1.2.1"
versionCode 19
versionName "1.2.2"
}
buildTypes {
release {

Binary file not shown.

View File

@ -151,8 +151,13 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
holder.status_prev2 = (ImageView) convertView.findViewById(R.id.status_prev2);
holder.status_prev3 = (ImageView) convertView.findViewById(R.id.status_prev3);
holder.status_prev4 = (ImageView) convertView.findViewById(R.id.status_prev4);
holder.status_prev1_play = (ImageView) convertView.findViewById(R.id.status_prev1_play);
holder.status_prev2_play = (ImageView) convertView.findViewById(R.id.status_prev2_play);
holder.status_prev3_play = (ImageView) convertView.findViewById(R.id.status_prev3_play);
holder.status_prev4_play = (ImageView) convertView.findViewById(R.id.status_prev4_play);
holder.status_container2 = (LinearLayout) convertView.findViewById(R.id.status_container2);
holder.status_container3 = (LinearLayout) convertView.findViewById(R.id.status_container3);
holder.status_prev4_container = (RelativeLayout) convertView.findViewById(R.id.status_prev4_container);
holder.status_reply = (ImageView) convertView.findViewById(R.id.status_reply);
holder.status_privacy = (ImageView) convertView.findViewById(R.id.status_privacy);
holder.main_container = (LinearLayout) convertView.findViewById(R.id.main_container);
@ -459,20 +464,37 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
}else if( attachments.size() == 3){
holder.status_container2.setVisibility(View.VISIBLE);
holder.status_container3.setVisibility(View.VISIBLE);
holder.status_prev4.setVisibility(View.GONE);
holder.status_prev4_container.setVisibility(View.GONE);
}else {
holder.status_prev4.setVisibility(View.VISIBLE);
holder.status_prev4_container.setVisibility(View.VISIBLE);
}
for(final Attachment attachment: attachments){
ImageView imageView;
if( i == 0)
imageView = holder.status_prev1;
else if( i == 1)
imageView = holder.status_prev2;
else if(i == 2)
imageView = holder.status_prev3;
else
imageView = holder.status_prev4;
if( i == 0) {
imageView = holder.status_prev1;
if( attachment.getType().equals("image"))
holder.status_prev1_play.setVisibility(View.GONE);
else
holder.status_prev1_play.setVisibility(View.VISIBLE);
}else if( i == 1) {
imageView = holder.status_prev2;
if( attachment.getType().equals("image"))
holder.status_prev2_play.setVisibility(View.GONE);
else
holder.status_prev2_play.setVisibility(View.VISIBLE);
}else if(i == 2) {
imageView = holder.status_prev3;
if( attachment.getType().equals("image"))
holder.status_prev3_play.setVisibility(View.GONE);
else
holder.status_prev3_play.setVisibility(View.VISIBLE);
}else {
imageView = holder.status_prev4;
if( attachment.getType().equals("image"))
holder.status_prev4_play.setVisibility(View.GONE);
else
holder.status_prev4_play.setVisibility(View.VISIBLE);
}
String url = attachment.getPreview_url();
if( url == null || url.trim().equals(""))
url = attachment.getUrl();
@ -644,6 +666,11 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
ImageView status_prev2;
ImageView status_prev3;
ImageView status_prev4;
ImageView status_prev1_play;
ImageView status_prev2_play;
ImageView status_prev3_play;
ImageView status_prev4_play;
RelativeLayout status_prev4_container;
ImageView status_reply;
ImageView status_privacy;
LinearLayout status_container2;

View File

@ -60,6 +60,8 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
private int accountPerPage;
private String targetedId;
private boolean swiped;
private ListView lv_accounts;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -92,7 +94,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
accountPerPage = sharedpreferences.getInt(Helper.SET_ACCOUNTS_PER_PAGE, 40);
final ListView lv_accounts = (ListView) rootView.findViewById(R.id.lv_accounts);
lv_accounts = (ListView) rootView.findViewById(R.id.lv_accounts);
mainLoader = (RelativeLayout) rootView.findViewById(R.id.loader);
nextElementLoader = (RelativeLayout) rootView.findViewById(R.id.loading_next_accounts);
@ -238,6 +240,9 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
if( show_error_messages)
Toast.makeText(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
flag_loading = false;
swipeRefreshLayout.setRefreshing(false);
swiped = false;
return;
}
List<Account> accounts = apiResponse.getAccounts();
@ -246,6 +251,11 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
else
textviewNoAction.setVisibility(View.GONE);
max_id = apiResponse.getMax_id();
if( swiped ){
accountsListAdapter = new AccountsListAdapter(context, type, this.accounts);
lv_accounts.setAdapter(accountsListAdapter);
swiped = false;
}
if( accounts != null) {
for(Account tmpAccount: accounts){
this.accounts.add(tmpAccount);

View File

@ -58,7 +58,7 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
private int accountPerPage;
private TextView no_action_text;
private boolean swiped;
private ListView lv_accounts;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -75,7 +75,7 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
accountPerPage = sharedpreferences.getInt(Helper.SET_ACCOUNTS_PER_PAGE, 40);
final ListView lv_accounts = (ListView) rootView.findViewById(R.id.lv_accounts);
lv_accounts = (ListView) rootView.findViewById(R.id.lv_accounts);
no_action_text = (TextView) rootView.findViewById(R.id.no_action_text);
mainLoader = (RelativeLayout) rootView.findViewById(R.id.loader);
nextElementLoader = (RelativeLayout) rootView.findViewById(R.id.loading_next_accounts);
@ -158,6 +158,9 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
if( show_error_messages)
Toast.makeText(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
flag_loading = false;
swipeRefreshLayout.setRefreshing(false);
swiped = false;
return;
}
List<Account> accounts = apiResponse.getAccounts();
@ -167,6 +170,11 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
}else
textviewNoAction.setVisibility(View.GONE);
max_id = apiResponse.getMax_id();
if( swiped ){
accountsFollowRequestAdapter = new AccountsFollowRequestAdapter(context, this.accounts);
lv_accounts.setAdapter(accountsFollowRequestAdapter);
swiped = false;
}
if( accounts != null) {
for(Account tmpAccount: accounts){
this.accounts.add(tmpAccount);

View File

@ -34,6 +34,7 @@ import java.util.List;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.client.Entities.Account;
import fr.gouv.etalab.mastodon.drawers.NotificationsListAdapter;
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
@ -62,6 +63,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
private SwipeRefreshLayout swipeRefreshLayout;
private int notificationPerPage;
private boolean swiped;
private ListView lv_notifications;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -77,7 +79,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
notificationPerPage = sharedpreferences.getInt(Helper.SET_NOTIFICATIONS_PER_PAGE, 40);
ListView lv_notifications = (ListView) rootView.findViewById(R.id.lv_notifications);
lv_notifications = (ListView) rootView.findViewById(R.id.lv_notifications);
mainLoader = (RelativeLayout) rootView.findViewById(R.id.loader);
nextElementLoader = (RelativeLayout) rootView.findViewById(R.id.loading_next_notifications);
@ -159,6 +161,9 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
if( show_error_messages)
Toast.makeText(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
flag_loading = false;
swipeRefreshLayout.setRefreshing(false);
swiped = false;
return;
}
List<Notification> notifications = apiResponse.getNotifications();
@ -166,6 +171,11 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
textviewNoAction.setVisibility(View.VISIBLE);
else
textviewNoAction.setVisibility(View.GONE);
if( swiped ){
notificationsListAdapter = new NotificationsListAdapter(context, this.notifications);
lv_notifications.setAdapter(notificationsListAdapter);
swiped = false;
}
max_id = apiResponse.getMax_id();
if( notifications != null) {

View File

@ -23,6 +23,7 @@ import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -65,6 +66,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
private String tag;
private int tootsPerPage;
private boolean swiped;
private ListView lv_status;
private boolean isOnWifi;
private int behaviorWithAttachments;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -94,12 +98,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
firstLoad = true;
swiped = false;
boolean isOnWifi = Helper.isOnWIFI(context);
isOnWifi = Helper.isOnWIFI(context);
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
final ListView lv_status = (ListView) rootView.findViewById(R.id.lv_status);
lv_status = (ListView) rootView.findViewById(R.id.lv_status);
tootsPerPage = sharedpreferences.getInt(Helper.SET_TOOTS_PER_PAGE, 40);
mainLoader = (RelativeLayout) rootView.findViewById(R.id.loader);
nextElementLoader = (RelativeLayout) rootView.findViewById(R.id.loading_next_status);
@ -257,6 +261,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
if( show_error_messages)
Toast.makeText(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
flag_loading = false;
swipeRefreshLayout.setRefreshing(false);
swiped = false;
return;
}
List<Status> statuses = apiResponse.getStatuses();
@ -264,6 +271,11 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
textviewNoAction.setVisibility(View.VISIBLE);
else
textviewNoAction.setVisibility(View.GONE);
if( swiped ){
statusListAdapter = new StatusListAdapter(context, type, isOnWifi, behaviorWithAttachments, this.statuses);
lv_status.setAdapter(statusListAdapter);
swiped = false;
}
max_id = apiResponse.getMax_id();
if( statuses != null) {
for(Status tmpStatus: statuses){

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

View File

@ -29,7 +29,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:baselineAligned="false">
<RelativeLayout
android:layout_height="60dp"
android:layout_width="60dp"
@ -145,14 +146,28 @@
android:id="@+id/status_document_container"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="200dp">
<ImageView
android:id="@+id/status_prev1"
android:layout_height="200dp"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="1"
android:scaleType="centerCrop"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
>
<ImageView
android:id="@+id/status_prev1"
android:layout_width="match_parent"
android:scaleType="centerCrop"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/status_prev1_play"
android:visibility="gone"
android:layout_centerInParent="true"
android:layout_width="20dp"
android:src="@drawable/ic_play_arrow"
android:layout_height="20dp"
tools:ignore="ContentDescription" />
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
@ -161,36 +176,79 @@
android:id="@+id/status_container2"
android:layout_weight="1"
android:layout_height="match_parent">
<ImageView
android:id="@+id/status_prev2"
<RelativeLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:scaleType="centerCrop"
android:layout_height="0dp"
tools:ignore="ContentDescription" />
android:layout_weight="1">
<ImageView
android:id="@+id/status_prev2"
android:layout_width="match_parent"
android:scaleType="centerCrop"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<ImageView
android:visibility="gone"
android:id="@+id/status_prev2_play"
android:layout_centerInParent="true"
android:layout_width="20dp"
android:src="@drawable/ic_play_arrow"
android:layout_height="20dp"
tools:ignore="ContentDescription" />
</RelativeLayout>
<LinearLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_marginTop="2dp"
android:id="@+id/status_container3"
android:layout_height="0dp">
<ImageView
android:id="@+id/status_prev3"
android:layout_weight="1"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="wrap_content"
tools:ignore="ContentDescription" />
<ImageView
android:layout_height="0dp"
android:baselineAligned="false">
<RelativeLayout
android:layout_marginLeft="2dp"
android:layout_marginStart="2dp"
android:id="@+id/status_prev4"
android:layout_weight="1"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="wrap_content"
tools:ignore="ContentDescription" />
android:layout_height="wrap_content">
<ImageView
android:id="@+id/status_prev3"
android:layout_width="match_parent"
android:scaleType="centerCrop"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/status_prev3_play"
android:layout_centerInParent="true"
android:layout_width="20dp"
android:src="@drawable/ic_play_arrow"
android:visibility="gone"
android:layout_height="20dp"
tools:ignore="ContentDescription" />
</RelativeLayout>
<RelativeLayout
android:layout_marginLeft="2dp"
android:layout_marginStart="2dp"
android:layout_weight="1"
android:layout_width="0dp"
android:id="@+id/status_prev4_container"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/status_prev4"
android:layout_width="match_parent"
android:scaleType="centerCrop"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/status_prev4_play"
android:layout_centerInParent="true"
android:visibility="gone"
android:layout_width="20dp"
android:src="@drawable/ic_play_arrow"
android:layout_height="20dp"
tools:ignore="ContentDescription" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -48,8 +48,8 @@
<RelativeLayout
android:id="@+id/loader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
>