Adds feature to display toots only with media for accounts
|
@ -37,6 +37,7 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
@ -103,6 +104,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
private static int instanceValue = 0;
|
||||
private Relationship relationship;
|
||||
private TextView account_un;
|
||||
private boolean showMediaOnly;
|
||||
|
||||
public enum action{
|
||||
FOLLOW,
|
||||
|
@ -139,6 +141,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
}else{
|
||||
Toast.makeText(this,R.string.toast_error_loading_account,Toast.LENGTH_LONG).show();
|
||||
}
|
||||
showMediaOnly = false;
|
||||
imageLoader = ImageLoader.getInstance();
|
||||
File cacheDir = new File(getCacheDir(), getString(R.string.app_name));
|
||||
ImageLoaderConfiguration configImg = new ImageLoaderConfiguration.Builder(this)
|
||||
|
@ -279,12 +282,29 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
new RetrieveRelationshipAsyncTask(getApplicationContext(), accountId,ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main_showaccount, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_show_media:
|
||||
showMediaOnly = !showMediaOnly;
|
||||
if( showMediaOnly )
|
||||
item.setIcon(R.drawable.ic_clear_all);
|
||||
else
|
||||
item.setIcon(R.drawable.ic_perm_media);
|
||||
tabLayout.getTabAt(0).select();
|
||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@ -429,6 +449,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.USER);
|
||||
bundle.putString("targetedId", accountId);
|
||||
bundle.putBoolean("hideHeader",true);
|
||||
bundle.putBoolean("showMediaOnly",showMediaOnly);
|
||||
bundle.putString("hideHeaderValue",String.valueOf(instanceValue));
|
||||
displayStatusFragment.setArguments(bundle);
|
||||
return displayStatusFragment;
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
isRefreshed = false;
|
||||
setTitle(R.string.conversation);
|
||||
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeContainer);
|
||||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
if( theme == Helper.THEME_LIGHT) {
|
||||
swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent,
|
||||
|
@ -97,7 +97,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
@Override
|
||||
public void onRefresh() {
|
||||
isRefreshed = true;
|
||||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
lv_status = (ListView) findViewById(R.id.lv_status);
|
||||
|
@ -114,7 +114,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
@Override
|
||||
public void run() {
|
||||
isRefreshed = true;
|
||||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
|
|
|
@ -1045,34 +1045,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
}
|
||||
|
||||
|
||||
/*private void manageShowUsers(searchAction action, boolean click){
|
||||
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean show_reply = sharedpreferences.getBoolean(Helper.SET_SHOW_REPLY, false);
|
||||
Log.v(Helper.TAG,"action: " + action);
|
||||
if(action == searchAction.CLOSE){
|
||||
toot_show_accounts.setVisibility(View.GONE);
|
||||
search_small_container.setVisibility(View.GONE);
|
||||
bottom_container.setVisibility(View.VISIBLE);
|
||||
if( show_reply && tootReply != null){
|
||||
toot_reply_content_container.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
toot_reply_content_container.setVisibility(View.GONE);
|
||||
}
|
||||
toot_content.requestFocus();
|
||||
if( !click) {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.toggleSoftInputFromWindow(toot_content.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
|
||||
}
|
||||
}else if(action == searchAction.OPEN){
|
||||
toot_show_accounts.setVisibility(View.VISIBLE);
|
||||
search_small_container.setVisibility(View.VISIBLE);
|
||||
bottom_container.setVisibility(View.GONE);
|
||||
toot_reply_content_container.setVisibility(View.GONE);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
private void tootReply(){
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
if( title != null)
|
||||
|
|
|
@ -35,6 +35,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
private OnRetrieveFeedsInterface listener;
|
||||
private String targetedID;
|
||||
private String tag;
|
||||
private boolean showMediaOnly = false;
|
||||
|
||||
public enum Type{
|
||||
HOME,
|
||||
|
@ -55,12 +56,13 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
this.listener = onRetrieveFeedsInterface;
|
||||
}
|
||||
|
||||
public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
|
||||
public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, boolean showMediaOnly, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
|
||||
this.context = context;
|
||||
this.action = action;
|
||||
this.max_id = max_id;
|
||||
this.listener = onRetrieveFeedsInterface;
|
||||
this.targetedID = targetedID;
|
||||
this.showMediaOnly = showMediaOnly;
|
||||
}
|
||||
public RetrieveFeedsAsyncTask(Context context, Type action, String tag, String targetedID, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
|
||||
this.context = context;
|
||||
|
@ -88,7 +90,10 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
apiResponse = api.getFavourites(max_id);
|
||||
break;
|
||||
case USER:
|
||||
apiResponse = api.getStatus(targetedID, max_id);
|
||||
if( !showMediaOnly)
|
||||
apiResponse = api.getStatus(targetedID, max_id);
|
||||
else
|
||||
apiResponse = api.getStatusWithMedia(targetedID, max_id);
|
||||
break;
|
||||
case ONESTATUS:
|
||||
apiResponse = api.getStatusbyId(targetedID);
|
||||
|
|
|
@ -287,6 +287,17 @@ public class API {
|
|||
return getStatus(accountId, false, false, max_id, null, tootPerPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves status with media for the account *synchronously*
|
||||
*
|
||||
* @param accountId String Id of the account
|
||||
* @param max_id String id max
|
||||
* @return APIResponse
|
||||
*/
|
||||
public APIResponse getStatusWithMedia(String accountId, String max_id) {
|
||||
return getStatus(accountId, true, false, max_id, null, tootPerPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves status for the account *synchronously*
|
||||
|
|
|
@ -133,11 +133,8 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
|||
if (constraint != null) {
|
||||
suggestions.clear();
|
||||
for (Account account : tempAccounts) {
|
||||
if (account.getAcct().toLowerCase().startsWith(constraint.toString().toLowerCase())) {
|
||||
suggestions.add(account);
|
||||
}
|
||||
suggestions.add(account);
|
||||
}
|
||||
|
||||
FilterResults filterResults = new FilterResults();
|
||||
filterResults.values = suggestions;
|
||||
filterResults.count = suggestions.size();
|
||||
|
|
|
@ -70,6 +70,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
private boolean isOnWifi;
|
||||
private int behaviorWithAttachments;
|
||||
private String instanceValue;
|
||||
private boolean showMediaOnly;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -80,11 +81,13 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
Bundle bundle = this.getArguments();
|
||||
boolean comesFromSearch = false;
|
||||
boolean hideHeader = false;
|
||||
showMediaOnly = false;
|
||||
if (bundle != null) {
|
||||
type = (RetrieveFeedsAsyncTask.Type) bundle.get("type");
|
||||
targetedId = bundle.getString("targetedId", null);
|
||||
tag = bundle.getString("tag", null);
|
||||
hideHeader = bundle.getBoolean("hideHeader", false);
|
||||
showMediaOnly = bundle.getBoolean("showMediaOnly",false);
|
||||
instanceValue = bundle.getString("hideHeaderValue", null);
|
||||
if( bundle.containsKey("statuses")){
|
||||
ArrayList<Parcelable> statusesReceived = bundle.getParcelableArrayList("statuses");
|
||||
|
@ -150,7 +153,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
if(!flag_loading ) {
|
||||
flag_loading = true;
|
||||
if( type == RetrieveFeedsAsyncTask.Type.USER)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.TAG)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
|
@ -174,7 +177,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
if(!flag_loading ) {
|
||||
flag_loading = true;
|
||||
if( type == RetrieveFeedsAsyncTask.Type.USER)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.TAG)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
|
@ -198,7 +201,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
flag_loading = true;
|
||||
swiped = true;
|
||||
if( type == RetrieveFeedsAsyncTask.Type.USER)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.TAG)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
|
@ -218,7 +221,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
|
||||
|
||||
if( type == RetrieveFeedsAsyncTask.Type.USER)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.TAG)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
|
|
After Width: | Height: | Size: 131 B |
After Width: | Height: | Size: 296 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 346 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 108 B |
After Width: | Height: | Size: 299 B |
After Width: | Height: | Size: 133 B |
After Width: | Height: | Size: 478 B |
After Width: | Height: | Size: 130 B |
After Width: | Height: | Size: 549 B |
|
@ -15,43 +15,35 @@
|
|||
You should have received a copy of the GNU General Public License along with Thomas Schneider; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:card_view="http://schemas.android.com/tools"
|
||||
style="?attr/cardStyle"
|
||||
card_view:cardPreventCornerOverlap="true"
|
||||
app:cardUseCompatPadding="true">
|
||||
<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:id="@+id/account_container"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_margin="5dp"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/account_pp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:maxLines="1"
|
||||
android:id="@+id/account_un"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/account_dn"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:maxLines="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
android:padding="2dp"
|
||||
android:id="@+id/account_container"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_margin="5dp"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/account_pp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:maxLines="1"
|
||||
android:id="@+id/account_un"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/account_dn"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:maxLines="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_show_media"
|
||||
android:title="@string/media"
|
||||
android:icon="@drawable/ic_perm_media"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
|
@ -49,6 +49,7 @@
|
|||
<string name="previous">Précédent</string>
|
||||
<string name="open_with">Ouvrir avec</string>
|
||||
<string name="validate">Valider</string>
|
||||
<string name="media">Médias</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Accueil</string>
|
||||
<string name="local_menu">Fil public local</string>
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
<string name="previous">Previous</string>
|
||||
<string name="open_with">Open with</string>
|
||||
<string name="validate">Validate</string>
|
||||
<string name="media">Media</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Home</string>
|
||||
<string name="local_menu">Local timeline</string>
|
||||
|
|