diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java index 10dd2b17d..7665b50f0 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java @@ -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 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 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,37 +351,72 @@ public abstract class BaseMainActivity extends BaseActivity } catch (Exception e) { e.printStackTrace(); } - int i = 0; - if(remoteInstances != null) - for(RemoteInstance remoteInstance: remoteInstances) { - MenuItem item = popup.getMenu().add(0, i, Menu.NONE, remoteInstance.getHost()); - if(remoteInstance.getType() == null || remoteInstance.getType().equals("MASTODON")) - 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) { - 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; + 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) { + 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); + 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; + } + }); + 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 diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java index f75d62053..231db75f3 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java @@ -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(); - new InstancesDAO(ShowAccountActivity.this, db).insertInstance(finalInstanceName, "MASTODON"); + 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: - TabLayoutTootsFragment tabLayoutTootsFragment = new TabLayoutTootsFragment(); - bundle.putString("targetedId", accountId); - tabLayoutTootsFragment.setArguments(bundle); - return tabLayoutTootsFragment; + 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: - DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment(); - bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.FOLLOWING); - bundle.putString("targetedId", accountId); - displayAccountsFragment.setArguments(bundle); - return displayAccountsFragment; + 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); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java index b5f709d24..88eb23b20 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java @@ -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("")){ diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/CrossActions.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/CrossActions.java index 6813e5457..23de2a440 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/CrossActions.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/CrossActions.java @@ -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); diff --git a/app/src/main/res/drawable-anydpi/ic_list_instance.xml b/app/src/main/res/drawable-anydpi/ic_list_instance.xml new file mode 100644 index 000000000..fd7111d5d --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_list_instance.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable-anydpi/ic_video_channel.xml b/app/src/main/res/drawable-anydpi/ic_video_channel.xml new file mode 100644 index 000000000..3cc63f78a --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_video_channel.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/red_border.xml b/app/src/main/res/drawable/red_border.xml new file mode 100644 index 000000000..4879a1244 --- /dev/null +++ b/app/src/main/res/drawable/red_border.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-sw600dp/activity_show_account.xml b/app/src/main/res/layout-sw600dp/activity_show_account.xml index 2f45ae261..904508aab 100644 --- a/app/src/main/res/layout-sw600dp/activity_show_account.xml +++ b/app/src/main/res/layout-sw600dp/activity_show_account.xml @@ -139,22 +139,25 @@ android:maxLines="1" android:textSize="16sp" android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> - - - + /> + - - - + /> + - + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f5fe17eba..88a4c7ec4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -646,6 +646,13 @@ The video has been added to bookmarks! The video has been removed from bookmarks! There is no Peertube videos in your favourites! + Channel + No Peertube channels + No Peertube instances + No Mastodon instances + No lists + Videos + Channels Never