mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
feat: radio stream add title button
This commit is contained in:
parent
2542b28916
commit
64958167f0
2 changed files with 24 additions and 5 deletions
|
|
@ -5,7 +5,6 @@ import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
@ -22,6 +21,7 @@ import com.cappielloantonio.play.service.MediaManager;
|
||||||
import com.cappielloantonio.play.service.MediaService;
|
import com.cappielloantonio.play.service.MediaService;
|
||||||
import com.cappielloantonio.play.ui.activity.MainActivity;
|
import com.cappielloantonio.play.ui.activity.MainActivity;
|
||||||
import com.cappielloantonio.play.ui.adapter.InternetRadioStationAdapter;
|
import com.cappielloantonio.play.ui.adapter.InternetRadioStationAdapter;
|
||||||
|
import com.cappielloantonio.play.ui.dialog.RadioEditorDialog;
|
||||||
import com.cappielloantonio.play.util.Constants;
|
import com.cappielloantonio.play.util.Constants;
|
||||||
import com.cappielloantonio.play.viewmodel.RadioViewModel;
|
import com.cappielloantonio.play.viewmodel.RadioViewModel;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
@ -54,6 +54,7 @@ public class HomeTabRadioFragment extends Fragment implements ClickCallback {
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
init();
|
||||||
initRadioStationView();
|
initRadioStationView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,13 +77,20 @@ public class HomeTabRadioFragment extends Fragment implements ClickCallback {
|
||||||
bind = null;
|
bind = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
bind.internetRadioStationPreTextView.setOnClickListener(v -> {
|
||||||
|
RadioEditorDialog dialog = new RadioEditorDialog(() -> radioViewModel.getInternetRadioStations(getViewLifecycleOwner()));
|
||||||
|
dialog.show(activity.getSupportFragmentManager(), null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void initRadioStationView() {
|
private void initRadioStationView() {
|
||||||
bind.internetRadioStationRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
bind.internetRadioStationRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||||
bind.internetRadioStationRecyclerView.setHasFixedSize(true);
|
bind.internetRadioStationRecyclerView.setHasFixedSize(true);
|
||||||
|
|
||||||
internetRadioStationAdapter = new InternetRadioStationAdapter(this);
|
internetRadioStationAdapter = new InternetRadioStationAdapter(this);
|
||||||
bind.internetRadioStationRecyclerView.setAdapter(internetRadioStationAdapter);
|
bind.internetRadioStationRecyclerView.setAdapter(internetRadioStationAdapter);
|
||||||
radioViewModel.getInternetRadioStations().observe(getViewLifecycleOwner(), internetRadioStations -> {
|
radioViewModel.getInternetRadioStations(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), internetRadioStations -> {
|
||||||
if (internetRadioStations == null) {
|
if (internetRadioStations == null) {
|
||||||
if (bind != null)
|
if (bind != null)
|
||||||
bind.internetRadioStationPlaceholder.placeholder.setVisibility(View.VISIBLE);
|
bind.internetRadioStationPlaceholder.placeholder.setVisibility(View.VISIBLE);
|
||||||
|
|
@ -114,6 +122,8 @@ public class HomeTabRadioFragment extends Fragment implements ClickCallback {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInternetRadioStationLongClick(Bundle bundle) {
|
public void onInternetRadioStationLongClick(Bundle bundle) {
|
||||||
Toast.makeText(requireContext(), "Long click!", Toast.LENGTH_SHORT).show();
|
RadioEditorDialog dialog = new RadioEditorDialog(() -> radioViewModel.getInternetRadioStations(getViewLifecycleOwner()));
|
||||||
|
dialog.setArguments(bundle);
|
||||||
|
dialog.show(activity.getSupportFragmentManager(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,19 +17,28 @@
|
||||||
android:paddingBottom="@dimen/global_padding_bottom">
|
android:paddingBottom="@dimen/global_padding_bottom">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/TitleLarge"
|
android:id="@+id/internet_radio_station_pre_text_view"
|
||||||
|
style="@style/TitleMedium"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="16dp"
|
android:paddingStart="16dp"
|
||||||
android:paddingTop="16dp"
|
android:paddingTop="16dp"
|
||||||
android:paddingEnd="16dp"
|
android:paddingEnd="16dp"
|
||||||
|
android:text="@string/home_subtitle_new_internet_radio_station"
|
||||||
|
android:textAllCaps="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/TitleLarge"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
android:text="@string/home_title_internet_radio_station" />
|
android:text="@string/home_title_internet_radio_station" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/internet_radio_station_recycler_view"
|
android:id="@+id/internet_radio_station_recycler_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue