Improves refresh loaders with themes
This commit is contained in:
parent
ef6b38f92a
commit
84fe4c66ca
|
@ -130,9 +130,6 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte
|
||||||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.TAG, tag,null, max_id, HashTagActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.TAG, tag,null, max_id, HashTagActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
|
||||||
R.color.mastodonC2,
|
|
||||||
R.color.mastodonC3);
|
|
||||||
final LinearLayoutManager mLayoutManager;
|
final LinearLayoutManager mLayoutManager;
|
||||||
mLayoutManager = new LinearLayoutManager(this);
|
mLayoutManager = new LinearLayoutManager(this);
|
||||||
lv_status.setLayoutManager(mLayoutManager);
|
lv_status.setLayoutManager(mLayoutManager);
|
||||||
|
|
|
@ -170,9 +170,27 @@ public class ListActivity extends BaseActivity implements OnListActionInterface
|
||||||
new ManageListsAsyncTask(ListActivity.this,listId, null ,null, ListActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new ManageListsAsyncTask(ListActivity.this,listId, null ,null, ListActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
|
||||||
R.color.mastodonC2,
|
switch (theme){
|
||||||
R.color.mastodonC3);
|
case Helper.THEME_LIGHT:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(ListActivity.this, R.color.white));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4__,
|
||||||
|
R.color.mastodonC4,
|
||||||
|
R.color.mastodonC4);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(ListActivity.this, R.color.mastodonC1_));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.dark_icon,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(ListActivity.this, R.color.black_2));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
new ManageListsAsyncTask(ListActivity.this,listId, null ,null, ListActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new ManageListsAsyncTask(ListActivity.this,listId, null ,null, ListActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,9 +205,26 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
||||||
|
|
||||||
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
switch (theme){
|
||||||
R.color.mastodonC2,
|
case Helper.THEME_LIGHT:
|
||||||
R.color.mastodonC3);
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(OwnerStatusActivity.this, R.color.white));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4__,
|
||||||
|
R.color.mastodonC4,
|
||||||
|
R.color.mastodonC4);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(OwnerStatusActivity.this, R.color.mastodonC1_));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.dark_icon,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(OwnerStatusActivity.this, R.color.black_2));
|
||||||
|
break;
|
||||||
|
}
|
||||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
|
|
|
@ -215,9 +215,26 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false,false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false,false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
switch (theme){
|
||||||
R.color.mastodonC2,
|
case Helper.THEME_LIGHT:
|
||||||
R.color.mastodonC3);
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(ShowConversationActivity.this, R.color.white));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4__,
|
||||||
|
R.color.mastodonC4,
|
||||||
|
R.color.mastodonC4);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(ShowConversationActivity.this, R.color.mastodonC1_));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.dark_icon,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(ShowConversationActivity.this, R.color.black_2));
|
||||||
|
break;
|
||||||
|
}
|
||||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.DividerItemDecoration;
|
import android.support.v7.widget.DividerItemDecoration;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
@ -32,6 +33,7 @@ import android.widget.Toast;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import fr.gouv.etalab.mastodon.activities.ListActivity;
|
||||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveManyRelationshipsAsyncTask;
|
import fr.gouv.etalab.mastodon.asynctasks.RetrieveManyRelationshipsAsyncTask;
|
||||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||||
|
@ -132,9 +134,28 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
||||||
asyncTask = new RetrieveAccountsAsyncTask(context, type, targetedId, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveAccountsAsyncTask(context, type, targetedId, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
R.color.mastodonC2,
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
R.color.mastodonC3);
|
switch (theme){
|
||||||
|
case Helper.THEME_LIGHT:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.white));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4__,
|
||||||
|
R.color.mastodonC4,
|
||||||
|
R.color.mastodonC4);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.mastodonC1_));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.dark_icon,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.black_2));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (type != RetrieveAccountsAsyncTask.Type.FOLLOWERS && type != RetrieveAccountsAsyncTask.Type.FOLLOWING)
|
if (type != RetrieveAccountsAsyncTask.Type.FOLLOWERS && type != RetrieveAccountsAsyncTask.Type.FOLLOWING)
|
||||||
asyncTask = new RetrieveAccountsAsyncTask(context, type, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveAccountsAsyncTask(context, type, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.DividerItemDecoration;
|
import android.support.v7.widget.DividerItemDecoration;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
@ -122,10 +123,27 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
|
||||||
asyncTask = new RetrieveFollowRequestSentAsyncTask(context, max_id, DisplayFollowRequestSentFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveFollowRequestSentAsyncTask(context, max_id, DisplayFollowRequestSentFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
R.color.mastodonC2,
|
switch (theme){
|
||||||
R.color.mastodonC3);
|
case Helper.THEME_LIGHT:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.white));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4__,
|
||||||
|
R.color.mastodonC4,
|
||||||
|
R.color.mastodonC4);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.mastodonC1_));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.dark_icon,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.black_2));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
asyncTask = new RetrieveFollowRequestSentAsyncTask(context, max_id, DisplayFollowRequestSentFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveFollowRequestSentAsyncTask(context, max_id, DisplayFollowRequestSentFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
return rootView;
|
return rootView;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.DividerItemDecoration;
|
import android.support.v7.widget.DividerItemDecoration;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
@ -133,9 +134,28 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
asyncTask = new RetrieveNotificationsAsyncTask(context, true, null, null, DisplayNotificationsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveNotificationsAsyncTask(context, true, null, null, DisplayNotificationsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
R.color.mastodonC2,
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
R.color.mastodonC3);
|
switch (theme){
|
||||||
|
case Helper.THEME_LIGHT:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.white));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4__,
|
||||||
|
R.color.mastodonC4,
|
||||||
|
R.color.mastodonC4);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.mastodonC1_));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.dark_icon,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.black_2));
|
||||||
|
break;
|
||||||
|
}
|
||||||
if( context != null)
|
if( context != null)
|
||||||
asyncTask = new RetrieveNotificationsAsyncTask(context, true, null, max_id, DisplayNotificationsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveNotificationsAsyncTask(context, true, null, max_id, DisplayNotificationsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
else
|
else
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
@ -180,9 +181,28 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
R.color.mastodonC2,
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
R.color.mastodonC3);
|
switch (theme){
|
||||||
|
case Helper.THEME_LIGHT:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.white));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4__,
|
||||||
|
R.color.mastodonC4,
|
||||||
|
R.color.mastodonC4);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.mastodonC1_));
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
swipeRefreshLayout.setColorSchemeResources(R.color.dark_icon,
|
||||||
|
R.color.mastodonC2,
|
||||||
|
R.color.mastodonC3);
|
||||||
|
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(context, R.color.black_2));
|
||||||
|
break;
|
||||||
|
}
|
||||||
if( context != null) {
|
if( context != null) {
|
||||||
if (type == RetrieveFeedsAsyncTask.Type.USER)
|
if (type == RetrieveFeedsAsyncTask.Type.USER)
|
||||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, showPinned, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, showPinned, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
Loading…
Reference in New Issue