Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
Merge dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Jizzu committed May 18, 2019
2 parents 5cebf16 + aed4cea commit 7c7bf88
Show file tree
Hide file tree
Showing 39 changed files with 1,331 additions and 1,209 deletions.
7 changes: 5 additions & 2 deletions .idea/assetWizardSettings.xml

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

Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ android {
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}

dataBinding {
enabled = true
}

buildTypes {
Expand All @@ -38,6 +43,7 @@ dependencies {
implementation "androidx.preference:preference:$rootProject.androidxVersion"
implementation "com.github.XunMengWinter:CircularAnim:$rootProject.circularAnimVersion"
implementation "com.github.Daio-io:dresscode:$rootProject.dresscodeVersion"
implementation "com.heinrichreimersoftware:material-intro:$rootProject.materialIntroVersion"
implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion"

// Firebase Crashlytics
Expand Down
12 changes: 9 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,34 @@
</intent-filter>
</activity>
<activity
android:name=".ui.view.AddTaskActivity"
android:name=".ui.view.task.AddTaskActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.view.EditTaskActivity"
android:name=".ui.view.task.EditTaskActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.view.TaskNoteActivity"
android:name=".ui.view.task.TaskNoteActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.view.settings.activity.SettingsActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.view.ChangelogActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.view.MainIntroActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Intro" />
<activity
android:name=".ui.view.SearchActivity"
android:screenOrientation="portrait" />

<service
android:name=".service.widget.WidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS" />

<receiver
android:name=".service.alarm.AlarmReceiver"
android:process=":remote" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.content.Intent
import android.net.Uri
import android.widget.RemoteViews
import apps.jizzu.simpletodo.R
import apps.jizzu.simpletodo.ui.view.EditTaskActivity
import apps.jizzu.simpletodo.ui.view.task.EditTaskActivity
import apps.jizzu.simpletodo.ui.view.MainActivity

class WidgetProvider : AppWidgetProvider() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ChangelogActivity : BaseActivity() {
super.onCreate(savedInstanceState)
matchDressCode()
setContentView(R.layout.activity_changelog)
initToolbar(getString(R.string.whats_new_title))
initToolbar(getString(R.string.whats_new_title), R.drawable.round_close_black_24)
btnConfirm.setOnClickListener { onBackPressed() }
}

Expand Down
15 changes: 14 additions & 1 deletion app/src/main/java/apps/jizzu/simpletodo/ui/view/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import apps.jizzu.simpletodo.ui.view.base.BaseActivity
import apps.jizzu.simpletodo.ui.view.settings.activity.SettingsActivity
import apps.jizzu.simpletodo.ui.view.settings.fragment.FragmentDateAndTime
import apps.jizzu.simpletodo.ui.view.settings.fragment.FragmentNotifications
import apps.jizzu.simpletodo.ui.view.task.AddTaskActivity
import apps.jizzu.simpletodo.utils.PreferenceHelper
import apps.jizzu.simpletodo.utils.gone
import apps.jizzu.simpletodo.utils.toast
Expand Down Expand Up @@ -244,7 +245,9 @@ class MainActivity : BaseActivity() {
}

private fun showChangelogActivity() {
if (mPreferenceHelper.getInt(PreferenceHelper.VERSION_CODE) != BuildConfig.VERSION_CODE) {
if (mPreferenceHelper.getBoolean(PreferenceHelper.IS_FIRST_LAUNCH) && mPreferenceHelper.getInt(PreferenceHelper.VERSION_CODE) == 0) {
startActivityForResult(Intent(this, MainIntroActivity::class.java), APP_INTRO_CODE)
} else if (mPreferenceHelper.getInt(PreferenceHelper.VERSION_CODE) != BuildConfig.VERSION_CODE) {
startActivity(Intent(this, ChangelogActivity::class.java))
}
}
Expand Down Expand Up @@ -479,6 +482,15 @@ class MainActivity : BaseActivity() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)

if (requestCode == APP_INTRO_CODE) {
if (resultCode == RESULT_OK) {
mPreferenceHelper.putBoolean(PreferenceHelper.IS_FIRST_LAUNCH, false)
mPreferenceHelper.putInt(PreferenceHelper.VERSION_CODE, BuildConfig.VERSION_CODE)
} else {
finish()
}
}

if (requestCode == SPEECH_INPUT_CODE && resultCode == RESULT_OK && data != null) {
val result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
val task = Task().apply {
Expand All @@ -492,5 +504,6 @@ class MainActivity : BaseActivity() {
companion object {
var mTaskList = arrayListOf<Task>()
private const val SPEECH_INPUT_CODE = 111
private const val APP_INTRO_CODE = 222
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package apps.jizzu.simpletodo.ui.view

import android.os.Bundle
import apps.jizzu.simpletodo.R
import com.heinrichreimersoftware.materialintro.app.IntroActivity
import com.heinrichreimersoftware.materialintro.slide.SimpleSlide

class MainIntroActivity : IntroActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

addIntroScreen(getString(R.string.intro_1_title), getString(R.string.intro_1_description),
R.drawable.illustration_intro_1)
addIntroScreen(getString(R.string.intro_2_title), getString(R.string.intro_2_description),
R.drawable.illustration_intro_2)
addIntroScreen(getString(R.string.intro_3_title), getString(R.string.intro_3_description),
R.drawable.illustration_intro_3)
addIntroScreen(getString(R.string.intro_4_title), getString(R.string.intro_4_description),
R.drawable.illustration_intro_4)
}

private fun addIntroScreen(title: String, description: String, drawable: Int) {
addSlide(SimpleSlide.Builder()
.title(title)
.description(description)
.image(drawable)
.background(R.color.white)
.backgroundDark(R.color.white)
.layout(R.layout.activity_main_intro)
.build())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.view.MenuItem
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.content.res.AppCompatResources
import androidx.appcompat.widget.SearchView
import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer
Expand Down Expand Up @@ -35,7 +36,7 @@ class SearchActivity : BaseActivity(), SearchView.OnQueryTextListener {
super.onCreate(savedInstanceState)
matchDressCode()
setContentView(R.layout.activity_search)
initToolbar("", R.drawable.round_arrow_back_black_24)
initToolbar()

if (intent.getBooleanExtra("isShortcut", false)) {
PreferenceHelper.getInstance().init(applicationContext)
Expand Down Expand Up @@ -66,10 +67,12 @@ class SearchActivity : BaseActivity(), SearchView.OnQueryTextListener {
mAdapter.updateData(arrayListOf())
llEmptyView.visible()
if (isSearchFieldEmpty) {
ivEmptyIllustration.setImageResource(R.drawable.illustration_search)
ivEmptyIllustration.setImageDrawable(AppCompatResources.getDrawable(this,
R.drawable.illustration_search))
tvEmptyTitle.text = getString(R.string.search_view_empty_text)
} else {
ivEmptyIllustration.setImageResource(R.drawable.illustration_not_found)
ivEmptyIllustration.setImageDrawable(AppCompatResources.getDrawable(this,
R.drawable.illustration_not_found))
tvEmptyTitle.text = getString(R.string.search_view_not_found_text)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import apps.jizzu.simpletodo.R
import apps.jizzu.simpletodo.data.models.Task
import apps.jizzu.simpletodo.ui.view.EditTaskActivity
import apps.jizzu.simpletodo.ui.view.task.EditTaskActivity
import apps.jizzu.simpletodo.utils.toastLong
import com.google.android.material.snackbar.Snackbar
import daio.io.dresscode.dressCodeStyleId
Expand All @@ -33,7 +33,7 @@ abstract class BaseActivity : AppCompatActivity() {
initStatusBar()
}

fun initToolbar(titleText: String, drawable: Int? = R.drawable.round_close_black_24, view: Toolbar? = toolbar) {
fun initToolbar(titleText: String = "", drawable: Int? = R.drawable.round_arrow_back_black_24, view: Toolbar? = toolbar) {
title = ""
tvToolbarTitle.text = titleText

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import android.widget.EditText
import android.widget.TimePicker
import androidx.core.content.ContextCompat
import apps.jizzu.simpletodo.R
import apps.jizzu.simpletodo.ui.view.TaskNoteActivity
import apps.jizzu.simpletodo.ui.view.task.TaskNoteActivity
import apps.jizzu.simpletodo.utils.DateAndTimeFormatter
import apps.jizzu.simpletodo.utils.PreferenceHelper
import apps.jizzu.simpletodo.utils.gone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SettingsActivity : BaseActivity() {
super.onCreate(savedInstanceState)
matchDressCode()
setContentView(R.layout.activity_settings)
initToolbar(getString(R.string.settings), R.drawable.round_arrow_back_black_24)
initToolbar(getString(R.string.settings))
openSettingsFragment()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class FragmentLicenses : BaseSettingsFragment() {
clRxJava.setOnClickListener { openUri(RX_JAVA_PAGE) }
clRxKotlin.setOnClickListener { openUri(RX_KOTLIN_PAGE) }
clDressCode.setOnClickListener { openUri(DRESS_CODE_PAGE) }
clMaterialIntro.setOnClickListener { openUri(MATERIAL_INTRO_PAGE) }
}

private fun openUri(uri: String) = startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(uri)))
Expand All @@ -42,5 +43,6 @@ class FragmentLicenses : BaseSettingsFragment() {
private const val RX_JAVA_PAGE = "https://github.com/ReactiveX/RxJava"
private const val RX_KOTLIN_PAGE = "https://github.com/ReactiveX/RxKotlin"
private const val DRESS_CODE_PAGE = "https://github.com/Daio-io/dresscode"
private const val MATERIAL_INTRO_PAGE = "https://github.com/heinrichreimer/material-intro"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package apps.jizzu.simpletodo.ui.view
package apps.jizzu.simpletodo.ui.view.task

import android.os.Bundle
import androidx.lifecycle.ViewModelProviders
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package apps.jizzu.simpletodo.ui.view
package apps.jizzu.simpletodo.ui.view.task

import android.os.Bundle
import android.view.Menu
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package apps.jizzu.simpletodo.ui.view
package apps.jizzu.simpletodo.ui.view.task

import android.app.Activity
import android.content.Intent
Expand All @@ -18,14 +18,14 @@ class TaskNoteActivity : BaseActivity() {
super.onCreate(savedInstanceState)
matchDressCode()
setContentView(R.layout.activity_task_note)
initToolbar(getString(R.string.task_note), R.drawable.round_arrow_back_black_24)
initToolbar(getString(R.string.task_note), R.drawable.round_close_black_24)
initScrollViewListener(svTaskDetails)
restoreData()
}

private fun restoreData() {
val note = intent.getStringExtra("note")
if (!note.isEmpty()) {
if (note.isNotEmpty()) {
tvTaskNote.apply {
setText(note)
setSelection(note.length)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ class PreferenceHelper private constructor() {
}

fun putBoolean(key: String, value: Boolean) {
val editor = mPreferences.edit()
editor.putBoolean(key, value)
editor.apply()
mPreferences.edit().apply {
putBoolean(key, value)
apply()
}
}

fun getBoolean(key: String) = mPreferences.getBoolean(key, true)
Expand All @@ -37,6 +38,7 @@ class PreferenceHelper private constructor() {
const val TIME_FORMAT_KEY = "time_format_key"
const val LAUNCHES_COUNTER = "launches_counter"
const val IS_NEED_TO_SHOW_RATE_DIALOG_LATER = "is_need_to_show_rate_dialog_later"
const val IS_FIRST_LAUNCH = "is_first_launch"

private var mInstance: PreferenceHelper? = null

Expand Down
Loading

0 comments on commit 7c7bf88

Please sign in to comment.