Optimizacion de los xml y implemetacion de nuevas clases y optimizacion igualmente de classes antiguas

This commit is contained in:
santi 2025-05-09 16:52:31 +02:00
parent 07b617a195
commit 9a728cb136
15 changed files with 1126 additions and 241 deletions

View File

@ -1,4 +1,4 @@
package com.santiparra.yomitrack.model.adapters.homeadapter; // Ajusta tu paquete si es necesario
package com.santiparra.yomitrack.model.adapters.homeadapter;
import android.view.LayoutInflater;
import android.view.View;
@ -44,7 +44,6 @@ public class HomeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
// Ajustamos manualmente el ancho
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
layoutParams.width = (int) (parent.getMeasuredWidth() * 0.85); // 85% del ancho de pantalla
view.setLayoutParams(layoutParams);
if (viewType == TYPE_AIRING) {

View File

@ -0,0 +1,136 @@
package com.santiparra.yomitrack.model.adapters.manga_adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.santiparra.yomitrack.R;
import com.santiparra.yomitrack.model.AnimeItem;
import java.util.List;
public class MangaAdapter extends RecyclerView.Adapter<MangaAdapter.MangaViewHolder> {
private final List<AnimeItem> mangaList;
private final Context context;
private int viewMode = 0;
public interface OnMangaRemoveListener {
void onMangaRemoved(AnimeItem manga);
}
private OnMangaRemoveListener removeListener;
public void setOnMangaRemoveListener(OnMangaRemoveListener listener) {
this.removeListener = listener;
}
public void setViewMode(int mode) {
this.viewMode = mode;
}
public MangaAdapter(Context context, List<AnimeItem> mangaList) {
this.context = context;
this.mangaList = mangaList;
}
@NonNull
@Override
public MangaViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
int layoutId;
switch (viewMode) {
case 1:
layoutId = R.layout.item_anime_large;
break;
case 2:
layoutId = R.layout.item_anime_compact;
break;
default:
layoutId = R.layout.item_anime;
break;
}
View view = LayoutInflater.from(context).inflate(layoutId, parent, false);
return new MangaViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MangaViewHolder holder, int position) {
AnimeItem manga = mangaList.get(position);
if (holder.title != null)
holder.title.setText(manga.getTitle());
if (holder.progress != null)
holder.progress.setText("Progress: " + manga.getWatchedEpisodes() + "/" + manga.getTotalEpisodes());
if (holder.score != null)
holder.score.setText(String.valueOf(manga.getScore()));
if (holder.type != null)
holder.type.setText(manga.getType());
if (holder.cover != null) {
Glide.with(context)
.load(manga.getImageUrl())
.placeholder(R.drawable.sample_anime_cover)
.into(holder.cover);
}
if (holder.buttonOptions != null) {
holder.buttonOptions.setOnClickListener(v -> {
PopupMenu popup = new PopupMenu(context, holder.buttonOptions);
popup.inflate(R.menu.anime_item_menu);
popup.setOnMenuItemClickListener(item -> {
int id = item.getItemId();
if (id == R.id.action_edit) {
Toast.makeText(context, "Edit: " + manga.getTitle(), Toast.LENGTH_SHORT).show();
return true;
} else if (id == R.id.action_remove) {
int pos = holder.getAdapterPosition();
if (pos != RecyclerView.NO_POSITION) {
AnimeItem removed = mangaList.remove(pos);
notifyItemRemoved(pos);
if (removeListener != null) {
removeListener.onMangaRemoved(removed);
}
Toast.makeText(context, "Removed: " + removed.getTitle(), Toast.LENGTH_SHORT).show();
}
return true;
}
return false;
});
popup.show();
});
}
}
@Override
public int getItemCount() {
return mangaList.size();
}
static class MangaViewHolder extends RecyclerView.ViewHolder {
TextView title, progress, score, type;
ImageView cover, buttonOptions;
MangaViewHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.textViewTitle);
progress = itemView.findViewById(R.id.textViewProgress);
score = itemView.findViewById(R.id.textViewScore);
type = itemView.findViewById(R.id.textViewType);
cover = itemView.findViewById(R.id.imageViewCover);
buttonOptions = itemView.findViewById(R.id.buttonOptions);
}
}
}

View File

@ -9,8 +9,8 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.santiparra.yomitrack.model.ItemModel;
import com.santiparra.yomitrack.R;
import com.santiparra.yomitrack.model.ItemModel;
import com.santiparra.yomitrack.model.adapters.homeadapter.HomeAdapter;
import java.util.List;
@ -19,11 +19,11 @@ import java.util.Map;
public class SectionAdapter extends RecyclerView.Adapter<SectionAdapter.SectionViewHolder> {
private final List<String> sectionTitles;
private final Map<String, List<ItemModel>> sectionImages;
private final Map<String, List<ItemModel>> sectionItems;
public SectionAdapter(List<String> sectionTitles, Map<String, List<ItemModel>> sectionImages) {
public SectionAdapter(List<String> sectionTitles, Map<String, List<ItemModel>> sectionItems) {
this.sectionTitles = sectionTitles;
this.sectionImages = sectionImages;
this.sectionItems = sectionItems;
}
@NonNull
@ -35,17 +35,14 @@ public class SectionAdapter extends RecyclerView.Adapter<SectionAdapter.SectionV
@Override
public void onBindViewHolder(@NonNull SectionViewHolder holder, int position) {
String title = sectionTitles.get(position);
List<ItemModel> items = sectionImages.get(title);
String sectionTitle = sectionTitles.get(position);
holder.title.setText(sectionTitle);
holder.sectionTitle.setText(title);
List<ItemModel> fullList = sectionItems.get(sectionTitle);
HomeAdapter homeAdapter = new HomeAdapter(items, title);
holder.sectionRecycler.setLayoutManager(
new LinearLayoutManager(holder.itemView.getContext(), LinearLayoutManager.HORIZONTAL, false)
);
holder.sectionRecycler.setAdapter(homeAdapter);
HomeAdapter adapter = new HomeAdapter(fullList, sectionTitle);
holder.recyclerView.setLayoutManager(new LinearLayoutManager(holder.itemView.getContext(), LinearLayoutManager.HORIZONTAL, false));
holder.recyclerView.setAdapter(adapter);
}
@Override
@ -54,13 +51,13 @@ public class SectionAdapter extends RecyclerView.Adapter<SectionAdapter.SectionV
}
static class SectionViewHolder extends RecyclerView.ViewHolder {
TextView sectionTitle;
RecyclerView sectionRecycler;
TextView title;
RecyclerView recyclerView;
public SectionViewHolder(@NonNull View itemView) {
super(itemView);
sectionTitle = itemView.findViewById(R.id.sectionTitle);
sectionRecycler = itemView.findViewById(R.id.sectionRecycler);
title = itemView.findViewById(R.id.sectionTitle);
recyclerView = itemView.findViewById(R.id.sectionRecyclerView);
}
}
}

View File

@ -1,19 +1,179 @@
package com.santiparra.yomitrack.ui.fragments.anime_list;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.santiparra.yomitrack.R;
import com.santiparra.yomitrack.model.AnimeItem;
import com.santiparra.yomitrack.model.adapters.anime_adapter.AnimeAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FragmentAnime extends Fragment {
private RecyclerView recyclerView;
private EditText editTextFilter;
private TextView textViewTitle;
private AnimeAdapter adapter;
private final List<AnimeItem> fullAnimeList = new ArrayList<>();
private final List<AnimeItem> filteredAnimeList = new ArrayList<>();
private String currentStatus = "Watching";
private int currentViewMode = 0;
private ImageButton buttonGrid, buttonLarge, buttonList;
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup container,
Bundle saveInstanceState){
return layoutInflater.inflate(R.layout.fragment_alist,container,false);
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_alist, container, false);
recyclerView = view.findViewById(R.id.recyclerViewAnimeList);
editTextFilter = view.findViewById(R.id.editTextFilter);
textViewTitle = view.findViewById(R.id.textViewWatching);
ImageView buttonFilterMenu = view.findViewById(R.id.buttonFilterMenu);
buttonGrid = view.findViewById(R.id.buttonViewGrid);
buttonLarge = view.findViewById(R.id.buttonViewLarge);
buttonList = view.findViewById(R.id.buttonViewList);
buttonGrid.setOnClickListener(v -> setLayoutMode(0));
buttonLarge.setOnClickListener(v -> setLayoutMode(1));
buttonList.setOnClickListener(v -> setLayoutMode(2));
initSampleAnimeList();
filteredAnimeList.addAll(fullAnimeList);
adapter = new AnimeAdapter(getContext(), filteredAnimeList);
recyclerView.setAdapter(adapter);
adapter.setOnAnimeRemoveListener(anime -> fullAnimeList.remove(anime));
editTextFilter.addTextChangedListener(new TextWatcher() {
@Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override public void afterTextChanged(Editable s) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
filterAnimeList(s.toString());
}
});
Map<Integer, String> filterMap = new HashMap<>();
filterMap.put(R.id.filter_all, "All");
filterMap.put(R.id.filter_watching, "Watching");
filterMap.put(R.id.filter_planning, "Planning");
filterMap.put(R.id.filter_paused, "Paused");
filterMap.put(R.id.filter_dropped, "Dropped");
filterMap.put(R.id.filter_completed, "Completed");
buttonFilterMenu.setOnClickListener(v -> {
PopupMenu popup = new PopupMenu(requireContext(), buttonFilterMenu);
popup.inflate(R.menu.filter_list_menu);
popup.setOnMenuItemClickListener(item -> {
String selectedStatus = filterMap.get(item.getItemId());
if (selectedStatus != null) {
currentStatus = selectedStatus;
textViewTitle.setText(currentStatus);
filterAnimeList(editTextFilter.getText().toString());
return true;
}
return false;
});
popup.show();
});
setLayoutMode(currentViewMode);
return view;
}
private void filterAnimeList(String query) {
filteredAnimeList.clear();
int count = 0;
for (AnimeItem anime : fullAnimeList) {
boolean matchesStatus = currentStatus.equals("All") || anime.getStatus().equalsIgnoreCase(currentStatus);
boolean matchesQuery = anime.getTitle().toLowerCase().contains(query.toLowerCase());
if (matchesStatus && matchesQuery) {
filteredAnimeList.add(anime);
count++;
if (count >= 10) {
Toast.makeText(requireContext(), "Mostrando los primeros 10 resultados", Toast.LENGTH_SHORT).show();
break;
}
}
}
adapter.notifyDataSetChanged();
}
private void setLayoutMode(int mode) {
currentViewMode = mode;
if (mode == 2) { // Compacta: solo texto
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
} else if (mode == 1) { // Imagen grande + info
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 1));
} else if (mode == 0) { // Lista tipo AniList
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
adapter = new AnimeAdapter(getContext(), filteredAnimeList);
adapter.setViewMode(mode);
adapter.setOnAnimeRemoveListener(anime -> fullAnimeList.remove(anime));
recyclerView.setAdapter(adapter);
adapter.notifyDataSetChanged();
int defaultTint = ContextCompat.getColor(requireContext(), R.color.textPrimary);
int activeTint = ContextCompat.getColor(requireContext(), R.color.activeTint);
buttonGrid.setColorFilter(mode == 0 ? activeTint : defaultTint);
buttonLarge.setColorFilter(mode == 1 ? activeTint : defaultTint);
buttonList.setColorFilter(mode == 2 ? activeTint : defaultTint);
}
private void initSampleAnimeList() {
fullAnimeList.clear();
fullAnimeList.add(new AnimeItem("Aharen-san wa Hakarenai Season 2", "https://cdn.example.com/img1.jpg", 5, 12, 8.5, "TV", "Watching"));
fullAnimeList.add(new AnimeItem("Anne Shirley", "https://cdn.example.com/img2.jpg", 5, 24, 7.9, "OVA", "Planning"));
fullAnimeList.add(new AnimeItem("Ballpark de Tsukamaete!", "https://cdn.example.com/img3.jpg", 5, 12, 9.2, "Movie", "Paused"));
fullAnimeList.add(new AnimeItem("Bleach: TYBW", "https://cdn.example.com/img4.jpg", 8, 13, 9.0, "TV", "Completed"));
fullAnimeList.add(new AnimeItem("Chainsaw Man", "https://cdn.example.com/img5.jpg", 1, 12, 8.8, "TV", "Dropped"));
fullAnimeList.add(new AnimeItem("Code Geass", "https://cdn.example.com/img6.jpg", 25, 25, 9.5, "TV", "Completed"));
fullAnimeList.add(new AnimeItem("Death Note", "https://cdn.example.com/img7.jpg", 37, 37, 9.6, "TV", "Completed"));
fullAnimeList.add(new AnimeItem("Erased", "https://cdn.example.com/img8.jpg", 12, 12, 9.0, "TV", "Watching"));
fullAnimeList.add(new AnimeItem("Fate/Zero", "https://cdn.example.com/img9.jpg", 13, 13, 9.1, "TV", "Planning"));
fullAnimeList.add(new AnimeItem("Gintama", "https://cdn.example.com/img10.jpg", 201, 201, 9.7, "TV", "Paused"));
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("currentStatus", currentStatus);
}
@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState);
if (savedInstanceState != null) {
currentStatus = savedInstanceState.getString("currentStatus", "Watching");
textViewTitle.setText(currentStatus);
filterAnimeList(editTextFilter.getText().toString());
}
}
}

View File

@ -2,20 +2,18 @@ package com.santiparra.yomitrack.ui.fragments.home;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.santiparra.yomitrack.R;
import com.santiparra.yomitrack.model.ItemModel;
import com.santiparra.yomitrack.model.RecentActivityModel;
import com.santiparra.yomitrack.model.adapters.recentactivity_adapter.RecentActivityAdapter;
import com.santiparra.yomitrack.model.adapters.sectionadapter.SectionAdapter;
import java.util.ArrayList;
@ -26,6 +24,10 @@ import java.util.Map;
public class FragmentHome extends Fragment {
private final List<RecentActivityModel> fullRecentActivity = new ArrayList<>();
private final List<RecentActivityModel> visibleRecentActivity = new ArrayList<>();
private RecentActivityAdapter activityAdapter;
public FragmentHome() {
super(R.layout.fragment_home);
}
@ -34,66 +36,90 @@ public class FragmentHome extends Fragment {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// RecyclerView principal
// Secciones principales
RecyclerView mainRecyclerView = view.findViewById(R.id.mainRecyclerView);
mainRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
// Crear las secciones
List<String> sectionTitles = Arrays.asList(
"Airing", "Anime in Progress", "Manga in Progress"
);
List<String> sectionTitles = Arrays.asList("Airing", "Anime in Progress", "Manga in Progress");
Map<String, List<ItemModel>> sectionItems = new HashMap<>();
List<ItemModel> airingItems = new ArrayList<>();
airingItems.add(new ItemModel("Naruto", "5/220", "https://th.bing.com/th/id/OIP.aypxRH6Qq7yXLFCXiYhaKAHaLo?rs=1&pid=ImgDetMain", ItemModel.ContentType.ANIME));
airingItems.add(new ItemModel("One Piece", "900/1100", "https://i.imgur.com/VgVfG6K.jpg", ItemModel.ContentType.ANIME));
airingItems.add(new ItemModel("Bleach", "100/366", "https://i.imgur.com/I0d1HyA.jpg", ItemModel.ContentType.ANIME));
sectionItems.put("Airing", Arrays.asList(
new ItemModel("Naruto", "5/220", "https://i.imgur.com/qzWZbL2.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Bleach", "100/366", "https://i.imgur.com/I0d1HyA.jpg", ItemModel.ContentType.ANIME),
new ItemModel("One Piece", "900/1100", "https://i.imgur.com/VgVfG6K.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Boruto", "10/100", "https://i.imgur.com/lWhD6Zc.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Dragon Ball", "80/150", "https://i.imgur.com/z4d4kWk.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Another", "2/12", "https://i.imgur.com/z4d4kWk.jpg", ItemModel.ContentType.ANIME)
));
List<ItemModel> animeInProgressItems = new ArrayList<>();
animeInProgressItems.add(new ItemModel("Attack on Titan", "16/25", "https://i.imgur.com/z4d4kWk.jpg", ItemModel.ContentType.ANIME));
animeInProgressItems.add(new ItemModel("Jujutsu Kaisen", "10/24", "https://i.imgur.com/lWhD6Zc.jpg", ItemModel.ContentType.ANIME));
sectionItems.put("Anime in Progress", Arrays.asList(
new ItemModel("Attack on Titan", "16/25", "https://i.imgur.com/z4d4kWk.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Jujutsu Kaisen", "10/24", "https://i.imgur.com/lWhD6Zc.jpg", ItemModel.ContentType.ANIME),
new ItemModel("One Piece", "900/1100", "https://i.imgur.com/VgVfG6K.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Boruto", "10/100", "https://i.imgur.com/lWhD6Zc.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Dragon Ball", "80/150", "https://i.imgur.com/z4d4kWk.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Another", "2/12", "https://i.imgur.com/z4d4kWk.jpg", ItemModel.ContentType.ANIME)
));
List<ItemModel> mangaInProgressItems = new ArrayList<>();
mangaInProgressItems.add(new ItemModel("Chainsaw Man", "45/100", "https://i.imgur.com/7tZ0h8R.jpg", ItemModel.ContentType.MANGA));
mangaInProgressItems.add(new ItemModel("Berserk", "370/380", "https://i.imgur.com/8FJYYHo.jpg", ItemModel.ContentType.MANGA));
sectionItems.put("Manga in Progress", Arrays.asList(
new ItemModel("Chainsaw Man", "45/100", "https://i.imgur.com/7tZ0h8R.jpg", ItemModel.ContentType.MANGA),
new ItemModel("Berserk", "370/380", "https://i.imgur.com/8FJYYHo.jpg", ItemModel.ContentType.MANGA),
new ItemModel("One Piece", "900/1100", "https://i.imgur.com/VgVfG6K.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Boruto", "10/100", "https://i.imgur.com/lWhD6Zc.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Dragon Ball", "80/150", "https://i.imgur.com/z4d4kWk.jpg", ItemModel.ContentType.ANIME),
new ItemModel("Another", "2/12", "https://i.imgur.com/z4d4kWk.jpg", ItemModel.ContentType.ANIME)
));
sectionItems.put("Airing", airingItems);
sectionItems.put("Anime in Progress", animeInProgressItems);
sectionItems.put("Manga in Progress", mangaInProgressItems);
SectionAdapter sectionAdapter = new SectionAdapter(sectionTitles, sectionItems);
mainRecyclerView.setAdapter(sectionAdapter);
SectionAdapter adapter = new SectionAdapter(sectionTitles, sectionItems);
mainRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mainRecyclerView.setAdapter(adapter);
// Actividades recientes
RecyclerView activityRecyclerView = view.findViewById(R.id.activityRecyclerView);
activityRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
// Sección inferior: campo de estado + nueva card
EditText editStatus = view.findViewById(R.id.editStatus);
fullRecentActivity.addAll(Arrays.asList(
new RecentActivityModel("Midca", "Read chapters 1 - 60 of", "Choujun! Choujou Senpai", "4 minutes ago", "https://i.imgur.com/7tZ0h8R.jpg"),
new RecentActivityModel("prtrncyon", "Scored 9/10 on", "Chainsaw Man", "12 hours ago", "https://cdn.myanimelist.net/images/manga/2/253146.jpg"),
new RecentActivityModel("BtwIsSanti", "Watched episode 7 of", "Fate/Zero", "1 day ago", "https://cdn.myanimelist.net/images/anime/5/73245.jpg"),
new RecentActivityModel("Taku", "Watched episode 3 of", "Mob Psycho 100", "2 days ago", "https://i.imgur.com/I0d1HyA.jpg"),
new RecentActivityModel("Maki", "Read chapter 14 of", "Blue Period", "4 days ago", "https://i.imgur.com/z4d4kWk.jpg"),
new RecentActivityModel("Yato", "Scored 10/10 on", "Noragami", "5 days ago", "https://i.imgur.com/8FJYYHo.jpg"),
new RecentActivityModel("Eri", "Completed", "My Dress-Up Darling", "6 days ago", "https://i.imgur.com/qzWZbL2.jpg"),
new RecentActivityModel("Yuji", "Watched episode 6 of", "Jujutsu Kaisen", "7 days ago", "https://i.imgur.com/lWhD6Zc.jpg"),
new RecentActivityModel("Light", "Scored 10/10 on", "Death Note", "8 days ago", "https://i.imgur.com/I0d1HyA.jpg"),
new RecentActivityModel("Luffy", "Watched episode 1000 of", "One Piece", "9 days ago", "https://i.imgur.com/VgVfG6K.jpg"),
new RecentActivityModel("Gon", "Started watching", "Hunter x Hunter", "10 days ago", "https://i.imgur.com/z4d4kWk.jpg")
));
View activityCard = view.findViewById(R.id.activityCard);
ImageView activityImage = activityCard.findViewById(R.id.activityImage);
TextView activityUser = activityCard.findViewById(R.id.activityUser);
TextView activityAction = activityCard.findViewById(R.id.activityAction);
TextView activityTitle = activityCard.findViewById(R.id.activityTitle);
TextView activityTime = activityCard.findViewById(R.id.activityTime);
visibleRecentActivity.addAll(fullRecentActivity.subList(0, Math.min(10, fullRecentActivity.size())));
activityAdapter = new RecentActivityAdapter(visibleRecentActivity);
activityRecyclerView.setAdapter(activityAdapter);
// Contenido inicial
activityUser.setText("Midca");
activityAction.setText("Read chapters 1 - 60 of");
activityTitle.setText("Choujun! Choujou Senpai");
activityTime.setText("4 minutes ago");
Button buttonShowMore = view.findViewById(R.id.buttonShowMoreActivity);
Button buttonShowLess = view.findViewById(R.id.buttonShowLessActivity);
Glide.with(requireContext())
.load("https://i.imgur.com/7tZ0h8R.jpg")
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.into(activityImage);
if (fullRecentActivity.size() > 10) {
buttonShowMore.setVisibility(View.VISIBLE);
buttonShowLess.setVisibility(View.GONE);
// Actualización con el texto del usuario
editStatus.setOnEditorActionListener((v, actionId, event) -> {
String status = editStatus.getText().toString().trim();
if (!status.isEmpty()) {
activityAction.setText(status);
}
return true;
});
buttonShowMore.setOnClickListener(v -> {
visibleRecentActivity.clear();
visibleRecentActivity.addAll(fullRecentActivity);
activityAdapter.notifyDataSetChanged();
buttonShowMore.setVisibility(View.GONE);
buttonShowLess.setVisibility(View.VISIBLE);
});
buttonShowLess.setOnClickListener(v -> {
visibleRecentActivity.clear();
visibleRecentActivity.addAll(fullRecentActivity.subList(0, 10));
activityAdapter.notifyDataSetChanged();
buttonShowMore.setVisibility(View.VISIBLE);
buttonShowLess.setVisibility(View.GONE);
});
} else {
buttonShowMore.setVisibility(View.GONE);
buttonShowLess.setVisibility(View.GONE);
}
}
}

View File

@ -1,18 +1,174 @@
package com.santiparra.yomitrack.ui.fragments.manga_list;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.santiparra.yomitrack.R;
import com.santiparra.yomitrack.model.AnimeItem;
import com.santiparra.yomitrack.model.adapters.manga_adapter.MangaAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FragmentManga extends Fragment {
private RecyclerView recyclerView;
private EditText editTextFilter;
private TextView textViewTitle;
private MangaAdapter adapter;
private final List<AnimeItem> fullMangaList = new ArrayList<>();
private final List<AnimeItem> filteredMangaList = new ArrayList<>();
private String currentStatus = "Reading";
private int currentViewMode = 0;
private ImageButton buttonGrid, buttonLarge, buttonList;
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup container,
Bundle saveInstanceState){
return layoutInflater.inflate(R.layout.fragment_mlist,container,false);
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_alist, container, false);
recyclerView = view.findViewById(R.id.recyclerViewAnimeList);
editTextFilter = view.findViewById(R.id.editTextFilter);
textViewTitle = view.findViewById(R.id.textViewWatching);
ImageView buttonFilterMenu = view.findViewById(R.id.buttonFilterMenu);
buttonGrid = view.findViewById(R.id.buttonViewGrid);
buttonLarge = view.findViewById(R.id.buttonViewLarge);
buttonList = view.findViewById(R.id.buttonViewList);
buttonGrid.setOnClickListener(v -> setLayoutMode(0));
buttonLarge.setOnClickListener(v -> setLayoutMode(1));
buttonList.setOnClickListener(v -> setLayoutMode(2));
initSampleMangaList();
filteredMangaList.addAll(fullMangaList);
adapter = new MangaAdapter(getContext(), filteredMangaList);
recyclerView.setAdapter(adapter);
adapter.setOnMangaRemoveListener(manga -> fullMangaList.remove(manga));
editTextFilter.addTextChangedListener(new TextWatcher() {
@Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override public void afterTextChanged(Editable s) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
filterMangaList(s.toString());
}
});
Map<Integer, String> filterMap = new HashMap<>();
filterMap.put(R.id.filter_all, "All");
filterMap.put(R.id.filter_watching, "Reading");
filterMap.put(R.id.filter_planning, "Planning");
filterMap.put(R.id.filter_paused, "Paused");
filterMap.put(R.id.filter_dropped, "Dropped");
filterMap.put(R.id.filter_completed, "Completed");
buttonFilterMenu.setOnClickListener(v -> {
PopupMenu popup = new PopupMenu(requireContext(), buttonFilterMenu);
popup.inflate(R.menu.filter_list_menu);
popup.setOnMenuItemClickListener(item -> {
String selectedStatus = filterMap.get(item.getItemId());
if (selectedStatus != null) {
currentStatus = selectedStatus;
textViewTitle.setText(currentStatus);
filterMangaList(editTextFilter.getText().toString());
return true;
}
return false;
});
popup.show();
});
setLayoutMode(currentViewMode);
return view;
}
private void filterMangaList(String query) {
filteredMangaList.clear();
int count = 0;
for (AnimeItem manga : fullMangaList) {
boolean matchesStatus = currentStatus.equals("All") || manga.getStatus().equalsIgnoreCase(currentStatus);
boolean matchesQuery = manga.getTitle().toLowerCase().contains(query.toLowerCase());
if (matchesStatus && matchesQuery) {
filteredMangaList.add(manga);
count++;
if (count >= 10) {
Toast.makeText(requireContext(), "Mostrando los primeros 10 resultados", Toast.LENGTH_SHORT).show();
break;
}
}
}
adapter.notifyDataSetChanged();
}
private void setLayoutMode(int mode) {
currentViewMode = mode;
if (mode == 2) {
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
} else if (mode == 1) {
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 1));
} else if (mode == 0) {
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
adapter = new MangaAdapter(getContext(), filteredMangaList);
adapter.setViewMode(mode);
adapter.setOnMangaRemoveListener(manga -> fullMangaList.remove(manga));
recyclerView.setAdapter(adapter);
adapter.notifyDataSetChanged();
int defaultTint = ContextCompat.getColor(requireContext(), R.color.textPrimary);
int activeTint = ContextCompat.getColor(requireContext(), R.color.activeTint);
buttonGrid.setColorFilter(mode == 0 ? activeTint : defaultTint);
buttonLarge.setColorFilter(mode == 1 ? activeTint : defaultTint);
buttonList.setColorFilter(mode == 2 ? activeTint : defaultTint);
}
private void initSampleMangaList() {
fullMangaList.clear();
fullMangaList.add(new AnimeItem("Chainsaw Man", "https://cdn.example.com/img1.jpg", 45, 100, 8.5, "Manga", "Reading"));
fullMangaList.add(new AnimeItem("Berserk", "https://cdn.example.com/img2.jpg", 370, 380, 9.4, "Manga", "Paused"));
fullMangaList.add(new AnimeItem("One Piece", "https://cdn.example.com/img3.jpg", 1090, 1200, 9.8, "Manga", "Reading"));
fullMangaList.add(new AnimeItem("Attack on Titan", "https://cdn.example.com/img4.jpg", 139, 139, 9.5, "Manga", "Completed"));
fullMangaList.add(new AnimeItem("Solo Leveling", "https://cdn.example.com/img5.jpg", 179, 179, 8.9, "Manhwa", "Completed"));
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("currentStatus", currentStatus);
}
@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState);
if (savedInstanceState != null) {
currentStatus = savedInstanceState.getString("currentStatus", "Reading");
textViewTitle.setText(currentStatus);
filterMangaList(editTextFilter.getText().toString());
}
}
}

View File

@ -1,6 +1,7 @@
package com.santiparra.yomitrack.ui.fragments.profile;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -19,7 +20,8 @@ import java.util.List;
public class FragmentProfile extends Fragment {
public FragmentProfile() {}
public FragmentProfile() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -32,11 +34,25 @@ public class FragmentProfile extends Fragment {
super.onViewCreated(view, savedInstanceState);
TextView usernameText = view.findViewById(R.id.usernameText);
TextView descriptionText = view.findViewById(R.id.descriptionText);
TextView descriptionText = view.findViewById(R.id.profileDescriptionText);
TextView seeMore = view.findViewById(R.id.textViewSeeMore);
LinearLayout statsContainer = view.findViewById(R.id.animeStatsContainer);
usernameText.setText("BtwIsSanti");
descriptionText.setText("Eiko is my waifu right now\nMai and Mikasa is my second wife");
descriptionText.setText("Eiko is my waifu right now. Mai and Mikasa is my second wife. Long live anime.");
seeMore.setOnClickListener(v -> {
if (descriptionText.getMaxLines() == 2) {
descriptionText.setMaxLines(Integer.MAX_VALUE);
descriptionText.setEllipsize(null);
seeMore.setText("Ver menos");
} else {
descriptionText.setMaxLines(2);
descriptionText.setEllipsize(TextUtils.TruncateAt.END);
seeMore.setText("Ver más");
}
});
// Cargar estadísticas simuladas
List<UserStats> statsList = StatsHelper.getAnimeStats();
@ -91,7 +107,7 @@ public class FragmentProfile extends Fragment {
"Watched episode 10 of Dr. Stone",
"Watched episode 9 of Mushoku Tensei",
"Watched episode 11 of Ousama Ranking",
"Watched episode 7 of HUNTER×HUNTER" // Se ignora si hay más de 10
"Watched episode 7 of HUNTER×HUNTER"
};
int limit = Math.min(10, activities.length);
@ -126,16 +142,25 @@ public class FragmentProfile extends Fragment {
int colorRes = R.color.primary;
switch (stat.getCategory()) {
case "Reading": colorRes = R.color.statWatching; break;
case "Completed": colorRes = R.color.statCompleted; break;
case "On Hold": colorRes = R.color.statOnHold; break;
case "Dropped": colorRes = R.color.statDropped; break;
case "Plan to Read": colorRes = R.color.statPlanToWatch; break;
case "Reading":
colorRes = R.color.statWatching;
break;
case "Completed":
colorRes = R.color.statCompleted;
break;
case "On Hold":
colorRes = R.color.statOnHold;
break;
case "Dropped":
colorRes = R.color.statDropped;
break;
case "Plan to Read":
colorRes = R.color.statPlanToWatch;
break;
}
bar.setProgressTintList(ContextCompat.getColorStateList(requireContext(), colorRes));
mangaStatsContainer.addView(statView);
}
}
}

View File

@ -1,16 +1,224 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="@color/background"
tools:context="ui.fragments.anime_list.FragmentAnime">
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
<!-- Parte superior: imagen de fondo + avatar + nombre -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Anime"
android:gravity="center"
android:textSize="30sp"
android:textColor="@color/textPrimary"/>
android:layout_height="200dp"
android:background="@drawable/sample_cover"
android:padding="12dp">
<ImageView
android:id="@+id/imageViewBanner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/sample_cover"
android:contentDescription="Profile background" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="bottom"
android:paddingBottom="16dp">
<ImageView
android:id="@+id/imageViewAvatar"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginEnd="12dp"
android:src="@drawable/ic_profile"
android:background="@drawable/circle_mask"
android:scaleType="centerCrop"
android:clipToOutline="true"
android:contentDescription="Profile picture" />
<TextView
android:id="@+id/textViewUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BtwIsSanti"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textSize="20sp"
android:gravity="center_vertical"/>
</LinearLayout>
</RelativeLayout>
<!-- Tabs simulados -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/primary"
android:padding="8dp">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="Overview"
android:textColor="@color/textPrimary"
android:layout_height="0dp"/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="Anime List"
android:textColor="@color/textPrimary"
android:textStyle="bold"
android:layout_height="0dp"/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="Manga List"
android:textColor="@color/textPrimary"
android:layout_height="0dp"/>
</LinearLayout>
<!-- Campo de búsqueda + botón de filtro + botones de vista -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingHorizontal="8dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:weightSum="1">
<EditText
android:id="@+id/editTextFilter"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.6"
android:hint="Filter"
android:drawableStart="@android:drawable/ic_menu_search"
android:background="@drawable/edittext_background"
android:padding="8dp"
android:textColor="@color/textPrimary"
android:inputType="text"
android:textSize="14sp" />
<ImageView
android:id="@+id/buttonFilterMenu"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.1"
android:src="@drawable/ic_more_vert"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Filter menu"
android:padding="4dp"
app:tint="@color/textPrimary" />
<ImageButton
android:id="@+id/buttonViewGrid"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.1"
android:src="@drawable/ic_view_module"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Grid view"
android:padding="4dp" />
<ImageButton
android:id="@+id/buttonViewList"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.1"
android:src="@drawable/ic_view_list"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="List view"
android:padding="4dp" />
<ImageButton
android:id="@+id/buttonViewLarge"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.1"
android:src="@drawable/ic_view_comfy"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Large view"
android:padding="4dp" />
</LinearLayout>
<!-- Título del estado actual -->
<TextView
android:id="@+id/textViewWatching"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Watching"
android:textColor="@color/textPrimary"
android:textSize="16sp"
android:textStyle="bold"
android:layout_marginTop="4dp"
android:layout_marginBottom="2dp" />
<!-- Encabezado tipo tabla -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:background="@color/primary">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Title"
android:textColor="@color/textPrimary"
android:textStyle="bold"
android:textSize="14sp" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:text="Score"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textStyle="bold"
android:textSize="14sp" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:text="Type"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textStyle="bold"
android:textSize="14sp" />
<TextView
android:layout_width="24dp"
android:layout_height="wrap_content"
android:text="⋮"
android:textColor="@color/textPrimary"
android:gravity="end"
android:textStyle="bold" />
</LinearLayout>
<!-- Lista de anime -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewAnimeList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingBottom="8dp" />
</LinearLayout>
</FrameLayout>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
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:background="@color/background"
@ -10,51 +10,81 @@
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:clipToPadding="false">
android:clipToPadding="false"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingTop="80dp"
android:paddingBottom="100dp"
android:clipToPadding="false">
android:paddingBottom="100dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mainRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:contentDescription="@string/home_section_list"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:paddingHorizontal="16dp"
android:paddingTop="8dp"
android:clipToPadding="false"
android:contentDescription="@string/home_section_list" />
android:paddingTop="8dp" />
<EditText
android:id="@+id/editStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="60dp"
android:hint="Write a status..."
android:textSize="16sp"
android:padding="16dp"
android:layout_marginTop="16dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/edit_text_background"
android:hint="Write a status..."
android:minHeight="60dp"
android:padding="16dp"
android:textColor="@color/textPrimary"
android:textColorHint="@color/textPrimary" />
android:textColorHint="@color/textPrimary"
android:textSize="16sp" />
<include
layout="@layout/item_activity_card"
android:id="@+id/activityCard"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:text="Recent Activity"
android:textColor="@color/textPrimary"
android:textSize="18sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/activityRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_marginHorizontal="16dp" />
android:layout_marginTop="8dp"
android:layout_marginBottom="32dp"
android:nestedScrollingEnabled="false"
android:paddingHorizontal="16dp" />
<Button
android:id="@+id/buttonShowMoreActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="16dp"
android:layout_marginBottom="32dp"
android:text="Mostrar más"
android:visibility="gone" />
<Button
android:id="@+id/buttonShowLessActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="4dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="32dp"
android:text="Mostrar menos"
android:visibility="gone" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</FrameLayout>

View File

@ -1,16 +1,186 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="@color/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
tools:context="ui.fragments.manga_list.FragmentManga">
tools:context=".ui.fragments.manga_list.FragmentManga">
<TextView
<!-- Cabecera de usuario (opcional) -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Manga"
android:gravity="center"
android:textSize="30sp"
android:textColor="@color/textPrimary"/>
android:layout_height="200dp"
android:background="@drawable/sample_cover"
android:padding="12dp">
</FrameLayout>
<ImageView
android:id="@+id/imageViewBanner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/sample_cover"
android:contentDescription="Profile background" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="bottom"
android:paddingBottom="16dp">
<ImageView
android:id="@+id/imageViewAvatar"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginEnd="12dp"
android:src="@drawable/ic_profile"
android:background="@drawable/circle_mask"
android:scaleType="centerCrop"
android:clipToOutline="true"
android:contentDescription="Profile picture" />
<TextView
android:id="@+id/textViewUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BtwIsSanti"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textSize="20sp"
android:gravity="center_vertical"/>
</LinearLayout>
</RelativeLayout>
<!-- Filtros y modos de vista -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingHorizontal="8dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:weightSum="1">
<EditText
android:id="@+id/editTextFilter"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.6"
android:hint="Filter"
android:drawableStart="@android:drawable/ic_menu_search"
android:background="@drawable/edittext_background"
android:padding="8dp"
android:textColor="@color/textPrimary"
android:inputType="text"
android:textSize="14sp" />
<ImageView
android:id="@+id/buttonFilterMenu"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.1"
android:src="@drawable/ic_more_vert"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Filter menu"
android:padding="4dp"
app:tint="@color/textPrimary" />
<ImageButton
android:id="@+id/buttonViewGrid"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.1"
android:src="@drawable/ic_view_module"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Grid view"
android:padding="4dp" />
<ImageButton
android:id="@+id/buttonViewList"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.1"
android:src="@drawable/ic_view_list"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="List view"
android:padding="4dp" />
<ImageButton
android:id="@+id/buttonViewLarge"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.1"
android:src="@drawable/ic_view_comfy"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Large view"
android:padding="4dp" />
</LinearLayout>
<!-- Estado actual -->
<TextView
android:id="@+id/textViewWatching"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reading"
android:textColor="@color/textPrimary"
android:textSize="16sp"
android:textStyle="bold"
android:layout_marginTop="4dp"
android:layout_marginBottom="2dp" />
<!-- Encabezado tabla -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:background="@color/primary">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Title"
android:textColor="@color/textPrimary"
android:textStyle="bold"
android:textSize="14sp" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:text="Score"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textStyle="bold"
android:textSize="14sp" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:text="Type"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textStyle="bold"
android:textSize="14sp" />
<TextView
android:layout_width="24dp"
android:layout_height="wrap_content"
android:text="⋮"
android:textColor="@color/textPrimary"
android:gravity="end"
android:textStyle="bold" />
</LinearLayout>
<!-- Lista -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewAnimeList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingBottom="8dp" />
</LinearLayout>

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:padding="16dp">
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="80dp"> <!-- evita que se tape el final -->
android:paddingBottom="32dp">
<!-- Header con imagen -->
<!-- Header con avatar + nombre -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp">
@ -32,147 +32,122 @@
android:layout_alignParentStart="true"
android:background="@drawable/circle_mask"
android:clipToOutline="true"
android:src="@drawable/sample_avatar" />
android:scaleType="centerCrop"
android:src="@drawable/ic_profile" />
<TextView
android:id="@+id/usernameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/avatarImage"
android:layout_marginStart="16dp"
android:layout_toEndOf="@id/avatarImage"
android:layout_marginStart="12dp"
android:text="BtwIsSanti"
android:textColor="@color/textPrimary"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<!-- Descripción -->
<TextView
android:id="@+id/descriptionText"
<!-- Descripción en tarjeta -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Eiko is my waifu right now\nMai and Mikasa is my second wife"
android:textColor="@color/textPrimary"
android:textSize="16sp" />
android:layout_margin="16dp"
app:cardCornerRadius="16dp"
app:cardElevation="6dp">
<!-- Título: Anime Stats -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:background="@color/primary">
<TextView
android:id="@+id/descriptionTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description"
android:textColor="@color/textPrimary"
android:textStyle="bold"
android:textSize="18sp" />
<TextView
android:id="@+id/profileDescriptionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Eiko is my waifu right now. Mai and Mikasa is my second wife."
android:textColor="@color/textPrimary"
android:textSize="16sp"
android:maxLines="2"
android:ellipsize="end"
android:layout_marginTop="8dp" />
<TextView
android:id="@+id/textViewSeeMore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ver más"
android:textColor="@color/activeTint"
android:textSize="14sp"
android:paddingTop="4dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- Estadísticas de anime -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Anime Stats"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/textPrimary"
android:textSize="18sp"
android:layout_marginTop="16dp" />
android:layout_marginStart="16dp"
android:layout_marginTop="12dp" />
<!-- Totales de anime -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginTop="16dp">
<TextView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="520\nTotal Anime"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textAlignment="center" />
<TextView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="150.5\nDays Watched"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textAlignment="center" />
<TextView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="67.8\nMean Score"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textAlignment="center" />
</LinearLayout>
<!-- Contenedor de barras dinámicas de anime -->
<LinearLayout
android:id="@+id/animeStatsContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="8dp" />
android:layout_margin="16dp" />
<!-- Título: Manga Stats -->
<!-- Estadísticas de manga -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Manga Stats"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/textPrimary"
android:textSize="18sp"
android:layout_marginTop="16dp" />
android:layout_marginStart="16dp"
android:layout_marginTop="12dp" />
<!-- Totales de manga -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginTop="16dp">
<TextView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="189\nTotal Manga"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textAlignment="center" />
<TextView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="9280\nChapters Read"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textAlignment="center" />
<TextView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="71.0\nMean Score"
android:textColor="@color/textPrimary"
android:gravity="center"
android:textAlignment="center" />
</LinearLayout>
<!-- Contenedor de barras dinámicas de manga -->
<LinearLayout
android:id="@+id/mangaStatsContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="8dp" />
android:layout_margin="16dp" />
<!-- Actividad reciente -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recent Activity"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/textPrimary"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp" />
<!-- Actividad -->
<LinearLayout
android:id="@+id/activityContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="24dp" />
android:layout_marginTop="8dp"
android:layout_marginBottom="32dp"
android:paddingBottom="8dp" />
</LinearLayout>
</ScrollView>

View File

@ -1,31 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingTop="12dp"
android:paddingBottom="0dp">
android:paddingBottom="12dp">
<!-- Título de la sección -->
<TextView
android:id="@+id/sectionTitle"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Section Title"
android:textSize="22sp"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/textPrimary"
android:paddingBottom="8dp" />
android:layout_marginBottom="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp" />
<!-- Lista horizontal de ítems -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/sectionRecycler"
android:id="@+id/sectionRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:overScrollMode="never"
android:nestedScrollingEnabled="false"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
android:nestedScrollingEnabled="false" />
</LinearLayout>

View File

@ -4,6 +4,7 @@
<color name="background">#121926</color>
<color name="textPrimary">#FFFFFF</color>
<color name="gray">#808080</color>
<color name="activeTint">#F26D50</color> <!-- estilo AniList -->
<!-- Colores por estado -->
<color name="statWatching">#3db4f2</color>
@ -11,5 +12,4 @@
<color name="statOnHold">#f5a623</color>
<color name="statDropped">#f45b69</color>
<color name="statPlanToWatch">#c678dd</color>
</resources>

View File

@ -17,4 +17,7 @@
<item name="activityAction" type="id" />
<item name="statLabelFull" type="id" />
<item name="statProgressBar" type="id" />
<item name="imageViewCover" type="id" />
<item name="textViewProgress" type="id" />
<item name="textViewTitle" type="id" />
</resources>

View File

@ -6,4 +6,5 @@
<string name="media_image_desc">Media Image</string>
<string name="profile">\n</string>
<string name="write_a_status">Write a status...</string>
<string name="show_more" />
</resources>