forked from github/szkolny
[UI] New notifications view.
This commit is contained in:
parent
34061695f9
commit
83d123e341
@ -21,7 +21,10 @@ interface NotificationDao {
|
|||||||
@Query("DELETE FROM notifications WHERE profileId = :profileId")
|
@Query("DELETE FROM notifications WHERE profileId = :profileId")
|
||||||
fun clear(profileId: Int)
|
fun clear(profileId: Int)
|
||||||
|
|
||||||
@Query("SELECT * FROM notifications")
|
@Query("DELETE FROM notifications")
|
||||||
|
fun clearAll()
|
||||||
|
|
||||||
|
@Query("SELECT * FROM notifications ORDER BY addedDate DESC")
|
||||||
fun getAll(): LiveData<List<Notification>>
|
fun getAll(): LiveData<List<Notification>>
|
||||||
|
|
||||||
@Query("SELECT * FROM notifications")
|
@Query("SELECT * FROM notifications")
|
||||||
|
@ -1,104 +0,0 @@
|
|||||||
package pl.szczodrzynski.edziennik.ui.modules.notifications;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.PorterDuff;
|
|
||||||
import android.graphics.PorterDuffColorFilter;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.cardview.widget.CardView;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.App;
|
|
||||||
import pl.szczodrzynski.edziennik.R;
|
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Notification;
|
|
||||||
|
|
||||||
import static pl.szczodrzynski.edziennik.utils.Utils.d;
|
|
||||||
|
|
||||||
public class NotificationsAdapter extends RecyclerView.Adapter<NotificationsAdapter.ViewHolder> {
|
|
||||||
private static final String TAG = "NotificationsAdapter";
|
|
||||||
private Context context;
|
|
||||||
private List<Notification> notificationList;
|
|
||||||
|
|
||||||
//getting the context and product list with constructor
|
|
||||||
public NotificationsAdapter(Context mCtx, List<Notification> notificationList) {
|
|
||||||
this.context = mCtx;
|
|
||||||
this.notificationList = notificationList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
||||||
//inflating and returning our view holder
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(context);
|
|
||||||
View view = inflater.inflate(R.layout.row_notifications_item, parent, false);
|
|
||||||
return new ViewHolder(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
|
||||||
App app = (App) context.getApplicationContext();
|
|
||||||
|
|
||||||
Notification notification = notificationList.get(position);
|
|
||||||
|
|
||||||
holder.notificationsItemDate.setText(Date.fromMillis(notification.addedDate).getFormattedString());
|
|
||||||
holder.notificationsItemText.setText(notification.text);
|
|
||||||
holder.notificationsItemTitle.setText(notification.title);
|
|
||||||
holder.notificationsItemType.setText(Notification.stringType(context, notification.type));
|
|
||||||
|
|
||||||
holder.notificationsItemCard.setOnClickListener((v -> {
|
|
||||||
Intent intent = new Intent("android.intent.action.MAIN");
|
|
||||||
notification.fillIntent(intent);
|
|
||||||
|
|
||||||
d(TAG, "notification with item "+notification.redirectFragmentId+" extras "+(intent.getExtras() == null ? "null" : intent.getExtras().toString()));
|
|
||||||
|
|
||||||
//Log.d(TAG, "Got date "+intent.getLongExtra("timetableDate", 0));
|
|
||||||
|
|
||||||
if (notification.profileId != -1 && notification.profileId != app.profile.getId() && context instanceof Activity) {
|
|
||||||
Toast.makeText(app, app.getString(R.string.toast_changing_profile), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
app.sendBroadcast(intent);
|
|
||||||
}));
|
|
||||||
|
|
||||||
if (!notification.seen) {
|
|
||||||
holder.notificationsItemText.setBackground(context.getResources().getDrawable(R.drawable.bg_rounded_8dp));
|
|
||||||
holder.notificationsItemText.getBackground().setColorFilter(new PorterDuffColorFilter(0x692196f3, PorterDuff.Mode.MULTIPLY));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
holder.notificationsItemText.setBackground(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return notificationList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
class ViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
|
|
||||||
CardView notificationsItemCard;
|
|
||||||
TextView notificationsItemDate;
|
|
||||||
TextView notificationsItemText;
|
|
||||||
TextView notificationsItemTitle;
|
|
||||||
TextView notificationsItemType;
|
|
||||||
|
|
||||||
ViewHolder(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
notificationsItemCard = itemView.findViewById(R.id.notificationsItemCard);
|
|
||||||
notificationsItemDate = itemView.findViewById(R.id.notificationsItemDate);
|
|
||||||
notificationsItemText = itemView.findViewById(R.id.notificationsItemText);
|
|
||||||
notificationsItemTitle = itemView.findViewById(R.id.notificationsItemTitle);
|
|
||||||
notificationsItemType = itemView.findViewById(R.id.notificationsItemType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,72 @@
|
|||||||
|
package pl.szczodrzynski.edziennik.ui.modules.notifications
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import pl.szczodrzynski.edziennik.*
|
||||||
|
import pl.szczodrzynski.edziennik.data.db.modules.notification.Notification
|
||||||
|
import pl.szczodrzynski.edziennik.data.db.modules.notification.getNotificationTitle
|
||||||
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
|
||||||
|
class NotificationsAdapter(
|
||||||
|
private val context: Context
|
||||||
|
) : RecyclerView.Adapter<NotificationsAdapter.ViewHolder>() {
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "NotificationsAdapter"
|
||||||
|
}
|
||||||
|
|
||||||
|
var items = listOf<Notification>()
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
val view = inflater.inflate(R.layout.row_notifications_item, parent, false)
|
||||||
|
return ViewHolder(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
val app = context.applicationContext as App
|
||||||
|
|
||||||
|
val notification = items[position]
|
||||||
|
|
||||||
|
val date = Date.fromMillis(notification.addedDate).formattedString
|
||||||
|
val colorSecondary = android.R.attr.textColorSecondary.resolveAttr(context)
|
||||||
|
|
||||||
|
holder.title.text = notification.text
|
||||||
|
holder.profileDate.text = listOf(
|
||||||
|
notification.profileName ?: "",
|
||||||
|
" • ",
|
||||||
|
date.asColoredSpannable(colorSecondary)
|
||||||
|
).concat()
|
||||||
|
holder.type.text = context.getNotificationTitle(notification.type)
|
||||||
|
|
||||||
|
holder.root.onClick {
|
||||||
|
val intent = Intent("android.intent.action.MAIN")
|
||||||
|
notification.fillIntent(intent)
|
||||||
|
|
||||||
|
d(TAG, "notification with item " + notification.viewId + " extras " + if (intent.extras == null) "null" else intent.extras!!.toString())
|
||||||
|
|
||||||
|
//Log.d(TAG, "Got date "+intent.getLongExtra("timetableDate", 0));
|
||||||
|
|
||||||
|
if (notification.profileId != -1 && notification.profileId != app.profile.id && context is Activity) {
|
||||||
|
Toast.makeText(app, app.getString(R.string.toast_changing_profile), Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
app.sendBroadcast(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = items.size
|
||||||
|
|
||||||
|
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
|
var root = itemView
|
||||||
|
var title: TextView = itemView.findViewById(R.id.title)
|
||||||
|
var profileDate: TextView = itemView.findViewById(R.id.profileDate)
|
||||||
|
var type: TextView = itemView.findViewById(R.id.type)
|
||||||
|
}
|
||||||
|
}
|
@ -1,65 +0,0 @@
|
|||||||
package pl.szczodrzynski.edziennik.ui.modules.notifications;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.App;
|
|
||||||
import pl.szczodrzynski.edziennik.R;
|
|
||||||
import pl.szczodrzynski.edziennik.databinding.FragmentNotificationsBinding;
|
|
||||||
import pl.szczodrzynski.edziennik.utils.Themes;
|
|
||||||
|
|
||||||
public class NotificationsFragment extends Fragment {
|
|
||||||
|
|
||||||
private App app = null;
|
|
||||||
private Activity activity = null;
|
|
||||||
private FragmentNotificationsBinding b = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
activity = getActivity();
|
|
||||||
if (getActivity() == null || getContext() == null)
|
|
||||||
return null;
|
|
||||||
app = (App) activity.getApplication();
|
|
||||||
getContext().getTheme().applyStyle(Themes.INSTANCE.getAppTheme(), true);
|
|
||||||
if (app.profile == null)
|
|
||||||
return inflater.inflate(R.layout.fragment_loading, container, false);
|
|
||||||
// activity, context and profile is valid
|
|
||||||
b = DataBindingUtil.inflate(inflater, R.layout.fragment_notifications, container, false);
|
|
||||||
return b.getRoot();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
if (app == null || app.profile == null || activity == null || b == null || !isAdded())
|
|
||||||
return;
|
|
||||||
|
|
||||||
RecyclerView recyclerView = b.notificationsView;
|
|
||||||
recyclerView.setHasFixedSize(true);
|
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
|
||||||
|
|
||||||
if (app.appConfig.notifications.size() > 0) {
|
|
||||||
NotificationsAdapter adapter = new NotificationsAdapter(getContext(), app.appConfig.notifications);
|
|
||||||
recyclerView.setAdapter(adapter);
|
|
||||||
recyclerView.setVisibility(View.VISIBLE);
|
|
||||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
|
||||||
//linearLayoutManager.setReverseLayout(true);
|
|
||||||
//linearLayoutManager.setStackFromEnd(true);
|
|
||||||
recyclerView.setLayoutManager(linearLayoutManager);
|
|
||||||
b.notificationsNoData.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
recyclerView.setVisibility(View.GONE);
|
|
||||||
b.notificationsNoData.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Kuba Szczodrzyński 2019-11-22.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pl.szczodrzynski.edziennik.ui.modules.notifications
|
||||||
|
|
||||||
|
import android.os.AsyncTask
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.lifecycle.Observer
|
||||||
|
import androidx.recyclerview.widget.DividerItemDecoration.HORIZONTAL
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||||
|
import pl.szczodrzynski.edziennik.App
|
||||||
|
import pl.szczodrzynski.edziennik.MainActivity
|
||||||
|
import pl.szczodrzynski.edziennik.R
|
||||||
|
import pl.szczodrzynski.edziennik.databinding.FragmentNotificationsBinding
|
||||||
|
import pl.szczodrzynski.edziennik.utils.SimpleDividerItemDecoration
|
||||||
|
import pl.szczodrzynski.edziennik.utils.Themes
|
||||||
|
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationsFragment : Fragment() {
|
||||||
|
private lateinit var app: App
|
||||||
|
private lateinit var activity: MainActivity
|
||||||
|
private lateinit var b: FragmentNotificationsBinding
|
||||||
|
|
||||||
|
private val adapter by lazy {
|
||||||
|
NotificationsAdapter(activity)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
|
activity = (getActivity() as MainActivity?) ?: return null
|
||||||
|
if (context == null)
|
||||||
|
return null
|
||||||
|
app = activity.application as App
|
||||||
|
context!!.theme.applyStyle(Themes.appTheme, true)
|
||||||
|
if (app.profile == null)
|
||||||
|
return inflater.inflate(R.layout.fragment_loading, container, false)
|
||||||
|
// activity, context and profile is valid
|
||||||
|
b = FragmentNotificationsBinding.inflate(inflater)
|
||||||
|
return b.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
// TODO check if app, activity, b can be null
|
||||||
|
if (app.profile == null || !isAdded)
|
||||||
|
return
|
||||||
|
|
||||||
|
activity.bottomSheet.prependItems(
|
||||||
|
BottomSheetPrimaryItem(true)
|
||||||
|
.withTitle(R.string.menu_remove_notifications)
|
||||||
|
.withIcon(CommunityMaterial.Icon.cmd_delete_sweep_outline)
|
||||||
|
.withOnClickListener(View.OnClickListener {
|
||||||
|
activity.bottomSheet.close()
|
||||||
|
AsyncTask.execute { app.db.notificationDao().clearAll() }
|
||||||
|
Toast.makeText(activity, R.string.menu_remove_notifications_success, Toast.LENGTH_SHORT).show()
|
||||||
|
}))
|
||||||
|
|
||||||
|
app.db.notificationDao()
|
||||||
|
.getAll()
|
||||||
|
.observe(this, Observer { notifications ->
|
||||||
|
if (app.profile == null || !isAdded) return@Observer
|
||||||
|
|
||||||
|
adapter.items = notifications
|
||||||
|
if (b.notificationsView.adapter == null) {
|
||||||
|
b.notificationsView.adapter = adapter
|
||||||
|
b.notificationsView.apply {
|
||||||
|
setHasFixedSize(true)
|
||||||
|
layoutManager = LinearLayoutManager(context).apply {
|
||||||
|
addItemDecoration(SimpleDividerItemDecoration(context))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
if (notifications != null && notifications.isNotEmpty()) {
|
||||||
|
b.notificationsView.visibility = View.VISIBLE
|
||||||
|
b.notificationsNoData.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
b.notificationsView.visibility = View.GONE
|
||||||
|
b.notificationsNoData.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Kuba Szczodrzyński 2019-11-22.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pl.szczodrzynski.edziennik.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import pl.szczodrzynski.edziennik.R;
|
||||||
|
|
||||||
|
public class SimpleDividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
private Drawable mDivider;
|
||||||
|
|
||||||
|
public SimpleDividerItemDecoration(Context context) {
|
||||||
|
mDivider = context.getResources().getDrawable(R.drawable.divider);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||||
|
int left = parent.getPaddingLeft();
|
||||||
|
int right = parent.getWidth() - parent.getPaddingRight();
|
||||||
|
|
||||||
|
int childCount = parent.getChildCount();
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
View child = parent.getChildAt(i);
|
||||||
|
|
||||||
|
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||||
|
|
||||||
|
int top = child.getBottom() + params.bottomMargin;
|
||||||
|
int bottom = top + mDivider.getIntrinsicHeight();
|
||||||
|
|
||||||
|
mDivider.setBounds(left, top, right, bottom);
|
||||||
|
mDivider.draw(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
app/src/main/res/drawable/divider.xml
Normal file
15
app/src/main/res/drawable/divider.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) Kuba Szczodrzyński 2019-11-22.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<size
|
||||||
|
android:width="1dp"
|
||||||
|
android:height="1dp" />
|
||||||
|
|
||||||
|
<solid android:color="@color/dividerColor" />
|
||||||
|
|
||||||
|
</shape>
|
37
app/src/main/res/drawable/ic_no_notifications.xml
Normal file
37
app/src/main/res/drawable/ic_no_notifications.xml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (c) Kuba Szczodrzyński 2019-11-22.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="128dp"
|
||||||
|
android:height="128dp"
|
||||||
|
android:viewportWidth="128"
|
||||||
|
android:viewportHeight="128">
|
||||||
|
<path
|
||||||
|
android:pathData="m104,18h-80c-5.523,0 -10,4.477 -10,10v84.699c0,2.93 2.371,5.301 5.301,5.301h0.012c1.691,0 3.277,-0.805 4.277,-2.164l10.082,-13.75c1.883,-2.566 4.875,-4.086 8.063,-4.086h62.266c5.523,0 10,-4.477 10,-10v-60c0,-5.523 -4.477,-10 -10,-10z"
|
||||||
|
android:fillColor="#2babee"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m128,104c0,13.254 -10.746,24 -24,24 -13.254,0 -24,-10.746 -24,-24s10.746,-24 24,-24c13.254,0 24,10.746 24,24z"
|
||||||
|
android:fillColor="#fc556c"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m114.84,98.824 l-16.012,16.012c-1.555,1.555 -4.102,1.555 -5.656,0 -1.555,-1.559 -1.555,-4.106 0,-5.656l16.012,-16.012c1.555,-1.555 4.102,-1.555 5.656,0 1.551,1.555 1.551,4.102 0,5.656z"
|
||||||
|
android:fillColor="#fff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m93.164,98.824 l16.012,16.012c1.555,1.555 4.102,1.555 5.656,0 1.555,-1.559 1.555,-4.106 0,-5.656l-16.012,-16.012c-1.555,-1.555 -4.102,-1.555 -5.656,0 -1.551,1.555 -1.551,4.102 0,5.656z"
|
||||||
|
android:fillColor="#fff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m74,78h-36c-2.211,0 -4,-1.789 -4,-4 0,-2.211 1.789,-4 4,-4h36c2.211,0 4,1.789 4,4 0,2.211 -1.789,4 -4,4z"
|
||||||
|
android:fillColor="#f1fcff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m72,54h18c2.211,0 4,1.789 4,4 0,2.211 -1.789,4 -4,4h-18c-2.211,0 -4,-1.789 -4,-4 0,-2.211 1.789,-4 4,-4z"
|
||||||
|
android:fillColor="#f1fcff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m38,54h20c2.211,0 4,1.789 4,4 0,2.211 -1.789,4 -4,4h-20c-2.211,0 -4,-1.789 -4,-4 0,-2.211 1.789,-4 4,-4z"
|
||||||
|
android:fillColor="#f1fcff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m38,38h34c2.211,0 4,1.789 4,4 0,2.211 -1.789,4 -4,4h-34c-2.211,0 -4,-1.789 -4,-4 0,-2.211 1.789,-4 4,-4z"
|
||||||
|
android:fillColor="#f1fcff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m86,38h4c2.211,0 4,1.789 4,4 0,2.211 -1.789,4 -4,4h-4c-2.211,0 -4,-1.789 -4,-4 0,-2.211 1.789,-4 4,-4z"
|
||||||
|
android:fillColor="#f1fcff"/>
|
||||||
|
</vector>
|
@ -1,35 +1,29 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/notificationsView"
|
android:id="@+id/notificationsView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
tools:listitem="@layout/row_notifications_item"
|
||||||
</androidx.recyclerview.widget.RecyclerView>
|
tools:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/notificationsNoData"
|
android:id="@+id/notificationsNoData"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_gravity="center"
|
||||||
android:layout_marginLeft="8dp"
|
android:drawableTop="@drawable/ic_no_notifications"
|
||||||
android:layout_marginTop="8dp"
|
android:drawablePadding="16dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:fontFamily="sans-serif-light"
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:text="@string/notifications_no_data"
|
android:text="@string/notifications_no_data"
|
||||||
android:textSize="18sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="italic"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
tools:visibility="visible" />
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</FrameLayout>
|
||||||
</layout>
|
</layout>
|
@ -1,75 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
|
||||||
android:id="@+id/notificationsItemCard"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:background="?selectableItemBackground"
|
|
||||||
app:cardElevation="4dp"
|
|
||||||
app:cardCornerRadius="5dp"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingTop="5dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:paddingBottom="3dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="?selectableItemBackground"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="8dp">
|
android:padding="8dp"
|
||||||
|
android:background="?selectableItemBackground">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/notificationsItemDate"
|
android:id="@+id/title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
android:textAppearance="@style/NavView.TextView.Medium"
|
||||||
android:textSize="16sp"
|
tools:text="Dzisiaj 1 to szczęśliwy numerek" />
|
||||||
tools:text="date" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/notificationsItemText"
|
android:id="@+id/profileDate"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:autoLink="all"
|
|
||||||
tools:text="text" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/notificationsItemTitle"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"
|
tools:text="Władca Androida • 22 listopada" />
|
||||||
tools:text="title" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/notificationsItemType"
|
android:id="@+id/type"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"
|
tools:text="Szczęśliwy numerek" />
|
||||||
tools:text="type" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -1028,4 +1028,6 @@
|
|||||||
<string name="timetable_no_subject_name">(brak nazwy)</string>
|
<string name="timetable_no_subject_name">(brak nazwy)</string>
|
||||||
<string name="dialog_event_manual_more_options">Więcej opcji</string>
|
<string name="dialog_event_manual_more_options">Więcej opcji</string>
|
||||||
<string name="edziennik_progress_endpoint_grade_comments">Pobieranie komentarzy ocen...</string>
|
<string name="edziennik_progress_endpoint_grade_comments">Pobieranie komentarzy ocen...</string>
|
||||||
|
<string name="menu_remove_notifications">Usuń wszystkie</string>
|
||||||
|
<string name="menu_remove_notifications_success">Wyczyszczono powiadomienia</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user