Add channels
This commit is contained in:
parent
8a01ea773f
commit
269d7f6b55
|
@ -53,6 +53,7 @@ import android.util.Patterns;
|
|||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
|
@ -89,6 +90,7 @@ import java.util.regex.Pattern;
|
|||
|
||||
import fr.gouv.etalab.mastodon.R;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.ManageFiltersAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.ManageListsAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveInstanceAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveMetaDataAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveRemoteDataAsyncTask;
|
||||
|
@ -118,6 +120,7 @@ import fr.gouv.etalab.mastodon.fragments.WhoToFollowFragment;
|
|||
import fr.gouv.etalab.mastodon.helper.CrossActions;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnFilterActionInterface;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnListActionInterface;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveEmojiAccountInterface;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveInstanceInterface;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveMetaDataInterface;
|
||||
|
@ -163,7 +166,7 @@ import org.json.JSONObject;
|
|||
|
||||
|
||||
public abstract class BaseMainActivity extends BaseActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener, OnUpdateAccountInfoInterface, OnRetrieveMetaDataInterface, OnRetrieveInstanceInterface, OnRetrieveRemoteAccountInterface, OnRetrieveEmojiAccountInterface, OnFilterActionInterface {
|
||||
implements NavigationView.OnNavigationItemSelectedListener, OnUpdateAccountInfoInterface, OnRetrieveMetaDataInterface, OnRetrieveInstanceInterface, OnRetrieveRemoteAccountInterface, OnRetrieveEmojiAccountInterface, OnFilterActionInterface, OnListActionInterface {
|
||||
|
||||
private FloatingActionButton toot, delete_all, add_new;
|
||||
private HashMap<String, String> tagTile = new HashMap<>();
|
||||
|
@ -198,6 +201,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
boolean isLoadingInstance = false;
|
||||
private ImageView delete_instance;
|
||||
public static String displayPeertube = null;
|
||||
private PopupMenu popup;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -333,10 +337,11 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
federatedTimelines.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new ManageListsAsyncTask(BaseMainActivity.this, ManageListsAsyncTask.action.GET_LIST, null, null, null, null, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
SQLiteDatabase db = Sqlite.getInstance(BaseMainActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
new InstancesDAO(BaseMainActivity.this, db).cleanDoublon();
|
||||
List<RemoteInstance> remoteInstances = new InstancesDAO(BaseMainActivity.this, db).getAllInstances();
|
||||
PopupMenu popup = new PopupMenu(BaseMainActivity.this, federatedTimelines);
|
||||
popup = new PopupMenu(BaseMainActivity.this, federatedTimelines);
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.remote_instances, popup.getMenu());
|
||||
try {
|
||||
|
@ -346,15 +351,18 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int i = 0;
|
||||
if(remoteInstances != null)
|
||||
if(remoteInstances != null) {
|
||||
SubMenu submMastodon = popup.getMenu().findItem(R.id.action_show_mastodon).getSubMenu();
|
||||
SubMenu submPeertube = popup.getMenu().findItem(R.id.action_show_peertube).getSubMenu();
|
||||
SubMenu submChannel = popup.getMenu().findItem(R.id.action_show_channel).getSubMenu();
|
||||
int i = 0, j = 0 , k = 0, l = 0;
|
||||
for (RemoteInstance remoteInstance : remoteInstances) {
|
||||
MenuItem item = popup.getMenu().add(0, i, Menu.NONE, remoteInstance.getHost());
|
||||
if(remoteInstance.getType() == null || remoteInstance.getType().equals("MASTODON"))
|
||||
if (remoteInstance.getType() == null || remoteInstance.getType().equals("MASTODON")) {
|
||||
MenuItem itemPlaceHolder = submMastodon.findItem(R.id.mastodon_instances);
|
||||
if( itemPlaceHolder != null)
|
||||
itemPlaceHolder.setVisible(false);
|
||||
MenuItem item = submMastodon.add(0, i, Menu.NONE, remoteInstance.getHost());
|
||||
item.setIcon(R.drawable.mastodon_icon_item);
|
||||
else
|
||||
item.setIcon(R.drawable.peertube_icon);
|
||||
i++;
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
@ -377,6 +385,38 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
return false;
|
||||
}
|
||||
});
|
||||
i++;
|
||||
}if (remoteInstance.getType() == null || remoteInstance.getType().equals("PEERTUBE")) {
|
||||
MenuItem itemPlaceHolder = submPeertube.findItem(R.id.peertube_instances);
|
||||
if( itemPlaceHolder != null)
|
||||
itemPlaceHolder.setVisible(false);
|
||||
MenuItem item = submPeertube.add(0, j, Menu.NONE, remoteInstance.getHost());
|
||||
item.setIcon(R.drawable.peertube_icon);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
DisplayStatusFragment statusFragment;
|
||||
Bundle bundle = new Bundle();
|
||||
statusFragment = new DisplayStatusFragment();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE);
|
||||
bundle.putString("remote_instance", remoteInstance.getHost());
|
||||
statusFragment.setArguments(bundle);
|
||||
String fragmentTag = "REMOTE_INSTANCE";
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
||||
main_app_container.setVisibility(View.VISIBLE);
|
||||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
toolbarTitle.setVisibility(View.VISIBLE);
|
||||
delete_instance.setVisibility(View.VISIBLE);
|
||||
toolbarTitle.setText(remoteInstance.getHost());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
@ -2056,6 +2096,39 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActionDone(ManageListsAsyncTask.action actionType, APIResponse apiResponse, int statusCode) {
|
||||
if( apiResponse.getError() != null){
|
||||
return;
|
||||
}
|
||||
if( actionType == ManageListsAsyncTask.action.GET_LIST && popup != null) {
|
||||
if (apiResponse.getLists() != null && apiResponse.getLists().size() > 0) {
|
||||
SubMenu submList = popup.getMenu().findItem(R.id.action_show_list).getSubMenu();
|
||||
int l = 0;
|
||||
for (fr.gouv.etalab.mastodon.client.Entities.List list : apiResponse.getLists()) {
|
||||
MenuItem itemPlaceHolder = submList.findItem(R.id.list_instances);
|
||||
if( itemPlaceHolder != null)
|
||||
itemPlaceHolder.setVisible(false);
|
||||
MenuItem item = submList.add(0, l, Menu.NONE, list.getTitle());
|
||||
item.setIcon(R.drawable.ic_list_instance);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
Intent intent = new Intent(BaseMainActivity.this, ListActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("id", list.getId());
|
||||
b.putString("title", list.getTitle());
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
l++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Page Adapter for settings
|
||||
|
|
|
@ -22,11 +22,9 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.TabLayout;
|
||||
|
@ -48,31 +46,20 @@ import android.text.style.UnderlineSpan;
|
|||
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.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
import fr.gouv.etalab.mastodon.R;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.PostActionAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveAccountAsyncTask;
|
||||
|
@ -130,7 +117,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
private ViewPager mPager;
|
||||
private String accountId;
|
||||
private TabLayout tabLayout;
|
||||
private TextView account_note, account_follow_request;
|
||||
private TextView account_note, account_follow_request, account_type;
|
||||
private String userId;
|
||||
private Relationship relationship;
|
||||
private ImageView pp_actionBar;
|
||||
|
@ -145,8 +132,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
private TextView account_un;
|
||||
private Account account;
|
||||
private boolean show_boosts, show_replies;
|
||||
|
||||
|
||||
private boolean showMediaOnly, showPinned;
|
||||
private boolean peertubeAccount;
|
||||
|
||||
public enum action{
|
||||
FOLLOW,
|
||||
|
@ -187,9 +174,10 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
account_pp = findViewById(R.id.account_pp);
|
||||
account_dn = findViewById(R.id.account_dn);
|
||||
account_un = findViewById(R.id.account_un);
|
||||
|
||||
account_type = findViewById(R.id.account_type);
|
||||
if(b != null){
|
||||
accountId = b.getString("accountId");
|
||||
peertubeAccount = b.getBoolean("peertubeAccount", false);
|
||||
new RetrieveRelationshipAsyncTask(getApplicationContext(), accountId,ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveAccountAsyncTask(getApplicationContext(),accountId, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
|
@ -208,69 +196,11 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
|
||||
statusListAdapter = new StatusListAdapter(getApplicationContext(), RetrieveFeedsAsyncTask.Type.USER, accountId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
||||
|
||||
|
||||
showMediaOnly = false;
|
||||
showPinned = false;
|
||||
|
||||
|
||||
tabLayout = findViewById(R.id.account_tabLayout);
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.toots)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.following)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.followers)));
|
||||
|
||||
mPager = findViewById(R.id.account_viewpager);
|
||||
mPager.setOffscreenPageLimit(3);
|
||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
|
||||
mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
TabLayout.Tab tab = tabLayout.getTabAt(position);
|
||||
if( tab != null)
|
||||
tab.select();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
mPager.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
Fragment fragment = null;
|
||||
if( mPager.getAdapter() != null)
|
||||
fragment = (Fragment) mPager.getAdapter().instantiateItem(mPager, tab.getPosition());
|
||||
switch (tab.getPosition()){
|
||||
case 0:
|
||||
if( displayStatusFragment != null )
|
||||
displayStatusFragment.scrollToTop();
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if( fragment != null) {
|
||||
DisplayAccountsFragment displayAccountsFragment = ((DisplayAccountsFragment) fragment);
|
||||
displayAccountsFragment.scrollToTop();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
account_note = findViewById(R.id.account_note);
|
||||
|
||||
|
@ -331,6 +261,11 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
popup.getMenu().findItem(R.id.action_mention).setVisible(true);
|
||||
stringArrayConf = getResources().getStringArray(R.array.more_action_confirm);
|
||||
}
|
||||
if( peertubeAccount){
|
||||
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_direct_message).setVisible(false);
|
||||
}
|
||||
if( relationship != null){
|
||||
if( !relationship.isFollowing()) {
|
||||
popup.getMenu().findItem(R.id.action_hide_boost).setVisible(false);
|
||||
|
@ -371,11 +306,17 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String response = new HttpsConnection(ShowAccountActivity.this).get("https://" + finalInstanceName + "/api/v1/timelines/public?local=true", 10, null, null);
|
||||
if( !peertubeAccount)
|
||||
new HttpsConnection(ShowAccountActivity.this).get("https://" + finalInstanceName + "/api/v1/timelines/public?local=true", 10, null, null);
|
||||
else
|
||||
new HttpsConnection(ShowAccountActivity.this).get("https://" + finalInstanceName + "/api/v1/videos/", 10, null, null);
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
final SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
if( !peertubeAccount)
|
||||
new InstancesDAO(ShowAccountActivity.this, db).insertInstance(finalInstanceName, "MASTODON");
|
||||
else
|
||||
new InstancesDAO(ShowAccountActivity.this, db).insertInstance(finalInstanceName, "PEERTUBE");
|
||||
Toast.makeText(getApplicationContext(), R.string.toast_instance_followed,Toast.LENGTH_LONG).show();
|
||||
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -530,7 +471,10 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
account_dn.setCompoundDrawables( null, null, null, null);
|
||||
}
|
||||
|
||||
|
||||
//Peertube account
|
||||
if( peertubeAccount) {
|
||||
account_type.setVisibility(View.VISIBLE);
|
||||
}
|
||||
TextView actionbar_title = findViewById(R.id.show_account_title);
|
||||
if( account.getAcct() != null)
|
||||
actionbar_title.setText(account.getAcct());
|
||||
|
@ -656,6 +600,70 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
}
|
||||
});
|
||||
|
||||
if( !peertubeAccount) {
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.toots)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.following)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.followers)));
|
||||
}else {
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.videos)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.channels)));
|
||||
}
|
||||
|
||||
mPager = findViewById(R.id.account_viewpager);
|
||||
mPager.setOffscreenPageLimit(3);
|
||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
|
||||
mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
TabLayout.Tab tab = tabLayout.getTabAt(position);
|
||||
if( tab != null)
|
||||
tab.select();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
mPager.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
Fragment fragment = null;
|
||||
if( mPager.getAdapter() != null)
|
||||
fragment = (Fragment) mPager.getAdapter().instantiateItem(mPager, tab.getPosition());
|
||||
switch (tab.getPosition()){
|
||||
case 0:
|
||||
if( displayStatusFragment != null )
|
||||
displayStatusFragment.scrollToTop();
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if( fragment != null) {
|
||||
DisplayAccountsFragment displayAccountsFragment = ((DisplayAccountsFragment) fragment);
|
||||
displayAccountsFragment.scrollToTop();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if ( account.getFields() != null && account.getFields().size() > 0){
|
||||
|
@ -754,7 +762,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
account.makeEmojisAccount(ShowAccountActivity.this, ShowAccountActivity.this);
|
||||
account_note.setText(account.getNoteSpan(), TextView.BufferType.SPANNABLE);
|
||||
account_note.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
if (tabLayout.getTabAt(0) != null && tabLayout.getTabAt(1) != null && tabLayout.getTabAt(2) != null) {
|
||||
if (!peertubeAccount && tabLayout.getTabAt(0) != null && tabLayout.getTabAt(1) != null && tabLayout.getTabAt(2) != null) {
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).setText(getString(R.string.status_cnt, withSuffix(account.getStatuses_count())));
|
||||
//noinspection ConstantConditions
|
||||
|
@ -763,7 +771,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
tabLayout.getTabAt(2).setText(getString(R.string.followers_cnt, withSuffix(account.getFollowers_count())));
|
||||
|
||||
//Allows to filter by long click
|
||||
/*final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
|
||||
final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
|
||||
tabStrip.getChildAt(0).setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
|
@ -837,7 +845,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
popup.show();
|
||||
return true;
|
||||
}
|
||||
});*/
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
@ -995,18 +1003,39 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
Bundle bundle = new Bundle();
|
||||
switch (position){
|
||||
case 0:
|
||||
if( ! peertubeAccount){
|
||||
TabLayoutTootsFragment tabLayoutTootsFragment = new TabLayoutTootsFragment();
|
||||
bundle.putString("targetedId", accountId);
|
||||
tabLayoutTootsFragment.setArguments(bundle);
|
||||
return tabLayoutTootsFragment;
|
||||
}else{
|
||||
DisplayStatusFragment displayStatusFragment = new DisplayStatusFragment();
|
||||
bundle = new Bundle();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.USER);
|
||||
bundle.putString("targetedId", accountId);
|
||||
bundle.putBoolean("showReply",false);
|
||||
displayStatusFragment.setArguments(bundle);
|
||||
return displayStatusFragment;
|
||||
}
|
||||
case 1:
|
||||
if( peertubeAccount){
|
||||
DisplayStatusFragment displayStatusFragment = new DisplayStatusFragment();
|
||||
bundle = new Bundle();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE);
|
||||
bundle.putString("search_peertube", account.getHost());
|
||||
bundle.putBoolean("account_channel",true);
|
||||
displayStatusFragment.setArguments(bundle);
|
||||
return displayStatusFragment;
|
||||
}else{
|
||||
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
|
||||
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.FOLLOWING);
|
||||
bundle.putString("targetedId", accountId);
|
||||
displayAccountsFragment.setArguments(bundle);
|
||||
return displayAccountsFragment;
|
||||
}
|
||||
|
||||
case 2:
|
||||
displayAccountsFragment = new DisplayAccountsFragment();
|
||||
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
|
||||
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.FOLLOWERS);
|
||||
bundle.putString("targetedId", accountId);
|
||||
displayAccountsFragment.setArguments(bundle);
|
||||
|
|
|
@ -121,6 +121,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
showReply = bundle.getBoolean("showReply",false);
|
||||
remoteInstance = bundle.getString("remote_instance", "");
|
||||
search_peertube = bundle.getString("search_peertube", null);
|
||||
|
||||
}
|
||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
if( !remoteInstance.equals("")){
|
||||
|
|
|
@ -234,6 +234,9 @@ public class CrossActions {
|
|||
if( remoteAccounts != null && remoteAccounts.size() > 0) {
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
//Flag it has a peertube account
|
||||
if( remoteAccount.getHost() != null && remoteAccount.getAcct().split("@").length > 1)
|
||||
b.putBoolean("peertubeAccount", true);
|
||||
b.putString("accountId", remoteAccounts.get(0).getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#606984"
|
||||
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#606984"
|
||||
android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM12,14.5v-9l6,4.5 -6,4.5z"/>
|
||||
</vector>
|
|
@ -0,0 +1,11 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke android:width="1dip" android:color="@color/red_1"/>
|
||||
<corners
|
||||
android:radius="2dp">
|
||||
</corners>
|
||||
<padding android:bottom="1dip"
|
||||
android:left="4dip"
|
||||
android:right="4dip"
|
||||
android:top="1dip"/>
|
||||
</shape>
|
|
@ -139,11 +139,6 @@
|
|||
android:maxLines="1"
|
||||
android:textSize="16sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<TextView
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
|
@ -154,7 +149,15 @@
|
|||
android:textSize="14sp"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_marginTop="5dp"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/red_1"
|
||||
android:background="@drawable/red_border"
|
||||
android:text="Peertube"
|
||||
android:id="@+id/account_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/temp_mute"
|
||||
android:visibility="gone"
|
||||
|
|
|
@ -137,10 +137,6 @@
|
|||
android:maxLines="1"
|
||||
android:textSize="16sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
|
@ -151,7 +147,15 @@
|
|||
android:textSize="14sp"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_marginTop="5dp"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/red_1"
|
||||
android:background="@drawable/red_border"
|
||||
android:text="Peertube"
|
||||
android:id="@+id/account_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/temp_mute"
|
||||
android:visibility="gone"
|
||||
|
|
|
@ -1,9 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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">
|
||||
<item
|
||||
android:id="@+id/action_add_instance"
|
||||
android:title="@string/add_remote_instance"
|
||||
android:icon="@drawable/ic_add_instance"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_show_mastodon"
|
||||
android:title="Mastodon"
|
||||
android:icon="@drawable/mastodon_icon_item"
|
||||
app:showAsAction="never"
|
||||
>
|
||||
<menu>
|
||||
<item android:id="@+id/mastodon_instances" android:title="@string/no_mastodon_instances"/>
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/action_show_peertube"
|
||||
android:title="Peertube"
|
||||
android:icon="@drawable/peertube_icon"
|
||||
app:showAsAction="never"
|
||||
>
|
||||
<menu>
|
||||
<item android:id="@+id/peertube_instances" android:title="@string/no_peertube_instances"/>
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/action_show_channel"
|
||||
android:title="@string/channel"
|
||||
android:icon="@drawable/ic_video_channel"
|
||||
app:showAsAction="never"
|
||||
>
|
||||
<menu>
|
||||
<item android:id="@+id/channel_instances" android:title="@string/no_peertube_channels"/>
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/action_show_list"
|
||||
android:title="@string/action_lists"
|
||||
android:icon="@drawable/ic_list_instance"
|
||||
app:showAsAction="never"
|
||||
>
|
||||
<menu>
|
||||
<item android:id="@+id/list_instances" android:title="@string/no_lists"/>
|
||||
</menu>
|
||||
</item>
|
||||
</menu>
|
||||
|
|
|
@ -646,6 +646,13 @@
|
|||
<string name="bookmark_add_peertube">The video has been added to bookmarks!</string>
|
||||
<string name="bookmark_remove_peertube">The video has been removed from bookmarks!</string>
|
||||
<string name="bookmark_peertube_empty">There is no Peertube videos in your favourites!</string>
|
||||
<string name="channel">Channel</string>
|
||||
<string name="no_peertube_channels">No Peertube channels</string>
|
||||
<string name="no_peertube_instances">No Peertube instances</string>
|
||||
<string name="no_mastodon_instances">No Mastodon instances</string>
|
||||
<string name="no_lists">No lists</string>
|
||||
<string name="videos">Videos</string>
|
||||
<string name="channels">Channels</string>
|
||||
|
||||
<string-array name="filter_expire">
|
||||
<item>Never</item>
|
||||
|
|
Loading…
Reference in New Issue