Manage accounts
This commit is contained in:
parent
b4e7c3f8e2
commit
9510678a9f
|
@ -58,6 +58,11 @@
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name=".ShowAccountActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".AccountActivity"
|
android:name=".AccountActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
|
|
|
@ -14,9 +14,6 @@ package app.fedilab.fedilabtube;
|
||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.res.ColorStateList;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
@ -26,8 +23,6 @@ import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -36,7 +31,6 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
|
@ -48,45 +42,34 @@ import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.ChannelData.Channel;
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
||||||
|
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
import app.fedilab.fedilabtube.viewmodel.AccountsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
||||||
import app.fedilab.fedilabtube.viewmodel.RelationshipVM;
|
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.CHANNEL;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.getLiveInstance;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
|
||||||
|
|
||||||
|
|
||||||
public class ShowAccountActivity extends AppCompatActivity {
|
public class ShowAccountActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
private Button account_follow;
|
|
||||||
private ViewPager mPager;
|
private ViewPager mPager;
|
||||||
private TabLayout tabLayout;
|
private TabLayout tabLayout;
|
||||||
private TextView account_note, subscriber_count;
|
private TextView account_note, subscriber_count;
|
||||||
private Map<String, Boolean> relationship;
|
|
||||||
private ImageView account_pp;
|
private ImageView account_pp;
|
||||||
private TextView account_dn;
|
private TextView account_dn;
|
||||||
private Channel channel;
|
private AccountData.Account account;
|
||||||
private action doAction;
|
private String accountAcct;
|
||||||
private String channelAcct;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -94,15 +77,13 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
setContentView(R.layout.activity_show_account);
|
setContentView(R.layout.activity_show_account);
|
||||||
setTitle("");
|
setTitle("");
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
account_follow = findViewById(R.id.account_follow);
|
|
||||||
subscriber_count = findViewById(R.id.subscriber_count);
|
subscriber_count = findViewById(R.id.subscriber_count);
|
||||||
account_follow.setEnabled(false);
|
|
||||||
account_pp = findViewById(R.id.account_pp);
|
account_pp = findViewById(R.id.account_pp);
|
||||||
account_dn = findViewById(R.id.account_dn);
|
account_dn = findViewById(R.id.account_dn);
|
||||||
account_pp.setBackgroundResource(R.drawable.account_pp_border);
|
account_pp.setBackgroundResource(R.drawable.account_pp_border);
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
channel = b.getParcelable("channel");
|
account = b.getParcelable("account");
|
||||||
channelAcct = b.getString("channelId");
|
accountAcct = b.getString("accountAcct");
|
||||||
} else {
|
} else {
|
||||||
Toasty.error(ShowAccountActivity.this, getString(R.string.toast_error_loading_account), Toast.LENGTH_LONG).show();
|
Toasty.error(ShowAccountActivity.this, getString(R.string.toast_error_loading_account), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
@ -114,11 +95,9 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
tabLayout = findViewById(R.id.account_tabLayout);
|
tabLayout = findViewById(R.id.account_tabLayout);
|
||||||
account_note = findViewById(R.id.account_note);
|
account_note = findViewById(R.id.account_note);
|
||||||
|
|
||||||
|
manageAccount();
|
||||||
ChannelsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(ChannelsVM.class);
|
AccountsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(AccountsVM.class);
|
||||||
|
viewModel.getAccount(accountAcct == null ? account.getUsername() + "@" + account.getHost() : accountAcct).observe(ShowAccountActivity.this, this::manageViewAccounts);
|
||||||
manageChannel();
|
|
||||||
viewModel.get(CHANNEL, channelAcct == null ? channel.getName() + "@" + channel.getHost() : channelAcct).observe(ShowAccountActivity.this, this::manageViewAccounts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,7 +116,7 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_mute) {
|
} else if (item.getItemId() == R.id.action_mute) {
|
||||||
PostActionsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(PostActionsVM.class);
|
PostActionsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(PostActionsVM.class);
|
||||||
viewModel.post(MUTE, channel.getOwnerAccount() != null ? channel.getOwnerAccount().getAcct() : channel.getAcct(), null).observe(ShowAccountActivity.this, apiResponse -> manageVIewPostActions(MUTE, apiResponse));
|
viewModel.post(MUTE, accountAcct == null ? account.getUsername() + "@" + account.getHost() : accountAcct, null).observe(ShowAccountActivity.this, apiResponse -> manageVIewPostActions(MUTE, apiResponse));
|
||||||
} else if (item.getItemId() == R.id.action_report) {
|
} else if (item.getItemId() == R.id.action_report) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ShowAccountActivity.this);
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ShowAccountActivity.this);
|
||||||
LayoutInflater inflater1 = getLayoutInflater();
|
LayoutInflater inflater1 = getLayoutInflater();
|
||||||
|
@ -150,7 +129,7 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
Toasty.info(ShowAccountActivity.this, getString(R.string.report_comment_size), Toasty.LENGTH_LONG).show();
|
Toasty.info(ShowAccountActivity.this, getString(R.string.report_comment_size), Toasty.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
PostActionsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(PostActionsVM.class);
|
PostActionsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(PostActionsVM.class);
|
||||||
viewModel.post(REPORT_ACCOUNT, channel.getId(), report_content.getText().toString()).observe(ShowAccountActivity.this, apiResponse -> manageVIewPostActions(REPORT_ACCOUNT, apiResponse));
|
viewModel.post(REPORT_ACCOUNT, account.getId(), report_content.getText().toString()).observe(ShowAccountActivity.this, apiResponse -> manageVIewPostActions(REPORT_ACCOUNT, apiResponse));
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -160,30 +139,18 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void manageChannel() {
|
private void manageAccount() {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
|
||||||
|
|
||||||
String accountIdRelation = channel.getAcct();
|
|
||||||
if (isLoggedIn(ShowAccountActivity.this)) {
|
|
||||||
RelationshipVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(RelationshipVM.class);
|
|
||||||
List<String> uids = new ArrayList<>();
|
|
||||||
uids.add(accountIdRelation);
|
|
||||||
viewModel.get(uids).observe(ShowAccountActivity.this, this::manageVIewRelationship);
|
|
||||||
}
|
|
||||||
|
|
||||||
setTitle(channel.getAcct());
|
|
||||||
|
|
||||||
|
setTitle(account.getAcct());
|
||||||
|
|
||||||
mPager = findViewById(R.id.account_viewpager);
|
mPager = findViewById(R.id.account_viewpager);
|
||||||
|
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.channels)));
|
||||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.videos)));
|
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.videos)));
|
||||||
mPager.setOffscreenPageLimit(1);
|
mPager.setOffscreenPageLimit(2);
|
||||||
|
|
||||||
|
|
||||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||||
mPager.setAdapter(mPagerAdapter);
|
mPager.setAdapter(mPagerAdapter);
|
||||||
ViewGroup.LayoutParams params = tabLayout.getLayoutParams();
|
|
||||||
params.height = 0;
|
|
||||||
tabLayout.setLayoutParams(params);
|
|
||||||
mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
@ -222,111 +189,26 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
switch (tab.getPosition()) {
|
switch (tab.getPosition()) {
|
||||||
case 0:
|
case 0:
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
DisplayVideosFragment displayVideosFragment = ((DisplayVideosFragment) fragment);
|
DisplayChannelsFragment displayChannelsFragment = ((DisplayChannelsFragment) fragment);
|
||||||
displayVideosFragment.scrollToTop();
|
displayChannelsFragment.scrollToTop();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
DisplayAccountsFragment displayAccountsFragment = ((DisplayAccountsFragment) fragment);
|
DisplayVideosFragment displayVideosFragment = ((DisplayVideosFragment) fragment);
|
||||||
displayAccountsFragment.scrollToTop();
|
displayVideosFragment.scrollToTop();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
account_dn.setText(channel.getDisplayName());
|
account_dn.setText(account.getDisplayName());
|
||||||
|
|
||||||
|
manageNotes(account);
|
||||||
manageNotes(channel);
|
Helper.loadGiF(ShowAccountActivity.this, account.getAvatar() != null ? account.getAvatar().getPath() : null, account_pp);
|
||||||
Helper.loadGiF(ShowAccountActivity.this, channel.getAvatar() != null ? channel.getAvatar().getPath() : null, account_pp);
|
|
||||||
//Follow button
|
|
||||||
String target = channel.getAcct();
|
|
||||||
|
|
||||||
account_follow.setOnClickListener(v -> {
|
|
||||||
if (doAction == action.NOTHING) {
|
|
||||||
Toasty.info(ShowAccountActivity.this, getString(R.string.nothing_to_do), Toast.LENGTH_LONG).show();
|
|
||||||
} else if (doAction == action.FOLLOW) {
|
|
||||||
account_follow.setEnabled(false);
|
|
||||||
PostActionsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(PostActionsVM.class);
|
|
||||||
viewModel.post(FOLLOW, target, null).observe(ShowAccountActivity.this, apiResponse -> manageVIewPostActions(FOLLOW, apiResponse));
|
|
||||||
} else if (doAction == action.UNFOLLOW) {
|
|
||||||
boolean confirm_unfollow = sharedpreferences.getBoolean(Helper.SET_UNFOLLOW_VALIDATION, true);
|
|
||||||
if (confirm_unfollow) {
|
|
||||||
AlertDialog.Builder unfollowConfirm = new AlertDialog.Builder(ShowAccountActivity.this);
|
|
||||||
unfollowConfirm.setTitle(getString(R.string.unfollow_confirm));
|
|
||||||
unfollowConfirm.setMessage(channel.getAcct());
|
|
||||||
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
|
||||||
unfollowConfirm.setPositiveButton(R.string.yes, (dialog, which) -> {
|
|
||||||
account_follow.setEnabled(false);
|
|
||||||
PostActionsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(PostActionsVM.class);
|
|
||||||
viewModel.post(UNFOLLOW, target, null).observe(ShowAccountActivity.this, apiResponse -> manageVIewPostActions(UNFOLLOW, apiResponse));
|
|
||||||
dialog.dismiss();
|
|
||||||
});
|
|
||||||
unfollowConfirm.show();
|
|
||||||
} else {
|
|
||||||
account_follow.setEnabled(false);
|
|
||||||
PostActionsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(PostActionsVM.class);
|
|
||||||
viewModel.post(UNFOLLOW, target, null).observe(ShowAccountActivity.this, apiResponse -> manageVIewPostActions(UNFOLLOW, apiResponse));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void manageVIewRelationship(APIResponse apiResponse) {
|
|
||||||
|
|
||||||
if (apiResponse.getError() != null) {
|
|
||||||
Toasty.error(ShowAccountActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.relationship = apiResponse.getRelationships();
|
|
||||||
manageButtonVisibility();
|
|
||||||
|
|
||||||
invalidateOptionsMenu();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Manages the visibility of the button
|
|
||||||
private void manageButtonVisibility() {
|
|
||||||
if (relationship == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
int[][] states = new int[][]{
|
|
||||||
new int[]{android.R.attr.state_enabled}, // enabled
|
|
||||||
new int[]{-android.R.attr.state_enabled}, // disabled
|
|
||||||
new int[]{-android.R.attr.state_checked}, // unchecked
|
|
||||||
new int[]{android.R.attr.state_pressed} // pressed
|
|
||||||
};
|
|
||||||
|
|
||||||
int[] colors = new int[]{
|
|
||||||
ContextCompat.getColor(ShowAccountActivity.this, Helper.getColorAccent()),
|
|
||||||
ContextCompat.getColor(ShowAccountActivity.this, Helper.getColorAccent()),
|
|
||||||
ContextCompat.getColor(ShowAccountActivity.this, Helper.getColorAccent()),
|
|
||||||
ContextCompat.getColor(ShowAccountActivity.this, Helper.getColorAccent())
|
|
||||||
};
|
|
||||||
account_follow.setBackgroundTintList(new ColorStateList(states, colors));
|
|
||||||
}
|
|
||||||
account_follow.setEnabled(true);
|
|
||||||
|
|
||||||
boolean isFollowing = relationship.get(channel.getAcct());
|
|
||||||
if (isFollowing) {
|
|
||||||
account_follow.setText(R.string.action_unfollow);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
account_follow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(ShowAccountActivity.this, R.color.red_1)));
|
|
||||||
}
|
|
||||||
doAction = action.UNFOLLOW;
|
|
||||||
} else {
|
|
||||||
account_follow.setText(R.string.action_follow);
|
|
||||||
doAction = action.FOLLOW;
|
|
||||||
}
|
|
||||||
account_follow.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
@ -344,47 +226,31 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
Toasty.error(ShowAccountActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
Toasty.error(ShowAccountActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String target = channel.getAcct();
|
if (statusAction == RetrofitPeertubeAPI.ActionType.MUTE) {
|
||||||
//IF action is unfollow or mute, sends an intent to remove statuses
|
|
||||||
if (statusAction == RetrofitPeertubeAPI.ActionType.UNFOLLOW) {
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
b.putString("receive_action", apiResponse.getTargetedId());
|
|
||||||
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
|
||||||
intentBC.putExtras(b);
|
|
||||||
}
|
|
||||||
if (statusAction == RetrofitPeertubeAPI.ActionType.UNFOLLOW || statusAction == RetrofitPeertubeAPI.ActionType.FOLLOW) {
|
|
||||||
RelationshipVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(RelationshipVM.class);
|
|
||||||
List<String> uris = new ArrayList<>();
|
|
||||||
uris.add(target);
|
|
||||||
viewModel.get(uris).observe(ShowAccountActivity.this, this::manageVIewRelationship);
|
|
||||||
} else if (statusAction == RetrofitPeertubeAPI.ActionType.MUTE) {
|
|
||||||
Toasty.info(ShowAccountActivity.this, getString(R.string.muted_done), Toast.LENGTH_LONG).show();
|
Toasty.info(ShowAccountActivity.this, getString(R.string.muted_done), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manageViewAccounts(APIResponse apiResponse) {
|
public void manageViewAccounts(APIResponse apiResponse) {
|
||||||
if (apiResponse.getChannels() != null && apiResponse.getChannels().size() == 1) {
|
if (apiResponse.getAccounts() != null && apiResponse.getAccounts().size() == 1) {
|
||||||
Channel channel = apiResponse.getChannels().get(0);
|
AccountData.Account account = apiResponse.getAccounts().get(0);
|
||||||
if (this.channel == null) {
|
if (this.account == null) {
|
||||||
this.channel = channel;
|
this.account = account;
|
||||||
manageChannel();
|
manageAccount();
|
||||||
}
|
}
|
||||||
if (channel.getOwnerAccount() != null) {
|
subscriber_count.setText(getString(R.string.followers_count, Helper.withSuffix(account.getFollowersCount())));
|
||||||
this.channel.setOwnerAccount(channel.getOwnerAccount());
|
|
||||||
}
|
|
||||||
subscriber_count.setText(getString(R.string.followers_count, Helper.withSuffix(channel.getFollowersCount())));
|
|
||||||
subscriber_count.setVisibility(View.VISIBLE);
|
subscriber_count.setVisibility(View.VISIBLE);
|
||||||
manageNotes(channel);
|
manageNotes(account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void manageNotes(Channel channel) {
|
private void manageNotes(AccountData.Account account) {
|
||||||
if (channel.getDescription() != null && channel.getDescription().compareTo("null") != 0 && channel.getDescription().trim().length() > 0) {
|
if (account.getDescription() != null && account.getDescription().compareTo("null") != 0 && account.getDescription().trim().length() > 0) {
|
||||||
SpannableString spannableString;
|
SpannableString spannableString;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
spannableString = new SpannableString(Html.fromHtml(channel.getDescription(), FROM_HTML_MODE_LEGACY));
|
spannableString = new SpannableString(Html.fromHtml(account.getDescription(), FROM_HTML_MODE_LEGACY));
|
||||||
else
|
else
|
||||||
spannableString = new SpannableString(Html.fromHtml(channel.getDescription()));
|
spannableString = new SpannableString(Html.fromHtml(account.getDescription()));
|
||||||
|
|
||||||
account_note.setText(spannableString, TextView.BufferType.SPANNABLE);
|
account_note.setText(spannableString, TextView.BufferType.SPANNABLE);
|
||||||
account_note.setMovementMethod(LinkMovementMethod.getInstance());
|
account_note.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
@ -394,11 +260,6 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum action {
|
|
||||||
FOLLOW,
|
|
||||||
UNFOLLOW,
|
|
||||||
NOTHING
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pager adapter for the 2 fragments
|
* Pager adapter for the 2 fragments
|
||||||
|
@ -414,25 +275,24 @@ public class ShowAccountActivity extends AppCompatActivity {
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
|
DisplayChannelsFragment displayChannelsFragment = new DisplayChannelsFragment();
|
||||||
|
bundle.putString("name", account.getAcct());
|
||||||
|
bundle.putBoolean("myChannels", false);
|
||||||
|
displayChannelsFragment.setArguments(bundle);
|
||||||
|
return displayChannelsFragment;
|
||||||
|
}
|
||||||
DisplayVideosFragment displayVideosFragment = new DisplayVideosFragment();
|
DisplayVideosFragment displayVideosFragment = new DisplayVideosFragment();
|
||||||
bundle = new Bundle();
|
bundle.putSerializable(Helper.TIMELINE_TYPE, TimelineVM.TimelineType.ACCOUNT_VIDEOS);
|
||||||
bundle.putSerializable("type", TimelineVM.TimelineType.USER_VIDEOS);
|
bundle.putString("channelId", account.getAcct());
|
||||||
bundle.putString("channelId", channel.getAcct());
|
bundle.putString("peertube_instance", account.getHost());
|
||||||
displayVideosFragment.setArguments(bundle);
|
displayVideosFragment.setArguments(bundle);
|
||||||
return displayVideosFragment;
|
return displayVideosFragment;
|
||||||
}
|
}
|
||||||
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
|
|
||||||
bundle.putString("targetedid", channel.getId());
|
|
||||||
bundle.putString("instance", getLiveInstance(ShowAccountActivity.this));
|
|
||||||
bundle.putString("name", channel.getAcct());
|
|
||||||
displayAccountsFragment.setArguments(bundle);
|
|
||||||
return displayAccountsFragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return 1;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_show_account);
|
setContentView(R.layout.activity_show_channel);
|
||||||
setTitle("");
|
setTitle("");
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
account_follow = findViewById(R.id.account_follow);
|
account_follow = findViewById(R.id.account_follow);
|
||||||
|
@ -417,7 +417,7 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
DisplayVideosFragment displayVideosFragment = new DisplayVideosFragment();
|
DisplayVideosFragment displayVideosFragment = new DisplayVideosFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable(Helper.TIMELINE_TYPE, TimelineVM.TimelineType.USER_VIDEOS);
|
bundle.putSerializable(Helper.TIMELINE_TYPE, TimelineVM.TimelineType.CHANNEL_VIDEOS);
|
||||||
bundle.putString("channelId", channel.getAcct());
|
bundle.putString("channelId", channel.getAcct());
|
||||||
bundle.putString("peertube_instance", channel.getHost());
|
bundle.putString("peertube_instance", channel.getHost());
|
||||||
bundle.putBoolean("sepia_search", sepiaSearch);
|
bundle.putBoolean("sepia_search", sepiaSearch);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
import app.fedilab.fedilabtube.client.data.BlockData;
|
import app.fedilab.fedilabtube.client.data.BlockData;
|
||||||
import app.fedilab.fedilabtube.client.data.CaptionData;
|
import app.fedilab.fedilabtube.client.data.CaptionData;
|
||||||
import app.fedilab.fedilabtube.client.data.ChannelData;
|
import app.fedilab.fedilabtube.client.data.ChannelData;
|
||||||
|
@ -165,7 +166,7 @@ public interface PeertubeService {
|
||||||
|
|
||||||
//Get my video
|
//Get my video
|
||||||
@GET("accounts/{name}/videos?sort=-publishedAt")
|
@GET("accounts/{name}/videos?sort=-publishedAt")
|
||||||
Call<VideoData.Video> getVideosForAccount(@Query("start") String maxId, @Query("count") String count);
|
Call<VideoData> getVideosForAccount(@Path("name") String name, @Query("start") String maxId, @Query("count") String count);
|
||||||
|
|
||||||
@Multipart
|
@Multipart
|
||||||
@PUT("videos/{id}")
|
@PUT("videos/{id}")
|
||||||
|
@ -228,6 +229,11 @@ public interface PeertubeService {
|
||||||
@GET("video-playlists")
|
@GET("video-playlists")
|
||||||
Call<PlaylistData> getPlaylists();
|
Call<PlaylistData> getPlaylists();
|
||||||
|
|
||||||
|
|
||||||
|
//Get a single account
|
||||||
|
@GET("accounts/{accountHandle}")
|
||||||
|
Call<AccountData.Account> getAccount(@Path("accountHandle") String accountHandle);
|
||||||
|
|
||||||
//Get/Post/Update/Delete playlist
|
//Get/Post/Update/Delete playlist
|
||||||
@GET("accounts/{accountHandle}/video-playlists")
|
@GET("accounts/{accountHandle}/video-playlists")
|
||||||
Call<PlaylistData> getPlaylistsForAccount(@Header("Authorization") String credentials, @Path("accountHandle") String accountHandle);
|
Call<PlaylistData> getPlaylistsForAccount(@Header("Authorization") String credentials, @Path("accountHandle") String accountHandle);
|
||||||
|
|
|
@ -320,6 +320,9 @@ public class RetrofitPeertubeAPI {
|
||||||
case MY_VIDEOS:
|
case MY_VIDEOS:
|
||||||
videoCall = peertubeService.getMyVideos(getToken(), max_id, count);
|
videoCall = peertubeService.getMyVideos(getToken(), max_id, count);
|
||||||
break;
|
break;
|
||||||
|
case ACCOUNT_VIDEOS:
|
||||||
|
videoCall = peertubeService.getVideosForAccount(forAccount, max_id, count);
|
||||||
|
break;
|
||||||
case SUBSCRIBTIONS:
|
case SUBSCRIBTIONS:
|
||||||
if (forAccount == null) {
|
if (forAccount == null) {
|
||||||
videoCall = peertubeService.getSubscriptionVideos(getToken(), max_id, count, filter);
|
videoCall = peertubeService.getSubscriptionVideos(getToken(), max_id, count, filter);
|
||||||
|
@ -844,6 +847,38 @@ public class RetrofitPeertubeAPI {
|
||||||
return apiResponse;
|
return apiResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get single account by its handle
|
||||||
|
*
|
||||||
|
* @param accountHandle String
|
||||||
|
* @return APIResponse
|
||||||
|
*/
|
||||||
|
public APIResponse getAccount(String accountHandle) {
|
||||||
|
PeertubeService peertubeService = init();
|
||||||
|
Call<AccountData.Account> accountDataCall = peertubeService.getAccount(accountHandle);
|
||||||
|
APIResponse apiResponse = new APIResponse();
|
||||||
|
if (accountDataCall != null) {
|
||||||
|
try {
|
||||||
|
Response<AccountData.Account> response = accountDataCall.execute();
|
||||||
|
if (response.isSuccessful() && response.body() != null) {
|
||||||
|
List<AccountData.Account> accountList = new ArrayList<>();
|
||||||
|
accountList.add(response.body());
|
||||||
|
apiResponse.setAccounts(accountList);
|
||||||
|
} else {
|
||||||
|
setError(apiResponse, response.code(), response.errorBody());
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Error error = new Error();
|
||||||
|
error.setError(_context.getString(R.string.toast_error));
|
||||||
|
apiResponse.setError(error);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get muted accounts
|
* Get muted accounts
|
||||||
*
|
*
|
||||||
|
|
|
@ -46,12 +46,14 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||||
|
|
||||||
public AllChannelRemoved allChannelRemoved;
|
public AllChannelRemoved allChannelRemoved;
|
||||||
public EditAlertDialog editAlertDialog;
|
public EditAlertDialog editAlertDialog;
|
||||||
private List<Channel> channels;
|
private final List<Channel> channels;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
private final boolean myChannel;
|
||||||
|
|
||||||
|
|
||||||
public ChannelListAdapter(List<Channel> channels) {
|
public ChannelListAdapter(List<Channel> channels, boolean myChannel) {
|
||||||
this.channels = channels;
|
this.channels = channels;
|
||||||
|
this.myChannel = myChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -75,7 +77,9 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||||
//Profile picture
|
//Profile picture
|
||||||
Helper.loadGiF(context, channel.getAvatar() != null ? channel.getAvatar().getPath() : null, holder.account_pp);
|
Helper.loadGiF(context, channel.getAvatar() != null ? channel.getAvatar().getPath() : null, holder.account_pp);
|
||||||
|
|
||||||
|
if( !this.myChannel) {
|
||||||
|
holder.more_actions.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
holder.more_actions.setOnClickListener(view -> {
|
holder.more_actions.setOnClickListener(view -> {
|
||||||
PopupMenu popup = new PopupMenu(context, holder.more_actions);
|
PopupMenu popup = new PopupMenu(context, holder.more_actions);
|
||||||
popup.getMenuInflater()
|
popup.getMenuInflater()
|
||||||
|
@ -84,8 +88,8 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||||
popup.getMenu().findItem(R.id.action_delete).setEnabled(false);
|
popup.getMenu().findItem(R.id.action_delete).setEnabled(false);
|
||||||
}
|
}
|
||||||
popup.setOnMenuItemClickListener(item -> {
|
popup.setOnMenuItemClickListener(item -> {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.action_delete:
|
if (itemId == R.id.action_delete) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(context.getString(R.string.delete_channel) + ": " + channel.getName());
|
builder.setTitle(context.getString(R.string.delete_channel) + ": " + channel.getName());
|
||||||
builder.setMessage(context.getString(R.string.action_channel_confirm_delete));
|
builder.setMessage(context.getString(R.string.action_channel_confirm_delete));
|
||||||
|
@ -107,12 +111,10 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||||
.show();
|
.show();
|
||||||
break;
|
} else if (itemId == R.id.action_edit) {
|
||||||
case R.id.action_edit:
|
|
||||||
if (context instanceof AccountActivity) {
|
if (context instanceof AccountActivity) {
|
||||||
editAlertDialog.show(channel);
|
editAlertDialog.show(channel);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||||
Notification notification = notifications.get(position);
|
Notification notification = notifications.get(position);
|
||||||
//Follow Notification
|
//Follow Notification
|
||||||
|
|
||||||
|
holder.peertube_notif_pp.setVisibility(View.VISIBLE);
|
||||||
AccountData.Account accountAction = null;
|
AccountData.Account accountAction = null;
|
||||||
ChannelData.Channel channelAction = null;
|
ChannelData.Channel channelAction = null;
|
||||||
if (notification.getActorFollow() != null) {
|
if (notification.getActorFollow() != null) {
|
||||||
|
@ -77,7 +77,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||||
Actor accountActionFollow = notification.getActorFollow().getFollower();
|
Actor accountActionFollow = notification.getActorFollow().getFollower();
|
||||||
String type = notification.getActorFollow().getFollowing().getType();
|
String type = notification.getActorFollow().getFollowing().getType();
|
||||||
String message;
|
String message;
|
||||||
if (type != null && type.equals("account")) {
|
if (type != null && type.compareTo("channel") == 0) {
|
||||||
message = context.getString(R.string.peertube_follow_channel, notification.getActorFollow().getFollower().getDisplayName(), notification.getActorFollow().getFollowing().getDisplayName());
|
message = context.getString(R.string.peertube_follow_channel, notification.getActorFollow().getFollower().getDisplayName(), notification.getActorFollow().getFollowing().getDisplayName());
|
||||||
} else {
|
} else {
|
||||||
message = context.getString(R.string.peertube_follow_account, accountActionFollow.getDisplayName());
|
message = context.getString(R.string.peertube_follow_account, accountActionFollow.getDisplayName());
|
||||||
|
@ -86,13 +86,12 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||||
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
|
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
|
||||||
else
|
else
|
||||||
holder.peertube_notif_message.setText(Html.fromHtml(message));
|
holder.peertube_notif_message.setText(Html.fromHtml(message));
|
||||||
holder.peertube_notif_pp.setOnClickListener(v -> {
|
Actor actor = notification.getActorFollow().getFollower();
|
||||||
Intent intent = new Intent(context, ShowChannelActivity.class);
|
accountAction = new AccountData.Account();
|
||||||
Bundle b = new Bundle();
|
accountAction.setAvatar(actor.getAvatar());
|
||||||
b.putString("channelId", accountActionFollow.getName() + "@" + accountActionFollow.getHost());
|
accountAction.setDisplayName(actor.getDisplayName());
|
||||||
intent.putExtras(b);
|
accountAction.setHost(actor.getHost());
|
||||||
context.startActivity(intent);
|
accountAction.setUsername(actor.getName());
|
||||||
});
|
|
||||||
} else if (notification.getComment() != null) { //Comment Notification
|
} else if (notification.getComment() != null) { //Comment Notification
|
||||||
String profileUrl = notification.getComment().getAccount().getAvatar() != null ? notification.getComment().getAccount().getAvatar().getPath() : null;
|
String profileUrl = notification.getComment().getAccount().getAvatar() != null ? notification.getComment().getAccount().getAvatar().getPath() : null;
|
||||||
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
|
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
|
||||||
|
@ -117,10 +116,9 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||||
} else {
|
} else {
|
||||||
String profileUrl = notification.getVideo() != null && notification.getVideo().getChannel().getAvatar() != null ? notification.getVideo().getChannel().getAvatar().getPath() : null;
|
String profileUrl = notification.getVideo() != null && notification.getVideo().getChannel().getAvatar() != null ? notification.getVideo().getChannel().getAvatar().getPath() : null;
|
||||||
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
|
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
|
||||||
|
|
||||||
|
|
||||||
String message = "";
|
String message = "";
|
||||||
boolean myVideo = false;
|
boolean myVideo = false;
|
||||||
|
holder.peertube_notif_pp.setVisibility(View.INVISIBLE);
|
||||||
if (notification.getVideo() != null) {
|
if (notification.getVideo() != null) {
|
||||||
if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_PUBLISHED) {
|
if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_PUBLISHED) {
|
||||||
message = context.getString(R.string.peertube_video_published, notification.getVideo().getName());
|
message = context.getString(R.string.peertube_video_published, notification.getVideo().getName());
|
||||||
|
@ -134,8 +132,10 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||||
} else if (notification.getType() == DisplayNotificationsFragment.NEW_VIDEO_FROM_SUBSCRIPTION) {
|
} else if (notification.getType() == DisplayNotificationsFragment.NEW_VIDEO_FROM_SUBSCRIPTION) {
|
||||||
channelAction = notification.getVideo().getChannel();
|
channelAction = notification.getVideo().getChannel();
|
||||||
message = context.getString(R.string.peertube_video_from_subscription, channelAction.getDisplayName(), notification.getVideo().getName());
|
message = context.getString(R.string.peertube_video_from_subscription, channelAction.getDisplayName(), notification.getVideo().getName());
|
||||||
|
holder.peertube_notif_pp.setVisibility(View.VISIBLE);
|
||||||
} else if (notification.getType() == DisplayNotificationsFragment.BLACKLIST_ON_MY_VIDEO) {
|
} else if (notification.getType() == DisplayNotificationsFragment.BLACKLIST_ON_MY_VIDEO) {
|
||||||
message = context.getString(R.string.peertube_video_blacklist, notification.getVideo().getName());
|
message = context.getString(R.string.peertube_video_blacklist, notification.getVideo().getName());
|
||||||
|
|
||||||
} else if (notification.getType() == DisplayNotificationsFragment.UNBLACKLIST_ON_MY_VIDEO) {
|
} else if (notification.getType() == DisplayNotificationsFragment.UNBLACKLIST_ON_MY_VIDEO) {
|
||||||
message = context.getString(R.string.peertube_video_unblacklist, notification.getVideo().getName());
|
message = context.getString(R.string.peertube_video_unblacklist, notification.getVideo().getName());
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,6 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
holder.peertube_notif_date.setText(Helper.dateDiff(context, notification.getCreatedAt()));
|
holder.peertube_notif_date.setText(Helper.dateDiff(context, notification.getCreatedAt()));
|
||||||
|
|
||||||
AccountData.Account finalAccountAction = accountAction;
|
AccountData.Account finalAccountAction = accountAction;
|
||||||
ChannelData.Channel finalChannelAction = channelAction;
|
ChannelData.Channel finalChannelAction = channelAction;
|
||||||
holder.peertube_notif_pp.setOnClickListener(v -> {
|
holder.peertube_notif_pp.setOnClickListener(v -> {
|
||||||
|
@ -180,7 +179,8 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||||
Intent intent = null;
|
Intent intent = null;
|
||||||
if (finalAccountAction != null) {
|
if (finalAccountAction != null) {
|
||||||
intent = new Intent(context, ShowAccountActivity.class);
|
intent = new Intent(context, ShowAccountActivity.class);
|
||||||
b.putString("channel", finalAccountAction.getAcct());
|
b.putParcelable("account", finalAccountAction);
|
||||||
|
b.putString("accountAcct", finalAccountAction.getUsername()+"@"+finalAccountAction.getHost());
|
||||||
} else if (finalChannelAction != null) {
|
} else if (finalChannelAction != null) {
|
||||||
intent = new Intent(context, ShowChannelActivity.class);
|
intent = new Intent(context, ShowChannelActivity.class);
|
||||||
b.putParcelable("channel", finalChannelAction);
|
b.putParcelable("channel", finalChannelAction);
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
||||||
private RecyclerView lv_channels;
|
private RecyclerView lv_channels;
|
||||||
private View rootView;
|
private View rootView;
|
||||||
private FloatingActionButton action_button;
|
private FloatingActionButton action_button;
|
||||||
|
private boolean myChannels;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
@ -76,8 +77,10 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
||||||
context = getContext();
|
context = getContext();
|
||||||
Bundle bundle = this.getArguments();
|
Bundle bundle = this.getArguments();
|
||||||
channels = new ArrayList<>();
|
channels = new ArrayList<>();
|
||||||
|
myChannels = true;
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
name = bundle.getString("name", null);
|
name = bundle.getString("name", null);
|
||||||
|
myChannels = bundle.getBoolean("myChannels", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
swiped = false;
|
swiped = false;
|
||||||
|
@ -86,9 +89,11 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
||||||
|
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
action_button = getActivity().findViewById(R.id.action_button);
|
action_button = getActivity().findViewById(R.id.action_button);
|
||||||
|
if( action_button != null) {
|
||||||
action_button.setVisibility(View.VISIBLE);
|
action_button.setVisibility(View.VISIBLE);
|
||||||
action_button.setOnClickListener(view -> manageAlert(null));
|
action_button.setOnClickListener(view -> manageAlert(null));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lv_channels = rootView.findViewById(R.id.lv_elements);
|
lv_channels = rootView.findViewById(R.id.lv_elements);
|
||||||
lv_channels.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
|
lv_channels.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
|
||||||
|
@ -97,7 +102,7 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
||||||
textviewNoAction = rootView.findViewById(R.id.no_action);
|
textviewNoAction = rootView.findViewById(R.id.no_action);
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
mainLoader.setVisibility(View.VISIBLE);
|
||||||
nextElementLoader.setVisibility(View.GONE);
|
nextElementLoader.setVisibility(View.GONE);
|
||||||
channelListAdapter = new ChannelListAdapter(this.channels);
|
channelListAdapter = new ChannelListAdapter(this.channels, myChannels);
|
||||||
channelListAdapter.allChannelRemoved = this;
|
channelListAdapter.allChannelRemoved = this;
|
||||||
channelListAdapter.editAlertDialog = this;
|
channelListAdapter.editAlertDialog = this;
|
||||||
lv_channels.setAdapter(channelListAdapter);
|
lv_channels.setAdapter(channelListAdapter);
|
||||||
|
@ -170,7 +175,7 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
||||||
textviewNoAction.setVisibility(View.GONE);
|
textviewNoAction.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (swiped) {
|
if (swiped) {
|
||||||
channelListAdapter = new ChannelListAdapter(this.channels);
|
channelListAdapter = new ChannelListAdapter(this.channels, myChannels);
|
||||||
channelListAdapter.allChannelRemoved = DisplayChannelsFragment.this;
|
channelListAdapter.allChannelRemoved = DisplayChannelsFragment.this;
|
||||||
channelListAdapter.editAlertDialog = DisplayChannelsFragment.this;
|
channelListAdapter.editAlertDialog = DisplayChannelsFragment.this;
|
||||||
lv_channels.setAdapter(channelListAdapter);
|
lv_channels.setAdapter(channelListAdapter);
|
||||||
|
@ -267,12 +272,16 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
||||||
}
|
}
|
||||||
channelListAdapter.notifyItemChanged(position);
|
channelListAdapter.notifyItemChanged(position);
|
||||||
}
|
}
|
||||||
|
if( action_button != null) {
|
||||||
action_button.setEnabled(true);
|
action_button.setEnabled(true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
mainHandler.post(myRunnable);
|
mainHandler.post(myRunnable);
|
||||||
}).start();
|
}).start();
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
|
if( action_button != null) {
|
||||||
action_button.setEnabled(false);
|
action_button.setEnabled(false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Toasty.error(context, context.getString(R.string.error_display_name_channel), Toast.LENGTH_LONG).show();
|
Toasty.error(context, context.getString(R.string.error_display_name_channel), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
playlistId = bundle.getString("playlistId", null);
|
playlistId = bundle.getString("playlistId", null);
|
||||||
}
|
}
|
||||||
max_id = "0";
|
max_id = "0";
|
||||||
forAccount = null;
|
forAccount = type== TimelineVM.TimelineType.ACCOUNT_VIDEOS?channelId: null;
|
||||||
lv_status = rootView.findViewById(R.id.lv_status);
|
lv_status = rootView.findViewById(R.id.lv_status);
|
||||||
RecyclerView lv_accounts = rootView.findViewById(R.id.lv_accounts);
|
RecyclerView lv_accounts = rootView.findViewById(R.id.lv_accounts);
|
||||||
Button display_all = rootView.findViewById(R.id.display_all);
|
Button display_all = rootView.findViewById(R.id.display_all);
|
||||||
|
@ -497,7 +497,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
*/
|
*/
|
||||||
private void loadTimeline(String max_id) {
|
private void loadTimeline(String max_id) {
|
||||||
if (search_peertube == null) { //Not a Peertube search
|
if (search_peertube == null) { //Not a Peertube search
|
||||||
if (type == TimelineVM.TimelineType.USER_VIDEOS) {
|
if (type == TimelineVM.TimelineType.CHANNEL_VIDEOS) {
|
||||||
viewModelFeeds.getVideosInChannel(sepiaSearch?remoteInstance:null, channelId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.getVideosInChannel(sepiaSearch?remoteInstance:null, channelId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
} else if (type == TimelineVM.TimelineType.VIDEOS_IN_PLAYLIST) {
|
} else if (type == TimelineVM.TimelineType.VIDEOS_IN_PLAYLIST) {
|
||||||
viewModelFeeds.loadVideosInPlaylist(playlistId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.loadVideosInPlaylist(playlistId, max_id).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
|
@ -523,9 +523,9 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
|
|
||||||
static class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
|
static class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
|
||||||
private int spanCount;
|
private final int spanCount;
|
||||||
private int spacing;
|
private final int spacing;
|
||||||
private boolean includeEdge;
|
private final boolean includeEdge;
|
||||||
|
|
||||||
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
|
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
|
||||||
this.spanCount = spanCount;
|
this.spanCount = spanCount;
|
||||||
|
|
|
@ -41,6 +41,12 @@ public class AccountsVM extends AndroidViewModel {
|
||||||
return apiResponseMutableLiveData;
|
return apiResponseMutableLiveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<APIResponse> getAccount(String acct) {
|
||||||
|
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||||
|
loadAccount(acct);
|
||||||
|
return apiResponseMutableLiveData;
|
||||||
|
}
|
||||||
|
|
||||||
private void loadAccounts(RetrofitPeertubeAPI.DataType dataType, String element) {
|
private void loadAccounts(RetrofitPeertubeAPI.DataType dataType, String element) {
|
||||||
Context _mContext = getApplication().getApplicationContext();
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
@ -62,4 +68,18 @@ public class AccountsVM extends AndroidViewModel {
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadAccount(String acct) {
|
||||||
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
RetrofitPeertubeAPI retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
||||||
|
APIResponse apiResponse = retrofitPeertubeAPI.getAccount(acct);
|
||||||
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Runnable myRunnable = () -> apiResponseMutableLiveData.setValue(apiResponse);
|
||||||
|
mainHandler.post(myRunnable);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,8 @@ public class TimelineVM extends AndroidViewModel {
|
||||||
|
|
||||||
|
|
||||||
public enum TimelineType {
|
public enum TimelineType {
|
||||||
USER_VIDEOS,
|
CHANNEL_VIDEOS,
|
||||||
|
ACCOUNT_VIDEOS,
|
||||||
SUBSCRIBTIONS,
|
SUBSCRIBTIONS,
|
||||||
MY_VIDEOS,
|
MY_VIDEOS,
|
||||||
LOCAL,
|
LOCAL,
|
||||||
|
|
|
@ -83,34 +83,10 @@
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/account_follow"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/account_pp"
|
app:layout_constraintStart_toEndOf="@+id/account_pp"
|
||||||
app:layout_constraintTop_toBottomOf="@id/account_dn" />
|
app:layout_constraintTop_toBottomOf="@id/account_dn" />
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/account_follow"
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:contentDescription="@string/make_an_action"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/subscriber_count"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/account_dn" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:contentDescription="@string/edit_profile"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/ic_baseline_edit_24"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/subscriber_count"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/account_dn" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
@ -135,11 +111,8 @@
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/account_tabLayout"
|
android:id="@+id/account_tabLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -157,14 +130,4 @@
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/action_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|end"
|
|
||||||
android:layout_margin="@dimen/fab_margin_button"
|
|
||||||
android:src="@drawable/ic_baseline_add_24"
|
|
||||||
android:tint="@android:color/white"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -0,0 +1,170 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Copyright 2020 Thomas Schneider
|
||||||
|
|
||||||
|
This file is a part of TubeLab
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||||
|
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
|
see <http://www.gnu.org/licenses>.
|
||||||
|
-->
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
tools:context=".ShowChannelActivity">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
app:contentScrim="?attr/colorPrimary"
|
||||||
|
app:expandedTitleMarginEnd="64dp"
|
||||||
|
app:expandedTitleMarginStart="48dp"
|
||||||
|
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/top_banner"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/account_pp"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="@drawable/account_pp_border"
|
||||||
|
android:contentDescription="@string/profile_picture"
|
||||||
|
android:padding="2dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/account_dn"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/subscriber_count"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/account_pp"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/account_pp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subscriber_count"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:visibility="invisible"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/account_follow"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/account_pp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/account_dn" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/account_follow"
|
||||||
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:contentDescription="@string/make_an_action"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/subscriber_count"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/account_dn" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:contentDescription="@string/edit_profile"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/ic_baseline_edit_24"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/subscriber_count"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/account_dn" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/top_banner"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/account_note"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textIsSelectable="true"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/account_tabLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:tabGravity="fill"
|
||||||
|
app:tabMode="fixed"
|
||||||
|
app:tabSelectedTextColor="?colorAccent"
|
||||||
|
app:tabTextColor="@android:color/white" />
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.viewpager.widget.ViewPager
|
||||||
|
android:id="@+id/account_viewpager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/action_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_margin="@dimen/fab_margin_button"
|
||||||
|
android:src="@drawable/ic_baseline_add_24"
|
||||||
|
android:tint="@android:color/white"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
Loading…
Reference in New Issue