Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kt lint testing2 #4

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/ktlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Ktlint

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
ktlint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: musichin/ktlint-check@v2
continue-on-error: true
with:
ktlint-version: '0.49.1'
level: 'warning'

# ktlint
code-style: android_studio
relative: true
experimental: true

reporter: |
plain,output=ktlint_report.txt
json,output=ktlint_report.json

patterns: |
**/**.kt
!**/generated/**
1 change: 1 addition & 0 deletions .idea/.name

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

10 changes: 10 additions & 0 deletions .idea/ktlint.xml

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

Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.itssuryansh.taaveez

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand All @@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.google.mynotes", appContext.packageName)
}
}
}
54 changes: 26 additions & 28 deletions app/src/main/java/com/itssuryansh/taaveez/About.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ import android.os.Build
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.widget.LinearLayout
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.ContextCompat
import mehdi.sakout.aboutpage.AboutPage
import mehdi.sakout.aboutpage.Element
import java.util.*
import java.util.Calendar

class About : AppCompatActivity() {

Expand All @@ -31,32 +29,34 @@ class About : AppCompatActivity() {
.setCustomFont("museo.ttf")
.setImage(R.mipmap.ic_launcher)
.setDescription(getString(R.string.about_poem))
.addItem(Element().setTitle("Current Version : "+getString(R.string.appVersion)).setGravity(Gravity.CENTER).setOnClickListener {
Toast.makeText(
this@About,
"Current version of App is : " + getString(R.string.appVersion),
Toast.LENGTH_LONG
).show()
})
.addItem(
Element().setTitle("Current Version : " + getString(R.string.appVersion)).setGravity(Gravity.CENTER).setOnClickListener {
Toast.makeText(
this@About,
"Current version of App is : " + getString(R.string.appVersion),
Toast.LENGTH_LONG,
).show()
},
)
.addGroup("CONNECT WITH US!")
.addEmail("itssuryanshprajapati@gmail.com")
.addWebsite("https://suryansh1720001.github.io")
.addYoutube("UCdjJbti71WN9ILx9774q2PA") //Enter your youtube link here (replace with my channel link)
.addYoutube("UCdjJbti71WN9ILx9774q2PA") // Enter your youtube link here (replace with my channel link)
// .addPlayStore(packageName) //Replace all this with your package name
.addInstagram("_its_s.u.r.y.a.n.s.h") //Your instagram id
.addInstagram("_its_s.u.r.y.a.n.s.h") // Your instagram id
.addItem(createCopyright())
.create()

setContentView(aboutPage)


}

private fun createCopyright(): Element {
val copyright = Element()
@SuppressLint("DefaultLocale") val copyrightString = String.format(

@SuppressLint("DefaultLocale")
val copyrightString = String.format(
"Copyright %d by Suryansh Prajapati",
Calendar.getInstance()[Calendar.YEAR]
Calendar.getInstance()[Calendar.YEAR],
)
copyright.title = copyrightString
copyright.iconDrawable = R.drawable.ic_copyright
Expand All @@ -65,7 +65,7 @@ class About : AppCompatActivity() {
Toast.makeText(
this@About,
copyrightString,
Toast.LENGTH_SHORT
Toast.LENGTH_SHORT,
).show()
}
return copyright
Expand All @@ -77,9 +77,9 @@ class About : AppCompatActivity() {
finish()
}

private fun loadDayNight(){
val sharedPreferences=getSharedPreferences("DayNight", Activity.MODE_PRIVATE)
val DayNight= sharedPreferences.getString("My_DayNight","MyDayNight")
private fun loadDayNight() {
val sharedPreferences = getSharedPreferences("DayNight", Activity.MODE_PRIVATE)
val DayNight = sharedPreferences.getString("My_DayNight", "MyDayNight")
if (DayNight != null) {
setDayNight(DayNight)
}
Expand All @@ -88,14 +88,12 @@ class About : AppCompatActivity() {
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private fun setDayNight(daynightMode: String) {
val editor = getSharedPreferences("DayNight", Context.MODE_PRIVATE).edit()
editor.putString("My_DayNight",daynightMode)
editor.putString("My_DayNight", daynightMode)
editor.apply()
if(daynightMode=="yes"){
getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
else{
getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO);
if (daynightMode == "yes") {
getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_YES)
} else {
getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}
}

}
}
Loading