@ -0,0 +1,9 @@ |
|||
<component name="ProjectDictionaryState"> |
|||
<dictionary name="naresh"> |
|||
<words> |
|||
<w>elektro</w> |
|||
<w>hsdsans</w> |
|||
<w>weblog</w> |
|||
</words> |
|||
</dictionary> |
|||
</component> |
After Width: | Height: | Size: 44 KiB |
@ -0,0 +1,36 @@ |
|||
package com.nareshkumarrao.eiweblog |
|||
|
|||
import android.content.Intent |
|||
import android.net.Uri |
|||
import android.os.Bundle |
|||
import android.view.View |
|||
import androidx.appcompat.app.AppCompatActivity |
|||
import androidx.appcompat.widget.AppCompatButton |
|||
import androidx.appcompat.widget.Toolbar |
|||
|
|||
|
|||
class AboutActivity : AppCompatActivity() { |
|||
override fun onCreate(savedInstanceState: Bundle?) { |
|||
super.onCreate(savedInstanceState) |
|||
setContentView(R.layout.activity_about) |
|||
|
|||
val aboutToolbar = this.findViewById<Toolbar>(R.id.about_toolbar) |
|||
setSupportActionBar(aboutToolbar) |
|||
supportActionBar?.setDisplayHomeAsUpEnabled(true) |
|||
supportActionBar?.setDisplayShowTitleEnabled(false) |
|||
} |
|||
|
|||
fun sendBeer(view: View) { |
|||
startActivity( Intent( |
|||
Intent.ACTION_VIEW, |
|||
Uri.parse("https://paypal.me/naresh97") |
|||
)) |
|||
} |
|||
|
|||
fun githubRepo(view: View){ |
|||
startActivity( Intent( |
|||
Intent.ACTION_VIEW, |
|||
Uri.parse("https://github.com/naresh97/ei-weblog-android") |
|||
)) |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.nareshkumarrao.eiweblog |
|||
|
|||
import androidx.appcompat.app.AppCompatActivity |
|||
import android.os.Bundle |
|||
import androidx.appcompat.widget.Toolbar |
|||
|
|||
class NotificationSettingsActivity : AppCompatActivity() { |
|||
override fun onCreate(savedInstanceState: Bundle?) { |
|||
super.onCreate(savedInstanceState) |
|||
setContentView(R.layout.activity_notification_settings) |
|||
|
|||
val notificationsToolbar = this.findViewById<Toolbar>(R.id.notification_toolbar) |
|||
setSupportActionBar(notificationsToolbar) |
|||
supportActionBar?.setDisplayHomeAsUpEnabled(true) |
|||
supportActionBar?.setDisplayShowTitleEnabled(false) |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.nareshkumarrao.eiweblog |
|||
|
|||
import android.content.Context |
|||
import androidx.work.Worker |
|||
import androidx.work.WorkerParameters |
|||
import java.math.BigInteger |
|||
import java.security.MessageDigest |
|||
|
|||
class UpdateWorker(private val context: Context, workerParams: WorkerParameters) : Worker(context, workerParams) { |
|||
override fun doWork(): Result { |
|||
|
|||
Utilities.weblogList(context) { articles -> |
|||
val lastArticle = Utilities.getLatestRelevantArticle(articles)!! |
|||
val hashString = lastArticle.title + lastArticle.content + lastArticle.date |
|||
val oldHash = md5(hashString) |
|||
|
|||
Utilities.fetchWeblogXML(applicationContext){newArticles -> |
|||
val lastNewArticle = Utilities.getLatestRelevantArticle(newArticles)!! |
|||
val newHashString = lastNewArticle.title + lastNewArticle.content + lastNewArticle.date |
|||
val newHash = md5(newHashString) |
|||
|
|||
if(oldHash != newHash){ |
|||
Utilities.sendNotification(context, lastNewArticle, newArticles.size) |
|||
} |
|||
} |
|||
} |
|||
|
|||
return Result.success() |
|||
} |
|||
|
|||
private fun md5(input:String): String { |
|||
val md = MessageDigest.getInstance("MD5") |
|||
return BigInteger(1, md.digest(input.toByteArray())).toString(16).padStart(32, '0') |
|||
} |
|||
|
|||
} |
After Width: | Height: | Size: 645 B |
After Width: | Height: | Size: 360 B |
After Width: | Height: | Size: 817 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
|||
android:shape="rectangle"> |
|||
<gradient android:startColor="@android:color/transparent" |
|||
android:endColor="#EEEEEEEE" |
|||
android:angle="90"/> |
|||
</shape> |
@ -0,0 +1,116 @@ |
|||
<?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/about_toolbar" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
|
|||
app:contentInsetStart="0px" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toTopOf="parent"> |
|||
|
|||
|
|||
|
|||
<TextView |
|||
android:id="@+id/title" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:fontFamily="@font/hsdsans_elektro" |
|||
android:minHeight="?actionBarSize" |
|||
android:padding="@dimen/appbar_padding" |
|||
android:text="@string/about_title" |
|||
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" |
|||
android:textColor="@color/black" |
|||
android:textSize="25sp" |
|||
android:paddingStart="0px" |
|||
android:paddingLeft="0px" |
|||
tools:ignore="RtlSymmetry" /> |
|||
|
|||
</androidx.appcompat.widget.Toolbar> |
|||
|
|||
<ScrollView |
|||
android:layout_width="match_parent" |
|||
android:layout_height="0dp" |
|||
android:fadeScrollbars="false" |
|||
app:layout_constraintBottom_toBottomOf="parent" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@+id/about_toolbar"> |
|||
|
|||
<androidx.constraintlayout.widget.ConstraintLayout |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content"> |
|||
|
|||
<View |
|||
android:layout_width="match_parent" |
|||
android:layout_height="5dp" |
|||
app:layout_constraintTop_toTopOf="parent" |
|||
android:background="@drawable/toolbar_dropshadow"/> |
|||
|
|||
<TextView |
|||
android:id="@+id/textView2" |
|||
android:layout_width="0dp" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginStart="16dp" |
|||
android:layout_marginLeft="16dp" |
|||
android:layout_marginTop="16dp" |
|||
android:layout_marginEnd="16dp" |
|||
android:layout_marginRight="16dp" |
|||
android:text="@string/about_text" |
|||
android:textColor="@color/black" |
|||
android:textSize="14sp" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintHorizontal_bias="0.0" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toTopOf="parent" /> |
|||
|
|||
<Button |
|||
android:id="@+id/button2" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginTop="20dp" |
|||
android:layout_marginBottom="16dp" |
|||
android:background="#FFFFFF" |
|||
android:onClick="githubRepo" |
|||
android:text="GitHub Repository" |
|||
android:textColor="@color/white" |
|||
app:backgroundTint="@color/black" |
|||
app:layout_constraintBottom_toBottomOf="parent" |
|||
app:layout_constraintStart_toStartOf="@+id/textView" |
|||
app:layout_constraintTop_toBottomOf="@+id/textView" /> |
|||
|
|||
<TextView |
|||
android:id="@+id/textView" |
|||
android:layout_width="0dp" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginTop="16dp" |
|||
android:text="@string/license_info" |
|||
android:textColor="@color/black" |
|||
android:textSize="14sp" |
|||
app:layout_constraintEnd_toEndOf="@+id/textView2" |
|||
app:layout_constraintHorizontal_bias="0.0" |
|||
app:layout_constraintStart_toStartOf="@+id/button" |
|||
app:layout_constraintTop_toBottomOf="@+id/button" /> |
|||
|
|||
<Button |
|||
android:id="@+id/button" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginTop="20dp" |
|||
android:onClick="sendBeer" |
|||
android:text="@string/send_beer" |
|||
android:textColor="@color/white" |
|||
app:backgroundTint="@color/fh_red" |
|||
app:layout_constraintStart_toStartOf="@+id/textView2" |
|||
app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
|||
|
|||
</androidx.constraintlayout.widget.ConstraintLayout> |
|||
</ScrollView> |
|||
|
|||
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -0,0 +1,63 @@ |
|||
<?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=".NotificationSettingsActivity"> |
|||
|
|||
<androidx.appcompat.widget.Toolbar |
|||
android:id="@+id/notification_toolbar" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
|
|||
app:contentInsetStart="0px" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toTopOf="parent"> |
|||
|
|||
|
|||
|
|||
<TextView |
|||
android:id="@+id/title" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:fontFamily="@font/hsdsans_elektro" |
|||
android:minHeight="?actionBarSize" |
|||
android:padding="@dimen/appbar_padding" |
|||
android:text="@string/notifications_title" |
|||
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" |
|||
android:textColor="@color/black" |
|||
android:textSize="25sp" |
|||
android:paddingStart="0px" |
|||
android:paddingLeft="0px" |
|||
tools:ignore="RtlSymmetry" /> |
|||
|
|||
</androidx.appcompat.widget.Toolbar> |
|||
|
|||
<androidx.appcompat.widget.SwitchCompat |
|||
android:id="@+id/switch1" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginEnd="32dp" |
|||
android:layout_marginRight="32dp" |
|||
app:layout_constraintBottom_toBottomOf="@+id/textView4" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintTop_toTopOf="@+id/textView4" /> |
|||
|
|||
<TextView |
|||
android:id="@+id/textView4" |
|||
android:layout_width="0dp" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginStart="32dp" |
|||
android:layout_marginLeft="32dp" |
|||
android:layout_marginTop="32dp" |
|||
android:layout_marginEnd="32dp" |
|||
android:layout_marginRight="32dp" |
|||
android:text="@string/enable_notifications" |
|||
android:textColor="@color/black" |
|||
android:textSize="18sp" |
|||
app:layout_constraintEnd_toStartOf="@+id/switch1" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@+id/notification_toolbar" /> |
|||
|
|||
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -1,6 +1,12 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<menu xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
<item android:title="@string/notifications" app:showAsAction="never"/> |
|||
<item android:title="@string/about" app:showAsAction="never"/> |
|||
<item |
|||
android:onClick="showNotificationSettings" |
|||
android:title="@string/notifications" |
|||
app:showAsAction="never" /> |
|||
<item |
|||
android:onClick="showAbout" |
|||
android:title="@string/about" |
|||
app:showAsAction="never" /> |
|||
</menu> |
@ -1,5 +1,5 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
<background android:drawable="@drawable/ic_launcher_background" /> |
|||
<foreground android:drawable="@drawable/ic_launcher_foreground" /> |
|||
<background android:drawable="@color/ic_launcher_background"/> |
|||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> |
|||
</adaptive-icon> |
@ -1,5 +1,5 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
<background android:drawable="@drawable/ic_launcher_background" /> |
|||
<foreground android:drawable="@drawable/ic_launcher_foreground" /> |
|||
<background android:drawable="@color/ic_launcher_background"/> |
|||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> |
|||
</adaptive-icon> |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
@ -1,16 +0,0 @@ |
|||
<resources xmlns:tools="http://schemas.android.com/tools"> |
|||
<!-- Base application theme. --> |
|||
<style name="Theme.EIWeblog" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> |
|||
<!-- Primary brand color. --> |
|||
<item name="colorPrimary">@color/purple_200</item> |
|||
<item name="colorPrimaryVariant">@color/purple_700</item> |
|||
<item name="colorOnPrimary">@color/black</item> |
|||
<!-- Secondary brand color. --> |
|||
<item name="colorSecondary">@color/teal_200</item> |
|||
<item name="colorSecondaryVariant">@color/teal_200</item> |
|||
<item name="colorOnSecondary">@color/black</item> |
|||
<!-- Status bar color. --> |
|||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> |
|||
<!-- Customize your theme here. --> |
|||
</style> |
|||
</resources> |
@ -0,0 +1,4 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<resources> |
|||
<color name="ic_launcher_background">#FFFFFF</color> |
|||
</resources> |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 2.7 KiB |