Diario: pantalla con frases ya salidas (cards con fecha), búsqueda y filtro por autor, pestaña nueva en la bottom nav (patrón FrasesDeAnime)
This commit is contained in:
1 parent
b4437d839b
commit
aa4b22c6c5
16 files changed
+622
-6
No files matched your search
@@ -23,6 +23,7 @@
|
||||
</activity>
|
||||
<activity android:name=".OptsActivity" android:label="@string/nav_opciones" android:exported="false"/>
|
||||
<activity android:name=".FavsActivity" android:label="@string/nav_favoritos" android:exported="false"/>
|
||||
<activity android:name=".DiaryActivity" android:label="@string/nav_diario" android:exported="false"/>
|
||||
<activity android:name=".AboutOfActivity" android:label="@string/aboutOf" android:exported="false"/>
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.ads.APPLICATION_ID"
|
||||
|
||||
@@ -386,6 +386,47 @@ public class DatabaseHelper {
|
||||
return a.toArray(new String[0]);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Diario (frases que ya han salido) */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/** Frase de un día ya visto: (Tday, IDFrase) */
|
||||
static class DiaryEntry {
|
||||
final String tday;
|
||||
final int idf;
|
||||
|
||||
DiaryEntry(String tday, int idf) {
|
||||
this.tday = tday;
|
||||
this.idf = idf;
|
||||
}
|
||||
}
|
||||
|
||||
/** Frases ya salidas en orden cronológico por día (para el Diario).
|
||||
* El día sirve para la fecha de las cards. */
|
||||
List<DiaryEntry> getSeenFrases() {
|
||||
List<DiaryEntry> seen = new ArrayList<>();
|
||||
try (Cursor c = userDb.rawQuery("SELECT Tday, IDFrase FROM frasesG ORDER BY Tday ASC", null)) {
|
||||
while (c.moveToNext()) {
|
||||
seen.add(new DiaryEntry(c.getString(0), c.getInt(1)));
|
||||
}
|
||||
}
|
||||
return seen;
|
||||
}
|
||||
|
||||
/** AutorID del maestro para una frase (-1 si no es válida) */
|
||||
int getAutorIDFromID(int IDF) {
|
||||
if (IDF <= 0) {
|
||||
return -1;
|
||||
}
|
||||
try (Cursor c = masterDb.rawQuery("SELECT AutorID FROM frases WHERE _id = ?",
|
||||
new String[]{String.valueOf(IDF)})) {
|
||||
return c.moveToFirst() ? c.getInt(0) : -1;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "getAutorID: " + e);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private String todayKey() {
|
||||
return new SimpleDateFormat("yyyyMMdd", Locale.US).format(new Date());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,312 @@
|
||||
package com.jkanetwork.st.calendariodefrases;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Diario (patrón FrasesDeAnime): frases que ya han salido, en cards con la
|
||||
* fecha en que salieron, búsqueda + filtro por autor y barra de navegación
|
||||
* inferior. Long-press en card: copiar/compartir.
|
||||
*/
|
||||
public class DiaryActivity extends AppCompatActivity {
|
||||
|
||||
DatabaseHelper db;
|
||||
|
||||
/** Fila de una card del diario */
|
||||
static class CardItem {
|
||||
final int idf;
|
||||
final int autorId;
|
||||
final String sentence;
|
||||
final String autor;
|
||||
final String date;
|
||||
|
||||
CardItem(int idf, int autorId, String sentence, String autor, String date) {
|
||||
this.idf = idf;
|
||||
this.autorId = autorId;
|
||||
this.sentence = sentence;
|
||||
this.autor = autor;
|
||||
this.date = date;
|
||||
}
|
||||
}
|
||||
|
||||
/** Adapter de cards (item_quote_card.xml): autor accent + fecha, sin estrella */
|
||||
class QuoteCardAdapter extends BaseAdapter {
|
||||
private List<CardItem> items = new ArrayList<>();
|
||||
|
||||
void update(List<CardItem> newItems) {
|
||||
items = newItems;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return items.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View v = convertView != null ? convertView
|
||||
: getLayoutInflater().inflate(R.layout.item_quote_card, parent, false);
|
||||
CardItem item = items.get(position);
|
||||
TextView autor = v.findViewById(R.id.card_autor);
|
||||
TextView sentence = v.findViewById(R.id.card_sentence);
|
||||
TextView date = v.findViewById(R.id.card_date);
|
||||
ImageView star = v.findViewById(R.id.card_star);
|
||||
autor.setText(item.autor);
|
||||
sentence.setText(item.sentence);
|
||||
date.setText(item.date);
|
||||
date.setVisibility(View.VISIBLE);
|
||||
star.setVisibility(View.GONE);
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
private final QuoteCardAdapter adapter = new QuoteCardAdapter();
|
||||
private final List<CardItem> allItems = new ArrayList<>();
|
||||
/* IDs de la vista FILTRADA, en el mismo orden que el adapter: si el
|
||||
adapter se reordena tras filtrar, el long-press debe actuar sobre la
|
||||
frase visible (esta lista), no sobre la BD en crudo */
|
||||
private final List<Integer> listIDFrases = new ArrayList<>();
|
||||
private Integer filterAutor = null; /* null = todos */
|
||||
private String query = "";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_diary);
|
||||
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
UiUtils.applySystemBarsInsets(this, findViewById(R.id.main_root),
|
||||
ContextCompat.getColor(this, R.color.bgCard), UiUtils.isDarkTheme(this));
|
||||
UiUtils.setupBottomNav(this, UiUtils.NavTab.DIARIO);
|
||||
UiUtils.loadBannerAd(this, (android.widget.FrameLayout) findViewById(R.id.adContainer));
|
||||
|
||||
db = new DatabaseHelper(this);
|
||||
|
||||
ListView list = findViewById(R.id.view_list);
|
||||
list.setAdapter(adapter);
|
||||
list.setEmptyView(findViewById(R.id.empty_list));
|
||||
registerForContextMenu(list);
|
||||
|
||||
/* Búsqueda: refiltra al teclear */
|
||||
EditText search = findViewById(R.id.search_input);
|
||||
search.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
query = s.toString().trim();
|
||||
applyFilters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int a, int b, int c) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int a, int b, int c) {
|
||||
}
|
||||
});
|
||||
|
||||
/* Restaurar filtro/búsqueda tras recrear la activity (giro, etc.) */
|
||||
if (savedInstanceState != null) {
|
||||
query = savedInstanceState.getString("query", "");
|
||||
if (savedInstanceState.containsKey("autor")) {
|
||||
filterAutor = savedInstanceState.getInt("autor");
|
||||
}
|
||||
if (!query.isEmpty()) {
|
||||
search.setText(query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString("query", query);
|
||||
if (filterAutor != null) {
|
||||
outState.putInt("autor", filterAutor);
|
||||
}
|
||||
}
|
||||
|
||||
/** Carga las frases ya salidas (con su fecha) y refresca filtro y lista */
|
||||
private void loadAll() {
|
||||
allItems.clear();
|
||||
for (DatabaseHelper.DiaryEntry e : db.getSeenFrases()) {
|
||||
if (e.idf <= 0) {
|
||||
continue;
|
||||
}
|
||||
allItems.add(new CardItem(e.idf, db.getAutorIDFromID(e.idf),
|
||||
db.getFraseFromID(e.idf), db.getAutorFromID(e.idf), formatDate(e.tday)));
|
||||
}
|
||||
setupFilterSpinner();
|
||||
applyFilters();
|
||||
}
|
||||
|
||||
/** TDay "20261017" -> "17 oct" */
|
||||
private String formatDate(String tday) {
|
||||
if (tday == null || tday.length() != 8) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
int day = Integer.parseInt(tday.substring(6, 8));
|
||||
int month = Integer.parseInt(tday.substring(4, 6));
|
||||
String[] months = {"ene", "feb", "mar", "abr", "may", "jun",
|
||||
"jul", "ago", "sep", "oct", "nov", "dic"};
|
||||
if (month < 1 || month > 12) {
|
||||
return "";
|
||||
}
|
||||
return day + " " + months[month - 1];
|
||||
} catch (NumberFormatException ex) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/** Desplegable "Todos los autores" + los presentes en el diario */
|
||||
private void setupFilterSpinner() {
|
||||
LinkedHashMap<Integer, String> autores = new LinkedHashMap<>();
|
||||
for (CardItem item : allItems) {
|
||||
if (item.autorId > 0 && !autores.containsKey(item.autorId)) {
|
||||
autores.put(item.autorId, item.autor);
|
||||
}
|
||||
}
|
||||
List<String> names = new ArrayList<>();
|
||||
names.add(getString(R.string.diario_todos));
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
ids.add(-1); /* -1 = todos (posición 0) */
|
||||
autores.entrySet().stream()
|
||||
.sorted((a, b) -> a.getValue().toLowerCase(Locale.getDefault())
|
||||
.compareTo(b.getValue().toLowerCase(Locale.getDefault())))
|
||||
.forEachOrdered(e -> {
|
||||
ids.add(e.getKey());
|
||||
names.add(e.getValue());
|
||||
});
|
||||
|
||||
ArrayAdapter<String> spinnerAdapter =
|
||||
new ArrayAdapter<>(this, R.layout.spinner_value, names);
|
||||
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
Spinner spinner = findViewById(R.id.spinner_autor);
|
||||
spinner.setAdapter(spinnerAdapter);
|
||||
|
||||
/* Mantener el filtro actual si sigue existiendo */
|
||||
int pos = 0;
|
||||
if (filterAutor != null) {
|
||||
int idx = ids.indexOf(filterAutor);
|
||||
pos = idx > 0 ? idx : 0;
|
||||
}
|
||||
spinner.setSelection(pos, false);
|
||||
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
Integer newFilter = ids.get(position);
|
||||
filterAutor = (newFilter != null && newFilter > 0) ? newFilter : null;
|
||||
applyFilters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Aplica filtro de autor + búsqueda sobre allItems */
|
||||
private void applyFilters() {
|
||||
List<CardItem> filtered = new ArrayList<>();
|
||||
String q = query.toLowerCase(Locale.getDefault());
|
||||
for (CardItem item : allItems) {
|
||||
boolean okAutor = filterAutor == null || item.autorId == filterAutor;
|
||||
boolean okQuery = q.isEmpty()
|
||||
|| item.sentence.toLowerCase(Locale.getDefault()).contains(q)
|
||||
|| item.autor.toLowerCase(Locale.getDefault()).contains(q);
|
||||
if (okAutor && okQuery) {
|
||||
filtered.add(item);
|
||||
}
|
||||
}
|
||||
listIDFrases.clear();
|
||||
for (CardItem item : filtered) {
|
||||
listIDFrases.add(item.idf);
|
||||
}
|
||||
adapter.update(filtered);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
loadAll(); /* las frases vistas pueden cambiar desde la main */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||
ContextMenu.ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_diarysentence, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
android.widget.AdapterView.AdapterContextMenuInfo info =
|
||||
(android.widget.AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
|
||||
int position = info.position;
|
||||
if (position < 0 || position >= listIDFrases.size()) {
|
||||
return false;
|
||||
}
|
||||
int idf = listIDFrases.get(position);
|
||||
String sentence = db.getFraseFromID(idf);
|
||||
String autor = db.getAutorFromID(idf);
|
||||
String shared = sentence + " (" + autor + ")\n" + getString(R.string.sharefrom);
|
||||
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.copy) {
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText("Sentence", shared));
|
||||
Toast.makeText(getApplicationContext(), R.string.copied, Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
} else if (id == R.id.share) {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, shared);
|
||||
startActivity(Intent.createChooser(intent, getString(R.string.share_with)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -79,9 +79,12 @@ public class FavsActivity extends AppCompatActivity {
|
||||
CardItem item = items.get(position);
|
||||
TextView autor = v.findViewById(R.id.card_autor);
|
||||
TextView sentence = v.findViewById(R.id.card_sentence);
|
||||
TextView date = v.findViewById(R.id.card_date);
|
||||
ImageView star = v.findViewById(R.id.card_star);
|
||||
autor.setText(item.autor);
|
||||
sentence.setText(item.sentence);
|
||||
date.setVisibility(View.GONE);
|
||||
star.setVisibility(View.VISIBLE);
|
||||
star.setOnClickListener(x -> onUnfav(item));
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public final class UiUtils {
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/** Pestañas de la barra inferior */
|
||||
public enum NavTab {INICIO, FAVORITOS, OPCIONES}
|
||||
public enum NavTab {INICIO, FAVORITOS, DIARIO, OPCIONES}
|
||||
|
||||
/**
|
||||
* Prepara la barra inferior (view_bottom_nav.xml) incluida en el layout:
|
||||
@@ -112,12 +112,15 @@ public final class UiUtils {
|
||||
|
||||
styleTab(activity, R.id.nav_inicio, accent, muted, active == NavTab.INICIO);
|
||||
styleTab(activity, R.id.nav_favoritos, accent, muted, active == NavTab.FAVORITOS);
|
||||
styleTab(activity, R.id.nav_diario, accent, muted, active == NavTab.DIARIO);
|
||||
styleTab(activity, R.id.nav_opciones, accent, muted, active == NavTab.OPCIONES);
|
||||
|
||||
activity.findViewById(R.id.nav_inicio).setOnClickListener(
|
||||
v -> goTab(activity, active, NavTab.INICIO));
|
||||
activity.findViewById(R.id.nav_favoritos).setOnClickListener(
|
||||
v -> goTab(activity, active, NavTab.FAVORITOS));
|
||||
activity.findViewById(R.id.nav_diario).setOnClickListener(
|
||||
v -> goTab(activity, active, NavTab.DIARIO));
|
||||
activity.findViewById(R.id.nav_opciones).setOnClickListener(
|
||||
v -> goTab(activity, active, NavTab.OPCIONES));
|
||||
}
|
||||
@@ -144,6 +147,8 @@ public final class UiUtils {
|
||||
cls = MainActivity.class;
|
||||
} else if (target == NavTab.FAVORITOS) {
|
||||
cls = FavsActivity.class;
|
||||
} else if (target == NavTab.DIARIO) {
|
||||
cls = DiaryActivity.class;
|
||||
} else {
|
||||
cls = OptsActivity.class;
|
||||
}
|
||||
@@ -154,7 +159,7 @@ public final class UiUtils {
|
||||
activity.overridePendingTransition(0, 0);
|
||||
/* Solo las pestañas viven en la pila; Acerca de se cierra al salir */
|
||||
if (!(activity instanceof MainActivity) && !(activity instanceof FavsActivity)
|
||||
&& !(activity instanceof OptsActivity)) {
|
||||
&& !(activity instanceof DiaryActivity) && !(activity instanceof OptsActivity)) {
|
||||
activity.finish();
|
||||
activity.overridePendingTransition(0, 0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Tarjeta de botones de navegación: borde marcado borderStrong, esquinas 8dp -->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/bgCard" />
|
||||
<stroke android:width="1dp" android:color="@color/borderStrong" />
|
||||
<corners android:radius="8dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp" android:height="24dp"
|
||||
android:viewportWidth="24" android:viewportHeight="24">
|
||||
<!-- Diario: libro -->
|
||||
<path android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zM20,2H8C6.9,2 6,2.9 6,4v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4C22,2.9 21.1,2 20,2zM20,16H8V4h12v12z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp" android:height="24dp"
|
||||
android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M7.41,8.59L12,13.17l4.59,-4.58L18,10l-6,6 -6,-6 1.41,-1.41z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp" android:height="24dp"
|
||||
android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M10,18h4v-2h-4v2zM3,6v2h18V6H3zM6,14h12v-2H6v2z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Diario (patrón FrasesDeAnime): header + búsqueda + filtro autor + cards con
|
||||
la fecha en que salió cada frase. Long-press en card: copiar/compartir. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/main_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bgMain"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Header -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="@color/bgCard"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/nav_diario"
|
||||
android:textColor="@color/textPrimary"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/borderColor" />
|
||||
|
||||
<!-- Contenido -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<!-- Búsqueda -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="42dp"
|
||||
android:background="@drawable/bg_pill"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_search"
|
||||
app:tint="@color/colorTextMuted" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search_input"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:hint="@string/buscar_diario"
|
||||
android:imeOptions="actionSearch"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/textPrimary"
|
||||
android:textColorHint="@color/colorTextMuted"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Filtro desplegable por autor -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/bg_card_strong"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="14dp"
|
||||
android:paddingEnd="14dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_filter"
|
||||
app:tint="@color/colorTextSecondary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/filtrar_por_autor"
|
||||
android:textColor="@color/colorTextMuted"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_autor"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@null" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_chevron_down"
|
||||
app:tint="@color/colorTextSecondary" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Lista de cards -->
|
||||
<ListView
|
||||
android:id="@+id/view_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_weight="1"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:scrollbars="none" />
|
||||
|
||||
<!-- Estado vacío -->
|
||||
<TextView
|
||||
android:id="@+id/empty_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/lista_vacia"
|
||||
android:textColor="@color/colorTextMuted"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Banner AdMob (AdView por código en loadBannerAd) -->
|
||||
<FrameLayout
|
||||
android:id="@+id/adContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- Barra de navegación inferior -->
|
||||
<include
|
||||
android:id="@+id/bottom_nav"
|
||||
layout="@layout/view_bottom_nav" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Card de frase para Favoritos (mockup SVG): autor en accent + estrella -->
|
||||
<!-- Card de frase para Favoritos y Diario (mockup SVG):
|
||||
autor en accent, fecha (solo Diario) y estrella (solo Favoritos) -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
@@ -26,6 +27,16 @@
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/card_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="17 oct"
|
||||
android:textColor="@color/colorTextMuted"
|
||||
android:textSize="11sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/card_star"
|
||||
android:layout_width="22dp"
|
||||
@@ -33,6 +44,7 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:contentDescription="@string/delfav"
|
||||
android:src="@drawable/ic_nav_star"
|
||||
android:visibility="gone"
|
||||
app:tint="@color/star" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Vista cerrada del Spinner del filtro de autor (dentro de la card con chevron) -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/textPrimary"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Barra de navegación inferior compartida (Inicio/Favoritos/Opciones).
|
||||
La pestaña activa se marca desde código (MainActivity.setupBottomNav)
|
||||
<!-- Barra de navegación inferior compartida (Inicio/Favoritos/Diario/Opciones).
|
||||
La pestaña activa se marca desde código (UiUtils.setupBottomNav)
|
||||
tintando icono+texto en accent. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
@@ -64,6 +64,33 @@
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/nav_diario"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_book"
|
||||
app:tint="@color/colorTextMuted" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/nav_diario"
|
||||
android:textColor="@color/colorTextMuted"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/nav_opciones"
|
||||
android:layout_width="0dp"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Menú contextual de una frase del Diario (como Favoritos sin "borrar fav") -->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/copy"
|
||||
android:title="@string/copiar" />
|
||||
|
||||
<item
|
||||
android:id="@+id/share"
|
||||
android:title="@string/compartir" />
|
||||
</menu>
|
||||
@@ -23,6 +23,7 @@
|
||||
<!-- Bottom nav -->
|
||||
<string name="nav_inicio">Inicio</string>
|
||||
<string name="nav_favoritos">Favoritos</string>
|
||||
<string name="nav_diario">Diario</string>
|
||||
<string name="nav_opciones">Opciones</string>
|
||||
<!-- Favoritos -->
|
||||
<string name="buscar_favoritos">Buscar en favoritos…</string>
|
||||
@@ -30,6 +31,10 @@
|
||||
<string name="copiar">Copiar</string>
|
||||
<string name="delfav">Borrar de los favoritos</string>
|
||||
<string name="compartir">Compartir</string>
|
||||
<!-- Diario -->
|
||||
<string name="buscar_diario">Buscar en el diario…</string>
|
||||
<string name="filtrar_por_autor">Filtrar por autor</string>
|
||||
<string name="diario_todos">Todos los autores</string>
|
||||
<!-- Opciones -->
|
||||
<string name="opts_notif_title">Notificación diaria</string>
|
||||
<string name="opts_notif_desc">Recibir cada día la frase como notificación</string>
|
||||
|
||||
Reference in new issue
Block a user