Merge remote-tracking branch 'remotes/tom-repo/develop' into PhotonQyv-Baseline
This commit is contained in:
commit
73c3161aef
Binary file not shown.
|
@ -40,11 +40,15 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
@ -119,6 +123,8 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
private String accountUrl;
|
||||
private int maxScrollSize;
|
||||
private boolean avatarShown = true;
|
||||
private DisplayStatusFragment displayStatusFragment;
|
||||
|
||||
public enum action{
|
||||
FOLLOW,
|
||||
UNFOLLOW,
|
||||
|
@ -226,7 +232,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
Fragment fragment = (Fragment) mPager.getAdapter().instantiateItem(mPager, tab.getPosition());
|
||||
switch (tab.getPosition()){
|
||||
case 0:
|
||||
DisplayStatusFragment displayStatusFragment = ((DisplayStatusFragment) fragment);
|
||||
if( displayStatusFragment != null )
|
||||
displayStatusFragment.scrollToTop();
|
||||
break;
|
||||
|
@ -268,6 +273,67 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
final ImageButton account_menu = (ImageButton) findViewById(R.id.account_menu);
|
||||
account_menu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PopupMenu popup = new PopupMenu(ShowAccountActivity.this, account_menu);
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.main_showaccount, popup.getMenu());
|
||||
if( !Helper.canPin || !accountId.equals(userId)) {
|
||||
popup.getMenu().findItem(R.id.action_show_pinned).setVisible(false);
|
||||
}
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_show_pinned:
|
||||
showPinned = !showPinned;
|
||||
if( showPinned )
|
||||
item.setIcon(R.drawable.ic_clear_all);
|
||||
else
|
||||
item.setIcon(R.drawable.ic_action_pin);
|
||||
if( tabLayout.getTabAt(0) != null)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).select();
|
||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
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);
|
||||
if( tabLayout.getTabAt(0) != null)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).select();
|
||||
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
return true;
|
||||
case R.id.action_open_browser:
|
||||
if( accountUrl != null) {
|
||||
Intent intent = new Intent(getApplicationContext(), WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
if( !accountUrl.startsWith("http://") && ! accountUrl.startsWith("https://"))
|
||||
accountUrl = "http://" + accountUrl;
|
||||
b.putString("url", accountUrl);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -284,67 +350,7 @@ 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);
|
||||
//TODO: if one day pinned toots from another account can be displayed, we need to remove the condition !accountId.equals(userId)
|
||||
if( !Helper.canPin || !accountId.equals(userId)) {
|
||||
menu.findItem(R.id.action_show_pinned).setVisible(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_show_pinned:
|
||||
showPinned = !showPinned;
|
||||
if( showPinned )
|
||||
item.setIcon(R.drawable.ic_clear_all);
|
||||
else
|
||||
item.setIcon(R.drawable.ic_action_pin);
|
||||
if( tabLayout.getTabAt(0) != null)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).select();
|
||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
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);
|
||||
if( tabLayout.getTabAt(0) != null)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).select();
|
||||
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
return true;
|
||||
case R.id.action_open_browser:
|
||||
if( accountUrl != null) {
|
||||
Intent intent = new Intent(getApplicationContext(), WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
if( !accountUrl.startsWith("http://") && ! accountUrl.startsWith("https://"))
|
||||
accountUrl = "http://" + accountUrl;
|
||||
b.putString("url", accountUrl);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(){
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveAccount(Account account, Error error) {
|
||||
|
@ -488,9 +494,89 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(2).setText(getString(R.string.followers_cnt, account.getFollowers_count()));
|
||||
|
||||
//Allows to filter by long click
|
||||
final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
|
||||
tabStrip.getChildAt(0).setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
PopupMenu popup = new PopupMenu(ShowAccountActivity.this, tabStrip.getChildAt(0));
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.option_filter_toots_account, popup.getMenu());
|
||||
Menu menu = popup.getMenu();
|
||||
|
||||
if( !Helper.canPin || !accountId.equals(userId)) {
|
||||
popup.getMenu().findItem(R.id.action_show_pinned).setVisible(false);
|
||||
}
|
||||
final MenuItem itemShowPined = menu.findItem(R.id.action_show_pinned);
|
||||
final MenuItem itemShowMedia = menu.findItem(R.id.action_show_media);
|
||||
|
||||
itemShowMedia.setChecked(showMediaOnly);
|
||||
itemShowPined.setChecked(showPinned);
|
||||
popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(PopupMenu menu) {
|
||||
if( displayStatusFragment != null)
|
||||
displayStatusFragment.refreshFilter();
|
||||
}
|
||||
});
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
item.setActionView(new View(getApplicationContext()));
|
||||
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||
@Override
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_show_pinned:
|
||||
showPinned = !showPinned;
|
||||
if( showPinned )
|
||||
item.setIcon(R.drawable.ic_clear_all);
|
||||
else
|
||||
item.setIcon(R.drawable.ic_action_pin);
|
||||
if( tabLayout.getTabAt(0) != null)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).select();
|
||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
break;
|
||||
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);
|
||||
if( tabLayout.getTabAt(0) != null)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).select();
|
||||
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
break;
|
||||
}
|
||||
itemShowMedia.setChecked(showMediaOnly);
|
||||
itemShowPined.setChecked(showPinned);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
imageLoader.displayImage(account.getAvatar(), account_pp, options);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -594,7 +680,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
Bundle bundle = new Bundle();
|
||||
switch (position){
|
||||
case 0:
|
||||
DisplayStatusFragment displayStatusFragment = new DisplayStatusFragment();
|
||||
displayStatusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.USER);
|
||||
bundle.putString("targetedId", accountId);
|
||||
bundle.putBoolean("hideHeader",true);
|
||||
|
@ -623,6 +709,18 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
Fragment createdFragment = (Fragment) super.instantiateItem(container, position);
|
||||
// save the appropriate reference depending on position
|
||||
switch (position) {
|
||||
case 0:
|
||||
displayStatusFragment = (DisplayStatusFragment) createdFragment;
|
||||
break;
|
||||
}
|
||||
return createdFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return NUM_PAGES;
|
||||
|
|
|
@ -295,6 +295,8 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
|
||||
SpannableString spannableString = Helper.clickableElements(context, content,
|
||||
status.getReblog() != null?status.getReblog().getMentions():status.getMentions(), true);
|
||||
Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/DroidSans-Regular.ttf");
|
||||
holder.notification_status_content.setTypeface(tf);
|
||||
holder.notification_status_content.setText(spannableString, TextView.BufferType.SPANNABLE);
|
||||
holder.notification_status_content.setMovementMethod(null);
|
||||
holder.notification_status_content.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
@ -302,9 +304,6 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
holder.status_reblog_count.setText(String.valueOf(status.getReblogs_count()));
|
||||
holder.status_date.setText(Helper.dateDiff(context, status.getCreated_at()));
|
||||
|
||||
Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/WorkSans-Regular.ttf");
|
||||
holder.notification_status_content.setTypeface(tf);
|
||||
|
||||
//Adds attachment -> disabled, to enable them uncomment the line below
|
||||
//loadAttachments(status, holder);
|
||||
holder.notification_status_container.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -571,7 +571,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
}
|
||||
}
|
||||
|
||||
Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/WorkSans-Regular.ttf");
|
||||
Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/DroidSans-Regular.ttf");
|
||||
holder.status_content.setTypeface(tf);
|
||||
|
||||
//Toot was translated and user asked to see it
|
||||
|
|
|
@ -56,7 +56,18 @@
|
|||
android:layout_marginEnd="10dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/account_menu"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_gravity="end|top"
|
||||
android:src="@drawable/ic_more_white"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="5dp"/>
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
|
@ -72,7 +83,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:layout_scrollFlags="scroll|enterAlways|snap"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
|
@ -133,8 +143,8 @@
|
|||
android:layout_marginLeft="10dp"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/account_followed_by"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/followed_by"
|
||||
android:maxLines="1"
|
||||
|
@ -145,8 +155,8 @@
|
|||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/request_sent"
|
||||
android:maxLines="1"
|
||||
|
|
|
@ -55,7 +55,18 @@
|
|||
android:layout_marginEnd="10dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/account_menu"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_gravity="end|top"
|
||||
android:src="@drawable/ic_more_white"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="5dp"/>
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
|
@ -131,8 +142,8 @@
|
|||
android:layout_marginLeft="10dp"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/account_followed_by"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/followed_by"
|
||||
android:maxLines="1"
|
||||
|
@ -143,8 +154,8 @@
|
|||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/request_sent"
|
||||
android:maxLines="1"
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
android:id="@+id/action_show_pinned"
|
||||
android:title="@string/pinned_toots"
|
||||
android:icon="@drawable/ic_action_pin"
|
||||
app:showAsAction="always" />
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_open_browser"
|
||||
android:title="@string/media"
|
||||
android:title="@string/action_open_in_web"
|
||||
android:icon="@drawable/ic_open_in_browser"
|
||||
app:showAsAction="always" />
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_show_media"
|
||||
android:title="@string/media"
|
||||
android:icon="@drawable/ic_perm_media"
|
||||
app:showAsAction="always" />
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_show_pinned"
|
||||
android:checkable="true"
|
||||
android:title="@string/pinned_toots"
|
||||
app:actionViewClass="android.widget.CheckBox"
|
||||
app:showAsAction="always"
|
||||
tools:ignore="AlwaysShowAction" />
|
||||
<item
|
||||
android:id="@+id/action_show_media"
|
||||
android:checkable="true"
|
||||
android:title="@string/media"
|
||||
app:actionViewClass="android.widget.CheckBox"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
|
@ -426,4 +426,5 @@
|
|||
|
||||
<string name="thanks_text_dev">Danke an:</string>
|
||||
<string name="set_multiaccount_actions">Erlauben Interaktionen zwischen den accounts?</string>
|
||||
<string name="action_open_in_web">Im Browser öffnen</string>
|
||||
</resources>
|
||||
|
|
|
@ -433,4 +433,5 @@
|
|||
<string name="toast_pin">Le pouet a été épinglé !</string>
|
||||
<string name="toast_unpin">Le pouet a été désépinglé !</string>
|
||||
<string name="pins_cnt">Epinglés %d</string>
|
||||
<string name="action_open_in_web">Ouvrir dans le navigateur</string>
|
||||
</resources>
|
|
@ -432,4 +432,5 @@
|
|||
<string name="thanks_text_dev">
|
||||
Agradecimentos a:
|
||||
</string>
|
||||
<string name="action_open_in_web">Open in browser</string>
|
||||
</resources>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<string name="reblog">Boosts</string>
|
||||
<string name="show_boosts">Show boosts</string>
|
||||
<string name="show_replies">Show replies</string>
|
||||
<string name="action_open_in_web">Open in browser</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Home</string>
|
||||
<string name="local_menu">Local timeline</string>
|
||||
|
|
Loading…
Reference in New Issue