Archived
Version bump 2.0.3 - course card attributes on the right now expand to up to 200dp, necessary declarations for notifications are now only made when a notification is requested
This commit is contained in:
+2
-2
@@ -9,8 +9,8 @@ android {
|
|||||||
applicationId "com.denizd.substitutionplan"
|
applicationId "com.denizd.substitutionplan"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 14
|
versionCode 15
|
||||||
versionName "2.0.2"
|
versionName "2.0.3"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -57,12 +57,6 @@ class DataFetcher(isplan: Boolean, ismenu: Boolean, isjobservice: Boolean, conte
|
|||||||
private lateinit var foodElements: Elements
|
private lateinit var foodElements: Elements
|
||||||
private lateinit var doc: Document
|
private lateinit var doc: Document
|
||||||
private lateinit var docFood: Document
|
private lateinit var docFood: Document
|
||||||
private var manager = mContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
||||||
private val channelId = "general"
|
|
||||||
private var channelName = mContext.getString(R.string.general)
|
|
||||||
private val importance = NotificationManager.IMPORTANCE_DEFAULT
|
|
||||||
private lateinit var channel: NotificationChannel
|
|
||||||
private lateinit var notification: Notification
|
|
||||||
private val prefs = PreferenceManager.getDefaultSharedPreferences(mContext) as SharedPreferences
|
private val prefs = PreferenceManager.getDefaultSharedPreferences(mContext) as SharedPreferences
|
||||||
private val edit = prefs.edit() as SharedPreferences.Editor
|
private val edit = prefs.edit() as SharedPreferences.Editor
|
||||||
private lateinit var pullToRefresh: SwipeRefreshLayout
|
private lateinit var pullToRefresh: SwipeRefreshLayout
|
||||||
@@ -235,13 +229,6 @@ class DataFetcher(isplan: Boolean, ismenu: Boolean, isjobservice: Boolean, conte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (jobservice) {
|
if (jobservice) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
channel = NotificationChannel(channelId, channelName, importance)
|
|
||||||
channel.enableLights(true)
|
|
||||||
channel.lightColor = Color.BLUE
|
|
||||||
manager.createNotificationChannel(channel)
|
|
||||||
}
|
|
||||||
|
|
||||||
val openApp = Intent(mContext, Main::class.java)
|
val openApp = Intent(mContext, Main::class.java)
|
||||||
openApp.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
openApp.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
openApp.flags += Intent.FLAG_ACTIVITY_CLEAR_TASK
|
openApp.flags += Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||||
@@ -252,8 +239,21 @@ class DataFetcher(isplan: Boolean, ismenu: Boolean, isjobservice: Boolean, conte
|
|||||||
notificationLayout.setTextViewText(R.id.notification_textview, notifText)
|
notificationLayout.setTextViewText(R.id.notification_textview, notifText)
|
||||||
|
|
||||||
if (notifText.isNotEmpty()) {
|
if (notifText.isNotEmpty()) {
|
||||||
|
val manager = mContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
|
val channelId = "general"
|
||||||
|
val channelName = mContext.getString(R.string.general)
|
||||||
|
val importance = NotificationManager.IMPORTANCE_DEFAULT
|
||||||
|
lateinit var channel: NotificationChannel
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
notification = NotificationCompat.Builder(mContext) // TODO switch out the deprecated notification delivery method
|
channel = NotificationChannel(channelId, channelName, importance)
|
||||||
|
channel.enableLights(true)
|
||||||
|
channel.lightColor = Color.BLUE
|
||||||
|
manager.createNotificationChannel(channel)
|
||||||
|
}
|
||||||
|
|
||||||
|
val notification = when (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
true -> NotificationCompat.Builder(mContext) // TODO switch out the deprecated notification delivery method
|
||||||
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
|
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
|
||||||
.setCustomContentView(notificationLayout)
|
.setCustomContentView(notificationLayout)
|
||||||
.setSmallIcon(R.drawable.ic_avh)
|
.setSmallIcon(R.drawable.ic_avh)
|
||||||
@@ -261,8 +261,7 @@ class DataFetcher(isplan: Boolean, ismenu: Boolean, isjobservice: Boolean, conte
|
|||||||
.setContentIntent(openAppPending)
|
.setContentIntent(openAppPending)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.build()
|
.build()
|
||||||
} else {
|
false -> NotificationCompat.Builder(mContext)
|
||||||
notification = NotificationCompat.Builder(mContext)
|
|
||||||
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
|
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
|
||||||
.setCustomContentView(notificationLayout)
|
.setCustomContentView(notificationLayout)
|
||||||
.setSmallIcon(R.drawable.ic_avh)
|
.setSmallIcon(R.drawable.ic_avh)
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ import java.util.*
|
|||||||
|
|
||||||
class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
|
class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
|
||||||
|
|
||||||
lateinit var context: Context
|
private lateinit var context: Context
|
||||||
lateinit var prefs: SharedPreferences
|
private lateinit var prefs: SharedPreferences
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@@ -47,14 +47,10 @@ class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
|
|||||||
setTaskDescription(taskDesc)
|
setTaskDescription(taskDesc)
|
||||||
|
|
||||||
context = this
|
context = this
|
||||||
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(context) as SharedPreferences
|
prefs = PreferenceManager.getDefaultSharedPreferences(context) as SharedPreferences
|
||||||
val edit = prefs.edit()
|
val edit = prefs.edit()
|
||||||
|
|
||||||
val fab = findViewById<ExtendedFloatingActionButton>(R.id.efab)
|
val fab = findViewById<ExtendedFloatingActionButton>(R.id.efab)
|
||||||
|
|
||||||
val start = Intent(this, Main::class.java)
|
val start = Intent(this, Main::class.java)
|
||||||
|
|
||||||
val name = findViewById<EditText>(R.id.txtName)
|
val name = findViewById<EditText>(R.id.txtName)
|
||||||
val grade = findViewById<EditText>(R.id.txtClasses)
|
val grade = findViewById<EditText>(R.id.txtClasses)
|
||||||
val courses = findViewById<EditText>(R.id.txtCourses)
|
val courses = findViewById<EditText>(R.id.txtCourses)
|
||||||
@@ -110,9 +106,7 @@ class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
|
|||||||
}, 400)
|
}, 400)
|
||||||
animOut.setAnimationListener(object: Animation.AnimationListener {
|
animOut.setAnimationListener(object: Animation.AnimationListener {
|
||||||
override fun onAnimationStart(arg0: Animation) {}
|
override fun onAnimationStart(arg0: Animation) {}
|
||||||
|
|
||||||
override fun onAnimationRepeat(arg0: Animation) {}
|
override fun onAnimationRepeat(arg0: Animation) {}
|
||||||
|
|
||||||
override fun onAnimationEnd(arg0: Animation) {
|
override fun onAnimationEnd(arg0: Animation) {
|
||||||
colour.visibility = View.GONE
|
colour.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.content.ComponentName
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.content.res.Configuration
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
import android.net.NetworkInfo
|
import android.net.NetworkInfo
|
||||||
@@ -90,6 +91,21 @@ class Main : AppCompatActivity(R.layout.activity_main) {
|
|||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||||
window.navigationBarColor = ContextCompat.getColor(this, R.color.background)
|
window.navigationBarColor = ContextCompat.getColor(this, R.color.background)
|
||||||
}
|
}
|
||||||
|
// else -> {
|
||||||
|
// when (context.resources.configuration.uiMode) {
|
||||||
|
// Configuration.UI_MODE_NIGHT_YES, Configuration.UI_MODE_NIGHT_UNDEFINED -> {
|
||||||
|
// AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||||
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
// window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||||
|
// window.navigationBarColor = ContextCompat.getColor(this, R.color.background)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Configuration.UI_MODE_NIGHT_NO -> {
|
||||||
|
// AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||||
|
// window.navigationBarColor = ContextCompat.getColor(this, R.color.background)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } // TODO theming based on system settings for Android Q
|
||||||
}
|
}
|
||||||
|
|
||||||
val bm = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher)
|
val bm = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher)
|
||||||
|
|||||||
@@ -33,14 +33,15 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/date"
|
android:id="@+id/date"
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="0dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:textAlignment="textEnd"
|
android:textAlignment="textEnd"
|
||||||
android:textColor="@color/textcolor"
|
android:textColor="@color/textcolor"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintWidth_max="200dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/time"
|
android:id="@+id/time"
|
||||||
@@ -48,10 +49,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:textAlignment="textEnd"
|
android:textAlignment="textEnd"
|
||||||
|
android:textColor="@color/textcolor"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/date"
|
app:layout_constraintEnd_toEndOf="@+id/date"
|
||||||
app:layout_constraintStart_toStartOf="@+id/date"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/date"
|
app:layout_constraintTop_toBottomOf="@+id/date"
|
||||||
android:textColor="@color/textcolor" />
|
app:layout_constraintWidth_max="200dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/course"
|
android:id="@+id/course"
|
||||||
@@ -75,8 +76,8 @@
|
|||||||
android:textColor="@color/textcolor"
|
android:textColor="@color/textcolor"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/time"
|
app:layout_constraintEnd_toEndOf="@+id/time"
|
||||||
app:layout_constraintStart_toStartOf="@+id/time"
|
app:layout_constraintTop_toBottomOf="@+id/time"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/time" />
|
app:layout_constraintWidth_max="200dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/additional"
|
android:id="@+id/additional"
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<item name="colorControlNormal">#000000</item>
|
<item name="colorControlNormal">#000000</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="EditTextTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="EditTextTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
|
||||||
<item name="colorControlNormal">@color/hintcolor</item>
|
<item name="colorControlNormal">@color/hintcolor</item>
|
||||||
<item name="colorControlActivated">@color/accent</item>
|
<item name="colorControlActivated">@color/accent</item>
|
||||||
<item name="colorControlHighlight">@color/accent</item>
|
<item name="colorControlHighlight">@color/accent</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user