diff --git a/Yeeemp/app/build.gradle b/Yeeemp/app/build.gradle index 181e49b..40cc93b 100644 --- a/Yeeemp/app/build.gradle +++ b/Yeeemp/app/build.gradle @@ -49,7 +49,7 @@ android { } dependencies { - + implementation 'com.google.android.flexbox:flexbox:3.0.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.11.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' diff --git a/Yeeemp/app/src/androidTest/java/art/pegasko/yeeemp/DBImplTest.java b/Yeeemp/app/src/androidTest/java/art/pegasko/yeeemp/DBImplTest.java index b4283cc..5576625 100644 --- a/Yeeemp/app/src/androidTest/java/art/pegasko/yeeemp/DBImplTest.java +++ b/Yeeemp/app/src/androidTest/java/art/pegasko/yeeemp/DBImplTest.java @@ -1,4 +1,20 @@ -package art.pegasko.yeeemp; +/** + * Copyright 2024 pegasko + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package art.pegasko.yeeemp; import android.database.sqlite.SQLiteDatabase; import android.provider.CalendarContract; diff --git a/Yeeemp/app/src/androidTest/java/art/pegasko/yeeemp/ExampleInstrumentedTest.java b/Yeeemp/app/src/androidTest/java/art/pegasko/yeeemp/ExampleInstrumentedTest.java index 97cc84c..2fb2e34 100644 --- a/Yeeemp/app/src/androidTest/java/art/pegasko/yeeemp/ExampleInstrumentedTest.java +++ b/Yeeemp/app/src/androidTest/java/art/pegasko/yeeemp/ExampleInstrumentedTest.java @@ -1,3 +1,19 @@ +/** + * Copyright 2024 pegasko + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package art.pegasko.yeeemp; import android.content.Context; diff --git a/Yeeemp/app/src/main/AndroidManifest.xml b/Yeeemp/app/src/main/AndroidManifest.xml index 7d82f9e..9b0c1a5 100644 --- a/Yeeemp/app/src/main/AndroidManifest.xml +++ b/Yeeemp/app/src/main/AndroidManifest.xml @@ -1,22 +1,6 @@ - - + xmlns:tools="http://schemas.android.com/tools"> + tools:targetApi="31"> + + android:theme="@style/Theme.Yeeemp.Green"> @@ -40,9 +28,8 @@ - + android:exported="false" + android:theme="@style/Theme.Yeeemp.Blue"> \ No newline at end of file diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/base/Event.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/base/Event.java index 978310a..2c315f7 100644 --- a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/base/Event.java +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/base/Event.java @@ -24,5 +24,6 @@ public interface Event { void setComment(String comment); void addTag(Tag tag); void removeTag(Tag tag); + void removeTags(); Tag[] getTags(); } diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/base/EventMaker.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/base/EventMaker.java index 7eb8fae..34a30e0 100644 --- a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/base/EventMaker.java +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/base/EventMaker.java @@ -19,4 +19,5 @@ package art.pegasko.yeeemp.base; public interface EventMaker { Event create(); void delete(Event event); + Event getById(int id); } diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/DBWrapper.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/DBWrapper.java index f46c086..84e0df1 100644 --- a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/DBWrapper.java +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/DBWrapper.java @@ -31,7 +31,7 @@ import art.pegasko.yeeemp.base.TagMaker; public class DBWrapper extends Wrapper { public static final String TAG = DBWrapper.class.getSimpleName(); - public static final boolean DEBUG = true; + public static final boolean DEBUG = false; public DBWrapper(Context context) { this.db = openDB(context); diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/EventImpl.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/EventImpl.java index 28ea33f..d6fab96 100644 --- a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/EventImpl.java +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/EventImpl.java @@ -171,6 +171,21 @@ public class EventImpl implements Event { } } + @Override + public void removeTags() { + synchronized (this.db) { + try { + db.delete( + "event_tag", + "event_id = ?", + new String[] { Integer.toString(this.getId()) } + ); + } catch (SQLiteException e) { + Log.wtf(TAG, e); + } + } + } + @Override public Tag[] getTags() { synchronized (this.db) { diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/EventMakerImpl.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/EventMakerImpl.java index 9f81365..b389d9d 100644 --- a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/EventMakerImpl.java +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/EventMakerImpl.java @@ -17,12 +17,14 @@ package art.pegasko.yeeemp.impl; import android.content.ContentValues; +import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.util.Log; import art.pegasko.yeeemp.base.Event; import art.pegasko.yeeemp.base.EventMaker; +import art.pegasko.yeeemp.base.Queue; public class EventMakerImpl implements EventMaker { public static final String TAG = EventMakerImpl.class.getSimpleName(); @@ -33,6 +35,31 @@ public class EventMakerImpl implements EventMaker { this.db = db; } + @Override + public Event getById(int id) { + synchronized (this.db) { + try { + Cursor cursor = db.query( + "event", + new String[] { "1" }, + "id = ?", + new String[] { Integer.toString(id) }, + null, + null, + null + ); + + if (Utils.findResult(cursor)) + return new EventImpl(this.db, id); + + } catch (SQLiteException e) { + Log.wtf(TAG, e); + } + + return null; + } + } + @Override public Event create() { synchronized (this.db) { diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/QueueImpl.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/QueueImpl.java index a90dc34..65efba2 100644 --- a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/QueueImpl.java +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/impl/QueueImpl.java @@ -90,7 +90,7 @@ public class QueueImpl implements Queue { new String[] { Integer.toString(this.getId()) }, null, null, - null + "event_id desc" ); if (cursor == null) { diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/okand/base/Event.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/okand/base/Event.java new file mode 100644 index 0000000..392774a --- /dev/null +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/okand/base/Event.java @@ -0,0 +1,46 @@ +/** + * Copyright 2024 pegasko + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package art.pegasko.yeeemp.okand.base; + +import java.util.ArrayList; +import java.util.List; + +import art.pegasko.yeeemp.base.Tag; + +public class Event { + private int id; + private String comment; + private List tags; + + public Event() { + this.id = -1; + this.comment = null; + this.tags = new ArrayList(); + } + + void setId(int id) { + this.id = id; + } + + public int getId() { + return this.id; + } + + public static Event get(int id) { + return Potato.getInstance().getById(id); + } +} diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/okand/base/Potato.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/okand/base/Potato.java new file mode 100644 index 0000000..05c4f0c --- /dev/null +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/okand/base/Potato.java @@ -0,0 +1,33 @@ +/** + * Copyright 2024 pegasko + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package art.pegasko.yeeemp.okand.base; + +public abstract class Potato { + private static Potato instance; + + public static Potato getInstance() { + return Potato.instance; + } + + public void setInstance(Potato instance) { + Potato.instance = instance; + } + + public abstract Event getById(int id); + public abstract void save(Event container); + public abstract void delete(Event container); +} diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/okand/impl/DBPotato.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/okand/impl/DBPotato.java new file mode 100644 index 0000000..551a304 --- /dev/null +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/okand/impl/DBPotato.java @@ -0,0 +1,37 @@ +/** + * Copyright 2024 pegasko + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package art.pegasko.yeeemp.okand.impl; + +import art.pegasko.yeeemp.okand.base.Event; +import art.pegasko.yeeemp.okand.base.Potato; + +public class DBPotato extends Potato { + @Override + public Event getById(int id) { + return null; + } + + @Override + public void save(Event container) { + + } + + @Override + public void delete(Event container) { + + } +} diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventEditActivity.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventEditActivity.java new file mode 100644 index 0000000..560aa0c --- /dev/null +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventEditActivity.java @@ -0,0 +1,202 @@ +/** + * Copyright 2024 pegasko + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package art.pegasko.yeeemp.ui.activity; + +import androidx.appcompat.app.AppCompatActivity; + +import android.app.DatePickerDialog; +import android.app.TimePickerDialog; +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.util.TimeUtils; +import android.view.MenuItem; +import android.view.View; +import android.widget.DatePicker; +import android.widget.TextView; +import android.widget.TimePicker; + +import com.google.android.material.snackbar.Snackbar; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.Date; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import art.pegasko.yeeemp.base.Queue; +import art.pegasko.yeeemp.base.Tag; +import art.pegasko.yeeemp.databinding.ActivityEventEditBinding; + +import art.pegasko.yeeemp.R; +import art.pegasko.yeeemp.base.Event; +import art.pegasko.yeeemp.base.Wrapper; +import art.pegasko.yeeemp.impl.Init; + +public class EventEditActivity extends AppCompatActivity { + public static final String TAG = EventEditActivity.class.getSimpleName(); + + private Queue queue; + private Event event; + private EventContainer eventContainer; + private ActivityEventEditBinding binding; + + /** Store values for edited or new event */ + private static class EventContainer { + public String comment; + public long timestamp; + public ArrayList tags; + + public EventContainer() { + this.timestamp = System.currentTimeMillis(); + this.tags = new ArrayList(); + this.comment = null; + } + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + Init.initDB(getApplicationContext()); + + // Get Queue ID from Intent + Bundle extras = getIntent().getExtras(); + if (extras == null) { + Log.e(TAG, "Missing Intent arguments (queue_id)"); + finish(); + return; + } + + int queue_id = extras.getInt("queue_id", -1); + if (queue_id == -1) { + Log.e(TAG, "Missing Intent arguments (queue_id)"); + finish(); + return; + } + + queue = Wrapper.getQueueMaker().getById(queue_id); + if (queue == null) { + Log.e(TAG, "Missing Intent arguments (queue_id)"); + finish(); + return; + } + + // New edit container + this.eventContainer = new EventContainer(); + + // Get Event ID from Intent (optional) + extras = getIntent().getExtras(); + if (extras != null) { + int event_id = extras.getInt("event_id", -1); + if (event_id != -1) { + this.event = Wrapper.getEventMaker().getById(event_id); + this.eventContainer.timestamp = this.event.getTimestamp(); + this.eventContainer.comment = this.event.getComment(); + for (Tag tag: this.event.getTags()) { + this.eventContainer.tags.add(tag.getName()); + } + } + } + + binding = ActivityEventEditBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + setSupportActionBar(binding.toolbar); + getSupportActionBar().setTitle(getSupportActionBar().getTitle() + " / " + (event == null ? "Create" : "Edit") + " Event"); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + + if (this.eventContainer.timestamp != 0) + binding.eventEditContent.eventEditTimestamp.setText(Utils.formatTs(this.eventContainer.timestamp)); + if (this.eventContainer.comment != null) + binding.eventEditContent.eventEditComment.setText(this.eventContainer.comment); + + binding.eventEditContent.eventEditContainerTimestamp.setOnClickListener((View view) -> { + Date date; + if (this.eventContainer.timestamp != 0) + date = new Date(this.eventContainer.timestamp); + else + date = new Date(); + + DatePickerDialog datePickerDialog = new DatePickerDialog( + view.getContext(), + (DatePicker datePicker, int year, int month, int day) -> { + TimePickerDialog timePickerDialog = new TimePickerDialog( + view.getContext(), + (TimePicker timePicker, int hour, int minute) -> { + Date newDate = new Date(); + newDate.setYear(year - 1900); + newDate.setMonth(month); + newDate.setDate(day); + newDate.setHours(hour); + newDate.setMinutes(minute); + newDate.setSeconds(0); + + this.eventContainer.timestamp = newDate.getTime(); + binding.eventEditContent.eventEditTimestamp.setText(Utils.formatTs(this.eventContainer.timestamp)); + }, + date.getHours(), date.getMinutes(), true + ); + timePickerDialog.show(); + }, date.getYear() + 1900, date.getMonth(), date.getDate() + ); + datePickerDialog.show(); + }); + + /* FAB Listeners */ + binding.fab.setOnLongClickListener((View view) -> { + Snackbar.make(view, "Save Event", Snackbar.LENGTH_LONG) + .setAnchorView(R.id.fab) + .setAction("Action", null).show(); + + return true; + }); + binding.fab.setOnClickListener(view -> { + // Finalize values + this.eventContainer.comment = this.binding.eventEditContent.eventEditComment.getText().toString().trim(); + + // Fill event + if (this.event == null) + this.event = Wrapper.getEventMaker().create(); + + this.event.setTimestamp(this.eventContainer.timestamp); + this.event.removeTags(); + for (String tag: this.eventContainer.tags) { + this.event.addTag(Wrapper.getTagMaker().getOrCreateInQueue(this.queue, tag)); + } + this.event.setComment(this.eventContainer.comment); + + finish(); + }); + + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + } + + return super.onOptionsItemSelected(item); + } +} \ No newline at end of file diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventListActivity.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventListActivity.java index 4d91a5c..8417950 100644 --- a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventListActivity.java +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventListActivity.java @@ -16,16 +16,23 @@ package art.pegasko.yeeemp.ui.activity; +import android.content.Intent; import android.os.Bundle; import android.util.Log; +import android.view.MenuItem; import android.view.View; +import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.snackbar.Snackbar; +import java.time.Duration; +import java.util.concurrent.ScheduledFuture; + import art.pegasko.yeeemp.R; import art.pegasko.yeeemp.base.Event; import art.pegasko.yeeemp.base.Queue; @@ -78,6 +85,9 @@ public class EventListActivity extends AppCompatActivity { binding = ActivityEventListBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); setSupportActionBar(binding.toolbar); + getSupportActionBar().setTitle(getSupportActionBar().getTitle() + " / " + queue.getName()); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); /* Queue list */ eventListAdapter = new EventRecyclerViewAdapter(queue); @@ -85,6 +95,25 @@ public class EventListActivity extends AppCompatActivity { eventList.setLayoutManager(new LinearLayoutManager(this)); eventList.setAdapter(eventListAdapter); +// /* Swipe delete */ +// ItemTouchHelper.SimpleCallback swipeCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { +// @Override +// public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) { +// return false; +// } +// +// @Override +// public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) { +// Snackbar.make(viewHolder.itemView, "undo delete event", 5000) +// .setAnchorView(R.id.fab) +// .setAction("Action", (View view) -> { +// +// }).show(); +// +// ScheduledFuture future = eventListAdapter.scheduleDeleteAt(viewHolder.getAdapterPosition()); +// } +// }; + /* FAB Listeners */ binding.fab.setOnLongClickListener((View view) -> { Snackbar.make(view, "Create Event", Snackbar.LENGTH_LONG) @@ -94,19 +123,44 @@ public class EventListActivity extends AppCompatActivity { return true; }); binding.fab.setOnClickListener(view -> { - Log.w(TAG, "TODO: Open editor"); + Bundle extra = new Bundle(); + extra.putInt("queue_id", this.queue.getId()); - Event event = Wrapper.getEventMaker().create(); - event.setTimestamp(System.currentTimeMillis()); - event.setComment("Lobster number " + System.currentTimeMillis()); - queue.addEvent(event); + Intent intent = new Intent(view.getContext(), EventEditActivity.class); + intent.putExtras(extra); - Log.w(TAG, "Create: " + event.toString() + " in " + queue); + view.getContext().startActivity(intent); - updateList(); +// Log.w(TAG, "TODO: Open editor"); +// +// Event event = Wrapper.getEventMaker().create(); +// event.setTimestamp(System.currentTimeMillis()); +// event.setComment("Lobster number " + System.currentTimeMillis()); +// queue.addEvent(event); +// +// Log.w(TAG, "Create: " + event.toString() + " in " + queue); + +// updateList(); }); /* Fill lists */ updateList(); } + + @Override + protected void onResume() { + super.onResume(); + + /* Ekchualle we returned from somewhere */ + updateList(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + } + + return super.onOptionsItemSelected(item); + } } diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventRecyclerViewAdapter.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventRecyclerViewAdapter.java index 0957b1f..870f33b 100644 --- a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventRecyclerViewAdapter.java +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/EventRecyclerViewAdapter.java @@ -17,25 +17,30 @@ package art.pegasko.yeeemp.ui.activity; import android.app.AlertDialog; -import android.content.DialogInterface; -import android.text.InputType; +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.EditText; import android.widget.PopupMenu; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + import art.pegasko.yeeemp.R; import art.pegasko.yeeemp.base.Event; import art.pegasko.yeeemp.base.Queue; +import art.pegasko.yeeemp.base.Tag; import art.pegasko.yeeemp.base.Wrapper; import art.pegasko.yeeemp.databinding.EventListItemBinding; -import art.pegasko.yeeemp.databinding.QueueListItemBinding; class EventRecyclerViewAdapter extends RecyclerView.Adapter { public static final String TAG = EventRecyclerViewAdapter.class.getSimpleName(); @@ -62,8 +67,28 @@ class EventRecyclerViewAdapter extends RecyclerView.Adapter { PopupMenu popupMenu = new PopupMenu(view.getContext(), viewHolder.getBinding().eventListItemItem); popupMenu.getMenuInflater().inflate(R.menu.event_list_item_action_menu, popupMenu.getMenu()); @@ -88,8 +113,16 @@ class EventRecyclerViewAdapter extends RecyclerView.Adapter { + Bundle extra = new Bundle(); + extra.putInt("event_id", this.events[position].getId()); + extra.putInt("queue_id", this.queue.getId()); -// viewHolder.queueStats.setText(Integer.toString(events[position].getEventCount())); + Intent intent = new Intent(view.getContext(), EventEditActivity.class); + intent.putExtras(extra); + + view.getContext().startActivity(intent); + }); } @Override @@ -114,4 +147,19 @@ class EventRecyclerViewAdapter extends RecyclerView.Adapter scheduleDeleteAt(int position) { +// ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); +// ScheduledFuture future = scheduledExecutorService.schedule(() -> { +// try { +// Wrapper.getEventMaker().delete(this.events[position]); +// } catch (Exception e) { +// Log.wtf(TAG, e); +// } +// }, 5, TimeUnit.SECONDS); +// +// // Hide item from list +// +// return future; +// } } diff --git a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/QueueRecyclerViewAdapter.java b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/QueueRecyclerViewAdapter.java index 67d3f77..9165378 100644 --- a/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/QueueRecyclerViewAdapter.java +++ b/Yeeemp/app/src/main/java/art/pegasko/yeeemp/ui/activity/QueueRecyclerViewAdapter.java @@ -35,6 +35,7 @@ import androidx.recyclerview.widget.RecyclerView; import art.pegasko.yeeemp.R; import art.pegasko.yeeemp.base.Event; import art.pegasko.yeeemp.base.Queue; +import art.pegasko.yeeemp.base.Tag; import art.pegasko.yeeemp.base.Wrapper; import art.pegasko.yeeemp.databinding.QueueListItemBinding; @@ -114,16 +115,35 @@ class QueueRecyclerViewAdapter extends RecyclerView.Adapter { - Log.w(TAG, "TODO: Open editor"); + Intent intent = new Intent(view.getContext(), EventEditActivity.class); + view.getContext().startActivity(intent); - Event event = Wrapper.getEventMaker().create(); - event.setTimestamp(System.currentTimeMillis()); - event.setComment("Lobster number " + System.currentTimeMillis()); - queues[position].addEvent(event); - - Log.w(TAG, "Create: " + event.toString() + " in " + queues[position]); - - reloadItems(); +// Log.w(TAG, "TODO: Open editor"); +// +// Event event = Wrapper.getEventMaker().create(); +// event.setTimestamp(System.currentTimeMillis()); +// event.setComment("Lobster number " + System.currentTimeMillis() + "\n" + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); +// queues[position].addEvent(event); +// +// Tag[] tags = new Tag[] { +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_cum"), +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_poo"), +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_fart"), +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_penis"), +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_dick"), +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_cock"), +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_zalupa"), +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_ololo"), +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_owo"), +// Wrapper.getTagMaker().getOrCreateInQueue(queues[position], "tag_" + position + "_uwu"), +// }; +// for (Tag tag: tags) { +// event.addTag(tag); +// } +// +// Log.w(TAG, "Create: " + event.toString() + " in " + queues[position]); +// +// reloadItems(); }); } diff --git a/Yeeemp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/Yeeemp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml index 92d0a4d..2b068d1 100644 --- a/Yeeemp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/Yeeemp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -1,19 +1,3 @@ - - + + + + + + + + + + \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/drawable/box_red.xml b/Yeeemp/app/src/main/res/drawable/box_red.xml new file mode 100644 index 0000000..478b967 --- /dev/null +++ b/Yeeemp/app/src/main/res/drawable/box_red.xml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/drawable/ic_launcher_background.xml b/Yeeemp/app/src/main/res/drawable/ic_launcher_background.xml index 33e25f1..07d5da9 100644 --- a/Yeeemp/app/src/main/res/drawable/ic_launcher_background.xml +++ b/Yeeemp/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,19 +1,3 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/drawable/tag_divider.xml b/Yeeemp/app/src/main/res/drawable/tag_divider.xml new file mode 100644 index 0000000..2790627 --- /dev/null +++ b/Yeeemp/app/src/main/res/drawable/tag_divider.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/layout/activity_event_edit.xml b/Yeeemp/app/src/main/res/layout/activity_event_edit.xml new file mode 100644 index 0000000..51d1cb4 --- /dev/null +++ b/Yeeemp/app/src/main/res/layout/activity_event_edit.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/layout/activity_event_list.xml b/Yeeemp/app/src/main/res/layout/activity_event_list.xml index 3d1b7aa..4ae3b42 100644 --- a/Yeeemp/app/src/main/res/layout/activity_event_list.xml +++ b/Yeeemp/app/src/main/res/layout/activity_event_list.xml @@ -1,19 +1,3 @@ - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/layout/content_event_list.xml b/Yeeemp/app/src/main/res/layout/content_event_list.xml index e2e137e..9cbcffc 100644 --- a/Yeeemp/app/src/main/res/layout/content_event_list.xml +++ b/Yeeemp/app/src/main/res/layout/content_event_list.xml @@ -1,19 +1,3 @@ - - \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/layout/content_queue_list.xml b/Yeeemp/app/src/main/res/layout/content_queue_list.xml index e22591d..a1c4d7a 100644 --- a/Yeeemp/app/src/main/res/layout/content_queue_list.xml +++ b/Yeeemp/app/src/main/res/layout/content_queue_list.xml @@ -1,19 +1,3 @@ - - \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/layout/event_list_item.xml b/Yeeemp/app/src/main/res/layout/event_list_item.xml index 58414df..4dce8a1 100644 --- a/Yeeemp/app/src/main/res/layout/event_list_item.xml +++ b/Yeeemp/app/src/main/res/layout/event_list_item.xml @@ -1,19 +1,3 @@ - - + android:padding="@dimen/queue_list_item_main_padding"> @@ -41,35 +25,47 @@ android:id="@+id/event_list_item__timestamp" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_margin="@dimen/pegasko_list_item_title_margin" + android:layout_margin="@dimen/event_list_item_timestamp_margin" android:fontFamily="monospace" android:text="TextView" android:textAlignment="viewStart" - android:textColor="@color/pegasko_black" - android:textSize="@dimen/pegasko_list_item_title" + android:textColor="@color/pegasko_white" + android:textSize="@dimen/event_list_item_timestamp_text" android:textStyle="bold" /> + + + + + + - - - - - - diff --git a/Yeeemp/app/src/main/res/layout/event_list_item_tag.xml b/Yeeemp/app/src/main/res/layout/event_list_item_tag.xml new file mode 100644 index 0000000..1dc7c96 --- /dev/null +++ b/Yeeemp/app/src/main/res/layout/event_list_item_tag.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/layout/queue_list_item.xml b/Yeeemp/app/src/main/res/layout/queue_list_item.xml index 325514f..fb4ce70 100644 --- a/Yeeemp/app/src/main/res/layout/queue_list_item.xml +++ b/Yeeemp/app/src/main/res/layout/queue_list_item.xml @@ -1,19 +1,3 @@ - - + android:padding="@dimen/queue_list_item_main_padding"> @@ -67,9 +51,9 @@ @@ -80,7 +64,7 @@ android:text="+" android:textAlignment="viewStart" android:textColor="@color/pegasko_black" - android:textSize="@dimen/pegasko_list_item_plus" + android:textSize="@dimen/queue_list_item_plus_text" android:textStyle="bold" /> diff --git a/Yeeemp/app/src/main/res/menu/event_list_item_action_menu.xml b/Yeeemp/app/src/main/res/menu/event_list_item_action_menu.xml index 7bbeb4d..c646188 100644 --- a/Yeeemp/app/src/main/res/menu/event_list_item_action_menu.xml +++ b/Yeeemp/app/src/main/res/menu/event_list_item_action_menu.xml @@ -1,19 +1,3 @@ - - - - diff --git a/Yeeemp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/Yeeemp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index a2231cc..6f3b755 100644 --- a/Yeeemp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/Yeeemp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,19 +1,3 @@ - - diff --git a/Yeeemp/app/src/main/res/values-land/dimens.xml b/Yeeemp/app/src/main/res/values-land/dimens.xml index 74ecb09..22d7f00 100644 --- a/Yeeemp/app/src/main/res/values-land/dimens.xml +++ b/Yeeemp/app/src/main/res/values-land/dimens.xml @@ -1,19 +1,3 @@ - - 48dp \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/values-night/themes.xml b/Yeeemp/app/src/main/res/values-night/themes.xml index 84c214e..939fa9f 100644 --- a/Yeeemp/app/src/main/res/values-night/themes.xml +++ b/Yeeemp/app/src/main/res/values-night/themes.xml @@ -1,19 +1,3 @@ - - + + + + diff --git a/Yeeemp/app/src/main/res/values-w1240dp/dimens.xml b/Yeeemp/app/src/main/res/values-w1240dp/dimens.xml index 687d895..d73f4a3 100644 --- a/Yeeemp/app/src/main/res/values-w1240dp/dimens.xml +++ b/Yeeemp/app/src/main/res/values-w1240dp/dimens.xml @@ -1,19 +1,3 @@ - - 200dp \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/values-w600dp/dimens.xml b/Yeeemp/app/src/main/res/values-w600dp/dimens.xml index 74ecb09..22d7f00 100644 --- a/Yeeemp/app/src/main/res/values-w600dp/dimens.xml +++ b/Yeeemp/app/src/main/res/values-w600dp/dimens.xml @@ -1,19 +1,3 @@ - - 48dp \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/values/colors.xml b/Yeeemp/app/src/main/res/values/colors.xml index f53be35..6c04273 100644 --- a/Yeeemp/app/src/main/res/values/colors.xml +++ b/Yeeemp/app/src/main/res/values/colors.xml @@ -1,19 +1,3 @@ - - #FF000000 diff --git a/Yeeemp/app/src/main/res/values/dimens.xml b/Yeeemp/app/src/main/res/values/dimens.xml index a8c2ba9..5eb42c3 100644 --- a/Yeeemp/app/src/main/res/values/dimens.xml +++ b/Yeeemp/app/src/main/res/values/dimens.xml @@ -1,35 +1,57 @@ - - 16dp - 80dp - 8dp + 80dp + 8dp - 8dp + 8dp - 24sp - 4dp + 24sp + 4dp - 12sp - 2dp + 12sp + 2dp - 32sp - 80dp + 32sp + 80dp - 2dp + 2dp + + 16sp + 4dp + + 12sp + 4dp + 4dp + + 32sp + 80dp + + 0dp + 0dp + + 4dp + 0dp + + 2dp + + 2dp + 2dp + + 4dp + 4dp + + 2dp + + 0dp + 2dp + 16sp + + 8dp + 4dp + 24sp + + 8dp + 4dp + 12sp \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/values/strings.xml b/Yeeemp/app/src/main/res/values/strings.xml index fdb8db9..2183e6a 100644 --- a/Yeeemp/app/src/main/res/values/strings.xml +++ b/Yeeemp/app/src/main/res/values/strings.xml @@ -1,19 +1,3 @@ - - Yeeemp diff --git a/Yeeemp/app/src/main/res/values/themes.xml b/Yeeemp/app/src/main/res/values/themes.xml index a54c692..e0b2c3d 100644 --- a/Yeeemp/app/src/main/res/values/themes.xml +++ b/Yeeemp/app/src/main/res/values/themes.xml @@ -1,19 +1,3 @@ - - @@ -38,17 +22,17 @@ @color/pegasko_white @color/pegasko_light - @color/pegasko_black + @color/pegasko_light - @color/pegasko_black - @color/pegasko_dark - @color/pegasko_black + @color/pegasko_white + @color/pegasko_light + @color/pegasko_light - @color/pegasko_white - @color/pegasko_white - @color/pegasko_light + @color/pegasko_dark + @color/pegasko_dark + @color/pegasko_dark @@ -56,17 +40,17 @@ @color/pegasko_green @color/pegasko_dark_green - @color/pegasko_black + @color/pegasko_dark_green - @color/pegasko_black - @color/pegasko_dark - @color/pegasko_black + @color/pegasko_green + @color/pegasko_dark_green + @color/pegasko_dark_green - @color/pegasko_green - @color/pegasko_green - @color/pegasko_dark_green + @color/pegasko_dark + @color/pegasko_dark + @color/pegasko_dark @@ -74,27 +58,35 @@ @color/pegasko_blue @color/pegasko_dark_blue - @color/pegasko_black + @color/pegasko_dark_blue - @color/pegasko_black - @color/pegasko_dark - @color/pegasko_black + @color/pegasko_blue + @color/pegasko_dark_blue + @color/pegasko_dark_blue - @color/pegasko_blue - @color/pegasko_blue - @color/pegasko_dark_blue + @color/pegasko_dark + @color/pegasko_dark + @color/pegasko_dark - - - - - - + + --> + + @color/pegasko_red + @color/pegasko_dark_red + @color/pegasko_dark_red + + + @color/pegasko_dark + @color/pegasko_dark + @color/pegasko_dark + \ No newline at end of file diff --git a/Yeeemp/app/src/main/res/xml/backup_rules.xml b/Yeeemp/app/src/main/res/xml/backup_rules.xml index f891574..fa0f996 100644 --- a/Yeeemp/app/src/main/res/xml/backup_rules.xml +++ b/Yeeemp/app/src/main/res/xml/backup_rules.xml @@ -1,19 +1,3 @@ - - -