mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 01:00:04 +02:00
Some cleaning
This commit is contained in:
parent
8b26deb064
commit
bf8543bc77
14 changed files with 51 additions and 51 deletions
|
@ -65,8 +65,7 @@ public class AccountActivity extends BaseBarActivity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivityAccountPeertubeBinding.inflate(getLayoutInflater());
|
binding = ActivityAccountPeertubeBinding.inflate(getLayoutInflater());
|
||||||
View view = binding.getRoot();
|
setContentView(binding.getRoot());
|
||||||
setContentView(view);
|
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
|
|
@ -518,7 +518,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
|
||||||
account.refresh_token = token.getRefresh_token();
|
account.refresh_token = token.getRefresh_token();
|
||||||
account.peertube_account = userMe.getAccount();
|
account.peertube_account = userMe.getAccount();
|
||||||
account.software = Account.API.PEERTUBE.name();
|
account.software = Account.API.PEERTUBE.name();
|
||||||
account.user_id = userMe.getAccount().getUserId();
|
account.user_id = userMe.getAccount().getId();
|
||||||
account.instance = userMe.getAccount().getHost();
|
account.instance = userMe.getAccount().getHost();
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(PREF_USER_TOKEN, token.getAccess_token());
|
editor.putString(PREF_USER_TOKEN, token.getAccess_token());
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class RetrofitPeertubeAPI {
|
||||||
account.api = Account.API.PEERTUBE;
|
account.api = Account.API.PEERTUBE;
|
||||||
account.software = Account.API.PEERTUBE.name();
|
account.software = Account.API.PEERTUBE.name();
|
||||||
account.peertube_account = peertubeAccount;
|
account.peertube_account = peertubeAccount;
|
||||||
account.user_id = peertubeAccount.getUserId();
|
account.user_id = peertubeAccount.getId();
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(PREF_USER_ID, account.user_id);
|
editor.putString(PREF_USER_ID, account.user_id);
|
||||||
editor.putString(PREF_USER_INSTANCE, host);
|
editor.putString(PREF_USER_INSTANCE, host);
|
||||||
|
|
|
@ -140,6 +140,10 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||||
|
|
||||||
private boolean isMyChannel(Channel channel) {
|
private boolean isMyChannel(Channel channel) {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
|
||||||
|
if (channel.getOwnerAccount() == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
String channeIdOwner = channel.getOwnerAccount().getId();
|
String channeIdOwner = channel.getOwnerAccount().getId();
|
||||||
String channeInstanceOwner = channel.getOwnerAccount().getHost();
|
String channeInstanceOwner = channel.getOwnerAccount().getHost();
|
||||||
String instanceShar = sharedpreferences.getString(PREF_USER_INSTANCE, null);
|
String instanceShar = sharedpreferences.getString(PREF_USER_INSTANCE, null);
|
||||||
|
|
|
@ -95,14 +95,11 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
||||||
search_peertube = bundle.getString("search_peertube", null);
|
search_peertube = bundle.getString("search_peertube", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getActivity() != null) {
|
action_button = getActivity().findViewById(R.id.action_button);
|
||||||
action_button = getActivity().findViewById(R.id.action_button);
|
if (action_button != null) {
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.lvElements.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
|
binding.lvElements.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
|
||||||
channelListAdapter = new ChannelListAdapter(this.channels);
|
channelListAdapter = new ChannelListAdapter(this.channels);
|
||||||
channelListAdapter.allChannelRemoved = this;
|
channelListAdapter.allChannelRemoved = this;
|
||||||
|
|
|
@ -65,8 +65,7 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
||||||
private int page;
|
private int page;
|
||||||
private List<VideoData.Video> peertubes;
|
private List<VideoData.Video> peertubes;
|
||||||
private boolean firstLoad;
|
private boolean firstLoad;
|
||||||
private View rootView;
|
|
||||||
private RecyclerView lv_status;
|
|
||||||
private TimelineVM viewModelFeeds;
|
private TimelineVM viewModelFeeds;
|
||||||
private Map<String, Boolean> relationship;
|
private Map<String, Boolean> relationship;
|
||||||
private Map<String, List<PlaylistExist>> playlists;
|
private Map<String, List<PlaylistExist>> playlists;
|
||||||
|
@ -82,7 +81,6 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
||||||
binding = FragmentOverviewPeertubeBinding.inflate(getLayoutInflater());
|
binding = FragmentOverviewPeertubeBinding.inflate(getLayoutInflater());
|
||||||
|
|
||||||
peertubes = new ArrayList<>();
|
peertubes = new ArrayList<>();
|
||||||
lv_status = rootView.findViewById(R.id.lv_status);
|
|
||||||
page = 1;
|
page = 1;
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
firstLoad = true;
|
firstLoad = true;
|
||||||
|
@ -95,24 +93,24 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
||||||
peertubeAdapater.playlistListener = this;
|
peertubeAdapater.playlistListener = this;
|
||||||
peertubeAdapater.relationShipListener = this;
|
peertubeAdapater.relationShipListener = this;
|
||||||
|
|
||||||
lv_status.setAdapter(peertubeAdapater);
|
binding.lvStatus.setAdapter(peertubeAdapater);
|
||||||
|
|
||||||
|
|
||||||
if (!Helper.isTablet(requireActivity())) {
|
if (!Helper.isTablet(requireActivity())) {
|
||||||
mLayoutManager = new LinearLayoutManager(requireActivity());
|
mLayoutManager = new LinearLayoutManager(requireActivity());
|
||||||
lv_status.setLayoutManager(mLayoutManager);
|
binding.lvStatus.setLayoutManager(mLayoutManager);
|
||||||
} else {
|
} else {
|
||||||
gLayoutManager = new GridLayoutManager(requireActivity(), 2);
|
gLayoutManager = new GridLayoutManager(requireActivity(), 2);
|
||||||
int spanCount = (int) Helper.convertDpToPixel(2, requireActivity());
|
int spanCount = (int) Helper.convertDpToPixel(2, requireActivity());
|
||||||
int spacing = (int) Helper.convertDpToPixel(5, requireActivity());
|
int spacing = (int) Helper.convertDpToPixel(5, requireActivity());
|
||||||
lv_status.addItemDecoration(new GridSpacingItemDecoration(spanCount, spacing, true));
|
binding.lvStatus.addItemDecoration(new GridSpacingItemDecoration(spanCount, spacing, true));
|
||||||
lv_status.setLayoutManager(gLayoutManager);
|
binding.lvStatus.setLayoutManager(gLayoutManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModelFeeds = new ViewModelProvider(DisplayOverviewFragment.this).get(TimelineVM.class);
|
viewModelFeeds = new ViewModelProvider(DisplayOverviewFragment.this).get(TimelineVM.class);
|
||||||
binding.swipeContainer.setOnRefreshListener(this::pullToRefresh);
|
binding.swipeContainer.setOnRefreshListener(this::pullToRefresh);
|
||||||
loadTimeline(page);
|
loadTimeline(page);
|
||||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
binding.lvStatus.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
if (mLayoutManager != null) {
|
if (mLayoutManager != null) {
|
||||||
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
||||||
|
@ -149,7 +147,7 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return rootView;
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -289,7 +287,7 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
||||||
peertubeAdapater = new PeertubeAdapter(this.peertubes);
|
peertubeAdapater = new PeertubeAdapter(this.peertubes);
|
||||||
peertubeAdapater.playlistListener = DisplayOverviewFragment.this;
|
peertubeAdapater.playlistListener = DisplayOverviewFragment.this;
|
||||||
peertubeAdapater.relationShipListener = DisplayOverviewFragment.this;
|
peertubeAdapater.relationShipListener = DisplayOverviewFragment.this;
|
||||||
lv_status.setAdapter(peertubeAdapater);
|
binding.lvStatus.setAdapter(peertubeAdapater);
|
||||||
} else
|
} else
|
||||||
peertubeAdapater.notifyItemRangeInserted(previousPosition, totalAdded);
|
peertubeAdapater.notifyItemRangeInserted(previousPosition, totalAdded);
|
||||||
//remove handlers
|
//remove handlers
|
||||||
|
@ -306,14 +304,12 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
if (lv_status != null) {
|
try {
|
||||||
try {
|
binding.lvStatus.setAdapter(null);
|
||||||
lv_status.setAdapter(null);
|
} catch (Exception ignored) {
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
rootView = null;
|
binding = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,13 +25,13 @@
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true">
|
||||||
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
|
app:expandedTitleGravity="top"
|
||||||
app:expandedTitleMarginEnd="64dp"
|
app:expandedTitleMarginEnd="64dp"
|
||||||
app:expandedTitleMarginStart="48dp"
|
app:expandedTitleMarginStart="48dp"
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||||
|
@ -41,6 +41,10 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -50,6 +54,7 @@
|
||||||
android:id="@+id/profile_picture"
|
android:id="@+id/profile_picture"
|
||||||
android:layout_width="72dp"
|
android:layout_width="72dp"
|
||||||
android:layout_height="72dp"
|
android:layout_height="72dp"
|
||||||
|
tools:src="@tools:sample/avatars"
|
||||||
android:contentDescription="@string/profile_picture"
|
android:contentDescription="@string/profile_picture"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
@ -63,7 +68,8 @@
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
app:layout_constraintRight_toLeftOf="@+id/button_container"
|
app:layout_constraintRight_toLeftOf="@+id/edit_button"
|
||||||
|
tools:text="@tools:sample/full_names"
|
||||||
app:layout_constraintStart_toEndOf="@+id/profile_picture"
|
app:layout_constraintStart_toEndOf="@+id/profile_picture"
|
||||||
app:layout_constraintTop_toTopOf="@+id/profile_picture" />
|
app:layout_constraintTop_toTopOf="@+id/profile_picture" />
|
||||||
|
|
||||||
|
@ -76,34 +82,27 @@
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintRight_toLeftOf="@+id/edit_button"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintRight_toLeftOf="@+id/button_container"
|
tools:text="@tools:sample/full_names"
|
||||||
app:layout_constraintStart_toEndOf="@+id/profile_picture"
|
app:layout_constraintStart_toEndOf="@+id/profile_picture"
|
||||||
app:layout_constraintTop_toTopOf="@+id/displayname" />
|
app:layout_constraintTop_toTopOf="@+id/displayname" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
android:id="@+id/edit_button"
|
||||||
android:id="@+id/button_container"
|
style="@style/Widget.Material3.Button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/edit"
|
||||||
|
android:textAllCaps="false"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/edit_button"
|
|
||||||
style="@style/Widget.Material3.Button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:text="@string/edit"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/action_playlist_add"
|
android:text="@string/action_playlist_add"
|
||||||
android:textSize="25sp" />
|
android:textSize="20sp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
<!-- Main Loader -->
|
<!-- Main Loader -->
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/no_instances"
|
android:text="@string/no_instances"
|
||||||
android:textSize="25sp" />
|
android:textSize="20sp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
<!-- Main Loader -->
|
<!-- Main Loader -->
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|
|
@ -324,7 +324,7 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/no_comments"
|
android:text="@string/no_comments"
|
||||||
android:textSize="25sp" />
|
android:textSize="20sp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
|
@ -58,6 +58,8 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textSize="20sp"
|
||||||
android:text="@string/no_videos" />
|
android:text="@string/no_videos" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
<!-- Main Loader -->
|
<!-- Main Loader -->
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textSize="20sp"
|
||||||
android:text="@string/action_playlist_add" />
|
android:text="@string/action_playlist_add" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
<!-- Main Loader -->
|
<!-- Main Loader -->
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
|
android:textSize="20sp"
|
||||||
android:text="@string/no_channels" />
|
android:text="@string/no_channels" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
<!-- Main Loader -->
|
<!-- Main Loader -->
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/no_videos"
|
android:text="@string/no_videos"
|
||||||
android:textSize="25sp" />
|
android:textSize="20sp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
<!-- Main Loader -->
|
<!-- Main Loader -->
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|
Loading…
Reference in a new issue