Compare commits

..

3 Commits

Author SHA1 Message Date
Kacper Ziubryniewicz
8f80bc70ed [Architecture] Implement dagger for homework 2019-11-04 22:13:07 +01:00
Kacper Ziubryniewicz
e1d902ceb5 [Architecture] Migrate homework to MVP 2019-11-04 20:19:50 +01:00
Kacper Ziubryniewicz
eb1984c6b5 [Architecture] Add base MVP classes 2019-11-04 20:18:42 +01:00
1677 changed files with 73076 additions and 89065 deletions

BIN
.github/apk-badge.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

View File

@ -1,2 +0,0 @@
.env
__pycache__/

View File

@ -1,57 +0,0 @@
import base64
import secrets
from hashlib import sha256
from typing import Tuple
import mysql.connector as mysql
from Crypto.Cipher import AES
def get_password(
version_name: str,
version_code: int,
db_host: str,
db_user: str,
db_pass: str,
db_name: str,
) -> Tuple[str, bytes]:
db = mysql.connect(
host=db_host,
user=db_user,
password=db_pass,
database=db_name,
auth_plugin="mysql_native_password",
)
print(f"Generating passwords for version {version_name} ({version_code})")
password = base64.b64encode(secrets.token_bytes(16)).decode()
iv = secrets.token_bytes(16)
key = f"{version_name}.{password}.{version_code}"
key = sha256(key.encode()).digest()
data = "ThisIsOurHardWorkPleaseDoNotCopyOrSteal(c)2019.KubaSz"
data = sha256(data.encode()).digest()
data = data + (chr(16) * 16).encode()
aes = AES.new(key=key, mode=AES.MODE_CBC, iv=iv)
app_password = base64.b64encode(aes.encrypt(data)).decode()
c = db.cursor()
c.execute(
"INSERT IGNORE INTO _appPasswords (versionCode, appPassword, password, iv) VALUES (%s, %s, %s, %s);",
(version_code, app_password, password, iv),
)
db.commit()
c = db.cursor()
c.execute(
"SELECT password, iv FROM _appPasswords WHERE versionCode = %s;",
(version_code,),
)
row = c.fetchone()
db.close()
return (row[0], row[1])

View File

@ -1,142 +0,0 @@
import re
import subprocess
import sys
from datetime import datetime
from typing import Tuple
VERSION_NAME_REGEX = r'versionName: "(.+?)"'
VERSION_CODE_REGEX = r"versionCode: ([0-9]+)"
VERSION_NAME_FORMAT = 'versionName: "{}"'
VERSION_CODE_FORMAT = "versionCode: {}"
def get_project_dir() -> str:
project_dir = sys.argv[1]
if project_dir[-1:] == "/" or project_dir[-1:] == "\\":
project_dir = project_dir[:-1]
return project_dir
def read_gradle_version(project_dir: str) -> Tuple[int, str]:
GRADLE_PATH = f"{project_dir}/build.gradle"
with open(GRADLE_PATH, "r") as f:
gradle = f.read()
version_name = re.search(VERSION_NAME_REGEX, gradle).group(1)
version_code = int(re.search(VERSION_CODE_REGEX, gradle).group(1))
return (version_code, version_name)
def write_gradle_version(project_dir: str, version_code: int, version_name: str):
GRADLE_PATH = f"{project_dir}/build.gradle"
with open(GRADLE_PATH, "r") as f:
gradle = f.read()
gradle = re.sub(
VERSION_NAME_REGEX, VERSION_NAME_FORMAT.format(version_name), gradle
)
gradle = re.sub(
VERSION_CODE_REGEX, VERSION_CODE_FORMAT.format(version_code), gradle
)
with open(GRADLE_PATH, "w") as f:
f.write(gradle)
def build_version_code(version_name: str) -> int:
version = version_name.split("+")[0].split("-")
version_base = version[0]
version_suffix = version[1] if len(version) == 2 else ""
base_parts = version_base.split(".")
major = int(base_parts[0]) or 0
minor = int(base_parts[1]) if len(base_parts) > 1 else 0
patch = int(base_parts[2]) if len(base_parts) > 2 else 0
beta = 9
rc = 9
if "dev" in version_suffix:
beta = 0
rc = 0
elif "beta." in version_suffix:
beta = int(version_suffix.split(".")[1])
rc = 0
elif "rc." in version_suffix:
beta = 0
rc = int(version_suffix.split(".")[1])
version_code = beta + rc * 10 + patch * 100 + minor * 10000 + major * 1000000
return version_code
def get_changelog(project_dir: str, format: str) -> Tuple[str, str]:
with open(
f"{project_dir}/app/src/main/assets/pl-changelog.html", "r", encoding="utf-8"
) as f:
changelog = f.read()
title = re.search(r"<h3>(.+?)</h3>", changelog).group(1)
content = re.search(r"(?s)<ul>(.+)</ul>", changelog).group(1).strip()
content = "\n".join(line.strip() for line in content.split("\n"))
if format != "html":
content = content.replace("<li>", "- ")
content = content.replace("<br>", "\n")
if format == "markdown":
content = re.sub(r"<u>(.+?)</u>", "__\\1__", content)
content = re.sub(r"<i>(.+?)</i>", "*\\1*", content)
content = re.sub(r"<b>(.+?)</b>", "**\\1**", content)
content = re.sub(r"</?.+?>", "", content)
return (title, content)
def get_commit_log(project_dir: str, format: str, max_lines: int = None) -> str:
last_tag = (
subprocess.check_output("git describe --tags --abbrev=0".split(" "))
.decode()
.strip()
)
log = subprocess.run(
args=f"git log {last_tag}..HEAD --format=%an%x00%at%x00%h%x00%s%x00%D".split(" "),
cwd=project_dir,
stdout=subprocess.PIPE,
)
log = log.stdout.strip().decode()
commits = [line.split("\x00") for line in log.split("\n")]
if max_lines:
commits = commits[:max_lines]
output = []
valid = False
for commit in commits:
if not commit[0]:
continue
if "origin/" in commit[4]:
valid = True
if not valid:
continue
date = datetime.fromtimestamp(float(commit[1]))
date = date.strftime("%Y-%m-%d %H:%M:%S")
if format == "html":
output.append(f"<li>{commit[3]} <i> - {commit[0]}</i></li>")
elif format == "markdown":
output.append(f"[{date}] {commit[0]}\n {commit[3]}")
elif format == "markdown_full":
output.append(
f"_[{date}] {commit[0]}_\n` `__`{commit[2]}`__ **{commit[3]}**"
)
elif format == "plain":
output.append(f"- {commit[3]}")
if format == "markdown":
output.insert(0, "```")
output.append("```")
return "\n".join(output)

View File

@ -1,69 +0,0 @@
import json
import os
import re
import sys
from datetime import datetime, timedelta
import requests
from _utils import (
get_commit_log,
get_project_dir,
read_gradle_version,
write_gradle_version,
)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("usage: bump_nightly.py <project dir>")
exit(-1)
repo = os.getenv("GITHUB_REPOSITORY")
sha = os.getenv("GITHUB_SHA")
if not repo or not sha:
print("Missing GitHub environment variables.")
exit(-1)
with requests.get(
f"https://api.github.com/repos/{repo}/actions/runs?per_page=5&status=success"
) as r:
data = json.loads(r.text)
runs = [run for run in data["workflow_runs"] if run["head_sha"] == sha]
if runs:
print("::set-output name=hasNewChanges::false")
exit(0)
print("::set-output name=hasNewChanges::true")
project_dir = get_project_dir()
(version_code, version_name) = read_gradle_version(project_dir)
version_name = version_name.split("+")[0]
date = datetime.now()
if date.hour > 6:
version_name += "+daily." + date.strftime("%Y%m%d-%H%M")
else:
date -= timedelta(days=1)
version_name += "+nightly." + date.strftime("%Y%m%d")
print("::set-output name=appVersionName::" + version_name)
print("::set-output name=appVersionCode::" + str(version_code))
write_gradle_version(project_dir, version_code, version_name)
commit_log = get_commit_log(project_dir, format="html", max_lines=10)
with open(
f"{project_dir}/app/src/main/assets/pl-changelog.html", "r", encoding="utf-8"
) as f:
changelog = f.read()
changelog = re.sub(r"<h3>(.+?)</h3>", f"<h3>{version_name}</h3>", changelog)
changelog = re.sub(r"(?s)<ul>(.+)</ul>", f"<ul>\n{commit_log}\n</ul>", changelog)
with open(
f"{project_dir}/app/src/main/assets/pl-changelog.html", "w", encoding="utf-8"
) as f:
f.write(changelog)

View File

@ -1,41 +0,0 @@
import os
from dotenv import load_dotenv
from _get_password import get_password
from _utils import build_version_code, write_gradle_version
from sign import sign
if __name__ == "__main__":
version_name = input("Enter version name: ")
version_code = build_version_code(version_name)
print(f"Bumping version to {version_name} ({version_code})")
project_dir = "../.."
load_dotenv()
DB_HOST = os.getenv("DB_HOST")
DB_USER = os.getenv("DB_USER")
DB_PASS = os.getenv("DB_PASS")
DB_NAME = os.getenv("DB_NAME")
write_gradle_version(project_dir, version_code, version_name)
(password, iv) = get_password(
version_name, version_code, DB_HOST, DB_USER, DB_PASS, DB_NAME
)
sign(project_dir, version_name, version_code, password, iv, commit=False)
print("Writing mock passwords")
os.chdir(project_dir)
os.system(
"sed -i -E 's/\/\*([0-9a-f]{2} ?){16}\*\//\/*secret password - removed for source code publication*\//g' app/src/main/cpp/szkolny-signing.cpp"
)
os.system(
"sed -i -E 's/\\t0x.., 0x(.)., 0x.(.), 0x.(.), 0x.., 0x.., 0x.., 0x.(.), 0x.., 0x.(.), 0x(.)., 0x(.)., 0x.., 0x.., 0x.., 0x.(.)/\\t0x\\3\\6, 0x\\7\\4, 0x\\1\\8, 0x\\2\\5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff /g' app/src/main/cpp/szkolny-signing.cpp"
)
os.system(
"sed -i -E 's/param1\..(.).(.).(.).(.)..(.)..(.)..(.)..(.).../param1.MTIzNDU2Nzg5MD\\5\\2\\7\\6\\1\\3\\4\8==/g' app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt"
)
input("Press any key to finish")

View File

@ -1,72 +0,0 @@
import os
import sys
from _utils import get_changelog, get_commit_log, get_project_dir, read_gradle_version
if __name__ == "__main__":
if len(sys.argv) < 2:
print("usage: extract_changelogs.py <project dir>")
exit(-1)
project_dir = get_project_dir()
(version_code, version_name) = read_gradle_version(project_dir)
print("::set-output name=appVersionName::" + version_name)
print("::set-output name=appVersionCode::" + str(version_code))
dir = f"{project_dir}/app/release/whatsnew-{version_name}/"
os.makedirs(dir, exist_ok=True)
print("::set-output name=changelogDir::" + dir)
(title, changelog) = get_changelog(project_dir, format="plain")
# plain text changelog - Firebase App Distribution
with open(dir + "whatsnew_titled.txt", "w", encoding="utf-8") as f:
f.write(title)
f.write("\n")
f.write(changelog)
print("::set-output name=changelogPlainTitledFile::" + dir + "whatsnew_titled.txt")
print("::set-output name=changelogTitle::" + title)
# plain text changelog, max 500 chars - Google Play
with open(dir + "whatsnew-pl-PL", "w", encoding="utf-8") as f:
changelog_lines = changelog.split("\n")
changelog = ""
for line in changelog_lines:
if len(changelog) + len(line) < 500:
changelog += "\n" + line
changelog = changelog.strip()
f.write(changelog)
print("::set-output name=changelogPlainFile::" + dir + "whatsnew-pl-PL")
# markdown changelog - Discord webhook
(_, changelog) = get_changelog(project_dir, format="markdown")
with open(dir + "whatsnew.md", "w", encoding="utf-8") as f:
f.write(changelog)
print("::set-output name=changelogMarkdownFile::" + dir + "whatsnew.md")
# html changelog - version info in DB
(_, changelog) = get_changelog(project_dir, format="html")
with open(dir + "whatsnew.html", "w", encoding="utf-8") as f:
f.write(changelog)
print("::set-output name=changelogHtmlFile::" + dir + "whatsnew.html")
changelog = get_commit_log(project_dir, format="plain", max_lines=10)
with open(dir + "commit_log.txt", "w", encoding="utf-8") as f:
f.write(changelog)
print("::set-output name=commitLogPlainFile::" + dir + "commit_log.txt")
changelog = get_commit_log(project_dir, format="markdown", max_lines=10)
with open(dir + "commit_log.md", "w", encoding="utf-8") as f:
f.write(changelog)
print("::set-output name=commitLogMarkdownFile::" + dir + "commit_log.md")
changelog = get_commit_log(project_dir, format="html", max_lines=10)
with open(dir + "commit_log.html", "w", encoding="utf-8") as f:
f.write(changelog)
print("::set-output name=commitLogHtmlFile::" + dir + "commit_log.html")

View File

@ -1,26 +0,0 @@
import glob
import os
import sys
from _utils import get_project_dir
if __name__ == "__main__":
if len(sys.argv) < 2:
print("usage: rename_artifacts.py <project dir>")
exit(-1)
project_dir = get_project_dir()
files = glob.glob(f"{project_dir}/app/release/*.*")
for file in files:
file_relative = file.replace(os.getenv("GITHUB_WORKSPACE") + "/", "")
if "-aligned.apk" in file:
os.unlink(file)
elif "-signed.apk" in file:
new_file = file.replace("-signed.apk", ".apk")
if os.path.isfile(new_file):
os.unlink(new_file)
os.rename(file, new_file)
elif ".apk" in file or ".aab" in file:
print("::set-output name=signedReleaseFile::" + file)
print("::set-output name=signedReleaseFileRelative::" + file_relative)

View File

@ -1,122 +0,0 @@
import glob
import os
import sys
from datetime import datetime
from time import time
import mysql.connector as mysql
from dotenv import load_dotenv
from _utils import get_changelog, get_commit_log, get_project_dir, read_gradle_version
def save_version(
project_dir: str,
db_host: str,
db_user: str,
db_pass: str,
db_name: str,
apk_server_release: str,
apk_server_nightly: str,
):
db = mysql.connect(
host=db_host,
user=db_user,
password=db_pass,
database=db_name,
auth_plugin="mysql_native_password",
)
(version_code, version_name) = read_gradle_version(project_dir)
(_, changelog) = get_changelog(project_dir, format="html")
types = ["dev", "beta", "nightly", "daily", "rc", "release"]
build_type = [x for x in types if x in version_name]
build_type = build_type[0] if build_type else "release"
if "+nightly." in version_name or "+daily." in version_name:
changelog = get_commit_log(project_dir, format="html")
build_type = "nightly"
elif "-dev" in version_name:
build_type = "dev"
elif "-beta." in version_name:
build_type = "beta"
elif "-rc." in version_name:
build_type = "rc"
build_date = int(time())
apk_name = None
bundle_name_play = None
files = glob.glob(f"{project_dir}/app/release/*.*")
output_apk = f"Edziennik_{version_name}_official.apk"
output_aab_play = f"Edziennik_{version_name}_play.aab"
for file in files:
if output_apk in file:
build_date = int(os.stat(file).st_mtime)
apk_name = output_apk
if output_aab_play in file:
build_date = int(os.stat(file).st_mtime)
bundle_name_play = output_aab_play
build_date = datetime.fromtimestamp(build_date).strftime("%Y-%m-%d %H:%M:%S")
if build_type in ["nightly", "daily"]:
download_url = apk_server_nightly + apk_name if apk_name else None
else:
download_url = apk_server_release + apk_name if apk_name else None
cols = [
"versionCode",
"versionName",
"releaseDate",
"releaseNotes",
"releaseType",
"downloadUrl",
"apkName",
"bundleNamePlay",
]
updated = {
"versionCode": version_code,
"downloadUrl": download_url,
"apkName": apk_name,
"bundleNamePlay": bundle_name_play,
}
values = [
version_code,
version_name,
build_date,
changelog,
build_type,
download_url,
apk_name,
bundle_name_play,
]
values.extend(val for val in updated.values() if val)
updated = ", ".join(f"{col} = %s" for (col, val) in updated.items() if val)
sql = f"INSERT INTO updates ({', '.join(cols)}) VALUES ({'%s, ' * (len(cols) - 1)}%s) ON DUPLICATE KEY UPDATE {updated};"
c = db.cursor()
c.execute(sql, tuple(values))
db.commit()
if __name__ == "__main__":
if len(sys.argv) < 2:
print("usage: save_version.py <project dir>")
exit(-1)
project_dir = get_project_dir()
load_dotenv()
DB_HOST = os.getenv("DB_HOST")
DB_USER = os.getenv("DB_USER")
DB_PASS = os.getenv("DB_PASS")
DB_NAME = os.getenv("DB_NAME")
APK_SERVER_RELEASE = os.getenv("APK_SERVER_RELEASE")
APK_SERVER_NIGHTLY = os.getenv("APK_SERVER_NIGHTLY")
save_version(project_dir, DB_HOST, DB_USER, DB_PASS, DB_NAME, APK_SERVER_RELEASE, APK_SERVER_NIGHTLY)

84
.github/utils/sign.py vendored
View File

@ -1,84 +0,0 @@
import os
import re
import sys
from dotenv import load_dotenv
from _get_password import get_password
from _utils import get_project_dir, read_gradle_version
def sign(
project_dir: str,
version_name: str,
version_code: int,
password: str,
iv: bytes,
commit: bool = False,
):
SIGNING_PATH = f"{project_dir}/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt"
CPP_PATH = f"{project_dir}/app/src/main/cpp/szkolny-signing.cpp"
with open(SIGNING_PATH, "r") as f:
signing = f.read()
with open(CPP_PATH, "r") as f:
cpp = f.read()
SIGNING_REGEX = r"\$param1\..*\.\$param2"
CPP_REGEX = r"(?s)/\*.+?toys AES_IV\[16\] = {.+?};"
SIGNING_FORMAT = "$param1.{}.$param2"
CPP_FORMAT = "/*{}*/\nstatic toys AES_IV[16] = {{\n\t{} }};"
print(f"Writing passwords for version {version_name} ({version_code})")
iv_hex = " ".join(["{:02x}".format(x) for x in iv])
iv_cpp = ", ".join(["0x{:02x}".format(x) for x in iv])
signing = re.sub(SIGNING_REGEX, SIGNING_FORMAT.format(password), signing)
cpp = re.sub(CPP_REGEX, CPP_FORMAT.format(iv_hex, iv_cpp), cpp)
with open(SIGNING_PATH, "w") as f:
f.write(signing)
with open(CPP_PATH, "w") as f:
f.write(cpp)
if commit:
os.chdir(project_dir)
os.system("git add .")
os.system(
f'git commit -m "[{version_name}] Update build.gradle, signing and changelog."'
)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("usage: sign.py <project dir> [commit]")
exit(-1)
project_dir = get_project_dir()
load_dotenv()
DB_HOST = os.getenv("DB_HOST")
DB_USER = os.getenv("DB_USER")
DB_PASS = os.getenv("DB_PASS")
DB_NAME = os.getenv("DB_NAME")
(version_code, version_name) = read_gradle_version(project_dir)
(password, iv) = get_password(
version_name, version_code, DB_HOST, DB_USER, DB_PASS, DB_NAME
)
print("::set-output name=appVersionName::" + version_name)
print("::set-output name=appVersionCode::" + str(version_code))
sign(
project_dir,
version_name,
version_code,
password,
iv,
commit="commit" in sys.argv,
)

View File

@ -1,118 +0,0 @@
import os
import sys
from datetime import datetime
import requests
from dotenv import load_dotenv
from _utils import get_changelog, get_commit_log, get_project_dir, read_gradle_version
def post_webhook(
project_dir: str,
apk_file: str,
apk_server_release: str,
apk_server_nightly: str,
webhook_release: str,
webhook_testing: str,
):
(_, version_name) = read_gradle_version(project_dir)
types = ["dev", "beta", "nightly", "daily", "rc", "release"]
build_type = [x for x in types if x in version_name]
build_type = build_type[0] if build_type else None
testing = ["dev", "beta", "nightly", "daily"]
testing = build_type in testing
apk_name = os.path.basename(apk_file)
if build_type in ["nightly", "daily"]:
download_url = apk_server_nightly + apk_name
else:
download_url = apk_server_release + apk_name
if testing:
build_date = int(os.stat(apk_file).st_mtime)
if build_date:
build_date = datetime.fromtimestamp(build_date).strftime("%Y-%m-%d %H:%M")
# untagged release, get commit log
if build_type in ["nightly", "daily"]:
changelog = get_commit_log(project_dir, format="markdown", max_lines=5)
else:
changelog = get_changelog(project_dir, format="markdown")
webhook = get_webhook_testing(
version_name, build_type, changelog, download_url, build_date
)
requests.post(url=webhook_testing, json=webhook)
else:
changelog = get_changelog(project_dir, format="markdown")
webhook = get_webhook_release(changelog, download_url)
requests.post(url=webhook_release, json=webhook)
def get_webhook_release(changelog: str, download_url: str):
(title, content) = changelog
return {"content": f"__**{title}**__\n{content}\n{download_url}"}
def get_webhook_testing(
version_name: str,
build_type: str,
changelog: str,
download_url: str,
build_date: str,
):
return {
"embeds": [
{
"title": f"Nowa wersja {build_type} aplikacji Szkolny.eu",
"description": f"Dostępna jest nowa wersja testowa **{build_type}**.",
"color": 2201331,
"fields": [
{
"name": f"Wersja `{version_name}`",
"value": f"[Pobierz .APK]({download_url})"
if download_url
else "*Pobieranie niedostępne*",
"inline": False,
},
{
"name": "Data kompilacji",
"value": build_date or "-",
"inline": False,
},
{
"name": "Ostatnie zmiany",
"value": changelog or "-",
"inline": False,
},
],
}
]
}
if __name__ == "__main__":
if len(sys.argv) < 2:
print("usage: webhook_discord.py <project dir>")
exit(-1)
project_dir = get_project_dir()
load_dotenv()
APK_FILE = os.getenv("APK_FILE")
APK_SERVER_RELEASE = os.getenv("APK_SERVER_RELEASE")
APK_SERVER_NIGHTLY = os.getenv("APK_SERVER_NIGHTLY")
WEBHOOK_RELEASE = os.getenv("WEBHOOK_RELEASE")
WEBHOOK_TESTING = os.getenv("WEBHOOK_TESTING")
post_webhook(
project_dir,
APK_FILE,
APK_SERVER_RELEASE,
APK_SERVER_NIGHTLY,
WEBHOOK_RELEASE,
WEBHOOK_TESTING,
)

View File

@ -1,154 +0,0 @@
name: Nightly build
on:
schedule:
# 23:30 UTC, 0:30 or 1:30 CET/CEST
- cron: "30 23 * * *"
workflow_dispatch:
jobs:
prepare:
name: Prepare build environment
runs-on: self-hosted
outputs:
hasNewChanges: ${{ steps.nightly.outputs.hasNewChanges }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
clean: false
- name: Set executable permissions to gradlew
run: chmod +x ./gradlew
- name: Setup Python
uses: actions/setup-python@v2
- name: Install packages
uses: BSFishy/pip-action@v1
with:
packages: |
python-dotenv
pycryptodome
mysql-connector-python
requests
- name: Bump nightly version
id: nightly
run: python $GITHUB_WORKSPACE/.github/utils/bump_nightly.py $GITHUB_WORKSPACE
- name: Write signing passwords
if: steps.nightly.outputs.hasNewChanges
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
run: python $GITHUB_WORKSPACE/.github/utils/sign.py $GITHUB_WORKSPACE commit
build:
name: Build APK
runs-on: self-hosted
needs:
- prepare
if: ${{ needs.prepare.outputs.hasNewChanges == 'true' }}
outputs:
androidHome: ${{ env.ANDROID_HOME }}
androidSdkRoot: ${{ env.ANDROID_SDK_ROOT }}
steps:
- name: Setup JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Clean build artifacts
run: |
rm -rf app/release/*
rm -rf app/build/outputs/apk/*
rm -rf app/build/outputs/bundle/*
- name: Assemble official release with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: assembleOfficialRelease
sign:
name: Sign APK
runs-on: self-hosted
needs:
- build
outputs:
signedReleaseFile: ${{ steps.artifacts.outputs.signedReleaseFile }}
signedReleaseFileRelative: ${{ steps.artifacts.outputs.signedReleaseFileRelative }}
steps:
- name: Sign build artifacts
id: sign_app
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/release
signingKeyBase64: ${{ secrets.KEY_STORE }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_ALIAS_PASSWORD }}
env:
ANDROID_HOME: ${{ needs.build.outputs.androidHome }}
ANDROID_SDK_ROOT: ${{ needs.build.outputs.androidSdkRoot }}
BUILD_TOOLS_VERSION: "30.0.2"
- name: Rename signed artifacts
id: artifacts
run: python $GITHUB_WORKSPACE/.github/utils/rename_artifacts.py $GITHUB_WORKSPACE
publish:
name: Publish APK
runs-on: self-hosted
needs:
- sign
steps:
- name: Setup Python
uses: actions/setup-python@v2
- name: Extract changelogs
id: changelog
run: python $GITHUB_WORKSPACE/.github/utils/extract_changelogs.py $GITHUB_WORKSPACE
- name: Upload APK to SFTP
uses: easingthemes/ssh-deploy@v2.1.6
env:
REMOTE_HOST: ${{ secrets.SSH_IP }}
REMOTE_USER: ${{ secrets.SSH_USERNAME }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
SOURCE: ${{ needs.sign.outputs.signedReleaseFileRelative }}
TARGET: ${{ secrets.SSH_PATH_NIGHTLY }}
- name: Save version metadata
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
APK_SERVER_RELEASE: ${{ secrets.APK_SERVER_RELEASE }}
APK_SERVER_NIGHTLY: ${{ secrets.APK_SERVER_NIGHTLY }}
run: python $GITHUB_WORKSPACE/.github/utils/save_version.py $GITHUB_WORKSPACE
- name: Distribute to App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{ secrets.FIREBASE_APP_ID }}
token: ${{ secrets.FIREBASE_TOKEN }}
groups: ${{ secrets.FIREBASE_GROUPS_NIGHTLY }}
file: ${{ needs.sign.outputs.signedReleaseFile }}
releaseNotesFile: ${{ steps.changelog.outputs.commitLogPlainFile }}
- name: Post Discord webhook
env:
APK_FILE: ${{ needs.sign.outputs.signedReleaseFile }}
APK_SERVER_RELEASE: ${{ secrets.APK_SERVER_RELEASE }}
APK_SERVER_NIGHTLY: ${{ secrets.APK_SERVER_NIGHTLY }}
WEBHOOK_RELEASE: ${{ secrets.WEBHOOK_RELEASE }}
WEBHOOK_TESTING: ${{ secrets.WEBHOOK_TESTING }}
run: python $GITHUB_WORKSPACE/.github/utils/webhook_discord.py $GITHUB_WORKSPACE
- name: Upload workflow artifact
uses: actions/upload-artifact@v2
if: true
with:
name: ${{ steps.changelog.outputs.appVersionName }}
path: |
app/release/whatsnew*/
app/release/*.apk
app/release/*.aab
app/release/*.json
app/release/*.txt

View File

@ -1,132 +0,0 @@
name: Release build - Google Play [AAB]
on:
push:
branches:
- "master"
jobs:
prepare:
name: Prepare build environment
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
clean: false
- name: Set executable permissions to gradlew
run: chmod +x ./gradlew
- name: Setup Python
uses: actions/setup-python@v2
- name: Install packages
uses: BSFishy/pip-action@v1
with:
packages: |
python-dotenv
pycryptodome
mysql-connector-python
requests
- name: Write signing passwords
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
run: python $GITHUB_WORKSPACE/.github/utils/sign.py $GITHUB_WORKSPACE commit
build:
name: Build App Bundle
runs-on: self-hosted
needs:
- prepare
outputs:
androidHome: ${{ env.ANDROID_HOME }}
androidSdkRoot: ${{ env.ANDROID_SDK_ROOT }}
steps:
- name: Setup JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Clean build artifacts
run: |
rm -rf app/release/*
rm -rf app/build/outputs/apk/*
rm -rf app/build/outputs/bundle/*
- name: Bundle play release with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: bundlePlayRelease
sign:
name: Sign App Bundle
runs-on: self-hosted
needs:
- build
outputs:
signedReleaseFile: ${{ steps.artifacts.outputs.signedReleaseFile }}
signedReleaseFileRelative: ${{ steps.artifacts.outputs.signedReleaseFileRelative }}
steps:
- name: Sign build artifacts
id: sign_app
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/release
signingKeyBase64: ${{ secrets.KEY_STORE }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_ALIAS_PASSWORD }}
env:
ANDROID_HOME: ${{ needs.build.outputs.androidHome }}
ANDROID_SDK_ROOT: ${{ needs.build.outputs.androidSdkRoot }}
BUILD_TOOLS_VERSION: "30.0.2"
- name: Rename signed artifacts
id: artifacts
run: python $GITHUB_WORKSPACE/.github/utils/rename_artifacts.py $GITHUB_WORKSPACE
publish:
name: Publish App Bundle
runs-on: self-hosted
needs:
- sign
steps:
- name: Setup Python
uses: actions/setup-python@v2
- name: Extract changelogs
id: changelog
run: python $GITHUB_WORKSPACE/.github/utils/extract_changelogs.py $GITHUB_WORKSPACE
- name: Save version metadata
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
APK_SERVER_RELEASE: ${{ secrets.APK_SERVER_RELEASE }}
APK_SERVER_NIGHTLY: ${{ secrets.APK_SERVER_NIGHTLY }}
run: python $GITHUB_WORKSPACE/.github/utils/save_version.py $GITHUB_WORKSPACE
- name: Publish AAB to Google Play
uses: r0adkll/upload-google-play@v1
if: ${{ endsWith(needs.sign.outputs.signedReleaseFile, '.aab') }}
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
packageName: pl.szczodrzynski.edziennik
releaseFiles: ${{ needs.sign.outputs.signedReleaseFile }}
releaseName: ${{ steps.changelog.outputs.appVersionName }}
track: ${{ secrets.PLAY_RELEASE_TRACK }}
whatsNewDirectory: ${{ steps.changelog.outputs.changelogDir }}
status: completed
- name: Upload workflow artifact
uses: actions/upload-artifact@v2
if: always()
with:
name: ${{ steps.changelog.outputs.appVersionName }}
path: |
app/release/whatsnew*/
app/release/*.apk
app/release/*.aab
app/release/*.json
app/release/*.txt

View File

@ -1,154 +0,0 @@
name: Release build - official
on:
push:
tags:
- "*"
jobs:
prepare:
name: Prepare build environment
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
clean: false
- name: Set executable permissions to gradlew
run: chmod +x ./gradlew
- name: Setup Python
uses: actions/setup-python@v2
- name: Install packages
uses: BSFishy/pip-action@v1
with:
packages: |
python-dotenv
pycryptodome
mysql-connector-python
requests
- name: Write signing passwords
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
run: python $GITHUB_WORKSPACE/.github/utils/sign.py $GITHUB_WORKSPACE commit
build:
name: Build APK
runs-on: self-hosted
needs:
- prepare
outputs:
androidHome: ${{ env.ANDROID_HOME }}
androidSdkRoot: ${{ env.ANDROID_SDK_ROOT }}
steps:
- name: Setup JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Clean build artifacts
run: |
rm -rf app/release/*
rm -rf app/build/outputs/apk/*
rm -rf app/build/outputs/bundle/*
- name: Assemble official release with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: assembleOfficialRelease
sign:
name: Sign APK
runs-on: self-hosted
needs:
- build
outputs:
signedReleaseFile: ${{ steps.artifacts.outputs.signedReleaseFile }}
signedReleaseFileRelative: ${{ steps.artifacts.outputs.signedReleaseFileRelative }}
steps:
- name: Sign build artifacts
id: sign_app
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/release
signingKeyBase64: ${{ secrets.KEY_STORE }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_ALIAS_PASSWORD }}
env:
ANDROID_HOME: ${{ needs.build.outputs.androidHome }}
ANDROID_SDK_ROOT: ${{ needs.build.outputs.androidSdkRoot }}
BUILD_TOOLS_VERSION: "30.0.2"
- name: Rename signed artifacts
id: artifacts
run: python $GITHUB_WORKSPACE/.github/utils/rename_artifacts.py $GITHUB_WORKSPACE
publish:
name: Publish APK
runs-on: self-hosted
needs:
- sign
steps:
- name: Setup Python
uses: actions/setup-python@v2
- name: Extract changelogs
id: changelog
run: python $GITHUB_WORKSPACE/.github/utils/extract_changelogs.py $GITHUB_WORKSPACE
- name: Upload APK to SFTP
uses: easingthemes/ssh-deploy@v2.1.6
env:
REMOTE_HOST: ${{ secrets.SSH_IP }}
REMOTE_USER: ${{ secrets.SSH_USERNAME }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
SOURCE: ${{ needs.sign.outputs.signedReleaseFileRelative }}
TARGET: ${{ secrets.SSH_PATH_RELEASE }}
- name: Save version metadata
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
APK_SERVER_RELEASE: ${{ secrets.APK_SERVER_RELEASE }}
APK_SERVER_NIGHTLY: ${{ secrets.APK_SERVER_NIGHTLY }}
run: python $GITHUB_WORKSPACE/.github/utils/save_version.py $GITHUB_WORKSPACE
- name: Distribute to App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{ secrets.FIREBASE_APP_ID }}
token: ${{ secrets.FIREBASE_TOKEN }}
groups: ${{ secrets.FIREBASE_GROUPS_RELEASE }}
file: ${{ needs.sign.outputs.signedReleaseFile }}
releaseNotesFile: ${{ steps.changelog.outputs.changelogPlainTitledFile }}
- name: Release on GitHub
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.changelog.outputs.changelogTitle }}
body_path: ${{ steps.changelog.outputs.changelogMarkdownFile }}
files: ${{ needs.sign.outputs.signedReleaseFile }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Post Discord webhook
env:
APK_FILE: ${{ needs.sign.outputs.signedReleaseFile }}
APK_SERVER_RELEASE: ${{ secrets.APK_SERVER_RELEASE }}
APK_SERVER_NIGHTLY: ${{ secrets.APK_SERVER_NIGHTLY }}
WEBHOOK_RELEASE: ${{ secrets.WEBHOOK_RELEASE }}
WEBHOOK_TESTING: ${{ secrets.WEBHOOK_TESTING }}
run: python $GITHUB_WORKSPACE/.github/utils/webhook_discord.py $GITHUB_WORKSPACE
- name: Upload workflow artifact
uses: actions/upload-artifact@v2
if: true
with:
name: ${{ steps.changelog.outputs.appVersionName }}
path: |
app/release/whatsnew*/
app/release/*.apk
app/release/*.aab
app/release/*.json
app/release/*.txt

193
.gitignore vendored
View File

@ -1,11 +1,5 @@
# Created by https://www.toptal.com/developers/gitignore/api/android,androidstudio,gradle,java,kotlin
# Edit at https://www.toptal.com/developers/gitignore?templates=android,androidstudio,gradle,java,kotlin
### Android ###
# Built application files
*.apk
*.aar
*.ap_
*.aab
@ -46,22 +40,22 @@ captures/
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
#.idea/dictionaries
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml
.idea/copyright/profiles_settings.xml
# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore
*.jks
*.keystore
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/
# Google Services (e.g. APIs or Firebase)
# google-services.json
@ -87,182 +81,3 @@ lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
### Android Patch ###
gen-external-apklibs
output-metadata.json
# Replacement of .externalNativeBuild directories introduced
# with Android Studio 3.5.
### Java ###
# Compiled class file
# Log file
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
!/*/libs/*.jar
### Kotlin ###
# Compiled class file
# Log file
# BlueJ files
# Mobile Tools for Java (J2ME)
# Package Files #
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
### Gradle ###
.gradle
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
### Gradle Patch ###
**/build/
### AndroidStudio ###
# Covers files to be ignored for android development using Android Studio.
# Built application files
# Files for the ART/Dalvik VM
# Java class files
# Generated files
# Gradle files
# Signing files
.signing/
# Local configuration file (sdk path, etc)
# Proguard folder generated by Eclipse
# Log Files
# Android Studio
/*/build/
/*/local.properties
/*/out
/*/*/build
/*/*/production
*.ipr
*~
*.swp
# Keystore files
*.jks
*.keystore
# Google Services (e.g. APIs or Firebase)
# google-services.json
# Android Patch
# External native build folder generated in Android Studio 2.2 and later
# NDK
obj/
# IntelliJ IDEA
*.iws
/out/
# User-specific configurations
.idea/caches/
.idea/libraries/
.idea/shelf/
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/datasources.xml
.idea/dataSources.ids
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
.idea/jarRepositories.xml
# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Legacy Eclipse project files
.classpath
.project
.cproject
.settings/
# Mobile Tools for Java (J2ME)
# Package Files #
# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
## Plugin-specific files:
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Mongo Explorer plugin
.idea/mongoSettings.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### AndroidStudio Patch ###
!/gradle/wrapper/gradle-wrapper.jar
# End of https://www.toptal.com/developers/gitignore/api/android,androidstudio,gradle,java,kotlin
signatures/
.idea/*.xml

View File

@ -1,19 +1,6 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
<option name="ALLOW_TRAILING_COMMA" value="true" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
@ -125,8 +112,5 @@
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -1,6 +0,0 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright (c) Antoni Czaplicki &amp;#36;{today.year}-&amp;#36;{today.month}-&amp;#36;{today.day}. " />
<option name="myName" value="Antoni" />
</copyright>
</component>

View File

@ -1,20 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="Kuba">
<words>
<w>autoryzacji</w>
<w>ciasteczko</w>
<w>csrf</w>
<w>edziennik</w>
<w>eggfall</w>
<w>elearning</w>
<w>gson</w>
<w>hebe</w>
<w>idziennik</w>
<w>kuba</w>
<w>synergia</w>
<w>szczodrzyński</w>
<w>szkolny</w>
<w>usos</w>
</words>
</dictionary>
</component>

9
.idea/discord.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="true" />
</component>
<component name="ProjectNotificationSettings">
<option name="askShowProject" value="false" />
</component>
</project>

4
.idea/encodings.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

6
.idea/kotlinc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Kotlin2JvmCompilerArguments">
<option name="jvmTarget" value="1.8" />
</component>
</project>

58
.idea/misc.xml Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.greenrobot.eventbus.Subscribe" />
</list>
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
<option name="myDefaultNotNull" value="androidx.annotation.RecentlyNonNull" />
<option name="myNullables">
<value>
<list size="12">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="10" class="java.lang.String" itemvalue="android.annotation.Nullable" />
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="11">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="9" class="java.lang.String" itemvalue="android.annotation.NonNull" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

621
LICENSE
View File

@ -1,621 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS

View File

@ -1,85 +1 @@
<div align="center">
![Readme Banner](.github/readme-banner.png)
[![Discord](https://img.shields.io/discord/619178050562686988?color=%237289DA&logo=discord&logoColor=white&style=for-the-badge)](https://szkolny.eu/discord)
[![Oficjalna strona](https://img.shields.io/badge/-website-orange?style=for-the-badge&logo=internet-explorer&logoColor=white)](https://szkolny.eu/)
[![Facebook Fanpage](https://img.shields.io/badge/-facebook-blue?style=for-the-badge&logo=facebook&logoColor=white)](https://szkolny.eu/facebook)
![Wersja Androida](https://img.shields.io/badge/android-4.1%2B-orange?style=for-the-badge&logo=android)
[![Najnowsza wersja](https://img.shields.io/github/v/release/szkolny-eu/szkolny-android?color=%2344CC11&include_prereleases&logo=github&logoColor=white&style=for-the-badge)](https://github.com/szkolny-eu/szkolny-android/releases/latest)
![Licencja](https://img.shields.io/github/license/szkolny-eu/szkolny-android?color=blue&logo=github&logoColor=white&style=for-the-badge)
[![Release build](https://img.shields.io/github/workflow/status/szkolny-eu/szkolny-android/Release%20build%20-%20official?label=Release&logo=github-actions&logoColor=white&style=for-the-badge)](https://github.com/szkolny-eu/szkolny-android/actions/workflows/build-release-apk.yml)
[![Play build](https://img.shields.io/github/workflow/status/szkolny-eu/szkolny-android/Release%20build%20-%20Google%20Play%20%5BAAB%5D?label=Play&logo=google-play&logoColor=white&style=for-the-badge)](https://github.com/szkolny-eu/szkolny-android/actions/workflows/build-release-aab-play.yml)
[![Nightly build](https://img.shields.io/github/workflow/status/szkolny-eu/szkolny-android/Nightly%20build?label=Nightly&logo=github-actions&logoColor=white&style=for-the-badge)](https://github.com/szkolny-eu/szkolny-android/actions/workflows/build-nightly-apk.yml)
</div>
## Ważna informacja
Jak zapewne już wiecie, we wrześniu 2020 r. **firma Librus zabroniła nam** publikowania w sklepie Google Play naszej aplikacji z obsługą dziennika Librus&reg; Synergia. Prowadziliśmy rozmowy, aby **umożliwić Wam wygodny, bezpłatny dostęp do Waszych ocen, wiadomości, zadań domowych**, jednak oczekiwania firmy Librus zdecydowanie przekroczyły wszelkie nasze możliwości finansowe. Mając na uwadze powyższe względy, zdecydowaliśmy się opublikować kod źródłowy aplikacji Szkolny.eu. Liczymy, że dzięki temu aplikacja będzie mogła dalej funkcjonować, być rozwijana, pomagając Wam w czasie zdalnego nauczania i przez kolejne lata nauki.
__Zachęcamy do [przeczytania całej informacji](https://szkolny.eu/informacja) na naszej stronie.__
*- Autorzy Szkolny.eu*
## O aplikacji
Szkolny.eu jest nieoficjalną aplikacją, umożliwiającą rodzicom i uczniom dostęp do danych z e-dziennika w każdym smartfonie. Jest to jedyna aplikacja, która posiada wsparcie dla wszystkich najpopularniejszych e-dzienników. Oznacza to, że mając kilka kont w różnych szkołach, wystarczy mieć tylko jedną aplikację.
### Funkcje aplikacji
- plan lekcji, terminarz, oceny, wiadomości, zadania domowe, uwagi, frekwencja
- wygodne **widgety** na ekran główny
- łatwa komunikacja z nauczycielami — **odbieranie, wyszukiwanie i wysyłanie wiadomości**
- pobieranie **załączników wiadomości i zadań domowych**
- **powiadomienia** o nowych informacjach na telefonie lub na komputerze
- organizacja zadań domowych i sprawdzianów — łatwe oznaczanie jako wykonane
- obliczanie **średniej ocen** ze wszystkich przedmiotów, oceny proponowane i końcowe
- Symulator edycji ocen — obliczanie średniej z przedmiotu po zmianie dowolnych jego ocen
- **dodawanie własnych wydarzeń** i zadań do terminarza
- nowoczesny i intuicyjny interfejs użytkownika
- **obsługa wielu profili** uczniów — jeżeli jesteś Rodzicem, możesz skonfigurować wszystkie swoje konta uczniowskie i łatwo między nimi przełączać
- opcja **automatycznej synchronizacji** z E-dziennikiem
- opcja Ciszy nocnej — nigdy więcej budzących Cię dźwięków z telefonu
[Zobacz porównanie funkcji z innymi aplikacjami](https://szkolny.eu/funkcje)
### Pobieranie
Najnowsze wersje możesz pobrać z Google Play lub bezpośrednio z naszej strony, w formacie .APK.
[<img src=".github/google-play-badge.png" height="100px">](https://szkolny.eu/pobierz/android)
[<img src=".github/apk-badge.png" height="100px">](https://szkolny.eu/pobierz)
### Kompilacja
Aby uruchomić aplikację „ze źródeł” należy użyć Android Studio w wersji co najmniej 4.2 Beta 6. Wersja `debug` może wtedy zostać zainstalowana np. na emulatorze Androida.
Aby zbudować wersję produkcyjną, tzn. `release` należy użyć wariantu `mainRelease` oraz podpisać wyjściowy plik .APK sygnaturą w wersji V1 i V2.
Warianty `play` oraz `official` są zastrzeżone dla wydań oficjalnych.
## Współpraca
PRy wprowadzające nowe funkcje lub naprawiające błędy są mile widziane!
__Jeśli masz jakieś pytania, zapraszamy na [nasz serwer Discord](https://szkolny.eu/discord).__
## Licencja
Szkolny.eu publikowany jest na licencji [GNU GPLv3](LICENSE). W szczególności, deweloper:
- Może modyfikować oraz usprawniać kod aplikacji
- Może dystrybuować wersje produkcyjne
- Musi opublikować wszelkie wprowadzone zmiany, tzn. publiczny fork tego repozytorium
- Nie może zmieniać licencji ani copyrightu aplikacji
Dodatkowo:
- Zabronione jest modyfikowanie lub usuwanie kodu odpowiedzialnego za zgodność wersji produkcyjnych z licencją.
- **Wersje skompilowane nie mogą być dystrybuowane za pomocą Google Play oraz żadnej platformy, na której istnieje oficjalna wersja aplikacji**.
**Autorzy aplikacji nie biorą odpowiedzialności za używanie aplikacji, modyfikowanie oraz dystrybuowanie.**
Znaki towarowe zamieszczone w aplikacji oraz tym dokumencie należą do ich prawowitych właścicieli i są używane wyłącznie w celach informacyjnych.
Szkolny.eu

1
agendacalendarview/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,54 @@
apply plugin: 'com.android.library'
//apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
android {
lintOptions {
abortOnError false
}
}
defaultConfig {
minSdkVersion 14
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debugMinify {
debuggable = true
minifyEnabled = true
proguardFiles 'proguard-android.txt'
}
}
sourceSets {
main {
assets.srcDirs = ['assets']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
//apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Google libraries
implementation "androidx.appcompat:appcompat:${androidXAppCompat}"
implementation "androidx.recyclerview:recyclerview:${androidXRecyclerView}"
implementation "com.google.android.material:material:${googleMaterial}"
// other libraries
//implementation 'se.emilsjolander:stickylistheaders:2.7.0'
implementation 'com.github.edisonw:StickyListHeaders:master-SNAPSHOT@aar'
implementation 'io.reactivex:rxjava:1.1.1'
}

View File

@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.tibolte.agendacalendarview">
</manifest>

View File

@ -0,0 +1,264 @@
package com.github.tibolte.agendacalendarview;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.os.Handler;
import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.github.tibolte.agendacalendarview.agenda.AgendaAdapter;
import com.github.tibolte.agendacalendarview.agenda.AgendaView;
import com.github.tibolte.agendacalendarview.calendar.CalendarView;
import com.github.tibolte.agendacalendarview.models.BaseCalendarEvent;
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
import com.github.tibolte.agendacalendarview.models.DayItem;
import com.github.tibolte.agendacalendarview.models.IDayItem;
import com.github.tibolte.agendacalendarview.models.IWeekItem;
import com.github.tibolte.agendacalendarview.models.WeekItem;
import com.github.tibolte.agendacalendarview.render.DefaultEventRenderer;
import com.github.tibolte.agendacalendarview.render.EventRenderer;
import com.github.tibolte.agendacalendarview.utils.BusProvider;
import com.github.tibolte.agendacalendarview.utils.Events;
import com.github.tibolte.agendacalendarview.utils.ListViewScrollTracker;
import com.github.tibolte.agendacalendarview.widgets.FloatingActionButton;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
/**
* View holding the agenda and calendar view together.
*/
public class AgendaCalendarView extends FrameLayout implements StickyListHeadersListView.OnStickyHeaderChangedListener {
private static final String LOG_TAG = AgendaCalendarView.class.getSimpleName();
private CalendarView mCalendarView;
private AgendaView mAgendaView;
private FloatingActionButton mFloatingActionButton;
private int mAgendaCurrentDayTextColor, mCalendarHeaderColor, mCalendarHeaderTextColor, mCalendarBackgroundColor, mCalendarDayTextColor, mCalendarPastDayTextColor, mCalendarCurrentDayColor, mFabColor;
private CalendarPickerController mCalendarPickerController;
public AgendaView getAgendaView() {
return mAgendaView;
}
private ListViewScrollTracker mAgendaListViewScrollTracker;
private AbsListView.OnScrollListener mAgendaScrollListener = new AbsListView.OnScrollListener() {
int mCurrentAngle;
int mMaxAngle = 85;
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
int scrollY = mAgendaListViewScrollTracker.calculateScrollY(firstVisibleItem, visibleItemCount);
if (scrollY != 0) {
mFloatingActionButton.show();
}
//Log.d(LOG_TAG, String.format("Agenda listView scrollY: %d", scrollY));
/*int toAngle = scrollY / 100;
if (toAngle > mMaxAngle) {
toAngle = mMaxAngle;
} else if (toAngle < -mMaxAngle) {
toAngle = -mMaxAngle;
}
RotateAnimation rotate = new RotateAnimation(mCurrentAngle, toAngle, mFloatingActionButton.getWidth() / 2, mFloatingActionButton.getHeight() / 2);
rotate.setFillAfter(true);
mCurrentAngle = toAngle;
mFloatingActionButton.startAnimation(rotate);*/
}
};
// region Constructors
public AgendaCalendarView(Context context) {
super(context);
}
public AgendaCalendarView(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ColorOptionsView, 0, 0);
mAgendaCurrentDayTextColor = a.getColor(R.styleable.ColorOptionsView_agendaCurrentDayTextColor, getResources().getColor(R.color.theme_primary));
mCalendarHeaderColor = a.getColor(R.styleable.ColorOptionsView_calendarHeaderColor, getResources().getColor(R.color.theme_primary_dark));
mCalendarHeaderTextColor = a.getColor(R.styleable.ColorOptionsView_calendarHeaderTextColor, getResources().getColor(R.color.theme_text_icons));
mCalendarBackgroundColor = a.getColor(R.styleable.ColorOptionsView_calendarColor, getResources().getColor(R.color.theme_primary));
mCalendarDayTextColor = a.getColor(R.styleable.ColorOptionsView_calendarDayTextColor, getResources().getColor(R.color.theme_text_icons));
mCalendarCurrentDayColor = a.getColor(R.styleable.ColorOptionsView_calendarCurrentDayTextColor, getResources().getColor(R.color.calendar_text_current_day));
mCalendarPastDayTextColor = a.getColor(R.styleable.ColorOptionsView_calendarPastDayTextColor, getResources().getColor(R.color.theme_light_primary));
mFabColor = a.getColor(R.styleable.ColorOptionsView_fabColor, getResources().getColor(R.color.theme_accent));
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.view_agendacalendar, this, true);
setAlpha(0f);
}
// endregion
// region Class - View
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mCalendarView = (CalendarView) findViewById(R.id.calendar_view);
mAgendaView = (AgendaView) findViewById(R.id.agenda_view);
mFloatingActionButton = (FloatingActionButton) findViewById(R.id.floating_action_button);
ColorStateList csl = new ColorStateList(new int[][]{new int[0]}, new int[]{mFabColor});
mFloatingActionButton.setBackgroundTintList(csl);
LinearLayout mDayNamesHeader = mCalendarView.findViewById(R.id.cal_day_names);
mDayNamesHeader.setBackgroundColor(mCalendarHeaderColor);
for (int i = 0; i < mDayNamesHeader.getChildCount(); i++) {
TextView txtDay = (TextView) mDayNamesHeader.getChildAt(i);
txtDay.setTextColor(mCalendarHeaderTextColor);
}
mCalendarView.findViewById(R.id.list_week).setBackgroundColor(mCalendarBackgroundColor);
mAgendaView.getAgendaListView().setOnItemClickListener((AdapterView<?> parent, View view, int position, long id) -> {
mCalendarPickerController.onEventSelected(CalendarManager.getInstance().getEvents().get(position));
});
BusProvider.getInstance().toObserverable()
.subscribe(event -> {
if (event instanceof Events.DayClickedEvent) {
if (mCalendarPickerController != null)
mCalendarPickerController.onDaySelected(((Events.DayClickedEvent) event).getDay());
} else if (event instanceof Events.EventsFetched) {
ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(this, "alpha", getAlpha(), 1f).setDuration(500);
alphaAnimation.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
long fabAnimationDelay = 500;
// Just after setting the alpha from this view to 1, we hide the fab.
// It will reappear as soon as the user is scrolling the Agenda view.
new Handler().postDelayed(() -> {
mFloatingActionButton.hide();
mAgendaListViewScrollTracker = new ListViewScrollTracker(mAgendaView.getAgendaListView());
mAgendaView.getAgendaListView().setOnScrollListener(mAgendaScrollListener);
mFloatingActionButton.setOnClickListener((v) -> {
mAgendaView.translateList(0);
mAgendaView.getAgendaListView().smoothScrollBy(0, 0);
//mAgendaView.getAgendaListView().getWrappedList().smoothScrollBy(0, 0);
mAgendaView.getAgendaListView().scrollToCurrentDate(CalendarManager.getInstance().getToday());
new Handler().postDelayed(() -> mFloatingActionButton.hide(), fabAnimationDelay);
});
}, fabAnimationDelay);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
alphaAnimation.start();
}
});
}
// endregion
// region Interface - StickyListHeadersListView.OnStickyHeaderChangedListener
@Override
public void onStickyHeaderChanged(StickyListHeadersListView stickyListHeadersListView, View header, int position, long headerId) {
//Log.d(LOG_TAG, String.format("onStickyHeaderChanged, position = %d, headerId = %d", position, headerId));
if (CalendarManager.getInstance().getEvents().size() > 0) {
CalendarEvent event = CalendarManager.getInstance().getEvents().get(position);
if (event != null) {
mCalendarView.scrollToDate(event);
mCalendarPickerController.onScrollToDate(event.getInstanceDay());
}
}
}
// endregion
// region Public methods
public void init(List<CalendarEvent> eventList, Calendar minDate, Calendar maxDate, Locale locale, CalendarPickerController calendarPickerController, EventRenderer<?> ... renderers) {
mCalendarPickerController = calendarPickerController;
CalendarManager.getInstance(getContext()).buildCal(minDate, maxDate, locale, new DayItem(), new WeekItem());
// Feed our views with weeks list and events
mCalendarView.init(CalendarManager.getInstance(getContext()), mCalendarDayTextColor, mCalendarCurrentDayColor, mCalendarPastDayTextColor, eventList);
// Load agenda events and scroll to current day
AgendaAdapter agendaAdapter = new AgendaAdapter(mAgendaCurrentDayTextColor);
mAgendaView.getAgendaListView().setAdapter(agendaAdapter);
mAgendaView.getAgendaListView().setOnStickyHeaderChangedListener(this);
CalendarManager.getInstance().loadEvents(eventList, new BaseCalendarEvent());
BusProvider.getInstance().send(new Events.EventsFetched());
Log.d(LOG_TAG, "CalendarEventTask finished, event count "+eventList.size());
// add default event renderer
addEventRenderer(new DefaultEventRenderer());
for (EventRenderer<?> renderer: renderers) {
addEventRenderer(renderer);
}
}
public void init(Locale locale, List<IWeekItem> lWeeks, List<IDayItem> lDays, List<CalendarEvent> lEvents, CalendarPickerController calendarPickerController) {
mCalendarPickerController = calendarPickerController;
CalendarManager.getInstance(getContext()).loadCal(locale, lWeeks, lDays, lEvents);
// Feed our views with weeks list and events
mCalendarView.init(CalendarManager.getInstance(getContext()), mCalendarDayTextColor, mCalendarCurrentDayColor, mCalendarPastDayTextColor, lEvents);
// Load agenda events and scroll to current day
AgendaAdapter agendaAdapter = new AgendaAdapter(mAgendaCurrentDayTextColor);
mAgendaView.getAgendaListView().setAdapter(agendaAdapter);
mAgendaView.getAgendaListView().setOnStickyHeaderChangedListener(this);
// notify that actually everything is loaded
BusProvider.getInstance().send(new Events.EventsFetched());
Log.d(LOG_TAG, "CalendarEventTask finished");
// add default event renderer
addEventRenderer(new DefaultEventRenderer());
}
public void addEventRenderer(@NonNull final EventRenderer<?> renderer) {
AgendaAdapter adapter = (AgendaAdapter) mAgendaView.getAgendaListView().getAdapter();
adapter.addEventRenderer(renderer);
}
public void enableFloatingIndicator(boolean enable) {
mFloatingActionButton.setVisibility(enable ? VISIBLE : GONE);
}
// endregion
}

View File

@ -0,0 +1,267 @@
package com.github.tibolte.agendacalendarview;
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
import com.github.tibolte.agendacalendarview.models.IDayItem;
import com.github.tibolte.agendacalendarview.models.IWeekItem;
import com.github.tibolte.agendacalendarview.utils.DateHelper;
import android.content.Context;
import android.util.Log;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/**
* This class manages information about the calendar. (Events, weather info...)
* Holds reference to the days list of the calendar.
* As the app is using several views, we want to keep everything in one place.
*/
public class CalendarManager {
private static final String LOG_TAG = CalendarManager.class.getSimpleName();
private static CalendarManager mInstance;
private Context mContext;
private Locale mLocale;
private Calendar mToday = Calendar.getInstance();
private SimpleDateFormat mWeekdayFormatter;
private SimpleDateFormat mMonthHalfNameFormat;
/// instances of classes provided from outside
private IDayItem mCleanDay;
private IWeekItem mCleanWeek;
/**
* List of days used by the calendar
*/
private List<IDayItem> mDays = new ArrayList<>();
/**
* List of weeks used by the calendar
*/
private List<IWeekItem> mWeeks = new ArrayList<>();
/**
* List of events instances
*/
private List<CalendarEvent> mEvents = new ArrayList<>();
// region Constructors
public CalendarManager(Context context) {
this.mContext = context;
}
public static CalendarManager getInstance(Context context) {
if (mInstance == null) {
mInstance = new CalendarManager(context);
}
return mInstance;
}
public static CalendarManager getInstance() {
return mInstance;
}
// endregion
// region Getters/Setters
public Locale getLocale() {
return mLocale;
}
public Context getContext() {
return mContext;
}
public Calendar getToday() {
return mToday;
}
public void setToday(Calendar today) {
this.mToday = today;
}
public List<IWeekItem> getWeeks() {
return mWeeks;
}
public List<CalendarEvent> getEvents() {
return mEvents;
}
public List<IDayItem> getDays() {
return mDays;
}
public SimpleDateFormat getWeekdayFormatter() {
return mWeekdayFormatter;
}
public SimpleDateFormat getMonthHalfNameFormat() {
return mMonthHalfNameFormat;
}
// endregion
// region Public methods
public void buildCal(Calendar minDate, Calendar maxDate, Locale locale, IDayItem cleanDay, IWeekItem cleanWeek) {
if (minDate == null || maxDate == null) {
throw new IllegalArgumentException(
"minDate and maxDate must be non-null.");
}
if (minDate.after(maxDate)) {
throw new IllegalArgumentException(
"minDate must be before maxDate.");
}
if (locale == null) {
throw new IllegalArgumentException("Locale is null.");
}
setLocale(locale);
mDays.clear();
mWeeks.clear();
mEvents.clear();
mCleanDay = cleanDay;
mCleanWeek = cleanWeek;
Calendar mMinCal = Calendar.getInstance(mLocale);
Calendar mMaxCal = Calendar.getInstance(mLocale);
Calendar mWeekCounter = Calendar.getInstance(mLocale);
mMinCal.setTime(minDate.getTime());
mMaxCal.setTime(maxDate.getTime());
// maxDate is exclusive, here we bump back to the previous day, as maxDate if December 1st, 2020,
// we don't include that month in our list
mMaxCal.add(Calendar.MINUTE, -1);
// Now iterate we iterate between mMinCal and mMaxCal so we build our list of weeks
mWeekCounter.setTime(mMinCal.getTime());
int maxMonth = mMaxCal.get(Calendar.MONTH);
int maxYear = mMaxCal.get(Calendar.YEAR);
int currentMonth = mWeekCounter.get(Calendar.MONTH);
int currentYear = mWeekCounter.get(Calendar.YEAR);
// Loop through the weeks
while ((currentMonth <= maxMonth // Up to, including the month.
|| currentYear < maxYear) // Up to the year.
&& currentYear < maxYear + 1) { // But not > next yr.
Date date = mWeekCounter.getTime();
// Build our week list
int currentWeekOfYear = mWeekCounter.get(Calendar.WEEK_OF_YEAR);
IWeekItem weekItem = cleanWeek.copy();
weekItem.setWeekInYear(currentWeekOfYear);
weekItem.setYear(currentYear);
weekItem.setDate(date);
weekItem.setMonth(currentMonth);
weekItem.setLabel(mMonthHalfNameFormat.format(date));
List<IDayItem> dayItems = getDayCells(mWeekCounter); // gather days for the built week
weekItem.setDayItems(dayItems);
mWeeks.add(weekItem);
//Log.d(LOG_TAG, String.format("Adding week: %s", weekItem));
mWeekCounter.add(Calendar.WEEK_OF_YEAR, 1);
currentMonth = mWeekCounter.get(Calendar.MONTH);
currentYear = mWeekCounter.get(Calendar.YEAR);
}
}
public void loadEvents(List<CalendarEvent> eventList, CalendarEvent noEvent) {
for (IWeekItem weekItem : getWeeks()) {
for (IDayItem dayItem : weekItem.getDayItems()) {
boolean isEventForDay = false;
boolean isShowBadgeForDay = false;
for (CalendarEvent event : eventList) {
if (DateHelper.isBetweenInclusive(dayItem.getDate(), event.getStartTime(), event.getEndTime())) {
CalendarEvent copy = event.copy();
if (copy.getShowBadge()) {
isShowBadgeForDay = true;
}
Calendar dayInstance = Calendar.getInstance();
dayInstance.setTime(dayItem.getDate());
copy.setInstanceDay(dayInstance);
copy.setDayReference(dayItem);
copy.setWeekReference(weekItem);
// add instances in chronological order
getEvents().add(copy);
isEventForDay = true;
}
}
if (!isEventForDay) {
Calendar dayInstance = Calendar.getInstance();
dayInstance.setTime(dayItem.getDate());
CalendarEvent copy = noEvent.copy();
copy.setInstanceDay(dayInstance);
copy.setDayReference(dayItem);
copy.setWeekReference(weekItem);
copy.setLocation("");
copy.setTitle(getContext().getResources().getString(R.string.agenda_event_no_events));
copy.setPlaceholder(true);
getEvents().add(copy);
}
dayItem.setShowBadge(isShowBadgeForDay);
}
}
}
public void loadCal (Locale locale, List<IWeekItem> lWeeks, List<IDayItem> lDays, List<CalendarEvent> lEvents) {
mWeeks = lWeeks;
mDays = lDays;
mEvents = lEvents;
setLocale(locale);
}
// endregion
// region Private methods
private List<IDayItem> getDayCells(Calendar startCal) {
Calendar cal = Calendar.getInstance(mLocale);
cal.setTime(startCal.getTime());
List<IDayItem> dayItems = new ArrayList<>();
int firstDayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
int offset = cal.getFirstDayOfWeek() - firstDayOfWeek;
if (offset > 0) {
offset -= 7;
}
cal.add(Calendar.DATE, offset);
//Log.d(LOG_TAG, String.format("Buiding row week starting at %s", cal.getTime()));
for (int c = 0; c < 7; c++) {
IDayItem dayItem = mCleanDay.copy();
dayItem.buildDayItemFromCal(cal);
dayItems.add(dayItem);
cal.add(Calendar.DATE, 1);
}
mDays.addAll(dayItems);
return dayItems;
}
private void setLocale(Locale locale) {
this.mLocale = locale;
setToday(Calendar.getInstance(mLocale));
mWeekdayFormatter = new SimpleDateFormat(getContext().getString(R.string.day_name_format), mLocale);
mMonthHalfNameFormat = new SimpleDateFormat(getContext().getString(R.string.month_half_name_format), locale);
}
// endregion
}

View File

@ -0,0 +1,14 @@
package com.github.tibolte.agendacalendarview;
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
import com.github.tibolte.agendacalendarview.models.IDayItem;
import java.util.Calendar;
public interface CalendarPickerController {
void onDaySelected(IDayItem dayItem);
void onEventSelected(CalendarEvent event);
void onScrollToDate(Calendar calendar);
}

View File

@ -0,0 +1,105 @@
package com.github.tibolte.agendacalendarview.agenda;
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
import com.github.tibolte.agendacalendarview.render.DefaultEventRenderer;
import com.github.tibolte.agendacalendarview.render.EventRenderer;
import androidx.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.ArrayList;
import java.util.List;
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
/**
* Adapter for the agenda, implements StickyListHeadersAdapter.
* Days as sections and CalendarEvents as list items.
*/
public class AgendaAdapter extends BaseAdapter implements StickyListHeadersAdapter {
private List<CalendarEvent> mEvents = new ArrayList<>();
private List<EventRenderer<?>> mRenderers = new ArrayList<>();
private int mCurrentDayColor;
// region Constructor
public AgendaAdapter(int currentDayTextColor) {
this.mCurrentDayColor = currentDayTextColor;
}
// endregion
// region Public methods
public void updateEvents(List<CalendarEvent> events) {
this.mEvents.clear();
this.mEvents.addAll(events);
notifyDataSetChanged();
}
// endregion
// region Interface - StickyListHeadersAdapter
@Override
public View getHeaderView(int position, View convertView, ViewGroup parent) {
AgendaHeaderView agendaHeaderView = (AgendaHeaderView) convertView;
if (agendaHeaderView == null) {
agendaHeaderView = AgendaHeaderView.inflate(parent);
}
agendaHeaderView.setDay(getItem(position).getInstanceDay(), mCurrentDayColor, getItem(position).getDayReference().getShowBadge());
return agendaHeaderView;
}
@Override
public long getHeaderId(int position) {
return mEvents.get(position).getInstanceDay().getTimeInMillis();
}
// endregion
// region Class - BaseAdapter
@Override
public int getCount() {
return mEvents.size();
}
@Override
public CalendarEvent getItem(int position) {
return mEvents.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
EventRenderer eventRenderer = new DefaultEventRenderer();
final CalendarEvent event = getItem(position);
// Search for the correct event renderer
for (EventRenderer renderer : mRenderers) {
if(event.getClass().isAssignableFrom(renderer.getRenderType())) {
eventRenderer = renderer;
break;
}
}
convertView = LayoutInflater.from(parent.getContext())
.inflate(eventRenderer.getEventLayout(), parent, false);
eventRenderer.render(convertView, event);
return convertView;
}
public void addEventRenderer(@NonNull final EventRenderer<?> renderer) {
mRenderers.add(renderer);
}
// endregion
}

View File

@ -0,0 +1,38 @@
package com.github.tibolte.agendacalendarview.agenda;
import com.github.tibolte.agendacalendarview.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.LinearLayout;
/**
* List item view for the StickyHeaderListView of the agenda view
*/
public class AgendaEventView extends LinearLayout {
public static AgendaEventView inflate(ViewGroup parent) {
return (AgendaEventView) LayoutInflater.from(parent.getContext()).inflate(R.layout.view_agenda_event, parent, false);
}
// region Constructors
public AgendaEventView(Context context) {
this(context, null);
}
public AgendaEventView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public AgendaEventView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setPadding(getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_left),
getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_top),
getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_right),
getResources().getDimensionPixelSize(R.dimen.agenda_event_view_padding_bottom));
}
// endregion
}

View File

@ -0,0 +1,81 @@
package com.github.tibolte.agendacalendarview.agenda;
import com.github.tibolte.agendacalendarview.CalendarManager;
import com.github.tibolte.agendacalendarview.R;
import com.github.tibolte.agendacalendarview.utils.DateHelper;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.GradientDrawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.Calendar;
/**
* Header view for the StickyHeaderListView of the agenda view
*/
public class AgendaHeaderView extends LinearLayout {
public static AgendaHeaderView inflate(ViewGroup parent) {
return (AgendaHeaderView) LayoutInflater.from(parent.getContext()).inflate(R.layout.view_agenda_header, parent, false);
}
// region Constructors
public AgendaHeaderView(Context context) {
super(context);
}
public AgendaHeaderView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public AgendaHeaderView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
// endregion
// region Public methods
public void setDay(Calendar day, int currentDayTextColor, boolean showBadge) {
TextView txtDayOfMonth = (TextView) findViewById(R.id.view_agenda_day_of_month);
TextView txtDayOfWeek = (TextView) findViewById(R.id.view_agenda_day_of_week);
TextView txtDay = (TextView) findViewById(R.id.view_agenda_day_text);
View circleView = findViewById(R.id.view_day_circle_selected);
Calendar today = CalendarManager.getInstance().getToday();
SimpleDateFormat dayWeekFormatter = new SimpleDateFormat(getContext().getString(R.string.day_name_format), CalendarManager.getInstance().getLocale());
SimpleDateFormat dayWeekLongFormatter = new SimpleDateFormat("EEEE", CalendarManager.getInstance().getLocale());
txtDayOfMonth.setTextColor(getResources().getColor(R.color.calendar_text_default));
txtDayOfWeek.setTextColor(getResources().getColor(R.color.calendar_text_default));
if (DateHelper.sameDate(day, today)) {
txtDayOfMonth.setTextColor(currentDayTextColor);
circleView.setVisibility(VISIBLE);
GradientDrawable drawable = (GradientDrawable) circleView.getBackground();
drawable.setStroke((int) (2 * Resources.getSystem().getDisplayMetrics().density), currentDayTextColor);
} else if (showBadge) {
circleView.setVisibility(VISIBLE);
GradientDrawable drawable = (GradientDrawable) circleView.getBackground();
drawable.setStroke((int) (2 * Resources.getSystem().getDisplayMetrics().density), 0xffff0000);
}
else {
circleView.setVisibility(INVISIBLE);
}
txtDayOfMonth.setText(String.valueOf(day.get(Calendar.DAY_OF_MONTH)));
txtDayOfWeek.setText(dayWeekFormatter.format(day.getTime()));
//txtDay.setText(dayWeekLongFormatter.format(day.getTime()));
}
// endregion
}

View File

@ -0,0 +1,54 @@
package com.github.tibolte.agendacalendarview.agenda;
import com.github.tibolte.agendacalendarview.CalendarManager;
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
import com.github.tibolte.agendacalendarview.utils.DateHelper;
import android.content.Context;
import android.util.AttributeSet;
import java.util.Calendar;
import java.util.List;
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
/**
* StickyListHeadersListView to scroll chronologically through events.
*/
public class AgendaListView extends StickyListHeadersListView {
// region Constructors
public AgendaListView(Context context) {
super(context);
}
public AgendaListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public AgendaListView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
// endregion
// region Public methods
public void scrollToCurrentDate(Calendar today) {
List<CalendarEvent> events = CalendarManager.getInstance().getEvents();
int toIndex = 0;
for (int i = 0; i < events.size(); i++) {
if (DateHelper.sameDate(today, events.get(i).getInstanceDay())) {
toIndex = i;
break;
}
}
final int finalToIndex = toIndex;
post(()->setSelection(finalToIndex));
}
// endregion
}

View File

@ -0,0 +1,145 @@
package com.github.tibolte.agendacalendarview.agenda;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import com.github.tibolte.agendacalendarview.CalendarManager;
import com.github.tibolte.agendacalendarview.R;
import com.github.tibolte.agendacalendarview.utils.BusProvider;
import com.github.tibolte.agendacalendarview.utils.Events;
public class AgendaView extends FrameLayout {
private AgendaListView mAgendaListView;
private View mShadowView;
// region Constructors
public AgendaView(Context context) {
super(context);
}
public AgendaView(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.view_agenda, this, true);
}
// endregion
// region Class - View
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mAgendaListView = (AgendaListView) findViewById(R.id.agenda_listview);
mShadowView = findViewById(R.id.view_shadow);
BusProvider.getInstance().toObserverable()
.subscribe(event -> {
if (event instanceof Events.DayClickedEvent) {
Events.DayClickedEvent clickedEvent = (Events.DayClickedEvent) event;
getAgendaListView().scrollToCurrentDate(clickedEvent.getCalendar());
} else if (event instanceof Events.CalendarScrolledEvent) {
int offset = (int) (3 * getResources().getDimension(R.dimen.day_cell_height));
translateList(offset);
} else if (event instanceof Events.EventsFetched) {
if (getAgendaListView().getAdapter() != null)
((AgendaAdapter) getAgendaListView().getAdapter()).updateEvents(CalendarManager.getInstance().getEvents());
getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (getWidth() != 0 && getHeight() != 0) {
// display only two visible rows on the calendar view
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) getLayoutParams();
int height = getHeight();
int margin = (int) (getContext().getResources().getDimension(R.dimen.calendar_header_height) + 2 * getContext().getResources().getDimension(R.dimen.day_cell_height));
layoutParams.height = height;
layoutParams.setMargins(0, margin, 0, 0);
setLayoutParams(layoutParams);
getAgendaListView().scrollToCurrentDate(CalendarManager.getInstance().getToday());
getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
}
}
);
} else if (event instanceof Events.ForecastFetched) {
((AgendaAdapter) getAgendaListView().getAdapter()).updateEvents(CalendarManager.getInstance().getEvents());
}
});
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
switch (eventaction) {
case MotionEvent.ACTION_DOWN:
// if the user touches the listView, we put it back to the top
translateList(0);
break;
default:
break;
}
return super.dispatchTouchEvent(event);
}
// endregion
// region Public methods
public AgendaListView getAgendaListView() {
return mAgendaListView;
}
public void translateList(int targetY) {
if (targetY != getTranslationY()) {
ObjectAnimator mover = ObjectAnimator.ofFloat(this, "translationY", targetY);
mover.setDuration(150);
mover.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
//mShadowView.setVisibility(GONE);
}
@Override
public void onAnimationEnd(Animator animation) {
if (targetY == 0) {
BusProvider.getInstance().send(new Events.AgendaListViewTouchedEvent());
}
//mShadowView.setVisibility(VISIBLE);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
mover.start();
}
}
// endregion
}

View File

@ -0,0 +1,279 @@
package com.github.tibolte.agendacalendarview.calendar;
import com.github.tibolte.agendacalendarview.CalendarManager;
import com.github.tibolte.agendacalendarview.R;
import com.github.tibolte.agendacalendarview.calendar.weekslist.WeekListView;
import com.github.tibolte.agendacalendarview.calendar.weekslist.WeeksAdapter;
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
import com.github.tibolte.agendacalendarview.models.IDayItem;
import com.github.tibolte.agendacalendarview.models.IWeekItem;
import com.github.tibolte.agendacalendarview.utils.BusProvider;
import com.github.tibolte.agendacalendarview.utils.DateHelper;
import com.github.tibolte.agendacalendarview.utils.Events;
import android.content.Context;
import androidx.recyclerview.widget.LinearLayoutManager;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
/**
* The calendar view is a freely scrolling view that allows the user to browse between days of the
* year.
*/
public class CalendarView extends LinearLayout {
private static final String LOG_TAG = CalendarView.class.getSimpleName();
/**
* Top of the calendar view layout, the week days list
*/
private LinearLayout mDayNamesHeader;
/**
* Part of the calendar view layout always visible, the weeks list
*/
private WeekListView mListViewWeeks;
/**
* The adapter for the weeks list
*/
private WeeksAdapter mWeeksAdapter;
/**
* The current highlighted day in blue
*/
private IDayItem mSelectedDay;
/**
* The current row displayed at top of the list
*/
private int mCurrentListPosition;
// region Constructors
public CalendarView(Context context) {
super(context);
}
public CalendarView(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.view_calendar, this, true);
setOrientation(VERTICAL);
}
// endregion
public IDayItem getSelectedDay() {
return mSelectedDay;
}
public void setSelectedDay(IDayItem mSelectedDay) {
this.mSelectedDay = mSelectedDay;
}
public WeekListView getListViewWeeks() {
return mListViewWeeks;
}
// region Class - View
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mDayNamesHeader = (LinearLayout) findViewById(R.id.cal_day_names);
mListViewWeeks = (WeekListView) findViewById(R.id.list_week);
mListViewWeeks.setLayoutManager(new LinearLayoutManager(getContext()));
mListViewWeeks.setHasFixedSize(true);
mListViewWeeks.setItemAnimator(null);
mListViewWeeks.setSnapEnabled(true);
// display only two visible rows on the calendar view
getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (getWidth() != 0 && getHeight() != 0) {
collapseCalendarView();
getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
}
}
);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
BusProvider.getInstance().toObserverable()
.subscribe(event -> {
if (event instanceof Events.CalendarScrolledEvent) {
expandCalendarView();
} else if (event instanceof Events.AgendaListViewTouchedEvent) {
collapseCalendarView();
} else if (event instanceof Events.DayClickedEvent) {
Events.DayClickedEvent clickedEvent = (Events.DayClickedEvent) event;
updateSelectedDay(clickedEvent.getCalendar(), clickedEvent.getDay());
}
});
}
// endregion
// region Public methods
public void init(CalendarManager calendarManager, int dayTextColor, int currentDayTextColor, int pastDayTextColor, List<CalendarEvent> eventList) {
Calendar today = calendarManager.getToday();
Locale locale = calendarManager.getLocale();
SimpleDateFormat weekDayFormatter = calendarManager.getWeekdayFormatter();
List<IWeekItem> weeks = calendarManager.getWeeks();
setUpHeader(today, weekDayFormatter, locale);
setUpAdapter(today, weeks, dayTextColor, currentDayTextColor, pastDayTextColor, eventList);
scrollToDate(today, weeks);
}
/**
* Fired when the Agenda list view changes section.
*
* @param calendarEvent The event for the selected position in the agenda listview.
*/
public void scrollToDate(final CalendarEvent calendarEvent) {
mListViewWeeks.post(()->scrollToPosition(updateSelectedDay(calendarEvent.getInstanceDay(), calendarEvent.getDayReference())));
}
public void scrollToDate(Calendar today, List<IWeekItem> weeks) {
Integer currentWeekIndex = null;
for (int c = 0; c < weeks.size(); c++) {
if (DateHelper.sameWeek(today, weeks.get(c))) {
currentWeekIndex = c;
break;
}
}
if (currentWeekIndex != null) {
final Integer finalCurrentWeekIndex = currentWeekIndex;
mListViewWeeks.post(() -> scrollToPosition(finalCurrentWeekIndex));
}
}
public void setBackgroundColor(int color) {
mListViewWeeks.setBackgroundColor(color);
}
// endregion
// region Private methods
private void scrollToPosition(int targetPosition) {
LinearLayoutManager layoutManager = ((LinearLayoutManager) mListViewWeeks.getLayoutManager());
layoutManager.scrollToPosition(targetPosition);
}
private void updateItemAtPosition(int position) {
WeeksAdapter weeksAdapter = (WeeksAdapter) mListViewWeeks.getAdapter();
weeksAdapter.notifyItemChanged(position);
}
/**
* Creates a new adapter if necessary and sets up its parameters.
*/
private void setUpAdapter(Calendar today, List<IWeekItem> weeks, int dayTextColor, int currentDayTextColor, int pastDayTextColor, List<CalendarEvent> events) {
BusProvider.getInstance().toObserverable()
.subscribe(event -> {
if (event instanceof Events.EventsFetched) {
//Log.d("CalendarView", "events size "+events.size());
if (mWeeksAdapter == null) {
//Log.d(LOG_TAG, "Setting adapter with today's calendar: " + today.toString());
mWeeksAdapter = new WeeksAdapter(getContext(), today, dayTextColor, currentDayTextColor, pastDayTextColor, events);
mListViewWeeks.setAdapter(mWeeksAdapter);
}
mWeeksAdapter.updateWeeksItems(weeks);
}});
}
private void setUpHeader(Calendar today, SimpleDateFormat weekDayFormatter, Locale locale) {
int daysPerWeek = 7;
String[] dayLabels = new String[daysPerWeek];
Calendar cal = Calendar.getInstance(CalendarManager.getInstance(getContext()).getLocale());
cal.setTime(today.getTime());
int firstDayOfWeek = cal.getFirstDayOfWeek();
for (int count = 0; count < 7; count++) {
cal.set(Calendar.DAY_OF_WEEK, firstDayOfWeek + count);
if (locale.getLanguage().equals("en")) {
dayLabels[count] = weekDayFormatter.format(cal.getTime()).toUpperCase(locale);
} else {
dayLabels[count] = weekDayFormatter.format(cal.getTime());
}
}
for (int i = 0; i < mDayNamesHeader.getChildCount(); i++) {
TextView txtDay = (TextView) mDayNamesHeader.getChildAt(i);
txtDay.setText(dayLabels[i]);
}
}
private void expandCalendarView() {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) getLayoutParams();
layoutParams.height = (int) (getResources().getDimension(R.dimen.calendar_header_height) + 5 * getResources().getDimension(R.dimen.day_cell_height));
setLayoutParams(layoutParams);
}
private void collapseCalendarView() {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) getLayoutParams();
layoutParams.height = (int) (getResources().getDimension(R.dimen.calendar_header_height) + 2 * getResources().getDimension(R.dimen.day_cell_height));
setLayoutParams(layoutParams);
}
/**
* Update a selected cell day item.
*
* @param calendar The Calendar instance of the day selected.
* @param dayItem The DayItem information held by the cell item.
* @return The selected row of the weeks list, to be updated.
*/
private int updateSelectedDay(Calendar calendar, IDayItem dayItem) {
Integer currentWeekIndex = null;
// update highlighted/selected day
if (!dayItem.equals(getSelectedDay())) {
dayItem.setSelected(true);
if (getSelectedDay() != null) {
getSelectedDay().setSelected(false);
}
setSelectedDay(dayItem);
}
for (int c = 0; c < CalendarManager.getInstance().getWeeks().size(); c++) {
if (DateHelper.sameWeek(calendar, CalendarManager.getInstance().getWeeks().get(c))) {
currentWeekIndex = c;
break;
}
}
if (currentWeekIndex != null) {
// highlighted day has changed, update the rows concerned
if (currentWeekIndex != mCurrentListPosition) {
updateItemAtPosition(mCurrentListPosition);
}
mCurrentListPosition = currentWeekIndex;
updateItemAtPosition(currentWeekIndex);
}
return mCurrentListPosition;
}
// endregion
}

View File

@ -0,0 +1,144 @@
package com.github.tibolte.agendacalendarview.calendar.weekslist;
import com.github.tibolte.agendacalendarview.utils.BusProvider;
import com.github.tibolte.agendacalendarview.utils.Events;
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
public class WeekListView extends RecyclerView {
private boolean mUserScrolling = false;
private boolean mScrolling = false;
// region Constructors
public WeekListView(Context context) {
super(context);
}
public WeekListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public WeekListView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
// endregion
// region Public methods
/**
* Enable snapping behaviour for this recyclerView
*
* @param enabled enable or disable the snapping behaviour
*/
public void setSnapEnabled(boolean enabled) {
if (enabled) {
addOnScrollListener(mScrollListener);
} else {
removeOnScrollListener(mScrollListener);
}
}
// endregion
// region Private methods
private OnScrollListener mScrollListener = new OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
final WeeksAdapter weeksAdapter = (WeeksAdapter) getAdapter();
switch (newState) {
case SCROLL_STATE_IDLE:
if (mUserScrolling) {
scrollToView(getCenterView());
postDelayed(() -> weeksAdapter.setDragging(false), 700); // Wait for recyclerView to settle
}
mUserScrolling = false;
mScrolling = false;
break;
// If scroll is caused by a touch (scroll touch, not any touch)
case SCROLL_STATE_DRAGGING:
BusProvider.getInstance().send(new Events.CalendarScrolledEvent());
// If scroll was initiated already, this is not a user scrolling, but probably a tap, else set userScrolling
if (!mScrolling) {
mUserScrolling = true;
}
weeksAdapter.setDragging(true);
break;
case SCROLL_STATE_SETTLING:
// The user's finger is not touching the list anymore, no need
// for any alpha animation then
weeksAdapter.setAlphaSet(true);
mScrolling = true;
break;
}
}
};
private View getChildClosestToPosition(int y) {
if (getChildCount() <= 0) {
return null;
}
int itemHeight = getChildAt(0).getMeasuredHeight();
int closestY = 9999;
View closestChild = null;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
int childCenterY = ((int) child.getY() + (itemHeight / 2));
int yDistance = childCenterY - y;
// If child center is closer than previous closest, set it as closest
if (Math.abs(yDistance) < Math.abs(closestY)) {
closestY = yDistance;
closestChild = child;
}
}
return closestChild;
}
private View getCenterView() {
return getChildClosestToPosition(getMeasuredHeight() / 2);
}
private void scrollToView(View child) {
if (child == null) {
return;
}
stopScroll();
int scrollDistance = getScrollDistance(child);
if (scrollDistance != 0) {
smoothScrollBy(0, scrollDistance);
}
}
private int getScrollDistance(View child) {
int itemHeight = getChildAt(0).getMeasuredHeight();
int centerY = getMeasuredHeight() / 2;
int childCenterY = ((int) child.getY() + (itemHeight / 2));
return childCenterY - centerY;
}
// endregion
}

View File

@ -0,0 +1,321 @@
package com.github.tibolte.agendacalendarview.calendar.weekslist;
import com.github.tibolte.agendacalendarview.CalendarManager;
import com.github.tibolte.agendacalendarview.R;
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
import com.github.tibolte.agendacalendarview.models.IDayItem;
import com.github.tibolte.agendacalendarview.models.IWeekItem;
import com.github.tibolte.agendacalendarview.utils.BusProvider;
import com.github.tibolte.agendacalendarview.utils.DateHelper;
import com.github.tibolte.agendacalendarview.utils.Events;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Typeface;
import android.graphics.drawable.GradientDrawable;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class WeeksAdapter extends RecyclerView.Adapter<WeeksAdapter.WeekViewHolder> {
public static final long FADE_DURATION = 250;
private Context mContext;
private Calendar mToday;
private List<IWeekItem> mWeeksList = new ArrayList<>();
private List<CalendarEvent> mEventList = new ArrayList<>();
private boolean mDragging;
private boolean mAlphaSet;
private int mDayTextColor, mPastDayTextColor, mCurrentDayColor;
// region Constructor
public WeeksAdapter(Context context, Calendar today, int dayTextColor, int currentDayTextColor, int pastDayTextColor, List<CalendarEvent> events) {
this.mToday = today;
this.mContext = context;
this.mDayTextColor = dayTextColor;
this.mCurrentDayColor = currentDayTextColor;
this.mPastDayTextColor = pastDayTextColor;
this.mEventList = events;
}
// endregion
public void updateWeeksItems(List<IWeekItem> weekItems) {
this.mWeeksList.clear();
this.mWeeksList.addAll(weekItems);
notifyDataSetChanged();
}
// region Getters/setters
public List<IWeekItem> getWeeksList() {
return mWeeksList;
}
public boolean isDragging() {
return mDragging;
}
public void setDragging(boolean dragging) {
if (dragging != this.mDragging) {
this.mDragging = dragging;
notifyItemRangeChanged(0, mWeeksList.size());
}
}
public boolean isAlphaSet() {
return mAlphaSet;
}
public void setAlphaSet(boolean alphaSet) {
mAlphaSet = alphaSet;
}
// endregion
// region RecyclerView.Adapter<WeeksAdapter.WeekViewHolder> methods
@Override
public WeekViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_week, parent, false);
return new WeekViewHolder(view);
}
@Override
public void onBindViewHolder(WeekViewHolder weekViewHolder, int position) {
IWeekItem weekItem = mWeeksList.get(position);
weekViewHolder.bindWeek(weekItem, mToday);
}
@Override
public int getItemCount() {
return mWeeksList.size();
}
// endregion
// region Class - WeekViewHolder
public class WeekViewHolder extends RecyclerView.ViewHolder {
/**
* List of layout containers for each day
*/
private List<LinearLayout> mCells;
private TextView mTxtMonth;
private FrameLayout mMonthBackground;
public WeekViewHolder(View itemView) {
super(itemView);
mTxtMonth = (TextView) itemView.findViewById(R.id.month_label);
mMonthBackground = (FrameLayout) itemView.findViewById(R.id.month_background);
LinearLayout daysContainer = (LinearLayout) itemView.findViewById(R.id.week_days_container);
setUpChildren(daysContainer);
}
public void bindWeek(IWeekItem weekItem, Calendar today) {
setUpMonthOverlay();
List<IDayItem> dayItems = weekItem.getDayItems();
for (int c = 0; c < dayItems.size(); c++) {
final IDayItem dayItem = dayItems.get(c);
LinearLayout cellItem = mCells.get(c);
TextView txtDay = (TextView) cellItem.findViewById(R.id.view_day_day_label);
TextView txtMonth = (TextView) cellItem.findViewById(R.id.view_day_month_label);
View circleView = cellItem.findViewById(R.id.view_day_circle_selected);
View eventIndicator1 = cellItem.findViewById(R.id.view_day_event_indicator1);
View eventIndicator2 = cellItem.findViewById(R.id.view_day_event_indicator2);
View eventIndicator3 = cellItem.findViewById(R.id.view_day_event_indicator3);
cellItem.setOnClickListener(v->BusProvider.getInstance().send(new Events.DayClickedEvent(dayItem)));
eventIndicator1.setVisibility(View.INVISIBLE);
eventIndicator2.setVisibility(View.INVISIBLE);
eventIndicator3.setVisibility(View.INVISIBLE);
Calendar dayItemCalendar = Calendar.getInstance();
dayItemCalendar.setTime(dayItem.getDate());
int eventCount = 0;
for (CalendarEvent event: mEventList) {
if (event.getStartTime().get(Calendar.YEAR) == dayItemCalendar.get(Calendar.YEAR)
&& event.getStartTime().get(Calendar.MONTH) == dayItemCalendar.get(Calendar.MONTH)
&& event.getStartTime().get(Calendar.DAY_OF_MONTH) == dayItemCalendar.get(Calendar.DAY_OF_MONTH)) {
eventCount++;
if (eventCount == 1) {
eventIndicator1.setVisibility(View.VISIBLE);
eventIndicator1.getBackground().setColorFilter(new PorterDuffColorFilter(event.getColor(),PorterDuff.Mode.MULTIPLY));
}
if (eventCount == 2) {
eventIndicator2.setVisibility(View.VISIBLE);
eventIndicator2.getBackground().setColorFilter(new PorterDuffColorFilter(event.getColor(),PorterDuff.Mode.MULTIPLY));
}
if (eventCount == 3) {
eventIndicator3.setVisibility(View.VISIBLE);
eventIndicator3.getBackground().setColorFilter(new PorterDuffColorFilter(event.getColor(),PorterDuff.Mode.MULTIPLY));
}
}
}
//Log.d("CalendarView", "Event count for day "+dayItem.getValue()+" is "+eventCount);
txtMonth.setVisibility(View.GONE);
txtDay.setTextColor(mDayTextColor);
txtMonth.setTextColor(mDayTextColor);
circleView.setVisibility(View.GONE);
txtDay.setTypeface(null, Typeface.NORMAL);
txtMonth.setTypeface(null, Typeface.NORMAL);
// Display the day
txtDay.setText(Integer.toString(dayItem.getValue()));
// Highlight first day of the month
if (dayItem.isFirstDayOfTheMonth() && !dayItem.isSelected()) {
txtMonth.setVisibility(View.VISIBLE);
txtMonth.setText(dayItem.getMonth());
txtDay.setTypeface(null, Typeface.BOLD);
txtMonth.setTypeface(null, Typeface.BOLD);
}
// Check if this day is in the past
if (today.getTime().after(dayItem.getDate()) && !DateHelper.sameDate(today, dayItem.getDate())) {
txtDay.setTextColor(mPastDayTextColor);
txtMonth.setTextColor(mPastDayTextColor);
}
// Highlight the cell if this day is today
if (dayItem.isToday() && !dayItem.isSelected()) {
txtDay.setTextColor(mCurrentDayColor);
}
if (dayItem.getShowBadge()) {
circleView.setVisibility(View.VISIBLE);
GradientDrawable drawable = (GradientDrawable) circleView.getBackground();
drawable.setStroke((int) (2 * Resources.getSystem().getDisplayMetrics().density), 0xffff0000);
}
// Show a circle if the day is selected
if (dayItem.isSelected()) {
txtDay.setTextColor(mDayTextColor);
circleView.setVisibility(View.VISIBLE);
GradientDrawable drawable = (GradientDrawable) circleView.getBackground();
drawable.setStroke((int) (1 * Resources.getSystem().getDisplayMetrics().density), mDayTextColor);
}
// Check if the month label has to be displayed
if (dayItem.getValue() == 15) {
mTxtMonth.setVisibility(View.VISIBLE);
SimpleDateFormat monthDateFormat = new SimpleDateFormat(mContext.getResources().getString(R.string.month_name_format), CalendarManager.getInstance().getLocale());
String month = monthDateFormat.format(weekItem.getDate()).toUpperCase();
if (today.get(Calendar.YEAR) != weekItem.getYear()) {
month = month + String.format(" %d", weekItem.getYear());
}
mTxtMonth.setText(month);
}
}
}
private void setUpChildren(LinearLayout daysContainer) {
mCells = new ArrayList<>();
for (int i = 0; i < daysContainer.getChildCount(); i++) {
mCells.add((LinearLayout) daysContainer.getChildAt(i));
}
}
private void setUpMonthOverlay() {
mTxtMonth.setVisibility(View.GONE);
if (isDragging()) {
AnimatorSet animatorSetFadeIn = new AnimatorSet();
animatorSetFadeIn.setDuration(FADE_DURATION);
ObjectAnimator animatorTxtAlphaIn = ObjectAnimator.ofFloat(mTxtMonth, "alpha", mTxtMonth.getAlpha(), 1f);
ObjectAnimator animatorBackgroundAlphaIn = ObjectAnimator.ofFloat(mMonthBackground, "alpha", mMonthBackground.getAlpha(), 1f);
animatorSetFadeIn.playTogether(
animatorTxtAlphaIn
//animatorBackgroundAlphaIn
);
animatorSetFadeIn.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
setAlphaSet(true);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
animatorSetFadeIn.start();
} else {
AnimatorSet animatorSetFadeOut = new AnimatorSet();
animatorSetFadeOut.setDuration(FADE_DURATION);
ObjectAnimator animatorTxtAlphaOut = ObjectAnimator.ofFloat(mTxtMonth, "alpha", mTxtMonth.getAlpha(), 0f);
ObjectAnimator animatorBackgroundAlphaOut = ObjectAnimator.ofFloat(mMonthBackground, "alpha", mMonthBackground.getAlpha(), 0f);
animatorSetFadeOut.playTogether(
animatorTxtAlphaOut
//animatorBackgroundAlphaOut
);
animatorSetFadeOut.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
setAlphaSet(false);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
animatorSetFadeOut.start();
}
if (isAlphaSet()) {
//mMonthBackground.setAlpha(1f);
mTxtMonth.setAlpha(1f);
} else {
//mMonthBackground.setAlpha(0f);
mTxtMonth.setAlpha(0f);
}
}
}
// endregion
}

View File

@ -0,0 +1,345 @@
package com.github.tibolte.agendacalendarview.models;
import java.util.Calendar;
/**
* Event model class containing the information to be displayed on the agenda view.
*/
public class BaseCalendarEvent implements CalendarEvent {
/**
* Id of the event.
*/
private long mId;
/**
* Color to be displayed in the agenda view.
*/
private int mColor;
/**
* Text color displayed on the background color
*/
private int mTextColor;
/**
* Title of the event.
*/
private String mTitle;
/**
* Description of the event.
*/
private String mDescription;
/**
* Where the event takes place.
*/
private String mLocation;
/**
* Calendar instance helping sorting the events per section in the agenda view.
*/
private Calendar mInstanceDay;
/**
* Start time of the event.
*/
private Calendar mStartTime;
/**
* End time of the event.
*/
private Calendar mEndTime;
/**
* Indicates if the event lasts all day.
*/
private boolean mAllDay;
/**
* Tells if this BaseCalendarEvent instance is used as a placeholder in the agenda view, if there's
* no event for that day.
*/
private boolean mPlaceHolder;
/**
* Tells if this BaseCalendarEvent instance is used as a forecast information holder in the agenda
* view.
*/
private boolean mWeather;
/**
* Duration of the event.
*/
private String mDuration;
/**
* References to a DayItem instance for that event, used to link interaction between the
* calendar view and the agenda view.
*/
private IDayItem mDayReference;
/**
* References to a WeekItem instance for that event, used to link interaction between the
* calendar view and the agenda view.
*/
private IWeekItem mWeekReference;
/**
* Weather icon string returned by the Dark Sky API.
*/
private String mWeatherIcon;
/**
* Temperature value returned by the Dark Sky API.
*/
private double mTemperature;
private boolean mShowBadge;
// region Constructor
/**
* Initializes the event
*
* @param id The id of the event.
* @param color The color of the event.
* @param textColor The color of the event description text.
* @param title The title of the event.
* @param description The description of the event.
* @param location The location of the event.
* @param dateStart The start date of the event.
* @param dateEnd The end date of the event.
* @param allDay Int that can be equal to 0 or 1.
* @param duration The duration of the event in RFC2445 format.
*/
public BaseCalendarEvent(long id, int color, int textColor, String title, String description, String location, long dateStart, long dateEnd, int allDay, String duration) {
this.mId = id;
this.mColor = color;
this.mTextColor = textColor;
this.mAllDay = (allDay == 1);
this.mDuration = duration;
this.mTitle = title;
this.mDescription = description;
this.mLocation = location;
this.mStartTime = Calendar.getInstance();
this.mStartTime.setTimeInMillis(dateStart);
this.mEndTime = Calendar.getInstance();
this.mEndTime.setTimeInMillis(dateEnd);
}
public BaseCalendarEvent() {
}
/**
* Initializes the event
* @param title The title of the event.
* @param description The description of the event.
* @param location The location of the event.
* @param color The color of the event (for display in the app).
* @param textColor The color of the event description text.
* @param startTime The start time of the event.
* @param endTime The end time of the event.
* @param allDay Indicates if the event lasts the whole day.
*/
public BaseCalendarEvent(String title, String description, String location, int color, int textColor, Calendar startTime, Calendar endTime, boolean allDay) {
this.mTitle = title;
this.mDescription = description;
this.mLocation = location;
this.mColor = color;
this.mTextColor = textColor;
this.mStartTime = startTime;
this.mEndTime = endTime;
this.mAllDay = allDay;
}
public BaseCalendarEvent(String title, String description, String location, int color, int textColor, Calendar startTime, Calendar endTime, boolean allDay, long id, boolean showBadge) {
this.mTitle = title;
this.mDescription = description;
this.mLocation = location;
this.mColor = color;
this.mTextColor = textColor;
this.mStartTime = startTime;
this.mEndTime = endTime;
this.mAllDay = allDay;
this.mId = id;
this.mShowBadge = showBadge;
}
public BaseCalendarEvent(BaseCalendarEvent calendarEvent) {
this.mId = calendarEvent.getId();
this.mColor = calendarEvent.getColor();
this.mTextColor = calendarEvent.getTextColor();
this.mAllDay = calendarEvent.isAllDay();
this.mDuration = calendarEvent.getDuration();
this.mTitle = calendarEvent.getTitle();
this.mDescription = calendarEvent.getDescription();
this.mLocation = calendarEvent.getLocation();
this.mStartTime = calendarEvent.getStartTime();
this.mEndTime = calendarEvent.getEndTime();
this.mShowBadge = calendarEvent.getShowBadge();
}
// endregion
// region Getters/Setters
public int getColor() {
return mColor;
}
public void setColor(int mColor) {
this.mColor = mColor;
}
public int getTextColor() {
return mTextColor;
}
public void setTextColor(int mTextColor) {
this.mTextColor = mTextColor;
}
public String getDescription() {
return mDescription;
}
public boolean isAllDay() {
return mAllDay;
}
public void setAllDay(boolean allDay) {
this.mAllDay = allDay;
}
public void setDescription(String mDescription) {
this.mDescription = mDescription;
}
public Calendar getInstanceDay() {
return mInstanceDay;
}
public void setInstanceDay(Calendar mInstanceDay) {
this.mInstanceDay = mInstanceDay;
this.mInstanceDay.set(Calendar.HOUR, 0);
this.mInstanceDay.set(Calendar.MINUTE, 0);
this.mInstanceDay.set(Calendar.SECOND, 0);
this.mInstanceDay.set(Calendar.MILLISECOND, 0);
this.mInstanceDay.set(Calendar.AM_PM, 0);
}
public Calendar getEndTime() {
return mEndTime;
}
public void setEndTime(Calendar mEndTime) {
this.mEndTime = mEndTime;
}
public void setPlaceholder(boolean placeholder) {
mPlaceHolder = placeholder;
}
public boolean isPlaceholder() {
return mPlaceHolder;
}
public long getId() {
return mId;
}
public void setId(long mId) {
this.mId = mId;
}
public boolean getShowBadge() {
return mShowBadge;
}
public void setShowBadge(boolean mShowBadge) {
this.mShowBadge = mShowBadge;
}
public String getLocation() {
return mLocation;
}
public void setLocation(String mLocation) {
this.mLocation = mLocation;
}
public Calendar getStartTime() {
return mStartTime;
}
public void setStartTime(Calendar mStartTime) {
this.mStartTime = mStartTime;
}
public String getTitle() {
return mTitle;
}
public void setTitle(String mTitle) {
this.mTitle = mTitle;
}
public String getDuration() {
return mDuration;
}
public void setDuration(String duration) {
this.mDuration = duration;
}
public boolean isPlaceHolder() {
return mPlaceHolder;
}
public void setPlaceHolder(boolean mPlaceHolder) {
this.mPlaceHolder = mPlaceHolder;
}
public boolean isWeather() {
return mWeather;
}
public void setWeather(boolean mWeather) {
this.mWeather = mWeather;
}
public IDayItem getDayReference() {
return mDayReference;
}
public void setDayReference(IDayItem mDayReference) {
this.mDayReference = mDayReference;
}
public IWeekItem getWeekReference() {
return mWeekReference;
}
public void setWeekReference(IWeekItem mWeekReference) {
this.mWeekReference = mWeekReference;
}
public String getWeatherIcon() {
return mWeatherIcon;
}
public void setWeatherIcon(String mWeatherIcon) {
this.mWeatherIcon = mWeatherIcon;
}
public double getTemperature() {
return mTemperature;
}
public void setTemperature(double mTemperature) {
this.mTemperature = mTemperature;
}
@Override
public CalendarEvent copy() {
return new BaseCalendarEvent(this);
}
// endregion
@Override
public String toString() {
return "BaseCalendarEvent{"
+ "title='"
+ mTitle
+ ", instanceDay= "
+ mInstanceDay.getTime()
+ "}";
}
}

View File

@ -0,0 +1,63 @@
package com.github.tibolte.agendacalendarview.models;
import java.util.Calendar;
public interface CalendarEvent {
void setPlaceholder(boolean placeholder);
boolean isPlaceholder();
public String getLocation();
public void setLocation(String mLocation);
long getId();
void setId(long mId);
boolean getShowBadge();
void setShowBadge(boolean mShowBadge);
int getTextColor();
void setTextColor(int mTextColor);
String getDescription();
void setDescription(String mDescription);
boolean isAllDay();
void setAllDay(boolean allDay);
Calendar getStartTime();
void setStartTime(Calendar mStartTime);
Calendar getEndTime();
void setEndTime(Calendar mEndTime);
String getTitle();
void setTitle(String mTitle);
Calendar getInstanceDay();
void setInstanceDay(Calendar mInstanceDay);
IDayItem getDayReference();
void setDayReference(IDayItem mDayReference);
IWeekItem getWeekReference();
void setWeekReference(IWeekItem mWeekReference);
CalendarEvent copy();
int getColor();
}

View File

@ -0,0 +1,145 @@
package com.github.tibolte.agendacalendarview.models;
import com.github.tibolte.agendacalendarview.CalendarManager;
import com.github.tibolte.agendacalendarview.utils.DateHelper;
import java.util.Calendar;
import java.util.Date;
/**
* Day model class.
*/
public class DayItem implements IDayItem {
private Date mDate;
private int mValue;
private int mDayOfTheWeek;
private boolean mToday;
private boolean mFirstDayOfTheMonth;
private boolean mSelected;
private String mMonth;
private boolean mShowBadge;
// region Constructor
public DayItem(Date date, int value, boolean today, String month) {
this.mDate = date;
this.mValue = value;
this.mToday = today;
this.mMonth = month;
}
// only for cleanDay
public DayItem() {
}
public DayItem(DayItem original) {
this.mDate = original.getDate();
this.mValue = original.getValue();
this.mToday = original.isToday();
this.mDayOfTheWeek = original.getDayOftheWeek();
this.mFirstDayOfTheMonth = original.isFirstDayOfTheMonth();
this.mSelected = original.isSelected();
this.mMonth = original.getMonth();
this.mShowBadge = original.mShowBadge;
}
// endregion
// region Getters/Setters
public Date getDate() {
return mDate;
}
public void setDate(Date date) {
this.mDate = date;
}
public int getValue() {
return mValue;
}
public void setValue(int value) {
this.mValue = value;
}
public boolean isToday() {
return mToday;
}
public void setToday(boolean today) {
this.mToday = today;
}
public boolean isSelected() {
return mSelected;
}
public void setSelected(boolean selected) {
this.mSelected = selected;
}
public boolean isFirstDayOfTheMonth() {
return mFirstDayOfTheMonth;
}
public void setFirstDayOfTheMonth(boolean firstDayOfTheMonth) {
this.mFirstDayOfTheMonth = firstDayOfTheMonth;
}
public String getMonth() {
return mMonth;
}
public void setMonth(String month) {
this.mMonth = month;
}
public int getDayOftheWeek() {
return mDayOfTheWeek;
}
public void setDayOftheWeek(int mDayOftheWeek) {
this.mDayOfTheWeek = mDayOftheWeek;
}
public void setShowBadge(boolean showBadge) {
this.mShowBadge = showBadge;
}
public boolean getShowBadge() {
return this.mShowBadge;
}
// region Public methods
public void buildDayItemFromCal(Calendar calendar) {
Date date = calendar.getTime();
this.mDate = date;
this.mValue = calendar.get(Calendar.DAY_OF_MONTH);
this.mToday = DateHelper.sameDate(calendar, CalendarManager.getInstance().getToday());
this.mMonth = CalendarManager.getInstance().getMonthHalfNameFormat().format(date);
if (this.mValue == 1) {
this.mFirstDayOfTheMonth = true;
}
}
// endregion
@Override
public String toString() {
return "DayItem{"
+ "Date='"
+ mDate.toString()
+ ", value="
+ mValue
+ '}';
}
@Override
public IDayItem copy() {
return new DayItem(this);
}
// endregion
}

View File

@ -0,0 +1,49 @@
package com.github.tibolte.agendacalendarview.models;
import java.util.Calendar;
import java.util.Date;
public interface IDayItem {
// region Getters/Setters
Date getDate();
void setDate(Date date);
int getValue();
void setValue(int value);
boolean isToday();
void setToday(boolean today);
boolean isSelected();
void setSelected(boolean selected);
boolean isFirstDayOfTheMonth();
void setFirstDayOfTheMonth(boolean firstDayOfTheMonth);
String getMonth();
void setMonth(String month);
int getDayOftheWeek();
void setDayOftheWeek(int mDayOftheWeek);
// endregion
void buildDayItemFromCal(Calendar calendar);
String toString();
IDayItem copy();
void setShowBadge(boolean showBadge);
boolean getShowBadge();
}

View File

@ -0,0 +1,34 @@
package com.github.tibolte.agendacalendarview.models;
import java.util.Date;
import java.util.List;
public interface IWeekItem {
int getWeekInYear();
void setWeekInYear(int weekInYear);
int getYear();
void setYear(int year);
int getMonth();
void setMonth(int month);
Date getDate();
void setDate(Date date);
String getLabel();
void setLabel(String label);
List<IDayItem> getDayItems();
void setDayItems(List<IDayItem> dayItems);
IWeekItem copy();
}

View File

@ -0,0 +1,110 @@
package com.github.tibolte.agendacalendarview.models;
import java.util.Date;
import java.util.List;
/**
* Week model class.
*/
public class WeekItem implements IWeekItem {
private int mWeekInYear;
private int mYear;
private int mMonth;
private Date mDate;
private String mLabel;
private List<IDayItem> mDayItems;
// region Constructor
public WeekItem(int weekInYear, int year, Date date, String label, int month) {
this.mWeekInYear = weekInYear;
this.mYear = year;
this.mDate = date;
this.mLabel = label;
this.mMonth = month;
}
public WeekItem(WeekItem original) {
this.mWeekInYear = original.getWeekInYear();
this.mYear = original.getYear();
this.mMonth = original.getMonth();
this.mDate = original.getDate();
this.mLabel = original.getLabel();
this.mDayItems = original.getDayItems();
}
public WeekItem(){
}
// endregion
// region Getters/Setters
public int getWeekInYear() {
return mWeekInYear;
}
public void setWeekInYear(int weekInYear) {
this.mWeekInYear = weekInYear;
}
public int getYear() {
return mYear;
}
public void setYear(int year) {
this.mYear = year;
}
public int getMonth() {
return mMonth;
}
public void setMonth(int month) {
this.mMonth = month;
}
public Date getDate() {
return mDate;
}
public void setDate(Date date) {
this.mDate = date;
}
public String getLabel() {
return mLabel;
}
public void setLabel(String label) {
this.mLabel = label;
}
public List<IDayItem> getDayItems() {
return mDayItems;
}
public void setDayItems(List<IDayItem> dayItems) {
this.mDayItems = dayItems;
}
@Override
public IWeekItem copy() {
return new WeekItem(this);
}
// endregion
@Override
public String toString() {
return "WeekItem{"
+ "label='"
+ mLabel
+ '\''
+ ", weekInYear="
+ mWeekInYear
+ ", year="
+ mYear
+ '}';
}
}

View File

@ -0,0 +1,82 @@
package com.github.tibolte.agendacalendarview.render;
import android.content.Context;
import android.content.res.Resources;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import android.graphics.Color;
import android.util.TypedValue;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.github.tibolte.agendacalendarview.R;
import com.github.tibolte.agendacalendarview.models.BaseCalendarEvent;
import com.google.android.material.internal.ViewUtils;
/**
* Class helping to inflate our default layout in the AgendaAdapter
*/
public class DefaultEventRenderer extends EventRenderer<BaseCalendarEvent> {
public static int themeAttributeToColor(int themeAttributeId,
Context context,
int fallbackColorId) {
TypedValue outValue = new TypedValue();
Resources.Theme theme = context.getTheme();
boolean wasResolved =
theme.resolveAttribute(
themeAttributeId, outValue, true);
if (wasResolved) {
return ContextCompat.getColor(
context, outValue.resourceId);
} else {
// fallback colour handling
return fallbackColorId;
}
}
// region class - EventRenderer
@Override
public void render(@NonNull View view, @NonNull BaseCalendarEvent event) {
CardView card = view.findViewById(R.id.view_agenda_event_card_view);
TextView txtTitle = view.findViewById(R.id.view_agenda_event_title);
TextView txtLocation = view.findViewById(R.id.view_agenda_event_location);
LinearLayout descriptionContainer = view.findViewById(R.id.view_agenda_event_description_container);
LinearLayout locationContainer = view.findViewById(R.id.view_agenda_event_location_container);
descriptionContainer.setVisibility(View.VISIBLE);
txtTitle.setText(event.getTitle());
txtLocation.setText(event.getLocation());
if (event.getLocation().length() > 0) {
locationContainer.setVisibility(View.VISIBLE);
txtLocation.setText(event.getLocation());
} else {
locationContainer.setVisibility(View.GONE);
}
if (!event.isPlaceholder()/*!event.getTitle().equals(view.getResources().getString(R.string.agenda_event_no_events))*/) {
txtTitle.setTextColor(event.getTextColor());
card.setCardBackgroundColor(event.getColor());
txtLocation.setTextColor(event.getTextColor());
}
else {
card.setCardBackgroundColor(Color.TRANSPARENT);
card.setCardElevation(0);
card.setBackgroundColor(Color.TRANSPARENT);
card.setRadius(0);
card.setBackgroundDrawable(null);
}
}
@Override
public int getEventLayout() {
return R.layout.view_agenda_event;
}
// endregion
}

View File

@ -0,0 +1,23 @@
package com.github.tibolte.agendacalendarview.render;
import androidx.annotation.LayoutRes;
import android.view.View;
import com.github.tibolte.agendacalendarview.models.CalendarEvent;
import java.lang.reflect.ParameterizedType;
/**
* Base class for helping layout rendering
*/
public abstract class EventRenderer<T extends CalendarEvent> {
public abstract void render(final View view, final T event);
@LayoutRes
public abstract int getEventLayout();
public Class<T> getRenderType() {
ParameterizedType type = (ParameterizedType) getClass().getGenericSuperclass();
return (Class<T>) type.getActualTypeArguments()[0];
}
}

View File

@ -0,0 +1,36 @@
package com.github.tibolte.agendacalendarview.utils;
import rx.Observable;
import rx.subjects.PublishSubject;
import rx.subjects.SerializedSubject;
import rx.subjects.Subject;
public class BusProvider {
public static BusProvider mInstance;
private final Subject<Object, Object> mBus = new SerializedSubject<>(PublishSubject.create());
// region Constructors
public static BusProvider getInstance() {
if (mInstance == null) {
mInstance = new BusProvider();
}
return mInstance;
}
// endregion
// region Public methods
public void send(Object object) {
mBus.onNext(object);
}
public Observable<Object> toObserverable() {
return mBus;
}
// endregion
}

View File

@ -0,0 +1,135 @@
package com.github.tibolte.agendacalendarview.utils;
import com.github.tibolte.agendacalendarview.CalendarManager;
import com.github.tibolte.agendacalendarview.R;
import com.github.tibolte.agendacalendarview.models.IWeekItem;
import android.content.Context;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
/**
* Class containing helper functions for dates
*/
public class DateHelper {
// region Public methods
/**
* Check if two Calendar instances have the same time (by month, year and day of month)
*
* @param cal The first Calendar instance.
* @param selectedDate The second Calendar instance.
* @return True if both instances have the same time.
*/
public static boolean sameDate(Calendar cal, Calendar selectedDate) {
return cal.get(Calendar.MONTH) == selectedDate.get(Calendar.MONTH)
&& cal.get(Calendar.YEAR) == selectedDate.get(Calendar.YEAR)
&& cal.get(Calendar.DAY_OF_MONTH) == selectedDate.get(Calendar.DAY_OF_MONTH);
}
/**
* Check if a Date instance and a Calendar instance have the same time (by month, year and day
* of month)
*
* @param cal The Calendar instance.
* @param selectedDate The Date instance.
* @return True if both have the same time.
*/
public static boolean sameDate(Calendar cal, Date selectedDate) {
Calendar selectedCal = Calendar.getInstance();
selectedCal.setTime(selectedDate);
return cal.get(Calendar.MONTH) == selectedCal.get(Calendar.MONTH)
&& cal.get(Calendar.YEAR) == selectedCal.get(Calendar.YEAR)
&& cal.get(Calendar.DAY_OF_MONTH) == selectedCal.get(Calendar.DAY_OF_MONTH);
}
/**
* Check if a Date instance is between two Calendar instances' dates (inclusively) in time.
*
* @param selectedDate The date to verify.
* @param startCal The start time.
* @param endCal The end time.
* @return True if the verified date is between the two specified dates.
*/
public static boolean isBetweenInclusive(Date selectedDate, Calendar startCal, Calendar endCal) {
Calendar selectedCal = Calendar.getInstance();
selectedCal.setTime(selectedDate);
// Check if we deal with the same day regarding startCal and endCal
return sameDate(selectedCal, startCal) || selectedCal.after(startCal) && selectedCal.before(endCal);
}
/**
* Check if Calendar instance's date is in the same week, as the WeekItem instance.
*
* @param cal The Calendar instance to verify.
* @param week The WeekItem instance to compare to.
* @return True if both instances are in the same week.
*/
public static boolean sameWeek(Calendar cal, IWeekItem week) {
return (cal.get(Calendar.WEEK_OF_YEAR) == week.getWeekInYear() && cal.get(Calendar.YEAR) == week.getYear());
}
/**
* Convert a millisecond duration to a string format
*
* @param millis A duration to convert to a string form
* @return A string of the form "Xd" or either "XhXm".
*/
public static String getDuration(Context context, long millis) {
if (millis < 0) {
throw new IllegalArgumentException("Duration must be greater than zero!");
}
long days = TimeUnit.MILLISECONDS.toDays(millis);
millis -= TimeUnit.DAYS.toMillis(days);
long hours = TimeUnit.MILLISECONDS.toHours(millis);
millis -= TimeUnit.HOURS.toMillis(hours);
long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
StringBuilder sb = new StringBuilder(64);
if (days > 0) {
sb.append(days);
sb.append(context.getResources().getString(R.string.agenda_event_day_duration));
return (sb.toString());
} else {
if (hours > 0) {
sb.append(hours);
sb.append("h");
}
if (minutes > 0) {
sb.append(minutes);
sb.append("m");
}
}
return (sb.toString());
}
/**
* Used for displaying the date in any section of the agenda view.
*
* @param calendar The date of the section.
* @param locale The locale used by the Sunrise calendar.
* @return The formatted date without the year included.
*/
public static String getYearLessLocalizedDate(Calendar calendar, Locale locale) {
SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat.getDateInstance(DateFormat.FULL, CalendarManager.getInstance().getLocale());
String pattern = sdf.toPattern();
String yearLessPattern = pattern.replaceAll("\\W?[Yy]+\\W?", "");
SimpleDateFormat yearLessSDF = new SimpleDateFormat(yearLessPattern, locale);
String yearLessDate = yearLessSDF.format(calendar.getTime()).toUpperCase();
if (yearLessDate.endsWith(",")) {
yearLessDate = yearLessDate.substring(0, yearLessDate.length() - 1);
}
return yearLessDate;
}
// endregion
}

View File

@ -0,0 +1,43 @@
package com.github.tibolte.agendacalendarview.utils;
import com.github.tibolte.agendacalendarview.models.IDayItem;
import java.util.Calendar;
/**
* Events emitted by the bus provider.
*/
public class Events {
public static class DayClickedEvent {
public Calendar mCalendar;
public IDayItem mDayItem;
public DayClickedEvent(IDayItem dayItem) {
this.mCalendar = Calendar.getInstance();
this.mCalendar.setTime(dayItem.getDate());
this.mDayItem = dayItem;
}
public Calendar getCalendar() {
return mCalendar;
}
public IDayItem getDay() {
return mDayItem;
}
}
public static class CalendarScrolledEvent {
}
public static class AgendaListViewTouchedEvent {
}
public static class EventsFetched {
}
public static class ForecastFetched {
}
}

View File

@ -0,0 +1,114 @@
package com.github.tibolte.agendacalendarview.utils;
import com.github.tibolte.agendacalendarview.agenda.AgendaListView;
import android.util.SparseArray;
import android.view.View;
/**
* Helper class calculating the scrolling distance in the AgendaListView.
*/
public class ListViewScrollTracker {
private AgendaListView mListView;
private SparseArray<Integer> mPositions;
private SparseArray<Integer> mListViewItemHeights = new SparseArray<>();
private int mFirstVisiblePosition;
private int mReferencePosition = -1; // Position of the current date in the Agenda listView
// region Constructor and Accessor(s)
public ListViewScrollTracker(AgendaListView listView) {
mListView = listView;
}
public int getReferencePosition() {
return mReferencePosition;
}
// endregion
// region Public methods
/**
* Call from an AbsListView.OnScrollListener to calculate the incremental offset (change in
* scroll offset
* since the last calculation).
*
* @param firstVisiblePosition First visible item position in the list.
* @param visibleItemCount Number of visible items in the list.
* @return The incremental offset, or 0 if it wasn't possible to calculate the offset.
*/
public int calculateIncrementalOffset(int firstVisiblePosition, int visibleItemCount) {
// Remember previous positions, if any
SparseArray<Integer> previousPositions = mPositions;
// Store new positions
mPositions = new SparseArray<>();
for (int i = 0; i < visibleItemCount; i++) {
mPositions.put(firstVisiblePosition + i, mListView.getListChildAt(i).getTop());
}
if (previousPositions != null) {
// Find position which exists in both mPositions and previousPositions, then return the difference
// of the new and old Y values.
for (int i = 0; i < previousPositions.size(); i++) {
int previousPosition = previousPositions.keyAt(i);
int previousTop = previousPositions.get(previousPosition);
Integer newTop = mPositions.get(previousPosition);
if (newTop != null) {
return newTop - previousTop;
}
}
}
return 0; // No view's position was in both previousPositions and mPositions
}
/**
* Call from an AbsListView.OnScrollListener to calculate the scrollY (Here
* we definite as the distance in pixels compared to the position representing the current
* date).
*
* @param firstVisiblePosition First visible item position in the list.
* @param visibleItemCount Number of visible items in the list.
* @return Distance in pixels compared to current day position (negative if firstVisiblePosition less than mReferencePosition)
*/
public int calculateScrollY(int firstVisiblePosition, int visibleItemCount) {
mFirstVisiblePosition = firstVisiblePosition;
if (mReferencePosition < 0) {
mReferencePosition = mFirstVisiblePosition;
}
if (visibleItemCount > 0) {
View c = mListView.getListChildAt(0); // this is the first visible row
int scrollY = -c.getTop();
mListViewItemHeights.put(firstVisiblePosition, c.getMeasuredHeight());
if (mFirstVisiblePosition >= mReferencePosition) {
for (int i = mReferencePosition; i < firstVisiblePosition; ++i) {
if (mListViewItemHeights.get(i) == null) {
mListViewItemHeights.put(i, c.getMeasuredHeight());
}
scrollY += mListViewItemHeights.get(i); // add all heights of the views that are gone
}
return scrollY;
} else {
for (int i = mReferencePosition - 1; i >= firstVisiblePosition; --i) {
if (mListViewItemHeights.get(i) == null) {
mListViewItemHeights.put(i, c.getMeasuredHeight());
}
scrollY -= mListViewItemHeights.get(i);
}
return scrollY;
}
}
return 0;
}
public void clear() {
mPositions = null;
}
// endregion
}

View File

@ -0,0 +1,110 @@
package com.github.tibolte.agendacalendarview.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
/**
* Floating action button helping to scroll back to the current date.
*/
public class FloatingActionButton extends com.google.android.material.floatingactionbutton.FloatingActionButton {
private static final int TRANSLATE_DURATION_MILLIS = 200;
private boolean mVisible = true;
private final Interpolator mInterpolator = new AccelerateDecelerateInterpolator();
// region Constructors
public FloatingActionButton(Context context) {
super(context);
}
public FloatingActionButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
// endregion
// region Overrides
@Override
public void show() {
show(true);
}
@Override
public void hide() {
hide(true);
}
// endregion
// region Public methods
public void show(boolean animate) {
toggle(true, animate, false);
}
public void hide(boolean animate) {
toggle(false, animate, false);
}
public boolean isVisible() {
return mVisible;
}
// endregion
// region Private methods
private void toggle(final boolean visible, final boolean animate, boolean force) {
if (mVisible != visible || force) {
mVisible = visible;
int height = getHeight();
if (height == 0 && !force) {
ViewTreeObserver vto = getViewTreeObserver();
if (vto.isAlive()) {
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
ViewTreeObserver currentVto = getViewTreeObserver();
if (currentVto.isAlive()) {
currentVto.removeOnPreDrawListener(this);
}
toggle(visible, animate, true);
return true;
}
});
return;
}
}
int translationY = visible ? 0 : height + getMarginBottom();
if (animate) {
animate().setInterpolator(mInterpolator)
.setDuration(TRANSLATE_DURATION_MILLIS)
.translationY(translationY);
} else {
setTranslationY(translationY);
}
}
}
private int getMarginBottom() {
int marginBottom = 0;
final ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
marginBottom = ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
}
return marginBottom;
}
// endregion
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke android:width="2dp" android:color="@color/theme_primary"/>
<solid android:color="@android:color/transparent" />
</shape>

View File

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) Kuba Szczodrzyński 2020-1-7.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#30000000"/>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#ffffff" />
</shape>

View File

@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M7,10H12V15H7M19,19H5V8H19M19,3H18V1H16V3H8V1H6V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3Z" />
</vector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke android:width="1dp" android:color="@color/theme_text_icons"/>
<solid android:color="@android:color/transparent" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:startColor="#88444444"
android:endColor="#00000000" />
</shape>

View File

@ -0,0 +1,48 @@
<?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:layout_height="wrap_content">
<LinearLayout
android:id="@+id/week_days_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<include layout="@layout/view_day_cell" />
<include layout="@layout/view_day_cell" />
<include layout="@layout/view_day_cell" />
<include layout="@layout/view_day_cell" />
<include layout="@layout/view_day_cell" />
<include layout="@layout/view_day_cell" />
<include layout="@layout/view_day_cell" />
</LinearLayout>
<FrameLayout
android:id="@+id/month_background"
android:layout_width="match_parent"
android:layout_height="@dimen/day_cell_height"
android:alpha="0"
android:background="@color/calendar_month_transparent_background" />
<TextView
android:id="@+id/month_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:alpha="0"
tools:alpha="1"
android:textColor="@android:color/black"
android:textSize="17sp"
android:textStyle="bold"
tools:text="MAJ" />
</RelativeLayout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<View
android:id="@+id/view_shadow"
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="@drawable/shadow"
android:visibility="visible"/>
<com.github.tibolte.agendacalendarview.agenda.AgendaListView
android:id="@+id/agenda_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animationCache="false"
android:divider="@color/agenda_list_header_divider"
android:dividerHeight="1dp"
android:overScrollMode="never"
android:scrollbars="none"
android:scrollingCache="false" />
</merge>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<com.github.tibolte.agendacalendarview.agenda.AgendaEventView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:id="@+id/view_agenda_event_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:cardBackgroundColor="@color/blue_selected"
app:cardCornerRadius="5dp">
<LinearLayout
android:id="@+id/view_agenda_event_description_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/view_agenda_event_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="16sp"
tools:text="sprawdzian - Biotechnologia" />
<LinearLayout
android:id="@+id/view_agenda_event_location_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/view_agenda_event_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/calendar_text_default"
android:textSize="12sp"
tools:text="9:05, biologia, Beata Pudełko, 1B3T" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</com.github.tibolte.agendacalendarview.agenda.AgendaEventView>

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<com.github.tibolte.agendacalendarview.agenda.AgendaHeaderView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/view_agenda_day_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="18sp"
android:visibility="visible" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp">
<View
android:id="@+id/view_day_circle_selected"
android:layout_width="@dimen/circle_day_size"
android:layout_height="@dimen/circle_day_size"
android:background="@drawable/agenda_day_circle"
android:visibility="invisible"
tools:visibility="visible" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/view_agenda_day_of_month"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="20sp"
tools:text="24" />
<TextView
android:id="@+id/view_agenda_day_of_week"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:textSize="12sp"
android:visibility="visible"
tools:text="śr." />
</LinearLayout>
</FrameLayout>
</FrameLayout>
</com.github.tibolte.agendacalendarview.agenda.AgendaHeaderView>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<com.github.tibolte.agendacalendarview.calendar.CalendarView
android:id="@+id/calendar_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.github.tibolte.agendacalendarview.agenda.AgendaView
android:id="@+id/agenda_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</com.github.tibolte.agendacalendarview.agenda.AgendaView>
<com.github.tibolte.agendacalendarview.widgets.FloatingActionButton
android:id="@+id/floating_action_button"
style="@style/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center" />
</merge>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:parentTag="LinearLayout"
tools:orientation="vertical">
<!-- Day names labels -->
<LinearLayout
android:id="@+id/cal_day_names"
android:layout_width="match_parent"
android:layout_height="@dimen/calendar_header_height"
android:orientation="horizontal">
<include layout="@layout/view_day_calendar_header" />
<include layout="@layout/view_day_calendar_header" />
<include layout="@layout/view_day_calendar_header" />
<include layout="@layout/view_day_calendar_header" />
<include layout="@layout/view_day_calendar_header" />
<include layout="@layout/view_day_calendar_header" />
<include layout="@layout/view_day_calendar_header" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="2dp"
android:background="#ff7f7f7f" />
<com.github.tibolte.agendacalendarview.calendar.weekslist.WeekListView
android:id="@+id/list_week"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="@android:color/transparent"
android:divider="@color/calendar_divider_color"
android:dividerHeight="1dp"
android:drawSelectorOnTop="false"
android:listSelector="@android:color/transparent"
android:overScrollMode="never"
android:scrollbars="none" />
</merge>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textColor="@android:color/white"
tools:text="pon." />

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="0dip"
android:layout_height="@dimen/day_cell_height"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/view_day_month_label"
style="@style/CalendarCellText"
android:visibility="gone"
tools:text="maj" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:id="@+id/view_day_circle_selected"
android:layout_width="@dimen/circle_selected_size"
android:layout_height="@dimen/circle_selected_size"
android:background="@drawable/selected_day_color_circle"
android:visibility="gone" />
<TextView
android:id="@+id/view_day_day_label"
style="@style/CalendarCellText"
android:layout_gravity="center"
tools:text="1" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_gravity="bottom"
android:gravity="center"
android:orientation="horizontal">
<View
android:id="@+id/view_day_event_indicator3"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="3dp"
android:layout_marginLeft="3dp"
android:background="@drawable/event_color_circle"
android:visibility="invisible" />
<View
android:id="@+id/view_day_event_indicator2"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="3dp"
android:layout_marginLeft="3dp"
android:background="@drawable/event_color_circle"
android:visibility="invisible" />
<View
android:id="@+id/view_day_event_indicator1"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="3dp"
android:layout_marginLeft="3dp"
android:background="@drawable/event_color_circle"
android:visibility="invisible" />
</LinearLayout>
</FrameLayout>
</LinearLayout>

View File

@ -0,0 +1,12 @@
<resources>
<!-- Agenda -->
<string name="today">Today</string>
<string name="tomorrow">Tomorrow</string>
<string name="agenda_event_day_duration">d</string>
<string name="agenda_event_all_day">All day</string>
<string name="agenda_event_no_events">No events</string>
<!-- Weather -->
<string name="month_name_format">LLLL</string>
<string name="month_half_name_format">MMM</string>
</resources>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ColorOptionsView">
<attr name="agendaCurrentDayTextColor" format="color" />
<attr name="calendarHeaderColor" format="color" />
<attr name="calendarHeaderTextColor" format="color" />
<attr name="calendarColor" format="color" />
<attr name="calendarDayTextColor" format="color" />
<attr name="calendarPastDayTextColor" format="color" />
<attr name="calendarCurrentDayTextColor" format="color" />
<attr name="fabColor" format="color" />
</declare-styleable>
</resources>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Colors for Calendar view -->
<color name="calendar_text_current_day">#000000</color>
<color name="calendar_text_default">#9C9CA0</color>
<color name="calendar_month_transparent_background">#CCFFFFFF</color>
<color name="calendar_divider_color">#F3F3F3</color>
<!-- Colors for Agenda view -->
<!--<color name="agenda_list_header_divider">#666666</color>-->
<color name="agenda_list_header_divider">#00000000</color>
<!-- General -->
<color name="blue_selected">#2196F3</color>
<color name="theme_primary_dark">#1976D2</color>
<color name="theme_primary">#2196F3</color>
<color name="theme_light_primary">#BBDEFB</color>
<color name="theme_accent">#4caf50</color>
<color name="theme_text_icons">#FFFFFF</color>
</resources>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Calendar values -->
<dimen name="calendar_header_height">20dp</dimen>
<dimen name="day_cell_height">52dp</dimen>
<dimen name="text_day_size">14dp</dimen>
<dimen name="circle_selected_size">32dp</dimen>
<!-- Agenda values -->
<dimen name="circle_day_size">60dp</dimen>
<!-- Floating action button values -->
<!--<dimen name="fab_size">56dp</dimen>-->
<dimen name="agenda_event_view_padding_left">70dp</dimen>
<dimen name="agenda_event_view_padding_top">5dp</dimen>
<dimen name="agenda_event_view_padding_right">15dp</dimen>
<dimen name="agenda_event_view_padding_bottom">5dp</dimen>
</resources>

View File

@ -0,0 +1,14 @@
<resources>
<!-- Calendar -->
<string name="month_name_format">LLLL</string>
<string name="day_name_format" translatable="false">E</string>
<!-- Agenda -->
<string name="today">Dziś</string>
<string name="tomorrow">Jutro</string>
<string name="agenda_event_day_duration">d</string>
<string name="agenda_event_all_day">Cały dzień</string>
<string name="agenda_event_no_events">Brak wydarzeń</string>
<string name="month_half_name_format">MMM</string>
</resources>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Calendar styles -->
<style name="CalendarCellText">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:textColor">@color/calendar_text_default</item>
<item name="android:textStyle">normal</item>
<item name="android:textSize">@dimen/text_day_size</item>
</style>
<!-- Agenda styles -->
<!-- FAB -->
<style name="fab">
<item name="android:src">@drawable/fab_arrow</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_gravity">bottom|start</item>
<item name="android:layout_margin">16dp</item>
<item name="elevation">8dp</item>
<item name="fabSize">normal</item>
<item name="pressedTranslationZ">6dp</item>
</style>
</resources>

View File

@ -1,231 +1,176 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply from: 'git-info.gradle'
apply plugin: 'io.fabric'
android {
compileSdkVersion setup.compileSdk
signingConfigs {
}
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId 'pl.szczodrzynski.edziennik'
minSdkVersion setup.minSdk
targetSdkVersion setup.targetSdk
versionCode release.versionCode
versionName release.versionName
buildConfigField "java.util.Map<String, String>", "GIT_INFO", gitInfoMap
buildConfigField "String", "VERSION_BASE", "\"${release.versionName}\""
manifestPlaceholders = [
buildTimestamp: String.valueOf(System.currentTimeMillis())
]
multiDexEnabled = true
externalNativeBuild {
cmake {
cppFlags "-std=c++11"
multiDexEnabled true
}
}
kapt {
arguments {
arg("room.schemaLocation", "$projectDir/schemas")
}
}
}
buildTypes {
applicationVariants.all { variant ->
variant.outputs.all {
if (variant.buildType.name == "release") {
outputFileName = "Edziennik_" + defaultConfig.versionName + ".apk"
} else if (variant.buildType.name == "debugMinify") {
outputFileName = "Edziennik_" + defaultConfig.versionName + "_debugMinify.apk"
} else {
outputFileName = "Edziennik_" + defaultConfig.versionName + "_debug.apk"
}
}
}
debug {
getIsDefault().set(true)
minifyEnabled = false
manifestPlaceholders = [
buildTimestamp: 0
]
minifyEnabled false
}
release {
minifyEnabled = true
shrinkResources = true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt')
proguardFiles fileTree('proguard').asList().toArray()
}
}
flavorDimensions "platform"
productFlavors {
unofficial {
getIsDefault().set(true)
versionName "${release.versionName}-${gitInfo.versionSuffix}"
dependencies {
implementation "com.google.firebase:firebase-core:${versions.firebase}"
}
official {}
play {}
}
variantFilter { variant ->
def flavors = variant.flavors*.name
setIgnore(variant.buildType.name == "debug" && !flavors.contains("unofficial") || flavors.contains("main"))
}
sourceSets {
unofficial {
java.srcDirs = ["src/main/java", "src/play-not/java"]
manifest.srcFile("src/play-not/AndroidManifest.xml")
}
official {
java.srcDirs = ["src/main/java", "src/play-not/java"]
manifest.srcFile("src/play-not/AndroidManifest.xml")
}
play {
java.srcDirs = ["src/main/java", "src/play/java"]
}
}
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
buildFeatures {
dataBinding = true
viewBinding = true
lintOptions {
checkReleaseBuilds false
}
dataBinding {
enabled = true
}
compileOptions {
coreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility '1.8'
targetCompatibility '1.8'
}
productFlavors {
}
kotlinOptions {
jvmTarget = "1.8"
}
packagingOptions {
resources {
excludes += ['META-INF/library-core_release.kotlin_module']
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.10.2"
}
}
lint {
checkReleaseBuilds false
exclude 'META-INF/library-core_release.kotlin_module'
}
}
/*task finalizeBundleDebug(type: Copy) {
from("debug/debug")
include "app.aab"
destinationDir file("debug/debug")
rename "app.aab", "Edziennik_debug.aab"
}
// it finalizes :bundleRelease
task finalizeBundleRelease(type: Copy) {
from("release/release")
include "app.aab"
destinationDir file("release/release")
rename "app.aab", "Edziennik_${android.defaultConfig.versionCode}.aab"
}*/
/*
// this adds the above two tasks
tasks.whenTaskAdded { task ->
if (!task.name.endsWith("Release") && !task.name.endsWith("ReleaseWithR8"))
return
def renameTaskName = "rename${task.name.capitalize()}"
def flavor = ""
if (task.name.startsWith("bundle"))
flavor = task.name.substring("bundle".length(), task.name.indexOf("Release")).uncapitalize()
if (task.name.startsWith("assemble"))
flavor = task.name.substring("assemble".length(), task.name.indexOf("Release")).uncapitalize()
if (task.name.startsWith("minify"))
flavor = task.name.substring("minify".length(), task.name.indexOf("Release")).uncapitalize()
if (flavor != "") {
tasks.create(renameTaskName, Copy) {
from file("${projectDir}/${flavor}/release/"),
file("${buildDir}/outputs/mapping/${flavor}Release/"),
file("${buildDir}/outputs/apk/${flavor}/release/"),
file("${buildDir}/outputs/bundle/${flavor}Release/")
include "*.aab", "*.apk", "mapping.txt", "output-metadata.json"
destinationDir file("${projectDir}/release/")
rename ".+?\\.(.+)", "Edziennik_${android.defaultConfig.versionName}_${flavor}." + '$1'
}
task.finalizedBy(renameTaskName)
}
if (task.name == "bundleDebug") {
task.finalizedBy finalizeBundleDebug
} else if (task.name == "bundleRelease") {
task.finalizedBy finalizeBundleRelease
}
}*/
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Language cores
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.multidex:multidex:2.0.1"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
kapt "androidx.room:room-compiler:${versions.room}"
debugImplementation "com.amitshekhar.android:debug-db:1.0.5"
// Android Jetpack
implementation "androidx.appcompat:appcompat:1.5.1"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.core:core-ktx:1.9.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"
implementation "androidx.navigation:navigation-fragment-ktx:2.5.2"
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.room:room-runtime:2.4.3"
implementation "androidx.room:room-ktx:2.4.3"
implementation "androidx.work:work-runtime-ktx:2.7.1"
kapt "androidx.room:room-compiler:2.4.3"
implementation "android.arch.navigation:navigation-fragment-ktx:${versions.navigationFragment}"
implementation "androidx.appcompat:appcompat:${versions.appcompat}"
implementation "androidx.cardview:cardview:${versions.cardView}"
implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}"
implementation "androidx.core:core-ktx:${versions.ktx}"
implementation "androidx.gridlayout:gridlayout:${versions.gridLayout}"
implementation "androidx.legacy:legacy-support-v4:${versions.legacy}"
implementation "androidx.lifecycle:lifecycle-livedata:${versions.lifecycle}"
implementation "androidx.recyclerview:recyclerview:${versions.recyclerView}"
implementation "androidx.room:room-runtime:${versions.room}"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
// Google design libs
implementation "com.google.android.material:material:1.6.1"
implementation "com.google.android.flexbox:flexbox:3.0.0"
implementation "com.google.android.gms:play-services-wearable:${versions.play_services}"
implementation "com.google.android.material:material:${versions.material}"
implementation "com.google.firebase:firebase-messaging:${versions.firebasemessaging}"
// Play Services/Firebase
implementation "com.google.android.gms:play-services-wearable:17.1.0"
implementation("com.google.firebase:firebase-core") { version { strictly "19.0.2" } }
implementation "com.google.firebase:firebase-crashlytics:18.2.13"
implementation("com.google.firebase:firebase-messaging") { version { strictly "20.1.3" } }
//implementation "com.github.kuba2k2.MaterialDrawer:library:e603091449"
implementation "com.mikepenz:crossfader:1.6.0" // do not update
implementation "com.mikepenz:iconics-core:${versions.iconics}"
implementation "com.mikepenz:iconics-views:${versions.iconics}"
implementation "com.mikepenz:community-material-typeface:${versions.font_cmd}@aar"
// OkHttp, Retrofit, Gson, Jsoup
implementation("com.squareup.okhttp3:okhttp") { version { strictly "3.12.13" } }
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
implementation 'com.google.code.gson:gson:2.8.8'
implementation 'org.jsoup:jsoup:1.14.3'
implementation "pl.droidsonroids:jspoon:1.3.2"
implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2"
implementation "com.github.kuba2k2:NavLib:${versions.navlib}"
// Szkolny.eu libraries/forks
implementation "eu.szkolny:android-snowfall:1ca9ea2da3"
implementation "eu.szkolny:agendacalendarview:1.0.4"
implementation "eu.szkolny:cafebar:5bf0c618de"
implementation "eu.szkolny.fslogin:lib:2.0.0"
implementation "eu.szkolny:material-about-library:1d5ebaf47c"
implementation "eu.szkolny:mhttp:af4b62e6e9"
implementation "eu.szkolny:nachos:0e5dfcaceb"
implementation "eu.szkolny.selective-dao:annotation:27f8f3f194"
officialImplementation "eu.szkolny:ssl-provider:1.0.0"
unofficialImplementation "eu.szkolny:ssl-provider:1.0.0"
implementation "pl.szczodrzynski:navlib:0.8.0"
implementation "pl.szczodrzynski:numberslidingpicker:2921225f76"
implementation "pl.szczodrzynski:recyclertablayout:700f980584"
implementation "pl.szczodrzynski:tachyon:551943a6b5"
kapt "eu.szkolny.selective-dao:codegen:27f8f3f194"
implementation "com.afollestad.material-dialogs:commons:${versions.materialdialogs}"
implementation "com.afollestad.material-dialogs:core:${versions.materialdialogs}"
// Iconics & related
implementation "com.mikepenz:iconics-core:5.3.2"
implementation "com.mikepenz:iconics-views:5.3.2"
implementation "com.mikepenz:community-material-typeface:5.8.55.0-kotlin@aar"
implementation "eu.szkolny:szkolny-font:77e33acc2a"
// Other dependencies
implementation "cat.ereza:customactivityoncrash:2.3.0"
implementation "com.android.volley:volley:1.2.1"
implementation "cat.ereza:customactivityoncrash:2.2.0"
implementation "com.applandeo:material-calendar-view:1.5.0"
implementation "com.crashlytics.sdk.android:crashlytics:2.10.1"
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
implementation "com.github.Applandeo:Material-Calendar-View:15de569cbc" // https://github.com/Applandeo/Material-Calendar-View
implementation "com.github.CanHub:Android-Image-Cropper:2.2.2" // https://github.com/CanHub/Android-Image-Cropper
implementation "com.github.ChuckerTeam.Chucker:library:3.5.2" // https://github.com/ChuckerTeam/chucker
implementation "com.github.antonKozyriatskyi:CircularProgressIndicator:1.2.2" // https://github.com/antonKozyriatskyi/CircularProgressIndicator
implementation "com.github.bassaer:chatmessageview:2.0.1" // https://github.com/bassaer/ChatMessageView
implementation "com.github.hypertrack:hyperlog-android:0.0.10" // https://github.com/hypertrack/hyperlog-android
implementation "com.github.smuyyh:JsonViewer:V1.0.6" // https://github.com/smuyyh/JsonViewer
implementation "com.github.underwindfall.PowerPermission:powerpermission-coroutines:1.4.0" // https://github.com/underwindfall/PowerPermission
implementation "com.github.underwindfall.PowerPermission:powerpermission:1.4.0" // https://github.com/underwindfall/PowerPermission
implementation "com.github.wulkanowy.uonet-request-signer:hebe-jvm:a99ca50a31" // https://github.com/wulkanowy/uonet-request-signer
implementation "com.jaredrummler:colorpicker:1.1.0"
implementation "io.coil-kt:coil:1.1.1"
implementation "com.evernote:android-job:1.2.6"
implementation "com.github.antonKozyriatskyi:CircularProgressIndicator:1.2.2"
implementation "com.github.bassaer:chatmessageview:2.0.1"
implementation("com.github.ozodrukh:CircularReveal:2.0.1@aar") {transitive = true}
implementation "com.heinrichreimersoftware:material-intro:1.5.8" // do not update
implementation "com.jaredrummler:colorpicker:1.0.2"
implementation "com.squareup.okhttp3:okhttp:3.12.0"
implementation "com.theartofdev.edmodo:android-image-cropper:2.8.0" // do not update
implementation "com.wdullaer:materialdatetimepicker:4.1.2"
implementation "com.yuyh.json:jsonviewer:1.0.6"
implementation "me.dm7.barcodescanner:zxing:1.9.8"
implementation "me.grantland:autofittextview:0.2.1"
implementation "me.leolin:ShortcutBadger:1.1.22@aar"
implementation "org.greenrobot:eventbus:3.2.0"
implementation("com.heinrichreimersoftware:material-intro") { version { strictly "1.5.8" } }
implementation("pl.droidsonroids.gif:android-gif-drawable") { version { strictly "1.2.15" } }
implementation "org.greenrobot:eventbus:3.1.1"
implementation "org.jsoup:jsoup:1.10.1"
implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.15"
//implementation "se.emilsjolander:stickylistheaders:2.7.0"
implementation 'com.github.edisonw:StickyListHeaders:master-SNAPSHOT@aar'
implementation "uk.co.samuelwall:material-tap-target-prompt:2.14.0"
// Debug-only dependencies
debugImplementation "com.github.amitshekhariitbhu.Android-Debug-Database:debug-db:v1.0.6"
implementation project(":agendacalendarview")
implementation project(":cafebar")
implementation project(":material-about-library")
implementation project(":mhttp")
implementation project(":nachos")
//implementation project(":Navigation")
implementation project(":szkolny-font")
debugImplementation "com.github.ChuckerTeam.Chucker:library:3.0.1"
releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:3.0.1"
//implementation 'com.github.wulkanowy:uonet-request-signer:master-SNAPSHOT'
//implementation 'com.github.kuba2k2.uonet-request-signer:android:master-63f094b14a-1'
implementation "org.redundent:kotlin-xml-builder:1.5.3"
implementation "io.github.wulkanowy:signer-android:0.1.1"
implementation "androidx.work:work-runtime-ktx:${versions.work}"
api "com.google.dagger:dagger:${versions.dagger}"
api "com.google.dagger:dagger-android-support:${versions.dagger}"
kapt "com.google.dagger:dagger-compiler:${versions.dagger}"
kapt "com.google.dagger:dagger-android-processor:${versions.dagger}"
}
repositories {
mavenCentral()
}

View File

@ -1,124 +0,0 @@
/*
* Copyright (c) Kuba Szczodrzyński 2021-3-27.
*/
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "org.eclipse.jgit:org.eclipse.jgit:5.5.+"
}
}
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.errors.RepositoryNotFoundException
import org.eclipse.jgit.lib.Constants
import org.eclipse.jgit.lib.Ref
import org.eclipse.jgit.lib.Repository
import org.eclipse.jgit.revwalk.RevCommit
import org.eclipse.jgit.revwalk.RevTag
import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
private def getGit() {
Repository repo
try {
repo = new FileRepositoryBuilder()
.readEnvironment()
.findGitDir(project.projectDir)
.build()
} catch (IllegalArgumentException | RepositoryNotFoundException ignore) {
def logger = LoggerFactory.getLogger("androidGitVersion")
logger.error("No git repository reachable from ${project.projectDir}")
return results
}
return Git.wrap(repo)
}
private static def getTags(Repository repo, Git git) {
RevWalk walk = new RevWalk(repo)
def tags = git.tagList().call().findResults { ref ->
def obj = walk.parseAny(ref.getObjectId())
def name = null
if (obj instanceof RevTag) {
name = obj.getTagName()
} else if (obj instanceof RevCommit) {
name = Repository.shortenRefName(ref.name)
}
[obj.id, name]
}
walk.close()
return tags
}
private static def getLastTag(Repository repo, Git git, Ref head) {
def tags = getTags(repo, git)
RevWalk revs = new RevWalk(repo)
revs.markStart(revs.parseCommit(head.getObjectId()))
def revCount = 0
Collection<List> commitTags = null
for (RevCommit commit : revs) {
def tagsHere = tags.findAll { (it[0] == commit.id) }
if (tagsHere) {
commitTags = tagsHere.stream().map {
[it[0].name, it[1], revCount]
}.toArray()
break
}
revCount++
}
return commitTags.last()
}
private def buildGitInfo() {
Git git = getGit()
Repository repo = git.repository
def head = repo.findRef(Constants.HEAD).target
def remotes = git.remoteList().call()
.stream()
.map {
it.name + "(" + it.URIs.stream()
.map { it.rawPath.stripMargin('/').replace(".git", "") }
.toArray()
.join(", ") + ")"
}
.toArray()
.join("; ")
def status = git.status().call()
def dirty = status.hasUncommittedChanges()
def tag = getLastTag(repo, git, head)
def tagName = tag[1]
def tagRevCount = tag[2]
def result = [
hash : head.objectId.name,
branch : repo.branch,
dirty : dirty,
remotes : remotes,
unstaged : status.uncommittedChanges.join("; "),
tag : tagName,
revCount : tagRevCount,
version : """$tagName-$tagRevCount-g${head.objectId.name.substring(0, 8)}""" + (dirty ? ".dirty" : ""),
versionSuffix : """${repo.branch.replace("/", "_")}""" + (dirty ? ".dirty" : "")
]
return result
}
private static def getMapString(map) {
def hashMap = "new java.util.HashMap<String, String>() { {\n"
map.each { k, v -> hashMap += """\tput("${k}", "${v}");\n""" }
return hashMap + "} }"
}
ext {
gitInfo = buildGitInfo()
gitInfoMap = getMapString(gitInfo)
}

Binary file not shown.

View File

@ -1,78 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class android.support.v7.widget.** { *; }
-keep class pl.szczodrzynski.edziennik.utils.models.** { *; }
-keep class pl.szczodrzynski.edziennik.data.db.enums.* { *; }
-keep class pl.szczodrzynski.edziennik.data.db.entity.Event { *; }
-keep class pl.szczodrzynski.edziennik.data.db.full.EventFull { *; }
-keep class pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage { *; }
-keep class pl.szczodrzynski.edziennik.data.db.entity.Note { *; }
-keep class pl.szczodrzynski.edziennik.ui.home.HomeCardModel { *; }
-keepclassmembers class pl.szczodrzynski.edziennik.ui.widgets.WidgetConfig { public *; }
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.timetable.WidgetTimetableProvider
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.notifications.WidgetNotificationsProvider
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.luckynumber.WidgetLuckyNumberProvider
-keep class pl.szczodrzynski.edziennik.config.AppData { *; }
-keep class pl.szczodrzynski.edziennik.config.AppData$** { *; }
-keep class pl.szczodrzynski.edziennik.utils.managers.TextStylingManager$HtmlMode { *; }
-keepnames class androidx.appcompat.view.menu.MenuBuilder { setHeaderTitleInt(java.lang.CharSequence); }
-keepnames class androidx.appcompat.view.menu.MenuPopupHelper { showPopup(int, int, boolean, boolean); }
-keepclassmembernames class androidx.appcompat.view.menu.StandardMenuPopup { private *; }
-keepclassmembernames class androidx.appcompat.view.menu.MenuItemImpl { private *; }
-keepclassmembernames class com.mikepenz.materialdrawer.widget.MiniDrawerSliderView { private *; }
-keep class .R
-keep class **.R$* {
<fields>;
}
-keepattributes SourceFile,LineNumberTable
#-printmapping mapping.txt
-keep class okhttp3.** { *; }
-keep class com.google.android.material.tabs.** {*;}
# ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
# Most of volatile fields are updated with AFU and should not be mangled
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}
-keepclasseswithmembernames class * {
native <methods>;
}
-keep class pl.szczodrzynski.edziennik.data.api.szkolny.interceptor.Signing { public final byte[] pleaseStopRightNow(java.lang.String, long); }
-keepclassmembers class pl.szczodrzynski.edziennik.data.api.szkolny.request.** { *; }
-keepclassmembers class pl.szczodrzynski.edziennik.data.api.szkolny.response.** { *; }
-keepclassmembernames class pl.szczodrzynski.edziennik.ui.login.LoginInfo$Platform { *; }
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData { *; }
-keepclassmembernames class pl.szczodrzynski.fslogin.realm.RealmData$Type { *; }

View File

@ -0,0 +1,14 @@
-dontwarn com.evernote.android.job.gcm.**
-dontwarn com.evernote.android.job.GcmAvailableHelper
-dontwarn com.evernote.android.job.work.**
-dontwarn com.evernote.android.job.WorkManagerAvailableHelper
-keep public class com.evernote.android.job.v21.PlatformJobService
-keep public class com.evernote.android.job.v14.PlatformAlarmService
-keep public class com.evernote.android.job.v14.PlatformAlarmReceiver
-keep public class com.evernote.android.job.JobBootReceiver
-keep public class com.evernote.android.job.JobRescheduleService
-keep public class com.evernote.android.job.gcm.PlatformGcmService
-keep public class com.evernote.android.job.work.PlatformWorker
-keep class com.evernote.android.job.** { *; }

42
app/proguard/app.pro Normal file
View File

@ -0,0 +1,42 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class android.support.v7.widget.** { *; }
-keep class pl.szczodrzynski.edziennik.utils.models.** { *; }
-keep class pl.szczodrzynski.edziennik.data.db.modules.events.Event { *; }
-keep class pl.szczodrzynski.edziennik.data.db.modules.events.EventFull { *; }
-keepclassmembers class pl.szczodrzynski.edziennik.widgets.WidgetConfig { public *; }
-keepnames class pl.szczodrzynski.edziennik.WidgetTimetable
-keepnames class pl.szczodrzynski.edziennik.notifications.WidgetNotifications
-keepnames class pl.szczodrzynski.edziennik.luckynumber.WidgetLuckyNumber
-keep class .R
-keep class **.R$* {
<fields>;
}
-keepattributes SourceFile,LineNumberTable
#-printmapping mapping.txt
-keep class okhttp3.** { *; }
-keep class com.google.android.material.tabs.** {*;}

1
app/proguard/blurry.pro Normal file
View File

@ -0,0 +1 @@
-keep class android.support.v8.renderscript.** { *; }

25
app/proguard/cafebar.pro Normal file
View File

@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\AndroidSDK/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}
-keep class android.support.v7.graphics.** { *; }
-dontwarn android.support.v7.graphics.**
-keep class android.support.design.widget.** { *; }
-keep interface android.support.design.widget.** { *; }
-dontwarn android.support.design.**

14
app/proguard/iconics.pro Normal file
View File

@ -0,0 +1,14 @@
# Android iconics library - https://github.com/mikepenz/Android-Iconics
# Warning: works ONLY with iconics > 1.0.0
#
# Tested on gradle config:
#
# compile 'com.mikepenz:iconics-core:1.7.1@aar'
#
-keep class com.mikepenz.iconics.** { *; }
-keep class com.mikepenz.community_material_typeface_library.CommunityMaterial
-keep class com.mikepenz.fontawesome_typeface_library.FontAwesome
-keep class com.mikepenz.google_material_typeface_library.GoogleMaterial
-keep class com.mikepenz.meteocons_typeface_library.Meteoconcs
-keep class com.mikepenz.octicons_typeface_library.Octicons

48
app/proguard/mhttp.pro Normal file
View File

@ -0,0 +1,48 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/wangchao/Work/android-sdk/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-dontwarn im.wangchao.**
-dontwarn okio.**
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
-keep class im.wangchao.** { *; }
-keep class **_HttpBinder { *; }
-keepclasseswithmembernames class * {
@im.wangchao.* <fields>;
}
-keepclasseswithmembernames class * {
@im.wangchao.* <methods>;
}
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# okhttp
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn javax.annotation.**
-dontwarn org.conscrypt.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
# If you do not use Rx:
-dontwarn rx.**

View File

@ -0,0 +1 @@
-keep class com.mikepenz.szkolny_font_typeface_library.SzkolnyFont { *; }

21
app/proguard/wear.pro Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,5 +0,0 @@
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF4caf50"
android:pathData="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/>
</vector>

View File

@ -1,13 +0,0 @@
<!--
~ Copyright (c) Kuba Szczodrzyński 2019-12-28.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M13.5,15.5H10V12.5H13.5A1.5,1.5 0,0 1,15 14A1.5,1.5 0,0 1,13.5 15.5M10,6.5H13A1.5,1.5 0,0 1,14.5 8A1.5,1.5 0,0 1,13 9.5H10M15.6,10.79C16.57,10.11 17.25,9 17.25,8C17.25,5.74 15.5,4 13.25,4H7V18H14.04C16.14,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79Z"/>
</vector>

View File

@ -1,13 +0,0 @@
<!--
~ Copyright (c) Kuba Szczodrzyński 2019-12-28.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M5,21H19V19H5V21M12,17A6,6 0,0 0,18 11V3H15.5V11A3.5,3.5 0,0 1,12 14.5A3.5,3.5 0,0 1,8.5 11V3H6V11A6,6 0,0 0,12 17Z"/>
</vector>

View File

@ -1,13 +0,0 @@
<!--
~ Copyright (c) Kuba Szczodrzyński 2019-11-25.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,8A4,4 0,0 1,16 12A4,4 0,0 1,12 16A4,4 0,0 1,8 12A4,4 0,0 1,12 8M12,10A2,2 0,0 0,10 12A2,2 0,0 0,12 14A2,2 0,0 0,14 12A2,2 0,0 0,12 10M10,22C9.75,22 9.54,21.82 9.5,21.58L9.13,18.93C8.5,18.68 7.96,18.34 7.44,17.94L4.95,18.95C4.73,19.03 4.46,18.95 4.34,18.73L2.34,15.27C2.21,15.05 2.27,14.78 2.46,14.63L4.57,12.97L4.5,12L4.57,11L2.46,9.37C2.27,9.22 2.21,8.95 2.34,8.73L4.34,5.27C4.46,5.05 4.73,4.96 4.95,5.05L7.44,6.05C7.96,5.66 8.5,5.32 9.13,5.07L9.5,2.42C9.54,2.18 9.75,2 10,2H14C14.25,2 14.46,2.18 14.5,2.42L14.87,5.07C15.5,5.32 16.04,5.66 16.56,6.05L19.05,5.05C19.27,4.96 19.54,5.05 19.66,5.27L21.66,8.73C21.79,8.95 21.73,9.22 21.54,9.37L19.43,11L19.5,12L19.43,13L21.54,14.63C21.73,14.78 21.79,15.05 21.66,15.27L19.66,18.73C19.54,18.95 19.27,19.04 19.05,18.95L16.56,17.95C16.04,18.34 15.5,18.68 14.87,18.93L14.5,21.58C14.46,21.82 14.25,22 14,22H10M11.25,4L10.88,6.61C9.68,6.86 8.62,7.5 7.85,8.39L5.44,7.35L4.69,8.65L6.8,10.2C6.4,11.37 6.4,12.64 6.8,13.8L4.68,15.36L5.43,16.66L7.86,15.62C8.63,16.5 9.68,17.14 10.87,17.38L11.24,20H12.76L13.13,17.39C14.32,17.14 15.37,16.5 16.14,15.62L18.57,16.66L19.32,15.36L17.2,13.81C17.6,12.64 17.6,11.37 17.2,10.2L19.31,8.65L18.56,7.35L16.15,8.39C15.38,7.5 14.32,6.86 13.12,6.62L12.75,4H11.25Z"/>
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,19 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="pl.szczodrzynski.edziennik">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<!-- PowerPermission uses minSdk 21, it's safe to override as it is used only in >= 23 -->
<uses-sdk tools:overrideLibrary="com.qifan.powerpermission.coroutines, com.qifan.powerpermission.core" />
<application
android:name=".App"
android:allowBackup="true"
@ -23,26 +10,16 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme.Dark"
android:theme="@style/SplashTheme"
android:usesCleartextTraffic="true"
tools:ignore="UnusedAttribute">
<meta-data android:name="buildTimestamp" android:value="${buildTimestamp}" />
<!-- __ __ _ _ _ _ _
| \/ | (_) /\ | | (_) (_) |
| \ / | __ _ _ _ __ / \ ___| |_ ___ ___| |_ _ _
| |\/| |/ _` | | '_ \ / /\ \ / __| __| \ \ / / | __| | | |
| | | | (_| | | | | | / ____ \ (__| |_| |\ V /| | |_| |_| |
|_| |_|\__,_|_|_| |_| /_/ \_\___|\__|_| \_/ |_|\__|\__, |
__/ |
|___/ -->
<activity android:name=".MainActivity"
android:configChanges="orientation|screenSize"
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
android:launchMode="singleTop"
android:exported="true"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -51,7 +28,63 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeActivity"
android:configChanges="orientation|screenSize"
android:label="@string/messages_compose_title"
android:theme="@style/AppTheme.Black" />
<activity
android:name=".ui.modules.feedback.FeedbackActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="@string/app_name"
android:theme="@style/AppTheme" />
<activity
android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleTop"
android:theme="@style/AppTheme.Light" />
<activity
android:name=".ui.modules.intro.ChangelogIntroActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:theme="@style/Theme.Intro" />
<!--
______ _ _
| ____(_) | |
| |__ _ _ __ ___| |__ __ _ ___ ___
| __| | | '__/ _ \ '_ \ / _` / __|/ _ \
| | | | | | __/ |_) | (_| \__ \ __/
|_| |_|_| \___|_.__/ \__,_|___/\___/
-->
<activity
android:name=".ui.modules.base.CrashActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:process=":error_activity"
android:theme="@style/DeadTheme" />
<!--
_____ _ _ _ _ _
/ ____| | | | | (_) (_) |
| | _ __ __ _ ___| |__ __ _ ___| |_ ___ ___| |_ _ _
| | | '__/ _` / __| '_ \ / _` |/ __| __| \ \ / / | __| | | |
| |____| | | (_| \__ \ | | | | (_| | (__| |_| |\ V /| | |_| |_| |
\_____|_| \__,_|___/_| |_| \__,_|\___|\__|_| \_/ |_|\__|\__, |
__/ |
|___/
-->
<activity
android:name=".ui.modules.base.CrashGtfoActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:theme="@style/DeadTheme" />
<activity
android:name=".widgets.WidgetConfigActivity"
android:configChanges="orientation|keyboardHidden"
android:excludeFromRecents="true"
android:noHistory="true"
android:theme="@style/AppTheme.NoDisplay">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<!--
__ ___ _ _
\ \ / (_) | | | |
@ -60,158 +93,44 @@
\ /\ / | | (_| | (_| | __/ |_ \__ \
\/ \/ |_|\__,_|\__, |\___|\__||___/
__/ |
|___/
|_
-->
<activity android:name=".ui.widgets.WidgetConfigActivity"
<activity
android:name=".widgets.timetable.LessonDetailsActivity"
android:configChanges="orientation|keyboardHidden"
android:excludeFromRecents="true"
android:noHistory="true"
android:exported="true"
android:theme="@style/AppTheme.Dark.NoDisplay">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<!-- TIMETABLE -->
<receiver android:name=".ui.widgets.timetable.WidgetTimetableProvider"
android:label="@string/widget_timetable_title"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_timetable_info" />
</receiver>
<service android:name=".ui.widgets.timetable.WidgetTimetableService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<activity android:name=".ui.widgets.LessonDialogActivity"
android:label=""
android:theme="@style/AppTheme.NoDisplay" />
<activity
android:name=".ui.modules.settings.SettingsLicenseActivity"
android:configChanges="orientation|keyboardHidden"
android:excludeFromRecents="true"
android:noHistory="true"
android:exported="true"
android:theme="@style/AppTheme.Dark.NoDisplay" />
<!-- NOTIFICATIONS -->
<receiver android:name=".ui.widgets.notifications.WidgetNotificationsProvider"
android:label="@string/widget_notifications_title"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_notifications_info" />
</receiver>
<service android:name=".ui.widgets.notifications.WidgetNotificationsService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<!-- LUCKY NUMBER -->
<receiver android:name=".ui.widgets.luckynumber.WidgetLuckyNumberProvider"
android:label="@string/widget_lucky_number_title"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_lucky_number_info" />
</receiver>
<!-- _ _ _ _ _
/\ | | (_) (_) | (_)
/ \ ___| |_ ___ ___| |_ _ ___ ___
/ /\ \ / __| __| \ \ / / | __| |/ _ \/ __|
/ ____ \ (__| |_| |\ V /| | |_| | __/\__ \
/_/ \_\___|\__|_| \_/ |_|\__|_|\___||___/
-->
<activity android:name=".ui.base.CrashActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:process=":error_activity"
android:exported="false"
android:theme="@style/DeadTheme" />
<activity android:name=".ui.intro.ChangelogIntroActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:exported="false"
android:theme="@style/Theme.Intro" />
<activity android:name=".ui.login.LoginActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleTop"
android:exported="false"
android:theme="@style/AppTheme.Light" />
<activity android:name=".ui.home.CounterActivity"
android:exported="false"
android:theme="@style/AppTheme.Black" />
<activity android:name=".ui.feedback.FeedbackActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="@string/app_name"
android:exported="false"
android:theme="@style/AppTheme" />
<activity android:name=".ui.settings.SettingsLicenseActivity"
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:theme="@style/AppTheme" />
<activity android:name="com.canhub.cropper.CropImageActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:theme="@style/Base.Theme.AppCompat" />
<activity android:name=".ui.login.oauth.OAuthLoginActivity"
<activity
android:name=".ui.modules.webpush.WebPushConfigActivity"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/AppTheme.Dark" />
<activity
android:name=".ui.modules.home.CounterActivity"
android:theme="@style/AppTheme.Black" />
<activity android:name=".ui.modules.webpush.QrScannerActivity" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:theme="@style/Theme.MaterialComponents.Light.DarkActionBar" />
<activity android:name=".ui.login.recaptcha.RecaptchaActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:theme="@style/Theme.MaterialComponents.Light.DarkActionBar" />
<activity android:name=".ui.base.BuildInvalidActivity" android:exported="false" />
<activity android:name=".ui.settings.contributors.ContributorsActivity" android:exported="false" />
<!-- _____ _
| __ \ (_)
| |__) |___ ___ ___ ___ _____ _ __ ___
| _ // _ \/ __/ _ \ \ \ / / _ \ '__/ __|
| | \ \ __/ (_| __/ |\ V / __/ | \__ \
|_| \_\___|\___\___|_| \_/ \___|_| |___/
-->
<receiver android:name=".receivers.UserPresentReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name=".sync.UpdateDownloaderService$DownloadProgressReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
</intent-filter>
</receiver>
<receiver android:name=".receivers.SzkolnyReceiver"
android:exported="true">
<intent-filter>
<action android:name="pl.szczodrzynski.edziennik.SZKOLNY_MAIN" />
</intent-filter>
</receiver>
<!-- _____ _
/ ____| (_)
| (___ ___ _ ____ ___ ___ ___ ___
\___ \ / _ \ '__\ \ / / |/ __/ _ \/ __|
____) | __/ | \ V /| | (_| __/\__ \
|_____/ \___|_| \_/ |_|\___\___||___/
-->
<service android:name=".data.api.ApiService" />
<service android:name=".data.firebase.MyFirebaseService"
android:exported="false">
<intent-filter android:priority="10000000">
<action android:name="com.google.firebase.MESSAGING_EVENT" />
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name=".sync.UpdateDownloaderService" />
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<!--
_____ _ _
| __ \ (_) | |
@ -220,13 +139,109 @@
| | | | | (_) \ V /| | (_| | __/ | \__ \
|_| |_| \___/ \_/ |_|\__,_|\___|_| |___/
-->
<provider android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<receiver
android:name=".WidgetTimetable"
android:label="@string/widget_timetable_title">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
android:name="android.appwidget.provider"
android:resource="@xml/widget_timetable_info" />
</receiver>
<!--
____ _ _
| _ \ | | (_)
| |_) | ___ ___ | |_ _ __ ___ ___ ___ ___ _____ _ __
| _ < / _ \ / _ \| __| | '__/ _ \/ __/ _ \ \ \ / / _ \ '__|
| |_) | (_) | (_) | |_ | | | __/ (_| __/ |\ V / __/ |
|____/ \___/ \___/ \__| |_| \___|\___\___|_| \_/ \_____|
-->
<receiver
android:name=".widgets.notifications.WidgetNotifications"
android:label="@string/widget_notifications_title">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_notifications_info" />
</receiver>
<receiver
android:name=".widgets.luckynumber.WidgetLuckyNumber"
android:label="@string/widget_lucky_number_title">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_lucky_number_info" />
</receiver>
<receiver
android:name=".receivers.UserPresentReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name=".receivers.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<service
android:name=".sync.MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver
android:name=".sync.FirebaseBroadcastReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</receiver>
<service
android:name=".widgets.timetable.WidgetTimetableService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<service
android:name=".widgets.notifications.WidgetNotificationsService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<service android:name=".receivers.BootReceiver$NotificationActionService" />
<service android:name=".Notifier$GetDataRetryService" />
<receiver
android:name=".receivers.SzkolnyReceiver"
android:exported="true">
<intent-filter>
<action android:name="pl.szczodrzynski.edziennik.SZKOLNY_MAIN" />
</intent-filter>
</receiver>
<service android:name=".api.v2.ApiService" />
</application>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
</manifest>

View File

@ -0,0 +1,27 @@
-----BEGIN CERTIFICATE-----
MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow
SjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT
GkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC
AQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF
q6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8
SMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0
Z8h/pZq4UmEUEz9l6YKHy9v6Dlb2honzhT+Xhq+w3Brvaw2VFn3EK6BlspkENnWA
a6xK8xuQSXgvopZPKiAlKQTGdMDQMc2PMTiVFrqoM7hD8bEfwzB/onkxEz0tNvjj
/PIzark5McWvxI0NHWQWM6r6hCm21AvA2H3DkwIDAQABo4IBfTCCAXkwEgYDVR0T
AQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYwfwYIKwYBBQUHAQEEczBxMDIG
CCsGAQUFBzABhiZodHRwOi8vaXNyZy50cnVzdGlkLm9jc3AuaWRlbnRydXN0LmNv
bTA7BggrBgEFBQcwAoYvaHR0cDovL2FwcHMuaWRlbnRydXN0LmNvbS9yb290cy9k
c3Ryb290Y2F4My5wN2MwHwYDVR0jBBgwFoAUxKexpHsscfrb4UuQdf/EFWCFiRAw
VAYDVR0gBE0wSzAIBgZngQwBAgEwPwYLKwYBBAGC3xMBAQEwMDAuBggrBgEFBQcC
ARYiaHR0cDovL2Nwcy5yb290LXgxLmxldHNlbmNyeXB0Lm9yZzA8BgNVHR8ENTAz
MDGgL6AthitodHRwOi8vY3JsLmlkZW50cnVzdC5jb20vRFNUUk9PVENBWDNDUkwu
Y3JsMB0GA1UdDgQWBBSoSmpjBH3duubRObemRWXv86jsoTANBgkqhkiG9w0BAQsF
AAOCAQEA3TPXEfNjWDjdGBX7CVW+dla5cEilaUcne8IkCJLxWh9KEik3JHRRHGJo
uM2VcGfl96S8TihRzZvoroed6ti6WqEBmtzw3Wodatg+VyOeph4EYpr/1wXKtx8/
wApIvJSwtmVi4MFU5aMqrSDE6ea73Mj2tcMyo5jMd6jmeWUHK8so/joWUoHOUgwu
X4Po1QYz+3dszkDqMp4fklxBwXRsW10KXzPMTZ+sOPAveyxindmjkW8lGy+QsRlG
PfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6
KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==
-----END CERTIFICATE-----

View File

@ -1,10 +1,99 @@
<h3>Wersja 4.13.6, 2023-03-24</h3>
<html>
<head>
<style type="text/css">
* {
word-wrap: break-word;
}
body {
background-color: #{bg-color}; color: #{text-color};
}
a {
color: #{link-color};
}
a:active {
color: #{link-color-active};
}
ol {
list-style-position: inside;
padding-left: 0;
padding-right: 0;
}
li:not(:first-child) {
padding-top: 8px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h3>Wersja 3.1.1, 2019-10-09</h3>
<ul>
<li>Naprawiono pobieranie załączników na Androidzie 13 i nowszym.</li>
<li>Dodano opcję odświeżenia planu lekcji na wybrany tydzień.</li>
<li>Usunięto błędy logowania. @BxOxSxS</li>
<li>Librus: poprawiona synchronizacja kategorii i kolorów ocen.</li>
<li>Zmieniony kolor dolnego paska w ciemnym motywie.</li>
<li>Zaktualizowany licznik czasu lekcji.</li>
</ul>
<h3>Wersja 3.1, 2019-09-29</h3>
<ul>
<li>Poprawiony interfejs zadań domowych.</li>
<li>Librus: wyświetlanie komentarzy ocen.</li>
<li>Librus: wyświetlanie nieobecności nauczycieli w Terminarzu.</li>
<li>Librus: usprawniona synchronizacja ocen.</li>
<li>Poprawki angielskiego tłumaczenia.</li>
</ul>
<h3>Wersja 3.0.3, 2019-09-26</h3>
<ul>
<li>Librus: poprawka kilku błędów synchronizacji.</li>
<li>Vulcan: prawidłowe oznaczanie wiadomości jako przeczytana.</li>
<li>Vulcan: poprawiona synchronizacja wiadomości i frekwencji.</li>
<li>Vulcan: poprawka błędów logowania.</li>
</ul>
<h3>Wersja 3.0.2, 2019-09-24</h3>
<ul>
<li>Librus: pobieranie Bieżących ocen opisowych.</li>
<li>Poprawki UI: kolor ikon paska statusu w jasnym motywie.</li>
<li>Poprawka braku skanera QR do przekazywania powiadomień.</li>
<li>Poprawka wyboru koloru i daty własnego wydarzenia, które crashowały aplikację.</li>
</ul>
<h3>Wersja 3.0.1, 2019-09-19</h3>
<ul>
<li>Librus: Poprawa błędu synchronizacji.</li>
<li>Poprawki UI związane z paskiem nawigacji.</li>
<li>Mobidziennik: Pobieranie ocen w niektórych przedmiotach.</li>
</ul>
<h3>Wersja 3.0, 2019-09-13</h3>
<ul>
<li><b>Nowy wygląd i sposób nawigacji</b> w całej aplikacji.</li>
<li>Menu nawigacji można teraz otworzyć przyciskiem na <b>dolnym pasku</b>. Pociągnięcie w górę tego paska wyświetla <b>menu kontekstowe</b> dotyczące danego widoku.</li>
<li>Założyliśmy serwer Discord! <a href="https://discord.gg/n9e8pWr">https://discord.gg/n9e8pWr</a></li>
<br>
<br>
Dzięki za korzystanie ze Szkolnego!<br>
<i>&copy; [Kuba Szczodrzyński](@kuba2k2) 2023</i>
<li>Librus: poprawka powielonych ogłoszeń szkolnych.</li>
<li>Naprawiłem błąd nieskończonej synchronizacji w Vulcanie.</li>
<li>Naprawiłem crash launchera przy dodaniu widgetu.</li>
<li>Naprawiłem częste crashe związane z widokiem kalendarza.</li>
<li>Nowe, ładniejsze (choć trochę) motywy kolorów.</li>
<li>Dużo drobnych poprawek UI i działania aplikacji.</li>
</ul>
<!--<i>
<h3>Plany na następne wersje:</h3>
<ul>
<li>Widget kalendarza ze sprawdzianami, ulepszenie widoku kalendarza w aplikacji</li>
<li>Wsparcie dla systemu Synergia w jednostkach samorządu terytorialnego - aplikacja Nasze Szkoły</li>
<li>Wsparcie dla Librusa w systemie Oświata w Radomiu</li>
<li>EduDziennik</li>
<li>Mobireg</li>
<li>Możliwość edycji planu lekcji</li>
</ul>
</i>-->
</body>

View File

@ -1,44 +0,0 @@
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
szkolny-signing
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
szkolny-signing.cpp)
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
#[[find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )]]
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
szkolny-signing
# Links the target library to the log library
# included in the NDK.
${log-lib} )

Some files were not shown because too many files have changed in this diff Show More