Skip to content

Commit

Permalink
1.0 v beta
Browse files Browse the repository at this point in the history
  • Loading branch information
0developers committed Feb 8, 2024
1 parent d0ace2e commit 8603145
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 111 deletions.
Binary file modified .gradle/8.0/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/8.0/checksums/md5-checksums.bin
Binary file not shown.
Binary file modified .gradle/8.0/checksums/sha1-checksums.bin
Binary file not shown.
Binary file modified .gradle/8.0/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/8.0/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.0/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/8.0/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/8.0/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified .gradle/file-system.probe
Binary file not shown.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
}

android {
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />


<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />

<queries>
<package android:name="org.telegram.messenger" />
Expand All @@ -24,6 +24,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.ToDoList"
tools:targetApi="31">
<activity
android:name=".signupActivity"
android:exported="false" />
<activity
android:name=".ViewTasksActivity"
android:exported="false"
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/zerodev/todo/signupActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.zerodev.todo

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class signupActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_signup)
}
}
62 changes: 7 additions & 55 deletions app/src/main/java/com/zerodev/todo/ui/settings/SettingsFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.SharedPreferences
import android.graphics.Color
import android.os.Bundle
Expand All @@ -17,8 +18,11 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.anggrayudi.storage.SimpleStorageHelper
import com.google.android.material.snackbar.Snackbar
import com.google.firebase.FirebaseApp
import com.google.firebase.auth.FirebaseAuth
import com.zerodev.todo.Data.NotifSounds
import com.zerodev.todo.databinding.FragmentSettingsBinding
import com.zerodev.todo.signupActivity
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
Expand Down Expand Up @@ -50,6 +54,8 @@ class SettingsFragment : Fragment() {
val settingsPref = context?.getSharedPreferences("settings", Context.MODE_PRIVATE)
val notifSounds = context?.let { NotifSounds(it) }
val notifSoundArray = notifSounds?.soundArray
val intent = Intent(this.requireContext(), signupActivity::class.java)
startActivity(intent)
if (settingsPref != null) {
settingsViewModel.setSharedPref(settingsPref)
}
Expand All @@ -65,27 +71,8 @@ class SettingsFragment : Fragment() {
" ${notifImportance[settingsPref.getInt("notifImportance", 0)]}"
}
// backup list click
binding.backuplist.setOnClickListener {
/*
if (ContextCompat.checkSelfPermission(
requireContext(),
Manifest.permission.WRITE_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
requireActivity(),
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
WRITE_EXTERNAL_STORAGE_REQUEST_CODE
)
} else {
saveToFile("it worked")
}
*/


}

// notif sound click listener
binding.notifSound.setOnClickListener {
//set notification sound
Expand Down Expand Up @@ -126,7 +113,7 @@ class SettingsFragment : Fragment() {
notifImportance,
settingsPref.getInt("notifImportance", 0)
) { dialog, index ->
settingsPref?.edit()?.putInt("notifImportance", index)
settingsPref.edit()?.putInt("notifImportance", index)
?.apply()
val snackbar = view?.let { it1 ->
Snackbar.make(
Expand Down Expand Up @@ -161,44 +148,9 @@ class SettingsFragment : Fragment() {
}
}

private fun saveToFile(text: String) {
val directoryPath =
Environment.getExternalStorageDirectory().absolutePath + "/TodoList/Backup"
val fileName = "Backup.json"

val directory = File(directoryPath)

if (!directory.exists()) {
directory.mkdirs() // Create the directory if it doesn't exist
}

val file = File(directory, fileName)

try {
file.createNewFile()

val fileOutputStream = FileOutputStream(file)
fileOutputStream.write(text.toByteArray())
fileOutputStream.close()

// File saved successfully
Toast.makeText(requireContext(), "File saved successfully", Toast.LENGTH_SHORT).show()
} catch (e: IOException) {
e.printStackTrace()
// Handle the exception
Toast.makeText(requireContext(), "Error saving file", Toast.LENGTH_SHORT).show()
}
}

private fun checkPermission(): Boolean {
var permissionGranted = false
registerForActivityResult(
ActivityResultContracts.RequestPermission()
) { isGranted: Boolean ->
permissionGranted = isGranted
}
return permissionGranted
}


override fun onDestroyView() {
Expand Down
46 changes: 46 additions & 0 deletions app/src/main/res/layout/activity_signup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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=".signupActivity">

<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sign Up to Todo List"
android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.104" />

<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="By Signing up , you will agree to our Privacy Policy"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView11"
app:layout_constraintVertical_bias="0.048" />

<com.google.android.gms.common.SignInButton
android:id="@+id/sign_in_button"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.494"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView12"
app:layout_constraintVertical_bias="0.519" />

</androidx.constraintlayout.widget.ConstraintLayout>
52 changes: 0 additions & 52 deletions app/src/main/res/layout/fragment_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,58 +20,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Backup"
android:textColor="@color/black"
android:textSize="18sp" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/backuplist"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="5dp"
android:background="@drawable/settings_items_back"
android:padding="10dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Backup todo List to device"
android:textColor="@color/white"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.049"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.516" />
</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="5dp"
android:background="@drawable/settings_items_back"
android:padding="10dp">

<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recover todo List to device"
android:textColor="@color/white"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.049"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.516" />
</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.4.0'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false
Expand Down

0 comments on commit 8603145

Please sign in to comment.