Improve media activity

This commit is contained in:
stom79 2018-09-05 17:08:57 +02:00
parent a6a4c7bca6
commit 1d9e27b4b4
6 changed files with 24 additions and 31 deletions

View File

@ -308,9 +308,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
final PopupMenu popup = new PopupMenu(ShowAccountActivity.this, account_menu); final PopupMenu popup = new PopupMenu(ShowAccountActivity.this, account_menu);
popup.getMenuInflater() popup.getMenuInflater()
.inflate(R.menu.main_showaccount, popup.getMenu()); .inflate(R.menu.main_showaccount, popup.getMenu());
if( !Helper.canPin ) {
popup.getMenu().findItem(R.id.action_show_pinned).setVisible(false);
}
final String[] stringArrayConf; final String[] stringArrayConf;
final boolean isOwner = account.getId().equals(userId); final boolean isOwner = account.getId().equals(userId);
String[] splitAcct = account.getAcct().split("@"); String[] splitAcct = account.getAcct().split("@");
@ -324,6 +322,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
popup.getMenu().findItem(R.id.action_follow_instance).setVisible(false); popup.getMenu().findItem(R.id.action_follow_instance).setVisible(false);
popup.getMenu().findItem(R.id.action_hide_boost).setVisible(false); popup.getMenu().findItem(R.id.action_hide_boost).setVisible(false);
popup.getMenu().findItem(R.id.action_endorse).setVisible(false); popup.getMenu().findItem(R.id.action_endorse).setVisible(false);
popup.getMenu().findItem(R.id.action_direct_message).setVisible(false);
stringArrayConf = getResources().getStringArray(R.array.more_action_owner_confirm); stringArrayConf = getResources().getStringArray(R.array.more_action_owner_confirm);
}else { }else {
popup.getMenu().findItem(R.id.action_block).setVisible(true); popup.getMenu().findItem(R.id.action_block).setVisible(true);
@ -412,21 +411,13 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
new PostActionAsyncTask(getApplicationContext(), API.StatusAction.SHOW_BOOST, account.getId(), ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new PostActionAsyncTask(getApplicationContext(), API.StatusAction.SHOW_BOOST, account.getId(), ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
return true; return true;
case R.id.action_show_pinned: case R.id.action_direct_message:
showPinned = !showPinned; Intent intent = new Intent(getApplicationContext(), TootActivity.class);
if( tabLayout.getTabAt(0) != null) Bundle b = new Bundle();
//noinspection ConstantConditions b.putString("mentionAccount", account.getAcct());
tabLayout.getTabAt(0).select(); b.putString("visibility", "direct");
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); intent.putExtras(b);
mPager.setAdapter(mPagerAdapter); startActivity(intent);
return true;
case R.id.action_show_media:
showMediaOnly = !showMediaOnly;
if( tabLayout.getTabAt(0) != null)
//noinspection ConstantConditions
tabLayout.getTabAt(0).select();
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
return true; return true;
case R.id.action_open_browser: case R.id.action_open_browser:
if( accountUrl != null) { if( accountUrl != null) {
@ -436,8 +427,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
} }
return true; return true;
case R.id.action_mention: case R.id.action_mention:
Intent intent = new Intent(getApplicationContext(), TootActivity.class); intent = new Intent(getApplicationContext(), TootActivity.class);
Bundle b = new Bundle(); b = new Bundle();
b.putString("mentionAccount", account.getAcct()); b.putString("mentionAccount", account.getAcct());
intent.putExtras(b); intent.putExtras(b);
startActivity(intent); startActivity(intent);

View File

@ -295,6 +295,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
mentionAccount = b.getString("mentionAccount", null); mentionAccount = b.getString("mentionAccount", null);
idRedirect = b.getString("idRedirect", null); idRedirect = b.getString("idRedirect", null);
removed = b.getBoolean("removed"); removed = b.getBoolean("removed");
visibility = b.getString("visibility", null);
restoredScheduled = b.getBoolean("restoredScheduled", false); restoredScheduled = b.getBoolean("restoredScheduled", false);
// ACTION_SEND route // ACTION_SEND route
if (b.getInt("uriNumberMast", 0) == 1) { if (b.getInt("uriNumberMast", 0) == 1) {
@ -428,8 +429,10 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
if( tootReply == null) { if( tootReply == null) {
String defaultVisibility = account.isLocked()?"private":"public"; if( visibility == null) {
visibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), defaultVisibility); String defaultVisibility = account.isLocked() ? "private" : "public";
visibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), defaultVisibility);
}
switch (visibility) { switch (visibility) {
case "public": case "public":
toot_visibility.setImageResource(R.drawable.ic_public_toot); toot_visibility.setImageResource(R.drawable.ic_public_toot);

View File

@ -985,9 +985,13 @@ public class API {
action = String.format("/accounts/%s/unpin", targetedId); action = String.format("/accounts/%s/unpin", targetedId);
break; break;
case SHOW_BOOST: case SHOW_BOOST:
params = new HashMap<>();
params.put("reblogs","true");
action = String.format("/accounts/%s/follow", targetedId); action = String.format("/accounts/%s/follow", targetedId);
break; break;
case HIDE_BOOST: case HIDE_BOOST:
params = new HashMap<>();
params.put("reblogs","false");
action = String.format("/accounts/%s/follow", targetedId); action = String.format("/accounts/%s/follow", targetedId);
break; break;
case UNSTATUS: case UNSTATUS:

View File

@ -32,6 +32,5 @@
android:id="@+id/viewpager" android:id="@+id/viewpager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="70dp"
/> />
</LinearLayout> </LinearLayout>

View File

@ -2,20 +2,15 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/action_show_pinned" android:id="@+id/action_direct_message"
android:title="@string/pinned_toots" android:title="@string/direct_message"
android:icon="@drawable/ic_pin_drop" android:icon="@drawable/ic_mail_outline_toot"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item <item
android:id="@+id/action_open_browser" android:id="@+id/action_open_browser"
android:title="@string/action_open_in_web" android:title="@string/action_open_in_web"
android:icon="@drawable/ic_open_with" android:icon="@drawable/ic_open_with"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item
android:id="@+id/action_show_media"
android:title="@string/media"
android:icon="@drawable/ic_perm_media"
app:showAsAction="ifRoom" />
<item <item
android:id="@+id/action_mute" android:id="@+id/action_mute"
android:title="@string/more_action_1" android:title="@string/more_action_1"

View File

@ -569,6 +569,7 @@
<string name="toast_unendorse">The account is no longer featured on profile</string> <string name="toast_unendorse">The account is no longer featured on profile</string>
<string name="toast_show_boost">Boosts are now shown!</string> <string name="toast_show_boost">Boosts are now shown!</string>
<string name="toast_hide_boost">Boosts are now hidden!</string> <string name="toast_hide_boost">Boosts are now hidden!</string>
<string name="direct_message">Direct message</string>
<string-array translatable="false" name="proxy_type_choice"> <string-array translatable="false" name="proxy_type_choice">