-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
298 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
app/src/main/java/de/felixnuesse/timedsilence/AboutActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package de.felixnuesse.timedsilence | ||
|
||
import android.content.Intent | ||
import android.net.Uri | ||
import android.os.Bundle | ||
import android.view.Menu | ||
import android.view.MenuItem | ||
import androidx.appcompat.app.AppCompatActivity | ||
import de.felixnuesse.timedsilence.databinding.ActivityAboutBinding | ||
import java.util.Calendar | ||
|
||
|
||
class AboutActivity : AppCompatActivity() { | ||
|
||
private lateinit var binding: ActivityAboutBinding | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
binding = ActivityAboutBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
binding.toolbar.title = ""; | ||
setSupportActionBar(binding.toolbar) | ||
|
||
|
||
binding.help.setOnClickListener { | ||
openURL("https://github.com/newhinton/Timed-Silence/issues") | ||
} | ||
|
||
|
||
binding.donate.setOnClickListener { | ||
openURL("https://github.com/sponsors/newhinton") | ||
} | ||
|
||
binding.copyright.setOnClickListener { | ||
openURL("https://github.com/newhinton/Timed-Silence") | ||
} | ||
|
||
binding.copyright.text = this.getString(R.string.copyright, Calendar.getInstance().get(Calendar.YEAR).toString()) | ||
} | ||
|
||
|
||
override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
menuInflater.inflate(R.menu.menu_about, menu) | ||
return true | ||
} | ||
|
||
override fun onOptionsItemSelected(item: MenuItem): Boolean { | ||
return when (item.itemId) { | ||
R.id.action_exit -> { | ||
finish() | ||
true | ||
} | ||
else -> super.onOptionsItemSelected(item) | ||
} | ||
} | ||
|
||
fun openURL(url: String) { | ||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/src/main/java/de/felixnuesse/timedsilence/util/PrepareDefaultsUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package de.felixnuesse.timedsilence.util | ||
|
||
import android.content.Context | ||
import de.felixnuesse.timedsilence.R | ||
import de.felixnuesse.timedsilence.handler.volume.VolumeState | ||
import de.felixnuesse.timedsilence.model.data.ScheduleObject | ||
import de.felixnuesse.timedsilence.model.database.DatabaseHandler | ||
|
||
class PrepareDefaultsUtil { | ||
|
||
companion object { | ||
fun addDefaults(context: Context) { | ||
val db = DatabaseHandler(context) | ||
|
||
var nightStartHour = 21 | ||
var nightStarMinutes = 0 | ||
var nightEndHour = 8 | ||
var nightEndMinutes = 0 | ||
val night = ScheduleObject( | ||
context.getString(R.string.default_schedule_night), | ||
(nightStartHour * 60 * 60 * 1000 + nightStarMinutes * 60 * 1000).toLong(), | ||
(nightEndHour * 60 * 60 * 1000 + nightEndMinutes * 60 * 1000).toLong(), | ||
VolumeState.TIME_SETTING_VIBRATE, | ||
0, | ||
pmon = true, | ||
ptue = true, | ||
pwed = true, | ||
pthu = true, | ||
pfri = true, | ||
psat = true, | ||
psun = true | ||
) | ||
|
||
db.createScheduleEntry(night) | ||
|
||
|
||
var dayStartHour = 8 | ||
var dayStarMinutes = 15 | ||
var dayEndHour = 21 | ||
var dayEndMinutes = 0 | ||
val day = ScheduleObject( | ||
context.getString(R.string.default_schedule_day), | ||
(dayStartHour * 60 * 60 * 1000 + dayStarMinutes * 60 * 1000).toLong(), | ||
(dayEndHour * 60 * 60 * 1000 + dayEndMinutes * 60 * 1000).toLong(), | ||
VolumeState.TIME_SETTING_LOUD, | ||
0, | ||
pmon = true, | ||
ptue = true, | ||
pwed = true, | ||
pthu = true, | ||
pfri = true, | ||
psat = true, | ||
psun = true | ||
) | ||
db.createScheduleEntry(day) | ||
|
||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="@color/iconColor" | ||
android:viewportWidth="960" | ||
android:viewportHeight="960"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M480,536L284,732Q273,743 256,743Q239,743 228,732Q217,721 217,704Q217,687 228,676L424,480L228,284Q217,273 217,256Q217,239 228,228Q239,217 256,217Q273,217 284,228L480,424L676,228Q687,217 704,217Q721,217 732,228Q743,239 743,256Q743,273 732,284L536,480L732,676Q743,687 743,704Q743,721 732,732Q721,743 704,743Q687,743 676,732L480,536Z" /> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
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" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".AboutActivity"> | ||
|
||
<androidx.appcompat.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="@null" | ||
android:theme="@style/AboutStyle" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"/> | ||
|
||
<ImageView | ||
android:id="@+id/imageView" | ||
android:layout_width="128dp" | ||
android:layout_height="128dp" | ||
android:layout_marginTop="48dp" | ||
android:scaleType="fitStart" | ||
android:scaleX="2" | ||
android:scaleY="2" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/toolbar" | ||
app:srcCompat="@drawable/ic_launcher_foreground" /> | ||
|
||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="32dp" | ||
android:text="@string/app_name" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="@+id/toolbar" | ||
app:layout_constraintTop_toBottomOf="@+id/imageView" /> | ||
|
||
<TextView | ||
android:id="@+id/textView3" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="@string/made_by" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/textView" /> | ||
|
||
<TextView | ||
android:id="@+id/textView4" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="8dp" | ||
android:text="Felix Nüsse" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/textView3" /> | ||
|
||
<Button | ||
android:id="@+id/donate" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="72dp" | ||
android:text="@string/donate" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/textView4" /> | ||
|
||
<Button | ||
android:id="@+id/help" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="@string/help" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/donate" /> | ||
|
||
<TextView | ||
android:id="@+id/copyright" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="32dp" | ||
android:text="TextView" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<menu 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" | ||
tools:context="de.felixnuesse.timedsilence.MainActivity"> | ||
<item | ||
android:id="@+id/action_exit" | ||
android:icon="@drawable/icon_close" | ||
android:orderInCategory="1" | ||
android:title="@string/back" | ||
app:showAsAction="always" /> | ||
|
||
</menu> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.