Merge branch 'dev' into notifications
23
.gitignore
vendored
@ -3,12 +3,13 @@ refilc/.flutter-plugins
|
|||||||
refilc/.flutter-plugins-dependencies
|
refilc/.flutter-plugins-dependencies
|
||||||
refilc/pubspec.lock
|
refilc/pubspec.lock
|
||||||
refilc/.dart_tool/
|
refilc/.dart_tool/
|
||||||
refilc/android/
|
# refilc/android/
|
||||||
refilc/ios/
|
# refilc/ios/
|
||||||
refilc/windows/
|
# refilc/windows/
|
||||||
refilc/linux/
|
# refilc/linux/
|
||||||
refilc/macos/
|
# refilc/macos/
|
||||||
refilc/build/
|
refilc/build/
|
||||||
|
refilc/android/key.properties
|
||||||
|
|
||||||
refilc_desktop_ui/.flutter-plugins
|
refilc_desktop_ui/.flutter-plugins
|
||||||
refilc_desktop_ui/.flutter-plugins-dependencies
|
refilc_desktop_ui/.flutter-plugins-dependencies
|
||||||
@ -34,6 +35,18 @@ filcnaplo_premium/.dart_tool/
|
|||||||
.github
|
.github
|
||||||
.idea
|
.idea
|
||||||
.gitmodules
|
.gitmodules
|
||||||
|
.gradle
|
||||||
|
|
||||||
refilc/.DS_Store
|
refilc/.DS_Store
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
refilc/linux/flutter/
|
||||||
|
refilc/macos/flutter/
|
||||||
|
.plugin_symlinks/
|
||||||
|
refilc/ios/Flutter/flutter_export_environment.sh
|
||||||
|
refilc/ios/Flutter/Generated.xcconfig
|
||||||
|
refilc/ios/Runner/GeneratedPluginRegistrant.h
|
||||||
|
refilc/ios/Runner/GeneratedPluginRegistrant.m
|
||||||
|
refilc/android/local.properties
|
||||||
|
refilc/macos/Flutter/GeneratedPluginRegistrant.swift
|
||||||
|
refilc/android/debugkey.properties
|
||||||
|
refilc/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<p align=center>
|
<p align=center>
|
||||||
<img src="https://media.discordapp.net/attachments/1111727410677825596/1113217167513624646/reFilc_Logo_Squircle.png?width=671&height=671" width=150>
|
<img src="https://refilc.hu/image/brand/logo.png" width=150>
|
||||||
<h1 align=center><b>reFilc</b></h1>
|
<h1 align=center><b>reFilc</b></h1>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ Run `fix-pub.sh`
|
|||||||
### Run the app
|
### Run the app
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd refilc
|
cd filcnaplo
|
||||||
flutter run
|
flutter run
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -48,5 +48,3 @@ Az összes (ugyan azon verzióhoz tartozó) contribution meg fog jelenni a relea
|
|||||||
**Péter:** video editor
|
**Péter:** video editor
|
||||||
|
|
||||||
**annon:** a régi Filc Napló fejlesztője (ez az app, ha bár sokban változott, alapjaiban a Filc-re épül)
|
**annon:** a régi Filc Napló fejlesztője (ez az app, ha bár sokban változott, alapjaiban a Filc-re épül)
|
||||||
|
|
||||||
<sup>Ez a projekt egy fork; az eredeti projektet megtaláljátok itt: [filc/naplo-archive](https://github.com/filc/naplo-archive) (köszi, annon)</sup>
|
|
||||||
|
116
refilc/android/app/build.gradle
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
def localProperties = new Properties()
|
||||||
|
def localPropertiesFile = rootProject.file('local.properties')
|
||||||
|
if (localPropertiesFile.exists()) {
|
||||||
|
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||||
|
localProperties.load(reader)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||||
|
if (flutterRoot == null) {
|
||||||
|
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||||
|
}
|
||||||
|
|
||||||
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||||
|
if (flutterVersionCode == null) {
|
||||||
|
throw new GradleException("Undefined VersionCode")
|
||||||
|
}
|
||||||
|
|
||||||
|
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||||
|
if (flutterVersionName == null) {
|
||||||
|
throw new GradleException("Undefined VersionName")
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
|
def keystoreProperties = new Properties()
|
||||||
|
def keystorePropertiesFile = rootProject.file("key.properties")
|
||||||
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||||
|
|
||||||
|
def debugKeystoreProperties = new Properties()
|
||||||
|
def debugKeystorePropertiesFile = rootProject.file("debugkey.properties")
|
||||||
|
debugKeystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile))
|
||||||
|
|
||||||
|
android {
|
||||||
|
ndkVersion "25.1.8937393"
|
||||||
|
|
||||||
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main.java.srcDirs += 'src/main/kotlin'
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
disable 'InvalidPackage'
|
||||||
|
disable "Instantiatable"
|
||||||
|
checkReleaseBuilds false
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "hu.refilc.naplo"
|
||||||
|
minSdkVersion 21
|
||||||
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
|
versionCode flutterVersionCode.toInteger()
|
||||||
|
versionName flutterVersionName
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
multiDexEnabled true
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
// Flag to enable support for the new language APIs
|
||||||
|
coreLibraryDesugaringEnabled true
|
||||||
|
// Sets Java compatibility to Java 8
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
debug {
|
||||||
|
keyAlias "androiddebugkey"
|
||||||
|
keyPassword debugKeystoreProperties['keyPassword']
|
||||||
|
storeFile file(debugKeystoreProperties['storeFile'])
|
||||||
|
storePassword debugKeystoreProperties['storePassword']
|
||||||
|
}
|
||||||
|
|
||||||
|
release {
|
||||||
|
keyAlias keystoreProperties['keyAlias']
|
||||||
|
keyPassword keystoreProperties['keyPassword']
|
||||||
|
storeFile file(keystoreProperties['storeFile'])
|
||||||
|
storePassword keystoreProperties['storePassword']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
|
}
|
||||||
|
|
||||||
|
release {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
shrinkResources false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flutter {
|
||||||
|
source '../..'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'com.android.support:multidex:2.0.1'
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
implementation 'joda-time:joda-time:2.9.4'
|
||||||
|
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||||
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||||
|
implementation 'androidx.window:window:1.0.0'
|
||||||
|
implementation 'androidx.window:window-java:1.0.0'
|
||||||
|
}
|
38
refilc/android/app/google-services.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "584481527599",
|
||||||
|
"project_id": "refilc-mobile-login",
|
||||||
|
"storage_bucket": "refilc-mobile-login.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:584481527599:android:cd0fef08720efc4de033da",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "hu.refilc.naplo"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "584481527599-2cpalmvit8kl489aoj3v6t28ujcbcd62.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "hu.refilc.naplo",
|
||||||
|
"certificate_hash": "3c61db0984e5db01569cb084c83f9b3e058d94dc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyAl8eWn7XVeWeA9dPMrWtzdRhhH4XOWOaY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
11
refilc/android/app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-keep class io.flutter.plugin.editing.** { *; }
|
||||||
|
-keep class androidx.lifecycle.DefaultLifecycleObserver
|
||||||
|
-keep class com.pauldemarco.flutter_blue.** { *; }
|
||||||
|
-keep class com.mr.flutter.plugin.filepicker.** { *; }
|
||||||
|
-keep class com.shockwave.**
|
||||||
|
|
||||||
|
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g
|
||||||
|
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args
|
||||||
|
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error
|
||||||
|
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter
|
||||||
|
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider
|
8
refilc/android/app/src/debug/AndroidManifest.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="hu.refilc.naplo">
|
||||||
|
<!-- Permissions -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
|
</manifest>
|
160
refilc/android/app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" package="hu.refilc.naplo">
|
||||||
|
<application android:name="${applicationName}" android:label="reFilc" tools:replace="android:label" android:icon="@mipmap/ic_launcher"
|
||||||
|
android:requestLegacyExternalStorage="true" android:enableOnBackInvokedCallback="false">
|
||||||
|
<activity android:exported="true" android:name="hu.refilc.naplo.MainActivity"
|
||||||
|
android:launchMode="singleTop" android:theme="@style/LaunchTheme"
|
||||||
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
|
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"
|
||||||
|
android:showWhenLocked="false"
|
||||||
|
android:turnScreenOn="true">
|
||||||
|
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable"
|
||||||
|
android:resource="@drawable/launch_background" />
|
||||||
|
<meta-data android:name="io.flutter.embedding.android.NormalTheme"
|
||||||
|
android:resource="@style/NormalTheme" />
|
||||||
|
<intent-filter>
|
||||||
|
<!-- commented bc of dynamic app icons -->
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
<!-- Deep Links -->
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->
|
||||||
|
<data
|
||||||
|
android:scheme="refilcapp"
|
||||||
|
android:host="refilc.hu" />
|
||||||
|
</intent-filter>
|
||||||
|
<!-- <intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<!- Accepts URIs that begin with https://api.refilc.hu ->
|
||||||
|
<data
|
||||||
|
android:scheme="https"
|
||||||
|
android:host="api.refilc.hu"
|
||||||
|
android:pathPrefix="/v2/rf-plus/auth/finish" />
|
||||||
|
</intent-filter> -->
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<!-- Accepts URIs that begin with https://refilc.hu -->
|
||||||
|
<data
|
||||||
|
android:scheme="https"
|
||||||
|
android:host="refilc.hu"
|
||||||
|
android:pathPrefix="/app" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<meta-data android:name="flutterEmbedding" android:value="2" />
|
||||||
|
|
||||||
|
<!-- custom app icon thingies from here -->
|
||||||
|
<!-- <activity-alias
|
||||||
|
android:label="reFilc"
|
||||||
|
android:icon="@drawable/launch_ic_refilc_default"
|
||||||
|
android:name=".MainActivityAlias"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true"
|
||||||
|
android:targetActivity=".MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity-alias>
|
||||||
|
<activity-alias
|
||||||
|
android:label="reFilc"
|
||||||
|
android:icon="@drawable/launch_ic_refilc_default"
|
||||||
|
android:name=".MainActivityAliasrefilc_default"
|
||||||
|
android:enabled="false"
|
||||||
|
android:exported="true"
|
||||||
|
android:targetActivity=".MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity-alias>
|
||||||
|
<activity-alias
|
||||||
|
android:label="reFilc"
|
||||||
|
android:icon="@drawable/launch_ic_refilc_overcomplicated"
|
||||||
|
android:name=".MainActivityAliasrefilc_overcomplicated"
|
||||||
|
android:enabled="false"
|
||||||
|
android:exported="true"
|
||||||
|
android:targetActivity=".MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity-alias>
|
||||||
|
<activity-alias
|
||||||
|
android:label="reFilc"
|
||||||
|
android:icon="@drawable/launch_ic_refilc_concept"
|
||||||
|
android:name=".MainActivityAliasrefilc_concept"
|
||||||
|
android:enabled="false"
|
||||||
|
android:exported="true"
|
||||||
|
android:targetActivity=".MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity-alias>
|
||||||
|
<activity-alias
|
||||||
|
android:label="reFilc"
|
||||||
|
android:icon="@drawable/launch_ic_refilc_pride"
|
||||||
|
android:name=".MainActivityAliasrefilc_pride"
|
||||||
|
android:enabled="false"
|
||||||
|
android:exported="true"
|
||||||
|
android:targetActivity=".MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity-alias> -->
|
||||||
|
<!-- end of custom app icon thingies -->
|
||||||
|
|
||||||
|
<receiver android:name="hu.refilc.naplo.widget_timetable.WidgetTimetable"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
|
<action android:name="list_widget.ACTION_WIDGET_CLICK_NAV_LEFT" />
|
||||||
|
<action android:name="list_widget.ACTION_WIDGET_CLICK_NAV_RIGHT" />
|
||||||
|
<action android:name="list_widget.ACTION_WIDGET_CLICK_NAV_TODAY" />
|
||||||
|
<action android:name="list_widget.ACTION_WIDGET_CLICK_NAV_REFRESH" />
|
||||||
|
<action android:name="list_widget.ACTION_WIDGET_CLICK_BUY_PREMIUM" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.appwidget.provider"
|
||||||
|
android:resource="@xml/home_widget_test_info" />
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<service android:name="hu.refilc.naplo.widget_timetable.WidgetTimetableService"
|
||||||
|
android:permission="android.permission.BIND_REMOTEVIEWS" />
|
||||||
|
|
||||||
|
<receiver android:name="es.antonborri.home_widget.HomeWidgetBackgroundReceiver"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="es.antonborri.home_widget.action.BACKGROUND" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<service android:name="es.antonborri.home_widget.HomeWidgetBackgroundService"
|
||||||
|
android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<meta-data android:name="flutterEmbedding" android:value="2" />
|
||||||
|
|
||||||
|
<!-- Permissions -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
</manifest>
|
@ -0,0 +1,5 @@
|
|||||||
|
package hu.refilc.naplo
|
||||||
|
|
||||||
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
|
||||||
|
class MainActivity: FlutterActivity()
|
@ -0,0 +1,73 @@
|
|||||||
|
package hu.refilc.naplo.database
|
||||||
|
|
||||||
|
import android.content.ContentValues
|
||||||
|
import android.content.Context
|
||||||
|
import android.database.Cursor
|
||||||
|
import android.database.sqlite.SQLiteDatabase
|
||||||
|
|
||||||
|
import java.sql.SQLException
|
||||||
|
|
||||||
|
import hu.refilc.naplo.database.SQLiteHelper
|
||||||
|
import kotlin.arrayOf
|
||||||
|
|
||||||
|
class DBManager(private val context: Context) {
|
||||||
|
private lateinit var database: SQLiteDatabase
|
||||||
|
private lateinit var dbHelper: SQLiteHelper
|
||||||
|
|
||||||
|
fun open(): DBManager {
|
||||||
|
this.dbHelper = SQLiteHelper(this.context)
|
||||||
|
this.database = this.dbHelper.getWritableDatabase()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun close() {
|
||||||
|
this.dbHelper.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fetchWidget(wid: Int): Cursor {
|
||||||
|
val cursor: Cursor = this.database.query(SQLiteHelper.TABLE_NAME_WIDGETS, arrayOf(SQLiteHelper._ID, SQLiteHelper.DAY_SEL), "${SQLiteHelper._ID} = $wid", null, null, null, null)
|
||||||
|
if (cursor != null) cursor.moveToFirst()
|
||||||
|
return cursor
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fetchTimetable(): Cursor {
|
||||||
|
val cursor: Cursor = this.database.query(SQLiteHelper.TABLE_NAME_USER_DATA, arrayOf(SQLiteHelper.TIMETABLE), null, null, null, null, null)
|
||||||
|
if (cursor != null) cursor.moveToFirst()
|
||||||
|
return cursor
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fetchLastUser(): Cursor {
|
||||||
|
val cursor: Cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, arrayOf(SQLiteHelper.LAST_ACCOUNT_ID), null, null, null, null, null)
|
||||||
|
if (cursor != null) cursor.moveToFirst()
|
||||||
|
return cursor
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fetchTheme(): Cursor {
|
||||||
|
val cursor: Cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, arrayOf(SQLiteHelper.THEME, SQLiteHelper.CUSTOM_ACCENT_COLOR, SQLiteHelper.CUSTOM_BACKGROUND_COLOR), null, null, null, null, null)
|
||||||
|
if (cursor != null) cursor.moveToFirst()
|
||||||
|
return cursor
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fetchLocale(): Cursor {
|
||||||
|
val cursor: Cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, arrayOf(SQLiteHelper.LOCALE), null, null, null, null, null)
|
||||||
|
if (cursor != null) cursor.moveToFirst()
|
||||||
|
return cursor
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteWidget(_id: Int) {
|
||||||
|
this.database.delete(SQLiteHelper.TABLE_NAME_WIDGETS, "_id=$_id", null)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun insertSelDay(_id: Int, day_sel: Int) {
|
||||||
|
val con: ContentValues = ContentValues()
|
||||||
|
con.put(SQLiteHelper._ID, _id)
|
||||||
|
con.put(SQLiteHelper.DAY_SEL, day_sel)
|
||||||
|
this.database.insert(SQLiteHelper.TABLE_NAME_WIDGETS, null, con)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun update(_id: Int, day_sel: Int): Int {
|
||||||
|
val con: ContentValues = ContentValues()
|
||||||
|
con.put(SQLiteHelper.DAY_SEL, day_sel)
|
||||||
|
return this.database.update(SQLiteHelper.TABLE_NAME_WIDGETS, con, "${SQLiteHelper._ID} = $_id", null)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package hu.refilc.naplo.database
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.database.sqlite.SQLiteDatabase
|
||||||
|
import android.database.sqlite.SQLiteOpenHelper
|
||||||
|
|
||||||
|
class SQLiteHelper(context: Context): SQLiteOpenHelper(context, DB_NAME, null, 7) {
|
||||||
|
companion object {
|
||||||
|
private final val CREATE_TABLE_WIDGET: String = " create table widgets ( _id INTEGER NOT NULL, day_sel INTEGER NOT NULL);"
|
||||||
|
private final val DB_NAME: String = "app.db"
|
||||||
|
private final val DB_VERSION: Int = 1
|
||||||
|
final val _ID: String = "_id"
|
||||||
|
final val DAY_SEL: String = "day_sel"
|
||||||
|
final val TIMETABLE: String = "timetable"
|
||||||
|
final val LAST_ACCOUNT_ID: String = "last_account_id"
|
||||||
|
final val THEME: String = "theme"
|
||||||
|
final val LOCALE: String = "language"
|
||||||
|
final val CUSTOM_ACCENT_COLOR: String = "custom_accent_color"
|
||||||
|
final val CUSTOM_BACKGROUND_COLOR: String = "custom_background_color"
|
||||||
|
final val TABLE_NAME_WIDGETS: String = "widgets"
|
||||||
|
final val TABLE_NAME_USER_DATA: String = "user_data"
|
||||||
|
final val TABLE_NAME_SETTINGS: String = "settings"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(db: SQLiteDatabase) {
|
||||||
|
db.execSQL(CREATE_TABLE_WIDGET)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS widgets")
|
||||||
|
onCreate(db)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package hu.refilc.naplo.utils
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.net.ConnectivityManager
|
||||||
|
import android.net.NetworkInfo
|
||||||
|
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
class Utils {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun hasNetwork(context: Context): Boolean {
|
||||||
|
val cm: ConnectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||||
|
val netInfo: NetworkInfo = cm.getActiveNetworkInfo() as NetworkInfo
|
||||||
|
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getWeekStartDate(): Date {
|
||||||
|
var calendar: Calendar = Calendar.getInstance()
|
||||||
|
while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
||||||
|
calendar.add(Calendar.DATE, -1)
|
||||||
|
}
|
||||||
|
return calendar.getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getWeekEndDate(): Date {
|
||||||
|
var calendar: Calendar = Calendar.getInstance()
|
||||||
|
while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
||||||
|
calendar.add(Calendar.DATE, 1)
|
||||||
|
}
|
||||||
|
calendar.add(Calendar.DATE, -1)
|
||||||
|
return calendar.getTime()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package hu.refilc.naplo.utils
|
||||||
|
|
||||||
|
import java.time.DayOfWeek
|
||||||
|
import java.time.Duration
|
||||||
|
import java.time.LocalDate
|
||||||
|
import kotlin.math.ceil
|
||||||
|
|
||||||
|
class Week private constructor(private final val start: LocalDate, private final val end: LocalDate) {
|
||||||
|
companion object {
|
||||||
|
fun current(): Week {
|
||||||
|
return fromDate(LocalDate.now())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fromId(id: Int): Week {
|
||||||
|
val _now: LocalDate = getYearStart().plusDays(id * 7L)
|
||||||
|
return Week(_now.minusDays(_now.getDayOfWeek().getValue() - 1L), _now.plusDays(7L - _now.getDayOfWeek().getValue()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fromDate(date: LocalDate): Week {
|
||||||
|
return Week(date.minusDays(date.getDayOfWeek().getValue() - 1L), date.plusDays(7L - date.getDayOfWeek().getValue()))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getYearStart(): LocalDate {
|
||||||
|
val now: LocalDate = LocalDate.now()
|
||||||
|
val start: LocalDate = getYearStart(now.getYear())
|
||||||
|
return if (start.isBefore(now)) start else getYearStart(now.getYear() - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getYearStart(year: Int): LocalDate {
|
||||||
|
val time: LocalDate = LocalDate.of(year, 9, 1)
|
||||||
|
if (time.getDayOfWeek() == DayOfWeek.SATURDAY)
|
||||||
|
return time.plusDays(2)
|
||||||
|
else if (time.getDayOfWeek() == DayOfWeek.SUNDAY)
|
||||||
|
return time.plusDays(1)
|
||||||
|
return time
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun next(): Week {
|
||||||
|
return Week.fromDate(start.plusDays(8))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun id(): Int {
|
||||||
|
return Math.ceil(Duration.between(getYearStart().atStartOfDay(), start.atStartOfDay()).toDays() / 7.0).toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(o: Any?): Boolean {
|
||||||
|
if (this == o as Week) return true
|
||||||
|
if (o == null || Week::class != o::class) return false
|
||||||
|
val week: Week = o as Week
|
||||||
|
return this.id() == week.id()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return id()
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,402 @@
|
|||||||
|
package hu.refilc.naplo.widget_timetable
|
||||||
|
|
||||||
|
import android.app.PendingIntent
|
||||||
|
import android.app.UiModeManager
|
||||||
|
import android.appwidget.AppWidgetManager
|
||||||
|
import android.appwidget.AppWidgetProvider
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import android.database.Cursor
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.RemoteViews
|
||||||
|
import android.widget.Toast
|
||||||
|
|
||||||
|
import org.joda.time.DateTime
|
||||||
|
import org.json.JSONArray
|
||||||
|
import org.json.JSONException
|
||||||
|
import org.json.JSONObject
|
||||||
|
|
||||||
|
import java.time.DayOfWeek
|
||||||
|
import java.time.format.TextStyle
|
||||||
|
import java.util.Collections
|
||||||
|
import java.util.Comparator
|
||||||
|
import java.util.Locale
|
||||||
|
import java.util.HashMap
|
||||||
|
import java.text.ParseException
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
import hu.refilc.naplo.database.DBManager
|
||||||
|
import hu.refilc.naplo.MainActivity
|
||||||
|
import hu.refilc.naplo.R
|
||||||
|
|
||||||
|
import hu.refilc.naplo.utils.Week
|
||||||
|
|
||||||
|
import es.antonborri.home_widget.HomeWidgetBackgroundIntent
|
||||||
|
import es.antonborri.home_widget.HomeWidgetLaunchIntent
|
||||||
|
import es.antonborri.home_widget.HomeWidgetProvider
|
||||||
|
import kotlin.collections.mutableMapOf
|
||||||
|
|
||||||
|
class WidgetTimetable : HomeWidgetProvider() {
|
||||||
|
override fun onUpdate(
|
||||||
|
context: Context,
|
||||||
|
appWidgetManager: AppWidgetManager,
|
||||||
|
appWidgetIds: IntArray,
|
||||||
|
widgetData: SharedPreferences
|
||||||
|
) {
|
||||||
|
val fullTheme: Array<Int> = getFullTheme(context)
|
||||||
|
val textColors: Array<Int> = getTextColors(context, fullTheme)
|
||||||
|
for (i in appWidgetIds.indices) {
|
||||||
|
val views: RemoteViews = generateView(context, appWidgetIds[i])
|
||||||
|
if (userLoggedIn(context)) {
|
||||||
|
val rday = selectDay(context, appWidgetIds[i], 0, true)
|
||||||
|
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday))
|
||||||
|
views.setInt(R.id.nav_current, "setTextColor", getColor(context, textColors[0]))
|
||||||
|
}
|
||||||
|
pushUpdate(context, views, appWidgetIds[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
|
super.onReceive(context, intent)
|
||||||
|
if (intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
|
||||||
|
val appId: Int = intent.getIntExtra(
|
||||||
|
AppWidgetManager.EXTRA_APPWIDGET_ID,
|
||||||
|
AppWidgetManager.INVALID_APPWIDGET_ID
|
||||||
|
)
|
||||||
|
val views: RemoteViews = generateView(context, appId)
|
||||||
|
try {
|
||||||
|
if (userLoggedIn(context)) {
|
||||||
|
if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_LEFT)) {
|
||||||
|
val rday = selectDay(context, appId, -1, false)
|
||||||
|
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday))
|
||||||
|
pushUpdate(context, views, appId)
|
||||||
|
} else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_RIGHT)) {
|
||||||
|
val rday = selectDay(context, appId, 1, false)
|
||||||
|
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday))
|
||||||
|
pushUpdate(context, views, appId)
|
||||||
|
} else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_TODAY)) {
|
||||||
|
val rday = getToday(context)
|
||||||
|
setSelectedDay(context, appId, rday)
|
||||||
|
views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday))
|
||||||
|
pushUpdate(context, views, appId)
|
||||||
|
} else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_REFRESH)) {
|
||||||
|
val pendingIntent: PendingIntent =
|
||||||
|
HomeWidgetLaunchIntent.getActivity(
|
||||||
|
context,
|
||||||
|
MainActivity::class.java,
|
||||||
|
Uri.parse("timetable://refresh")
|
||||||
|
)
|
||||||
|
pendingIntent.send()
|
||||||
|
} else if (intent.getAction()
|
||||||
|
.equals("android.appwidget.action.APPWIDGET_DELETED")
|
||||||
|
) {
|
||||||
|
val dbManager = DBManager(context.getApplicationContext())
|
||||||
|
try {
|
||||||
|
dbManager.open()
|
||||||
|
dbManager.deleteWidget(appId)
|
||||||
|
dbManager.close()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (intent.getAction().equals(ACTION_WIDGET_CLICK_BUY_PREMIUM)) {
|
||||||
|
val pendingIntent: PendingIntent = HomeWidgetLaunchIntent.getActivity(
|
||||||
|
context,
|
||||||
|
MainActivity::class.java,
|
||||||
|
Uri.parse("settings://premium")
|
||||||
|
)
|
||||||
|
pendingIntent.send()
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onEnabled(context: Context?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDisabled(context: Context?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val ACTION_WIDGET_CLICK_NAV_LEFT = "list_widget.ACTION_WIDGET_CLICK_NAV_LEFT"
|
||||||
|
private const val ACTION_WIDGET_CLICK_NAV_RIGHT =
|
||||||
|
"list_widget.ACTION_WIDGET_CLICK_NAV_RIGHT"
|
||||||
|
private const val ACTION_WIDGET_CLICK_NAV_TODAY =
|
||||||
|
"list_widget.ACTION_WIDGET_CLICK_NAV_TODAY"
|
||||||
|
private const val ACTION_WIDGET_CLICK_NAV_REFRESH =
|
||||||
|
"list_widget.ACTION_WIDGET_CLICK_NAV_REFRESH"
|
||||||
|
private const val ACTION_WIDGET_CLICK_BUY_PREMIUM =
|
||||||
|
"list_widget.ACTION_WIDGET_CLICK_BUY_PREMIUM"
|
||||||
|
|
||||||
|
fun pushUpdate(context: Context?, remoteViews: RemoteViews?, appWidgetSingleId: Int) {
|
||||||
|
val manager: AppWidgetManager = AppWidgetManager.getInstance(context)
|
||||||
|
manager.updateAppWidget(appWidgetSingleId, remoteViews)
|
||||||
|
manager.notifyAppWidgetViewDataChanged(appWidgetSingleId, R.id.widget_list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getColor(context: Context, color: Int): Int {
|
||||||
|
return context.getResources().getColor(color)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getTextColors(context: Context, fullTheme: Array<Int>): Array<Int> {
|
||||||
|
val uiModeManager: UiModeManager =
|
||||||
|
context.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
|
||||||
|
val nightMode: Int = uiModeManager.getNightMode()
|
||||||
|
val textColor: Int
|
||||||
|
val textDescColor: Int
|
||||||
|
if (fullTheme[0] == 0 && nightMode == UiModeManager.MODE_NIGHT_NO) {
|
||||||
|
textColor = R.color.text_light
|
||||||
|
textDescColor = R.color.text_desc_light
|
||||||
|
} else if (fullTheme[0] == 1) {
|
||||||
|
textColor = R.color.text_light
|
||||||
|
textDescColor = R.color.text_desc_light
|
||||||
|
} else {
|
||||||
|
textColor = R.color.text
|
||||||
|
textDescColor = R.color.text_desc
|
||||||
|
}
|
||||||
|
return arrayOf(textColor, textDescColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getFullTheme(context: Context): Array<Int> {
|
||||||
|
val dbManager = DBManager(context.getApplicationContext())
|
||||||
|
try {
|
||||||
|
dbManager.open()
|
||||||
|
val cursor: Cursor = dbManager.fetchTheme()
|
||||||
|
dbManager.close()
|
||||||
|
val theme: Int = cursor.getInt(0)
|
||||||
|
val customBackgroundColor: Int = cursor.getInt(2)
|
||||||
|
return arrayOf(theme, customBackgroundColor)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return arrayOf(0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun generateView(context: Context, appId: Int): RemoteViews {
|
||||||
|
val fullTheme: Array<Int> = getFullTheme(context)
|
||||||
|
val textColors: Array<Int> = getTextColors(context, fullTheme)
|
||||||
|
val serviceIntent = Intent(context, WidgetTimetableService::class.java)
|
||||||
|
serviceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appId)
|
||||||
|
serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)))
|
||||||
|
val views = RemoteViews(context.getPackageName(), R.layout.widget_timetable)
|
||||||
|
views.setViewVisibility(R.id.need_login, View.GONE)
|
||||||
|
views.setViewVisibility(R.id.tt_grid_cont, View.GONE)
|
||||||
|
views.setInt(R.id.nav_to_left, "setColorFilter", getColor(context, textColors[1]))
|
||||||
|
views.setInt(R.id.nav_to_right, "setColorFilter", getColor(context, textColors[1]))
|
||||||
|
views.setInt(R.id.nav_refresh, "setColorFilter", getColor(context, textColors[1]))
|
||||||
|
views.setInt(R.id.empty_view, "setTextColor", getColor(context, textColors[0]))
|
||||||
|
if (!userLoggedIn(context)) {
|
||||||
|
views.setViewVisibility(R.id.need_login, View.VISIBLE)
|
||||||
|
views.setOnClickPendingIntent(
|
||||||
|
R.id.open_login,
|
||||||
|
makePending(context, ACTION_WIDGET_CLICK_BUY_PREMIUM, appId)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
views.setViewVisibility(R.id.tt_grid_cont, View.VISIBLE)
|
||||||
|
views.setInt(R.id.widget_list, "setBackgroundColor", fullTheme[1])
|
||||||
|
views.setInt(R.id.bottom_nav, "setBackgroundColor", fullTheme[1])
|
||||||
|
views.setOnClickPendingIntent(
|
||||||
|
R.id.nav_to_left,
|
||||||
|
makePending(context, ACTION_WIDGET_CLICK_NAV_LEFT, appId)
|
||||||
|
)
|
||||||
|
views.setOnClickPendingIntent(
|
||||||
|
R.id.nav_to_right,
|
||||||
|
makePending(context, ACTION_WIDGET_CLICK_NAV_RIGHT, appId)
|
||||||
|
)
|
||||||
|
views.setOnClickPendingIntent(
|
||||||
|
R.id.nav_current,
|
||||||
|
makePending(context, ACTION_WIDGET_CLICK_NAV_TODAY, appId)
|
||||||
|
)
|
||||||
|
views.setOnClickPendingIntent(
|
||||||
|
R.id.nav_refresh,
|
||||||
|
makePending(context, ACTION_WIDGET_CLICK_NAV_REFRESH, appId)
|
||||||
|
)
|
||||||
|
views.setRemoteAdapter(R.id.widget_list, serviceIntent)
|
||||||
|
views.setEmptyView(R.id.widget_list, R.id.empty_view)
|
||||||
|
views.setInt(R.id.empty_view, "setBackgroundColor", fullTheme[1])
|
||||||
|
}
|
||||||
|
return views
|
||||||
|
}
|
||||||
|
|
||||||
|
fun makePending(context: Context?, action: String?, appWidgetId: Int): PendingIntent {
|
||||||
|
val activebtnnext = Intent(context, WidgetTimetable::class.java)
|
||||||
|
activebtnnext.setAction(action)
|
||||||
|
activebtnnext.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
|
||||||
|
return PendingIntent.getBroadcast(
|
||||||
|
context,
|
||||||
|
appWidgetId,
|
||||||
|
activebtnnext,
|
||||||
|
PendingIntent.FLAG_IMMUTABLE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun convertDayOfWeek(context: Context, rday: Int): String {
|
||||||
|
|
||||||
|
/*if(rday == -1) return DayOfWeek.of(1).getDisplayName(TextStyle.FULL, new Locale("hu", "HU"))
|
||||||
|
|
||||||
|
String dayOfWeek = DayOfWeek.of(rday + 1).getDisplayName(TextStyle.FULL, new Locale("hu", "HU"))*/
|
||||||
|
var dayOfWeek = "Unknown"
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
val loc: Locale = getLocale(context)
|
||||||
|
if (rday == -1) return DayOfWeek.of(1).getDisplayName(TextStyle.FULL, loc)
|
||||||
|
dayOfWeek = DayOfWeek.of(rday + 1).getDisplayName(TextStyle.FULL, loc)
|
||||||
|
}
|
||||||
|
return dayOfWeek.substring(0, 1).toUpperCase() + dayOfWeek.substring(1).toLowerCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setSelectedDay(context: Context, wid: Int, day: Int) {
|
||||||
|
val dbManager = DBManager(context.getApplicationContext())
|
||||||
|
try {
|
||||||
|
dbManager.open()
|
||||||
|
dbManager.update(wid, day)
|
||||||
|
dbManager.close()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getToday(context: Context): Int {
|
||||||
|
var rday: Int = DateTime().getDayOfWeek() - 1
|
||||||
|
val s: MutableList<JSONArray> = genJsonDays(context)
|
||||||
|
try {
|
||||||
|
if (checkIsAfter(s, rday)) rday += 1
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return retDay(rday, s.size)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun selectDay(context: Context, wid: Int, add: Int, afterSubjects: Boolean): Int {
|
||||||
|
val dbManager = DBManager(context.getApplicationContext())
|
||||||
|
try {
|
||||||
|
dbManager.open()
|
||||||
|
val cursor: Cursor = dbManager.fetchWidget(wid)
|
||||||
|
val s: MutableList<JSONArray> = genJsonDays(context)
|
||||||
|
var retday: Int = DateTime().getDayOfWeek() - 1
|
||||||
|
if (cursor.getCount() !== 0) retday = retDay(cursor.getInt(1) + add, s.size)
|
||||||
|
if (afterSubjects) if (checkIsAfter(s, retday)) retday += 1
|
||||||
|
retday = retDay(retday, s.size)
|
||||||
|
if (cursor.getCount() === 0) dbManager.insertSelDay(
|
||||||
|
wid,
|
||||||
|
retday
|
||||||
|
) else dbManager.update(wid, retday)
|
||||||
|
dbManager.close()
|
||||||
|
|
||||||
|
// get the date of the first lesson
|
||||||
|
val dt = DateTime(s[retday].getJSONObject(0).getString("Datum"))
|
||||||
|
retday = dt.getDayOfWeek() - 1
|
||||||
|
return retday
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
fun checkIsAfter(s: MutableList<JSONArray>, retday: Int): Boolean {
|
||||||
|
var retday = retday
|
||||||
|
retday = retDay(retday, s.size)
|
||||||
|
val vegIdopont: String =
|
||||||
|
s[retday].getJSONObject(s[retday].length() - 1).getString("VegIdopont")
|
||||||
|
return DateTime().isAfter(DateTime(vegIdopont))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun retDay(retday: Int, size: Int): Int {
|
||||||
|
var retday = retday
|
||||||
|
if (retday < 0) retday = size - 1 else if (retday > size - 1) retday = 0
|
||||||
|
return retday
|
||||||
|
}
|
||||||
|
|
||||||
|
fun genJsonDays(context: Context): MutableList<JSONArray> {
|
||||||
|
val genDays: MutableList<JSONArray> = mutableListOf<JSONArray>()
|
||||||
|
val dayMap: MutableMap<String, JSONArray> = mutableMapOf<String, JSONArray>()
|
||||||
|
val dbManager = DBManager(context.getApplicationContext())
|
||||||
|
try {
|
||||||
|
dbManager.open()
|
||||||
|
val ct: Cursor = dbManager.fetchTimetable()
|
||||||
|
if (ct.getCount() === 0) {
|
||||||
|
return genDays
|
||||||
|
}
|
||||||
|
val fetchedTimetable = JSONObject(ct.getString(0))
|
||||||
|
val currentWeek: String = Week.current().id().toString()
|
||||||
|
val week: JSONArray = fetchedTimetable.getJSONArray(currentWeek)
|
||||||
|
|
||||||
|
// Organize lessons into dates
|
||||||
|
for (i in 0 until week.length()) {
|
||||||
|
try {
|
||||||
|
val entry: JSONObject = week.getJSONObject(i)
|
||||||
|
val date: String = entry.getString("Datum")
|
||||||
|
dayMap.computeIfAbsent(date) { k -> JSONArray() }.put(entry)
|
||||||
|
} catch (e: JSONException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
genDays.addAll(dayMap.values)
|
||||||
|
|
||||||
|
// Sort the 'genDays' list of JSON based on the start time of the first entry
|
||||||
|
genDays.sortWith( { day1, day2 ->
|
||||||
|
// Extract the start time of the first entry in each day's JSON
|
||||||
|
val startTime1: String = day1.getJSONObject(0).getString("KezdetIdopont")
|
||||||
|
val startTime2: String = day2.getJSONObject(0).getString("KezdetIdopont")
|
||||||
|
// Compare the start times and return the result for sorting
|
||||||
|
startTime1.compareTo(startTime2)
|
||||||
|
})
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
} finally {
|
||||||
|
dbManager.close()
|
||||||
|
}
|
||||||
|
return genDays
|
||||||
|
}
|
||||||
|
|
||||||
|
fun zeroPad(value: Int, padding: Int): String {
|
||||||
|
val b = StringBuilder()
|
||||||
|
b.append(value)
|
||||||
|
while (b.length < padding) {
|
||||||
|
b.insert(0, "0")
|
||||||
|
}
|
||||||
|
return b.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getLocale(context: Context): Locale {
|
||||||
|
val dbManager = DBManager(context.getApplicationContext())
|
||||||
|
try {
|
||||||
|
dbManager.open()
|
||||||
|
val loc: String = dbManager.fetchLocale().getString(0)
|
||||||
|
dbManager.close()
|
||||||
|
if (loc.equals("hu") || loc.equals("de")) {
|
||||||
|
return Locale(loc, loc.toUpperCase())
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return Locale("en", "GB")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun userLoggedIn(context: Context): Boolean {
|
||||||
|
return !lastUserId(context).equals("")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun lastUserId(context: Context): String {
|
||||||
|
val dbManager = DBManager(context.getApplicationContext())
|
||||||
|
try {
|
||||||
|
dbManager.open()
|
||||||
|
val cursor: Cursor = dbManager.fetchLastUser()
|
||||||
|
dbManager.close()
|
||||||
|
if (cursor != null && !cursor.getString(0).equals("")) {
|
||||||
|
return cursor.getString(0)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,328 @@
|
|||||||
|
package hu.refilc.naplo.widget_timetable
|
||||||
|
|
||||||
|
import android.app.UiModeManager
|
||||||
|
import android.appwidget.AppWidgetManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.database.Cursor
|
||||||
|
import android.os.Build
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.RemoteViews
|
||||||
|
import android.widget.RemoteViewsService
|
||||||
|
|
||||||
|
import org.joda.time.DateTime
|
||||||
|
import org.json.JSONArray
|
||||||
|
import org.json.JSONException
|
||||||
|
import org.json.JSONObject
|
||||||
|
|
||||||
|
import java.util.Collections
|
||||||
|
import java.util.Comparator
|
||||||
|
|
||||||
|
import hu.refilc.naplo.database.DBManager
|
||||||
|
import hu.refilc.naplo.R
|
||||||
|
|
||||||
|
class WidgetTimetableDataProvider(context: Context, intent: Intent) : RemoteViewsService.RemoteViewsFactory {
|
||||||
|
private val context: Context
|
||||||
|
private val appWidgetId: Int
|
||||||
|
private var rday = 0
|
||||||
|
private var fullTheme: Array<Int>
|
||||||
|
private val uiModeManager: UiModeManager
|
||||||
|
private val nightMode: Int
|
||||||
|
var day_subjects: MutableList<Lesson> = mutableListOf<Lesson>()
|
||||||
|
var lessonIndexes: MutableList<Int> = mutableListOf<Int>()
|
||||||
|
var witem: Item? = null
|
||||||
|
|
||||||
|
/* Default values */
|
||||||
|
class Item(
|
||||||
|
var Layout: Int,
|
||||||
|
var BackgroundColor: Int,
|
||||||
|
var NumVisibility: Int,
|
||||||
|
var NameVisibility: Int,
|
||||||
|
var NameNodescVisibility: Int,
|
||||||
|
var DescVisibility: Int,
|
||||||
|
var RoomVisibility: Int,
|
||||||
|
var TimeVisibility: Int,
|
||||||
|
var NumColor: Int,
|
||||||
|
var NameColor: Int,
|
||||||
|
var NameNodescColor: Int,
|
||||||
|
var DescColor: Int,
|
||||||
|
var RoomColor: Int,
|
||||||
|
var TimeColor: Int
|
||||||
|
) {
|
||||||
|
var NameNodescPadding: Array<Int> = arrayOf(0, 0, 0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Lesson(
|
||||||
|
var status: String,
|
||||||
|
var lessonIndex: String,
|
||||||
|
var lessonName: String,
|
||||||
|
var lessonTopic: String,
|
||||||
|
var lessonRoom: String,
|
||||||
|
var lessonStart: Long,
|
||||||
|
var lessonEnd: Long,
|
||||||
|
var substituteTeacher: String
|
||||||
|
)
|
||||||
|
|
||||||
|
var itemNameNodescPadding: Array<Int> = arrayOf(0, 0, 0, 0)
|
||||||
|
|
||||||
|
init {
|
||||||
|
this.context = context
|
||||||
|
appWidgetId = intent.getIntExtra(
|
||||||
|
AppWidgetManager.EXTRA_APPWIDGET_ID,
|
||||||
|
AppWidgetManager.INVALID_APPWIDGET_ID
|
||||||
|
)
|
||||||
|
fullTheme = getFullTheme(context)
|
||||||
|
uiModeManager = context.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
|
||||||
|
nightMode = uiModeManager.getNightMode()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate() {
|
||||||
|
initData()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDataSetChanged() {
|
||||||
|
initData()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {}
|
||||||
|
|
||||||
|
override fun getCount(): Int {
|
||||||
|
return day_subjects.size
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setLayout(view: RemoteViews) {
|
||||||
|
/* Visibilities */
|
||||||
|
view.setViewVisibility(R.id.tt_item_num, witem!!.NumVisibility)
|
||||||
|
view.setViewVisibility(R.id.tt_item_name, witem!!.NameVisibility)
|
||||||
|
view.setViewVisibility(R.id.tt_item_name_nodesc, witem!!.NameNodescVisibility)
|
||||||
|
view.setViewVisibility(R.id.tt_item_desc, witem!!.DescVisibility)
|
||||||
|
view.setViewVisibility(R.id.tt_item_room, witem!!.RoomVisibility)
|
||||||
|
view.setViewVisibility(R.id.tt_item_time, witem!!.TimeVisibility)
|
||||||
|
|
||||||
|
/* backgroundResources */
|
||||||
|
view.setInt(R.id.main_lay, "setBackgroundResource", witem!!.Layout)
|
||||||
|
view.setInt(R.id.main_lay, "setBackgroundColor", witem!!.BackgroundColor)
|
||||||
|
|
||||||
|
/* Paddings */
|
||||||
|
view.setViewPadding(
|
||||||
|
R.id.tt_item_name_nodesc,
|
||||||
|
witem!!.NameNodescPadding[0],
|
||||||
|
witem!!.NameNodescPadding[1],
|
||||||
|
witem!!.NameNodescPadding[2],
|
||||||
|
witem!!.NameNodescPadding[3]
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Text Colors */
|
||||||
|
view.setInt(R.id.tt_item_num, "setTextColor", witem!!.NumColor)
|
||||||
|
view.setInt(R.id.tt_item_name, "setTextColor", getColor(context, witem!!.NameColor))
|
||||||
|
view.setInt(R.id.tt_item_name_nodesc, "setTextColor", getColor(context, witem!!.NameNodescColor))
|
||||||
|
view.setInt(R.id.tt_item_desc, "setTextColor", getColor(context, witem!!.DescColor))
|
||||||
|
view.setInt(R.id.tt_item_room, "setTextColor", getColor(context, witem!!.RoomColor))
|
||||||
|
view.setInt(R.id.tt_item_time, "setTextColor", getColor(context, witem!!.TimeColor))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getColor(context: Context, color: Int): Int {
|
||||||
|
return context.getResources().getColor(color)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getViewAt(position: Int): RemoteViews {
|
||||||
|
val view = RemoteViews(context.getPackageName(), R.layout.timetable_item)
|
||||||
|
witem = defaultItem(fullTheme, nightMode)
|
||||||
|
val curr_subject = day_subjects[position]
|
||||||
|
if (curr_subject.status.equals("empty")) {
|
||||||
|
witem!!.NumColor = getColor(context, R.color.text_miss_num)
|
||||||
|
witem!!.TimeVisibility = View.GONE
|
||||||
|
witem!!.RoomVisibility = View.GONE
|
||||||
|
witem!!.NameNodescColor = R.color.text_miss
|
||||||
|
}
|
||||||
|
if (!curr_subject.substituteTeacher.equals("null")) {
|
||||||
|
witem!!.NumColor = getColor(context, R.color.yellow)
|
||||||
|
witem!!.Layout = R.drawable.card_layout_tile_helyetesitett
|
||||||
|
}
|
||||||
|
if (curr_subject.status.equals("Elmaradt")) {
|
||||||
|
witem!!.NumColor = getColor(context, R.color.red)
|
||||||
|
witem!!.Layout = R.drawable.card_layout_tile_elmarad
|
||||||
|
} else if (curr_subject.status.equals("TanevRendjeEsemeny")) {
|
||||||
|
witem!!.NumVisibility = View.GONE
|
||||||
|
witem!!.TimeVisibility = View.GONE
|
||||||
|
witem!!.RoomVisibility = View.GONE
|
||||||
|
witem!!.NameNodescPadding[0] = 50
|
||||||
|
witem!!.NameNodescPadding[2] = 50
|
||||||
|
witem!!.NameNodescColor = R.color.text_miss
|
||||||
|
}
|
||||||
|
if (curr_subject.lessonTopic.equals("null")) {
|
||||||
|
witem!!.DescVisibility = View.GONE
|
||||||
|
witem!!.NameVisibility = View.GONE
|
||||||
|
witem!!.NameNodescVisibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
setLayout(view)
|
||||||
|
val lessonIndexTrailing = if (curr_subject.lessonIndex.equals("+")) "" else "."
|
||||||
|
view.setTextViewText(R.id.tt_item_num, curr_subject.lessonIndex + lessonIndexTrailing)
|
||||||
|
view.setTextViewText(R.id.tt_item_name, curr_subject.lessonName)
|
||||||
|
view.setTextViewText(R.id.tt_item_name_nodesc, curr_subject.lessonName)
|
||||||
|
view.setTextViewText(R.id.tt_item_desc, curr_subject.lessonTopic)
|
||||||
|
view.setTextViewText(R.id.tt_item_room, curr_subject.lessonRoom)
|
||||||
|
if (curr_subject.lessonStart != 0L && curr_subject.lessonEnd != 0L) view.setTextViewText(
|
||||||
|
R.id.tt_item_time,
|
||||||
|
((WidgetTimetable.zeroPad(
|
||||||
|
DateTime(curr_subject.lessonStart).getHourOfDay(),
|
||||||
|
2
|
||||||
|
) + ":" + WidgetTimetable.zeroPad(
|
||||||
|
DateTime(curr_subject.lessonStart).getMinuteOfHour(),
|
||||||
|
2
|
||||||
|
)).toString() +
|
||||||
|
"\n" + WidgetTimetable.zeroPad(
|
||||||
|
DateTime(curr_subject.lessonEnd).getHourOfDay(),
|
||||||
|
2
|
||||||
|
)).toString() + ":" + WidgetTimetable.zeroPad(
|
||||||
|
DateTime(curr_subject.lessonEnd).getMinuteOfHour(),
|
||||||
|
2
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLoadingView(): RemoteViews {
|
||||||
|
val view = RemoteViews(context.getPackageName(), R.layout.timetable_item)
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getViewTypeCount(): Int {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemId(position: Int): Long {
|
||||||
|
return position.toLong()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hasStableIds(): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initData() {
|
||||||
|
// refresh theme
|
||||||
|
fullTheme = getFullTheme(context)
|
||||||
|
rday = WidgetTimetable.selectDay(context, appWidgetId, 0, false)
|
||||||
|
day_subjects.clear()
|
||||||
|
lessonIndexes.clear()
|
||||||
|
try {
|
||||||
|
val arr: MutableList<JSONArray> = WidgetTimetable.genJsonDays(context) as MutableList<JSONArray>
|
||||||
|
if (arr.isEmpty()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val arr_lessons: JSONArray = WidgetTimetable.genJsonDays(context).get(rday)
|
||||||
|
for (i in 0 until arr_lessons.length()) {
|
||||||
|
val obj_lessons: JSONObject = arr_lessons.getJSONObject(i)
|
||||||
|
day_subjects.add(jsonToLesson(obj_lessons))
|
||||||
|
}
|
||||||
|
} catch (e: JSONException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
if (day_subjects.size > 0) {
|
||||||
|
Collections.sort(day_subjects, object : Comparator<Lesson?> {
|
||||||
|
override fun compare(o1: Lesson?, o2: Lesson?): Int {
|
||||||
|
return DateTime(o1?.lessonStart).compareTo(DateTime(o2?.lessonStart))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
for (i in 0 until day_subjects.size) {
|
||||||
|
if (!day_subjects[i].lessonIndex.equals("+")) {
|
||||||
|
lessonIndexes.add(Integer.valueOf(day_subjects[i].lessonIndex))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lessonIndexes.size > 0) {
|
||||||
|
var lessonsChecked: Int = Collections.min(lessonIndexes)
|
||||||
|
var i = 0
|
||||||
|
while (lessonsChecked < Collections.max(lessonIndexes)) {
|
||||||
|
if (!lessonIndexes.contains(lessonsChecked)) {
|
||||||
|
day_subjects.add(i, emptyLesson(lessonsChecked))
|
||||||
|
}
|
||||||
|
lessonsChecked++
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun defaultItem(fullTheme: Array<Int>, nightMode: Int): Item {
|
||||||
|
val textColor: Int
|
||||||
|
val textDescColor: Int
|
||||||
|
if (fullTheme[0] == 0 && nightMode == UiModeManager.MODE_NIGHT_NO) {
|
||||||
|
textColor = R.color.text_light
|
||||||
|
textDescColor = R.color.text_desc_light
|
||||||
|
} else if (fullTheme[0] == 1) {
|
||||||
|
textColor = R.color.text_light
|
||||||
|
textDescColor = R.color.text_desc_light
|
||||||
|
} else {
|
||||||
|
textColor = R.color.text
|
||||||
|
textDescColor = R.color.text_desc
|
||||||
|
}
|
||||||
|
return Item(
|
||||||
|
R.drawable.card_layout_tile,
|
||||||
|
fullTheme[2],
|
||||||
|
View.VISIBLE,
|
||||||
|
View.VISIBLE,
|
||||||
|
View.INVISIBLE,
|
||||||
|
View.VISIBLE,
|
||||||
|
View.VISIBLE,
|
||||||
|
View.VISIBLE,
|
||||||
|
fullTheme[1],
|
||||||
|
textColor,
|
||||||
|
textColor,
|
||||||
|
textDescColor,
|
||||||
|
textDescColor,
|
||||||
|
textColor
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun emptyLesson(lessonIndex: Int): Lesson {
|
||||||
|
return Lesson(
|
||||||
|
"empty",
|
||||||
|
lessonIndex.toString(),
|
||||||
|
"Lyukasóra",
|
||||||
|
"null",
|
||||||
|
"null",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"null"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun jsonToLesson(json: JSONObject): Lesson {
|
||||||
|
try {
|
||||||
|
var name: String = json.getString("Nev")
|
||||||
|
name = name.substring(0, 1).toUpperCase() + name.substring(1) // Capitalize name
|
||||||
|
return Lesson(
|
||||||
|
json.getJSONObject("Allapot").getString("Nev"),
|
||||||
|
if (!json.getString("Oraszam").equals("null")) json.getString("Oraszam") else "+",
|
||||||
|
name,
|
||||||
|
json.getString("Tema"),
|
||||||
|
json.getString("TeremNeve"),
|
||||||
|
DateTime(json.getString("KezdetIdopont")).getMillis(),
|
||||||
|
DateTime(json.getString("VegIdopont")).getMillis(),
|
||||||
|
json.getString("HelyettesTanarNeve")
|
||||||
|
)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.d("Filc", "exception: $e")
|
||||||
|
}
|
||||||
|
return Lesson("", "", "", "", "", 0, 0, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getFullTheme(context: Context): Array<Int> {
|
||||||
|
val dbManager = DBManager(context.getApplicationContext())
|
||||||
|
try {
|
||||||
|
dbManager.open()
|
||||||
|
val cursor: Cursor = dbManager.fetchTheme()
|
||||||
|
dbManager.close()
|
||||||
|
val theme: Int = cursor.getInt(0)
|
||||||
|
val customAccentColor: Int = cursor.getInt(1)
|
||||||
|
val customBackgroundColor: Int = cursor.getInt(2)
|
||||||
|
return arrayOf(theme, customAccentColor, customBackgroundColor)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return arrayOf(0, 0, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package hu.refilc.naplo.widget_timetable
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
|
import android.widget.RemoteViewsService
|
||||||
|
|
||||||
|
class WidgetTimetableService: RemoteViewsService() {
|
||||||
|
override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
|
||||||
|
return WidgetTimetableDataProvider(getApplicationContext(), intent)
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 772 B |
BIN
refilc/android/app/src/main/res/drawable-hdpi/splash.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
refilc/android/app/src/main/res/drawable-hdpi/tinta_image.png
Normal file
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 534 B |
BIN
refilc/android/app/src/main/res/drawable-mdpi/splash.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 18 KiB |
13
refilc/android/app/src/main/res/drawable-nodpi/ic_check.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M20,6l-11,11l-5,-5"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ff141516"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M15,18l-6,-6l6,-6"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ff141516"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M9,18l6,-6l-6,-6"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ff141516"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M12,2.69l5.66,5.66a8,8 0,1 1,-11.31 0z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ff141516"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M12,2l7,19l-7,-4l-7,4l7,-19z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ff141516"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
@ -0,0 +1,27 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M23,4l0,6l-6,0"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ff141516"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M1,20l0,-6l6,0"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ff141516"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M3.51,9a9,9 0,0 1,14.85 -3.36L23,10M1,14l4.64,4.36A9,9 0,0 0,20.49 15"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ff141516"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Background for widgets to make the rounded corners based on the
|
||||||
|
appWidgetRadius attribute value
|
||||||
|
-->
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<corners android:radius="?attr/appWidgetRadius" />
|
||||||
|
<solid android:color="?android:attr/colorBackground" />
|
||||||
|
</shape>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Background for views inside widgets to make the rounded corners based on the
|
||||||
|
appWidgetInnerRadius attribute value
|
||||||
|
-->
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<corners android:radius="?attr/appWidgetInnerRadius" />
|
||||||
|
<solid android:color="?android:attr/colorAccent" />
|
||||||
|
</shape>
|
BIN
refilc/android/app/src/main/res/drawable-v21/background.png
Normal file
After Width: | Height: | Size: 69 B |
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="fill" android:src="@drawable/background"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="center" android:src="@drawable/splash"/>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
After Width: | Height: | Size: 6.7 KiB |
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/highlight"/>
|
||||||
|
<stroke android:width="1dp" android:color="@color/highlight" />
|
||||||
|
<corners android:radius="10dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp"/>
|
||||||
|
</shape>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#00FFFFFF"/>
|
||||||
|
<corners android:radius="10dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp"/>
|
||||||
|
</shape>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/light_red"/>
|
||||||
|
<corners android:radius="10dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp"/>
|
||||||
|
</shape>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/light_yellow"/>
|
||||||
|
<corners android:radius="10dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp"/>
|
||||||
|
</shape>
|
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 1.1 KiB |
BIN
refilc/android/app/src/main/res/drawable-xhdpi/splash.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/highlight_light"/>
|
||||||
|
<stroke android:width="1dp" android:color="@color/highlight_light" />
|
||||||
|
<corners android:bottomLeftRadius="14dp" android:bottomRightRadius="14dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp"/>
|
||||||
|
</shape>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#00FFFFFF"/>
|
||||||
|
<stroke android:width="1dp" android:color="#00FFFFFF" />
|
||||||
|
<corners android:bottomLeftRadius="14dp" android:bottomRightRadius="14dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp"/>
|
||||||
|
</shape>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/highlight_light"/>
|
||||||
|
<stroke android:width="1dp" android:color="@color/highlight_light" />
|
||||||
|
<corners android:topLeftRadius="14dp" android:topRightRadius="14dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp"/>
|
||||||
|
</shape>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#00FFFFFF"/>
|
||||||
|
<stroke android:width="1dp" android:color="#00FFFFFF" />
|
||||||
|
<corners android:topLeftRadius="14dp" android:topRightRadius="14dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp"/>
|
||||||
|
</shape>
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<!--<gradient
|
||||||
|
android:angle="45"
|
||||||
|
android:endColor="@color/filc"
|
||||||
|
android:startColor="@color/filc" />-->
|
||||||
|
|
||||||
|
<solid android:color="@color/highlight_light"/>
|
||||||
|
|
||||||
|
<corners android:radius="12dp" />
|
||||||
|
<size android:width="2dp"/>
|
||||||
|
<padding
|
||||||
|
android:left="0.5dp"
|
||||||
|
android:right="0.5dp" />
|
||||||
|
|
||||||
|
</shape>
|
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 1.6 KiB |
BIN
refilc/android/app/src/main/res/drawable-xxhdpi/splash.png
Normal file
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 2.3 KiB |
BIN
refilc/android/app/src/main/res/drawable-xxxhdpi/splash.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
refilc/android/app/src/main/res/drawable/background.png
Normal file
After Width: | Height: | Size: 69 B |
18
refilc/android/app/src/main/res/drawable/btn_shape.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:state_pressed="true">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#ffE0CCEC"></solid>
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<gradient android:endColor="#ffE0CCEC" android:startColor="#ffC9ABDC" />
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</selector>
|
18
refilc/android/app/src/main/res/drawable/btn_shape_login.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:state_pressed="true">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/filc"></solid>
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<gradient android:endColor="@color/filc" android:startColor="@color/filc_gradient" />
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</selector>
|
BIN
refilc/android/app/src/main/res/drawable/ic_absences.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
refilc/android/app/src/main/res/drawable/ic_grades.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
refilc/android/app/src/main/res/drawable/ic_home.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
refilc/android/app/src/main/res/drawable/ic_messages.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
refilc/android/app/src/main/res/drawable/ic_notification.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
refilc/android/app/src/main/res/drawable/ic_timetable.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="fill" android:src="@drawable/background"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="center" android:src="@drawable/splash"/>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
BIN
refilc/android/app/src/main/res/font/montserrat_medium.ttf
Normal file
BIN
refilc/android/app/src/main/res/ic_launcher-web.png
Normal file
After Width: | Height: | Size: 13 KiB |
26
refilc/android/app/src/main/res/layout/home_widget_test.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@drawable/app_widget_background"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:id="@+id/widget_container">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="36sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="Title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_message"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="18sp"
|
||||||
|
tools:text="Message" />
|
||||||
|
</LinearLayout>
|
113
refilc/android/app/src/main/res/layout/timetable_item.xml
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/main_lay"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:paddingTop="0dp"
|
||||||
|
android:paddingBottom="0dp"
|
||||||
|
android:layout_marginTop="2.5dp"
|
||||||
|
android:layout_marginBottom="2.5dp"
|
||||||
|
android:layout_marginLeft="7.5dp"
|
||||||
|
android:layout_marginRight="7.5dp"
|
||||||
|
android:background="@drawable/card_layout_tile">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tt_item_num"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="1."
|
||||||
|
android:textColor="@color/filc"
|
||||||
|
android:textColorLink="#ff3D7BF4"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tt_item_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:textSize="15.5sp"
|
||||||
|
android:textFontWeight="700"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:layout_marginTop="2.5dp"
|
||||||
|
android:text="Óra neve"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:layout_toStartOf="@id/tt_item_room"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_toEndOf="@id/tt_item_num"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tt_item_name_nodesc"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textSize="15.5sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_marginTop="2.5dp"
|
||||||
|
android:layout_toStartOf="@id/tt_item_room"
|
||||||
|
android:text="Óra neve"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_toEndOf="@id/tt_item_num"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tt_item_desc"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textFontWeight="600"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:text="Óra leírása"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_toEndOf="@id/tt_item_num"
|
||||||
|
android:layout_toStartOf="@id/tt_item_room"
|
||||||
|
android:layout_below="@id/tt_item_name"
|
||||||
|
android:textColor="@color/text_desc"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tt_item_room"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textFontWeight="500"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="56."
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_toStartOf="@id/tt_item_time"
|
||||||
|
android:textColor="@color/text_desc"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tt_item_time"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textFontWeight="500"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:layout_marginTop="-2dp"
|
||||||
|
android:text="8:30\n9:10"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
154
refilc/android/app/src/main/res/layout/widget_timetable.xml
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_margin="@dimen/widget_margin">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/tt_grid_cont"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/card_layout_bg"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/empty_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Üres / Empty"
|
||||||
|
android:background="@drawable/widget_card_bottom_dark"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/widget_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@id/bottom_nav"
|
||||||
|
android:layout_marginTop="-8dp"
|
||||||
|
android:background="@drawable/widget_card_bottom_dark"
|
||||||
|
android:divider="#00000000"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:scrollbarFadeDuration="150"
|
||||||
|
android:scrollbarSize="10dp"
|
||||||
|
android:scrollbarThumbVertical="@drawable/widget_scroll_style" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/bottom_nav"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:background="@drawable/widget_card_top_dark">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/nav_refresh"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_toStartOf="@id/nav_to_left"
|
||||||
|
android:clickable="true"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/ic_refresh_cw"
|
||||||
|
android:tint="@color/text_desc"
|
||||||
|
tools:ignore="UseAppTint"
|
||||||
|
android:focusable="true" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/nav_to_left"
|
||||||
|
android:layout_width="45dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_toStartOf="@id/nav_to_right"
|
||||||
|
android:clickable="true"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/ic_chevron_left"
|
||||||
|
android:tint="@color/text_desc"
|
||||||
|
tools:ignore="UseAppTint"
|
||||||
|
android:focusable="true" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/nav_to_right"
|
||||||
|
android:layout_width="45dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/ic_chevron_right"
|
||||||
|
android:tint="@color/text_desc"
|
||||||
|
tools:ignore="UseAppTint"
|
||||||
|
android:focusable="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/nav_current"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_marginStart="15sp"
|
||||||
|
android:layout_marginTop="2sp"
|
||||||
|
android:layout_toStartOf="@id/nav_refresh"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="Órarend"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/need_login"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/card_layout_bg"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:paddingHorizontal="10dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:src="@drawable/tinta_image" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/iv_1"
|
||||||
|
android:layout_marginHorizontal="15dp"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:text="A widget használatához bejelentkezés szükséges."
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/open_login"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:background="@drawable/btn_shape_login"
|
||||||
|
android:text="Alkalmazás megnyitása"
|
||||||
|
android:padding="0dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:fontFamily="@font/montserrat_medium"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
|
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
|
||||||
|
</adaptive-icon>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
|
||||||
|
</adaptive-icon>
|
BIN
refilc/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 844 B |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 1.0 KiB |
BIN
refilc/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 450 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 576 B |
BIN
refilc/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
BIN
refilc/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 2.4 KiB |
BIN
refilc/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 4.1 KiB |