Skip to content

Commit

Permalink
[ADD] fire notification menu setting for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Procrastimax committed Apr 19, 2019
1 parent 2e29e08 commit 65cfaea
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 68 deletions.
25 changes: 0 additions & 25 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 0 additions & 38 deletions app/src/main/java/com/procrastimax/birthdaybuddy/MainActivity.kt
Expand Up @@ -205,37 +205,6 @@ class MainActivity : AppCompatActivity() {
}
}

fun closeAppBar(animated: Boolean = true) {
//this.app_bar.setExpanded(false, animated)
}

fun openAppBar(animated: Boolean = true) {
//this.app_bar.setExpanded(true, animated)
}


fun lockAppBar() {
/*val params = app_bar.layoutParams as CoordinatorLayout.LayoutParams
params.behavior = AppBarLayout.Behavior()
val behavior = params.behavior as AppBarLayout.Behavior
behavior.setDragCallback(object : AppBarLayout.Behavior.DragCallback() {
override fun canDrag(appBarLayout: AppBarLayout): Boolean {
return false
}
})*/
}

fun unlockAppBar() {
/*val params = app_bar.layoutParams as CoordinatorLayout.LayoutParams
params.behavior = AppBarLayout.Behavior()
val behavior = params.behavior as AppBarLayout.Behavior
behavior.setDragCallback(object : AppBarLayout.Behavior.DragCallback() {
override fun canDrag(appBarLayout: AppBarLayout): Boolean {
return true
}
})*/
}

companion object {
fun convertPxToDp(context: Context, px: Float): Float {
val metrics = context.resources.displayMetrics
Expand All @@ -246,12 +215,5 @@ class MainActivity : AppCompatActivity() {
val metrics = context.resources.displayMetrics
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, metrics).toInt()
}

enum class ToolbarState {
Default,
EditEvent,
ShowEvent,
Fragment
}
}
}
@@ -1,14 +1,18 @@
package com.procrastimax.birthdaybuddy.fragments

import android.app.AlarmManager
import android.app.PendingIntent
import android.app.SearchManager
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.constraint.ConstraintLayout
import android.support.v4.app.Fragment
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.*
import android.widget.TextView
import com.procrastimax.birthdaybuddy.AlarmReceiver
import com.procrastimax.birthdaybuddy.MainActivity
import com.procrastimax.birthdaybuddy.R
import com.procrastimax.birthdaybuddy.handler.EventHandler
Expand Down Expand Up @@ -258,6 +262,14 @@ class EventListFragment : Fragment() {
R.id.item_settings -> {
settingsClicked()
}
R.id.fire_notification -> {
val event = EventHandler.getEventToEventIndex(16)
val intent = Intent(context, AlarmReceiver::class.java)
intent.putExtra("EVENTSTRING", event.toString())
intent.putExtra("NOTIFICATIONID", event!!.eventID)
intent.putExtra("EVENTID", event.eventID)
activity!!.sendBroadcast(intent)
}
}
return super.onOptionsItemSelected(item)
}
Expand Down
Expand Up @@ -31,6 +31,7 @@ object BitmapHandler {

private var drawable_map: MutableMap<Int, Bitmap> = emptyMap<Int, Bitmap>().toMutableMap()

//TODO: add scaling for screen density
private val STANDARD_SCALING = 64 * 4

/**
Expand All @@ -52,7 +53,7 @@ object BitmapHandler {
var success = true

//first try to load from files
//if this doesnt succeed, then try to read from gallery and save edited bitmap to files
//if this doesn't succeed, then try to read from gallery and save edited bitmap to files
if ((checkExistingBitmapInFiles(context, id) != null) && (!readBitmapFromGallery)) {
var bitmap = getBitmapFromFile(context, id)
if (bitmap != null) {
Expand Down
Expand Up @@ -147,7 +147,7 @@ object NotificationHandler {
NOTIFICATION_WINDOW_LENGTH,
alarmIntent
)
println(" ---> EventBirthday notification added on " + notificationTime + " with ID: " + event.eventID * reminderStart.value)
println(" ---> EventBirthday notification added on " + notificationTime + " with ID: " + event.eventID * reminderStart.value+ " name: " + event.forename)
}
is AnnualEvent -> {
alarmManager.setWindow(
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/menu/toolbar_main.xml
Expand Up @@ -23,4 +23,9 @@
android:id="@+id/item_help"
app:showAsAction="never"
android:title="@string/main_menu_item_help"/>

<item
android:id="@+id/fire_notification"
app:showAsAction="never"
android:title="fire notification"/>
</menu>
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -8,7 +8,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Wed Feb 13 00:02:31 CET 2019
#Fri Apr 19 14:41:50 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

0 comments on commit 65cfaea

Please sign in to comment.