Added Stat activity, helpers and cleanup

This commit is contained in:
soraefir 2024-02-09 00:12:01 +01:00
parent f9285d0f31
commit ca5465bc75
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
22 changed files with 229 additions and 107 deletions

View File

@ -52,6 +52,7 @@ dependencies {
implementation 'com.caverock:androidsvg-aar:1.4' implementation 'com.caverock:androidsvg-aar:1.4'
implementation 'com.github.chrisbanes:PhotoView:2.3.0' implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.mikepenz:aboutlibraries:10.10.0' implementation 'com.mikepenz:aboutlibraries:10.10.0'
} }

View File

@ -30,6 +30,13 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".activity.StatActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity <activity
android:name=".activity.SettingsActivity" android:name=".activity.SettingsActivity"
android:exported="true" > android:exported="true" >

View File

@ -6,35 +6,24 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import net.helcel.beendroid.R import net.helcel.beendroid.R
import net.helcel.beendroid.activity.fragment.AboutFragment
import net.helcel.beendroid.activity.fragment.LicenseFragment
import net.helcel.beendroid.activity.fragment.SettingsFragment
import net.helcel.beendroid.countries.Visited
import net.helcel.beendroid.countries.World import net.helcel.beendroid.countries.World
import net.helcel.beendroid.helper.colorPrimary import net.helcel.beendroid.helper.createActionBar
import net.helcel.beendroid.helper.visited
class EditActivity : AppCompatActivity() { class EditActivity : AppCompatActivity() {
private lateinit var list : RecyclerView private lateinit var list : RecyclerView
private lateinit var visited : Visited
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_edit) setContentView(R.layout.activity_edit)
createActionBar(this, getString(R.string.action_edit))
// Create action bar
supportActionBar?.setBackgroundDrawable(colorPrimary(this))
supportActionBar?.title = getString(R.string.action_edit)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
visited = Visited(this)
visited.load()
list = findViewById(R.id.list) list = findViewById(R.id.list)
list.layoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false) list.layoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false)
list.adapter = FoldingListAdapter(this, World.WWW.children, visited) { } list.adapter = FoldingListAdapter(this, World.WWW.children, visited!!)
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -1,10 +1,7 @@
package net.helcel.beendroid.activity package net.helcel.beendroid.activity
import android.content.Context import android.content.Context
import android.graphics.Color
import android.graphics.Typeface import android.graphics.Typeface
import android.graphics.drawable.ColorDrawable
import android.util.TypedValue
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -15,16 +12,17 @@ import com.google.android.material.checkbox.MaterialCheckBox
import net.helcel.beendroid.R import net.helcel.beendroid.R
import net.helcel.beendroid.countries.GeoLoc import net.helcel.beendroid.countries.GeoLoc
import net.helcel.beendroid.countries.Visited import net.helcel.beendroid.countries.Visited
import net.helcel.beendroid.helper.colorBackground
import net.helcel.beendroid.helper.colorPanelBackground
import java.util.* import java.util.*
class FoldingListAdapter( class FoldingListAdapter(
private val ctx: Context, l: List<GeoLoc>, private val ctx: Context, l: List<GeoLoc>,
private val visited: Visited, private val visited: Visited,
private val parentLambda: () -> Unit,
) : RecyclerView.Adapter<FoldingListAdapter.FoldingListViewHolder>() { ) : RecyclerView.Adapter<FoldingListAdapter.FoldingListViewHolder>() {
private var cg : MutableMap<GeoLoc,Boolean> = l.sortedBy { it.fullName }.fold(LinkedHashMap<GeoLoc,Boolean>()) { acc, e -> private val cg : MutableMap<GeoLoc,Boolean> = l.sortedBy { it.fullName }.fold(LinkedHashMap<GeoLoc,Boolean>()) { acc, e ->
acc[e] = false acc[e] = false
acc acc
} }
@ -38,8 +36,8 @@ class FoldingListAdapter(
override fun onBindViewHolder(holder: FoldingListViewHolder, position: Int) { override fun onBindViewHolder(holder: FoldingListViewHolder, position: Int) {
val el = cg.toList()[position] val el = cg.toList()[position]
holder.bind(el) { parentLambda() }
holder.bind(el)
holder.addListeners( { holder.addListeners( {
if (!el.first.isEnd) { if (!el.first.isEnd) {
cg[el.first] = !el.second cg[el.first] = !el.second
@ -48,7 +46,6 @@ class FoldingListAdapter(
!el.first.isEnd !el.first.isEnd
}, { }, {
visited.setVisited(el.first, it) visited.setVisited(el.first, it)
parentLambda()
}) })
} }
@ -66,47 +63,32 @@ class FoldingListAdapter(
private val list: RecyclerView = itemView.findViewById(R.id.list_list) private val list: RecyclerView = itemView.findViewById(R.id.list_list)
init { init {
list.layoutManager = LinearLayoutManager(ctx, RecyclerView.VERTICAL, false) list.layoutManager = LinearLayoutManager(ctx, RecyclerView.VERTICAL, false)
list.setItemAnimator(null) //TODO: Fix slow recycler expansion
//list.setHasFixedSize(true)
} }
fun bind(el: Pair<GeoLoc, Boolean>, parentLambda: () -> Unit) { fun bind(el: Pair<GeoLoc, Boolean>) {
subItemView.visibility = if (el.second) View.VISIBLE else View.GONE subItemView.visibility = if (el.second) View.VISIBLE else View.GONE
textView.text = el.first.fullName textView.text = el.first.fullName
if (el.first.children.isEmpty()) { if (el.first.children.isEmpty()) {
val colorBackgroundTyped = TypedValue()
ctx.theme.resolveAttribute(
android.R.attr.colorBackground,
colorBackgroundTyped,
true
)
textView.backgroundTintList = null textView.backgroundTintList = null
textView.background = ColorDrawable(colorBackgroundTyped.data) textView.background = colorBackground(ctx)
textView.isActivated = false textView.isActivated = false
}else { }else {
textView.setTypeface(null, Typeface.BOLD) textView.setTypeface(null, Typeface.BOLD)
progressView.text = "${(el.first.children.map { visited.visited(it) }.count { it })}/${el.first.children.size}" progressView.text = ctx.getString(R.string.rate,(el.first.children.map { visited.getVisited(it) }.count { it }),el.first.children.size)
val colorGrayTyped = TypedValue() textView.background = colorPanelBackground(ctx)
ctx.theme.resolveAttribute( textView.background.alpha = 128
android.R.attr.panelColorBackground,
colorGrayTyped, list.adapter = FoldingListAdapter(ctx, el.first.children, visited)
true
)
val color = Color.valueOf(colorGrayTyped.data)
textView.setBackgroundColor(
Color.valueOf(
color.red(),
color.green(),
color.blue(),
0.5f
).toArgb()
)
list.adapter = FoldingListAdapter(ctx, el.first.children, visited, parentLambda)
textView.parent.parent.requestChildFocus(textView, textView) textView.parent.parent.requestChildFocus(textView, textView)
} }
checkBox.checkedState = checkBox.checkedState =
if (visited.visited(el.first)) MaterialCheckBox.STATE_CHECKED if (visited.getVisited(el.first)) MaterialCheckBox.STATE_CHECKED
else if (el.first.children.any { visited.visited(it) }) MaterialCheckBox.STATE_INDETERMINATE else if (el.first.children.any { visited.getVisited(it) }) MaterialCheckBox.STATE_INDETERMINATE
else MaterialCheckBox.STATE_UNCHECKED else MaterialCheckBox.STATE_UNCHECKED
} }

View File

@ -2,9 +2,9 @@ package net.helcel.beendroid.activity
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.PictureDrawable import android.graphics.drawable.PictureDrawable
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.Menu import android.view.Menu
import android.view.MenuInflater import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
@ -31,7 +31,6 @@ class MainActivity : AppCompatActivity() {
private lateinit var photoView : PhotoView private lateinit var photoView : PhotoView
private lateinit var visited : Visited
private lateinit var psvg : PSVGWrapper private lateinit var psvg : PSVGWrapper
private lateinit var css : CSSWrapper private lateinit var css : CSSWrapper
@ -63,11 +62,10 @@ class MainActivity : AppCompatActivity() {
true true
} }
R.id.action_stats -> { R.id.action_stats -> {
// TODO: Write stats activity startActivity(Intent(this@MainActivity, StatActivity::class.java))
true true
} }
R.id.action_settings -> { R.id.action_settings -> {
// Open settings
startActivity(Intent(this@MainActivity, SettingsActivity::class.java)) startActivity(Intent(this@MainActivity, SettingsActivity::class.java))
true true
} }
@ -80,11 +78,12 @@ class MainActivity : AppCompatActivity() {
}) })
// Restore visited countries // Restore visited countries
visited = Visited(this) visited = Visited(this).load()
// Wrap lists of countries // Wrap lists of countries
psvg = PSVGWrapper(this) psvg = PSVGWrapper(this)
css = CSSWrapper(visited) css = CSSWrapper(visited!!)
// Populate map from list of countries // Populate map from list of countries
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
@ -97,12 +96,10 @@ class MainActivity : AppCompatActivity() {
} }
private fun refreshMap() { private fun refreshMap() {
visited.load()
val opt : RenderOptions = RenderOptions.create() val opt : RenderOptions = RenderOptions.create()
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
opt.css(css.get()) opt.css(css.get())
} }
photoView.setImageLevel(1)
photoView.setImageDrawable(PictureDrawable(psvg.get().renderToPicture(opt))) photoView.setImageDrawable(PictureDrawable(psvg.get().renderToPicture(opt)))
} }

View File

@ -14,13 +14,8 @@ class SettingsActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
// Bind activity to XML layout with fragment view
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
createActionBar(this, getString(R.string.action_settings))
// Create action bar
supportActionBar?.setBackgroundDrawable(colorPrimary(this))
supportActionBar?.title = getString(R.string.action_settings)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
// Populate activity with settings fragment // Populate activity with settings fragment
supportFragmentManager.beginTransaction() supportFragmentManager.beginTransaction()

View File

@ -0,0 +1,127 @@
package net.helcel.beendroid.activity
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import com.github.mikephil.charting.animation.Easing
import com.github.mikephil.charting.charts.PieChart
import com.github.mikephil.charting.components.Legend
import com.github.mikephil.charting.data.PieData
import com.github.mikephil.charting.data.PieDataSet
import com.github.mikephil.charting.data.PieEntry
import com.github.mikephil.charting.formatter.PercentFormatter
import com.github.mikephil.charting.utils.ColorTemplate
import com.github.mikephil.charting.utils.MPPointF
import net.helcel.beendroid.R
import net.helcel.beendroid.countries.World
import net.helcel.beendroid.helper.createActionBar
import net.helcel.beendroid.helper.visited
class StatActivity : AppCompatActivity() {
private lateinit var chart : PieChart
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_stat)
createActionBar(this, getString(R.string.action_stat))
chart = findViewById(R.id.chart)
chart.setUsePercentValues(true)
chart.description.isEnabled = false
chart.setExtraOffsets(5F, 10F, 5F, 5F)
chart.setDragDecelerationFrictionCoef(0.95f)
chart.centerText = "Country Area"
chart.isDrawHoleEnabled = true
chart.setTransparentCircleColor(Color.TRANSPARENT)
chart.setHoleColor(Color.TRANSPARENT)
chart.setCenterTextColor(Color.WHITE)
chart.setTransparentCircleAlpha(0)
chart.holeRadius = 40F
chart.transparentCircleRadius = 45F
chart.setDrawCenterText(true)
chart.setRotationAngle(0F)
chart.isRotationEnabled = true
chart.isHighlightPerTapEnabled = false
// chart.spin(2000, 0, 360);
val l: Legend = chart.legend
l.verticalAlignment = Legend.LegendVerticalAlignment.TOP
l.horizontalAlignment = Legend.LegendHorizontalAlignment.RIGHT
l.orientation = Legend.LegendOrientation.VERTICAL
l.setDrawInside(false)
l.xEntrySpace = 7F
l.yEntrySpace = 0F
l.yOffset = 0F
chart.setEntryLabelColor(Color.WHITE)
chart.setEntryLabelTextSize(12f)
bind()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
finish()
return super.onOptionsItemSelected(item)
}
private fun bind() {
val entries = ArrayList<PieEntry>()
val VIS_continents = World.WWW.children.groupBy { visited!!.getVisited(it) }.map { Pair(it.key,it.value.map { c-> c.area }.fold(0){acc,i-> acc+i}) }
val VIS_country = World.WWW.children.map { it.children }.flatten().groupBy { visited!!.getVisited(it) }.map { Pair(it.key,it.value.map { c-> c.area }.fold(0){acc,i-> acc+i}) }
val vis = VIS_country
Log.d("VIS",vis.toString())
val max = vis.fold(0,) {acc, i -> acc+i.second}
vis.forEach {
entries.add(PieEntry(it.second.toFloat().div(max.toFloat()),it.first.toString()))
}
val dataSet = PieDataSet(entries, "GG1")
dataSet.valueTextColor = Color.BLACK
dataSet.sliceSpace = 3f
dataSet.iconsOffset = MPPointF(0f, 40f)
dataSet.selectionShift = 5f
// add a lot of colors
val colors = ArrayList<Int>()
for (c in ColorTemplate.VORDIPLOM_COLORS) colors.add(c)
for (c in ColorTemplate.JOYFUL_COLORS) colors.add(c)
for (c in ColorTemplate.COLORFUL_COLORS) colors.add(c)
for (c in ColorTemplate.LIBERTY_COLORS) colors.add(c)
for (c in ColorTemplate.PASTEL_COLORS) colors.add(c)
colors.add(ColorTemplate.getHoloBlue())
dataSet.colors = colors
val data = PieData(dataSet)
data.setDrawValues(false)
data.setValueFormatter(PercentFormatter())
data.setValueTextSize(11f)
data.setValueTextColor(Color.BLACK)
chart.setEntryLabelColor(Color.BLACK)
chart.data = data
chart.highlightValues(null)
chart.invalidate()
}
}

View File

@ -11,8 +11,7 @@ class Visited(ctx: Context) {
private val pref = ctx.getSharedPreferences("Visited", Context.MODE_PRIVATE) private val pref = ctx.getSharedPreferences("Visited", Context.MODE_PRIVATE)
private val editor = pref.edit() private val editor = pref.edit()
fun load() { fun load(): Visited {
Group.entries.forEach { Group.entries.forEach {
locs[it] = pref.getBoolean(it.code, false) locs[it] = pref.getBoolean(it.code, false)
} }
@ -23,9 +22,10 @@ class Visited(ctx: Context) {
locs[it] = pref.getBoolean(it.code, false) locs[it] = pref.getBoolean(it.code, false)
} }
editor.apply() editor.apply()
return this
} }
fun setVisited(key: GeoLoc, b: Boolean){ fun setVisited(key: GeoLoc, b: Boolean) {
locs[key] = b locs[key] = b
CoroutineScope(Dispatchers.Main).launch { CoroutineScope(Dispatchers.Main).launch {
editor.putBoolean(key.code, b) editor.putBoolean(key.code, b)
@ -33,7 +33,7 @@ class Visited(ctx: Context) {
} }
} }
fun visited(key: GeoLoc): Boolean { fun getVisited(key: GeoLoc): Boolean {
return locs.getOrDefault(key,false) return locs.getOrDefault(key,false)
} }

View File

@ -0,0 +1,7 @@
package net.helcel.beendroid.helper
import net.helcel.beendroid.countries.Visited
var visited : Visited? = null
//= Visited(this)

View File

@ -3,11 +3,28 @@ package net.helcel.beendroid.helper
import android.content.Context import android.content.Context
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.util.TypedValue import android.util.TypedValue
import androidx.appcompat.app.AppCompatActivity
fun colorWrapper(ctx : Context, res: Int): ColorDrawable {
fun colorPrimary(ctx : Context): ColorDrawable {
val colorPrimaryTyped = TypedValue() val colorPrimaryTyped = TypedValue()
ctx.theme.resolveAttribute(android.R.attr.colorPrimary, colorPrimaryTyped, true) ctx.theme.resolveAttribute(res, colorPrimaryTyped, true)
return ColorDrawable(colorPrimaryTyped.data) return ColorDrawable(colorPrimaryTyped.data)
} }
fun colorPrimary(ctx : Context): ColorDrawable {
return colorWrapper(ctx, android.R.attr.colorPrimary)
}
fun colorBackground(ctx : Context): ColorDrawable {
return colorWrapper(ctx, android.R.attr.colorBackground)
}
fun colorPanelBackground(ctx: Context): ColorDrawable {
return colorWrapper(ctx, android.R.attr.panelColorBackground)
}
fun createActionBar(ctx: AppCompatActivity, title: String) {
ctx.supportActionBar?.setBackgroundDrawable(colorPrimary(ctx))
ctx.supportActionBar?.title = title
ctx.supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

View File

@ -9,13 +9,13 @@ class CSSWrapper(private val visited: Visited) {
fun get() : String { fun get() : String {
return listOf(World.WWW.children return listOf(World.WWW.children
.filter { visited.visited(it)} .filter { visited.getVisited(it)}
.map { ".${it.code}{fill:$colorPrimary;}"} .map { ".${it.code}{fill:$colorPrimary;}"}
.fold(""){acc, s-> acc + s}, .fold(""){acc, s-> acc + s},
World.WWW.children World.WWW.children
.filter { !visited.visited(it) } .filter { !visited.getVisited(it) }
.map { cg -> cg.children .map { cg -> cg.children
.filter { visited.visited(it) } .filter { visited.getVisited(it) }
.map { ".${it.code}{fill:$colorPrimary;}"} .map { ".${it.code}{fill:$colorPrimary;}"}
.fold(""){acc, s-> acc + s} .fold(""){acc, s-> acc + s}
}.fold(""){acc,s->acc+s}, }.fold(""){acc,s->acc+s},

View File

@ -1,30 +1,24 @@
package net.helcel.beendroid.svg package net.helcel.beendroid.svg
import android.content.Context import android.content.Context
import android.util.TypedValue import android.util.Log
import com.caverock.androidsvg.SVG import com.caverock.androidsvg.SVG
import net.helcel.beendroid.R
import net.helcel.beendroid.countries.Country import net.helcel.beendroid.countries.Country
import net.helcel.beendroid.countries.GeoLoc import net.helcel.beendroid.countries.GeoLoc
import net.helcel.beendroid.countries.World import net.helcel.beendroid.countries.World
import net.helcel.beendroid.helper.colorWrapper
@OptIn(ExperimentalStdlibApi::class)
class PSVGWrapper(ctx: Context) { class PSVGWrapper(ctx: Context) {
private val cm = HashMap<GeoLoc, PSVGLoader>() private val cm = HashMap<GeoLoc, PSVGLoader>()
private var fm = "" private var fm = ""
private val colorForeground: String private val colorForeground: String = colorWrapper(ctx, R.color.darkgray).color.toHexString().substring(2)
private val colorBackground: String private val colorBackground: String = colorWrapper(ctx, R.color.black).color.toHexString().substring(2)
init { init {
val colorSecondaryTyped = TypedValue()
ctx.theme.resolveAttribute(android.R.attr.panelColorBackground, colorSecondaryTyped, true)
colorForeground = "\"#${Integer.toHexString(colorSecondaryTyped.data).subSequence(2, 8)}\""
val colorBackgroundTyped = TypedValue()
ctx.theme.resolveAttribute(android.R.attr.colorBackground, colorBackgroundTyped, true)
colorBackground = "\"#${Integer.toHexString(colorBackgroundTyped.data).subSequence(2, 8)}\""
Country.entries.forEach { Country.entries.forEach {
cm[it] = PSVGLoader(ctx, it, Level.ZERO).load() cm[it] = PSVGLoader(ctx, it, Level.ZERO).load()
} }
@ -45,7 +39,7 @@ class PSVGWrapper(ctx: Context) {
} }
fun get(): SVG { fun get(): SVG {
return SVG.getFromString("<svg id=\"map\" xmlns=\"http://www.w3.org/2000/svg\" width=\"1200\" height=\"1200\" x=\"0\" y=\"0\" fill=${colorForeground} stroke=${colorBackground} stroke-width=\"0.25px\">$fm</svg>") return SVG.getFromString("<svg id=\"map\" xmlns=\"http://www.w3.org/2000/svg\" width=\"1200\" height=\"1200\" x=\"0\" y=\"0\" fill=\"#$colorForeground\" stroke=\"#$colorBackground\" stroke-width=\"0.25px\">$fm</svg>")
} }
} }

View File

@ -6,7 +6,7 @@
android:viewportHeight="1600" > android:viewportHeight="1600" >
<path <path
android:fillColor="#FFFFFF" android:fillColor="@color/white"
android:fillType="nonZero" android:fillType="nonZero"
android:pathData="m800,1200q-83,0 -156,-31.5Q571,1137 517,1083 463,1029 431.5,956 400,883 400,800 400,717 431.5,644 463,571 517,517 571,463 644,431.5 717,400 800,400q83,0 156,31.5 73,31.5 127,85.5 54,54 85.5,127 31.5,73 31.5,156 0,83 -31.5,156 -31.5,73 -85.5,127 -54,54 -127,85.5 -73,31.5 -156,31.5zM800,1120q134,0 227,-93 93,-93 93,-227 0,-7 -0.5,-14.5 -0.5,-7.5 -0.5,-12.5 -5,29 -27,48 -22,19 -52,19L960,840Q927,840 903.5,816.5 880,793 880,760L880,720L720,720v-80q0,-33 23.5,-56.5Q767,560 800,560h40v0q0,-23 12.5,-40.5Q865,502 883,491q-20,-5 -40.5,-8 -20.5,-3 -42.5,-3 -134,0 -227,93 -93,93 -93,227 0,0 0,0 0,0 0,0h200q66,0 113,47 47,47 47,113v40L720,1000v110q20,5 39.5,7.5 19.5,2.5 40.5,2.5z" android:pathData="m800,1200q-83,0 -156,-31.5Q571,1137 517,1083 463,1029 431.5,956 400,883 400,800 400,717 431.5,644 463,571 517,517 571,463 644,431.5 717,400 800,400q83,0 156,31.5 73,31.5 127,85.5 54,54 85.5,127 31.5,73 31.5,156 0,83 -31.5,156 -31.5,73 -85.5,127 -54,54 -127,85.5 -73,31.5 -156,31.5zM800,1120q134,0 227,-93 93,-93 93,-227 0,-7 -0.5,-14.5 -0.5,-7.5 -0.5,-12.5 -5,29 -27,48 -22,19 -52,19L960,840Q927,840 903.5,816.5 880,793 880,760L880,720L720,720v-80q0,-33 23.5,-56.5Q767,560 800,560h40v0q0,-23 12.5,-40.5Q865,502 883,491q-20,-5 -40.5,-8 -20.5,-3 -42.5,-3 -134,0 -227,93 -93,93 -93,227 0,0 0,0 0,0 0,0h200q66,0 113,47 47,47 47,113v40L720,1000v110q20,5 39.5,7.5 19.5,2.5 40.5,2.5z"
android:strokeWidth="1" android:strokeWidth="1"

View File

@ -4,10 +4,10 @@ android:height="24dp"
android:viewportWidth="960" android:viewportWidth="960"
android:viewportHeight="960"> android:viewportHeight="960">
<path <path
android:fillColor="?attr/colorOnBackground" android:fillColor="@color/white"
android:pathData="M80,160Q80,127 103.5,103.5Q127,80 160,80L800,80Q833,80 856.5,103.5Q880,127 880,160L880,640Q880,673 856.5,696.5Q833,720 800,720L240,720L80,880ZM206,640L800,640Q800,640 800,640Q800,640 800,640L800,160Q800,160 800,160Q800,160 800,160L160,160Q160,160 160,160Q160,160 160,160L160,685L206,640ZM160,640L160,640L160,160Q160,160 160,160Q160,160 160,160L160,160Q160,160 160,160Q160,160 160,160L160,640Q160,640 160,640Q160,640 160,640L160,640Z" /> android:pathData="M80,160Q80,127 103.5,103.5Q127,80 160,80L800,80Q833,80 856.5,103.5Q880,127 880,160L880,640Q880,673 856.5,696.5Q833,720 800,720L240,720L80,880ZM206,640L800,640Q800,640 800,640Q800,640 800,640L800,160Q800,160 800,160Q800,160 800,160L160,160Q160,160 160,160Q160,160 160,160L160,685L206,640ZM160,640L160,640L160,160Q160,160 160,160Q160,160 160,160L160,160Q160,160 160,160Q160,160 160,160L160,640Q160,640 160,640Q160,640 160,640L160,640Z" />
<path <path
android:fillColor="?attr/colorPrimary" android:fillColor="@color/blue"
android:pathData="M480,280Q497,280 508.5,268.5Q520,257 520,240Q520,223 508.5,211.5Q497,200 480,200Q463,200 451.5,211.5Q440,223 440,240Q440,257 451.5,268.5Q463,280 480,280ZM440,600L520,600L520,360L440,360L440,600ZM80,880L80,160" /> android:pathData="M480,280Q497,280 508.5,268.5Q520,257 520,240Q520,223 508.5,211.5Q497,200 480,200Q463,200 451.5,211.5Q440,223 440,240Q440,257 451.5,268.5Q463,280 480,280ZM440,600L520,600L520,360L440,360L440,600ZM80,880L80,160" />
</vector> </vector>

View File

@ -4,6 +4,6 @@
android:viewportWidth="320" android:viewportWidth="320"
android:viewportHeight="512"> android:viewportHeight="512">
<path <path
android:fillColor="?attr/colorOnBackground" android:fillColor="@color/white"
android:pathData="M310.6,233.4c12.5,12.5 12.5,32.8 0,45.3l-192,192c-12.5,12.5 -32.8,12.5 -45.3,0s-12.5,-32.8 0,-45.3L242.7,256 73.4,86.6c-12.5,-12.5 -12.5,-32.8 0,-45.3s32.8,-12.5 45.3,0l192,192z"/> android:pathData="M310.6,233.4c12.5,12.5 12.5,32.8 0,45.3l-192,192c-12.5,12.5 -32.8,12.5 -45.3,0s-12.5,-32.8 0,-45.3L242.7,256 73.4,86.6c-12.5,-12.5 -12.5,-32.8 0,-45.3s32.8,-12.5 45.3,0l192,192z"/>
</vector> </vector>

View File

@ -5,6 +5,6 @@
android:viewportWidth="960" android:viewportWidth="960"
android:viewportHeight="960"> android:viewportHeight="960">
<path <path
android:fillColor="#FF0187FF" android:fillColor="@color/darkgray"
android:pathData="M0,0h960v960h-960z" /> android:pathData="M0,0h960v960h-960z" />
</vector> </vector>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
android:theme="@style/Theme.Beendroid" android:theme="@style/Theme.Beendroid"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:theme="@style/Theme.Beendroid"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.github.mikephil.charting.charts.PieChart
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

View File

@ -14,7 +14,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orderInCategory="100" android:orderInCategory="100"
android:title="@string/action_stats" android:title="@string/action_stat"
app:showAsAction="never" /> app:showAsAction="never" />
<item <item
android:id="@+id/action_settings" android:id="@+id/action_settings"

View File

@ -1,13 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03AFFF</color>
<color name="teal_700">#FF0187FF</color>
<color name="yellowish">#FFFFDD00</color>
<color name="black">#FF000000</color> <color name="black">#FF000000</color>
<color name="darkgray">#FF555555</color> <color name="darkgray">#FF0C1D2E</color>
<color name="lightgray">#FFBBBBBB</color> <color name="lightgray">#FF93A9BE</color>
<color name="blue">#FF3193F5</color>
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
</resources> </resources>

View File

@ -3,7 +3,7 @@
<string name="app_name">BeenDroid</string> <string name="app_name">BeenDroid</string>
<string name="app_version">1.0</string> <string name="app_version">1.0</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="action_stats">Stats</string> <string name="action_stat">Stats</string>
<string name="action_edit">Edit</string> <string name="action_edit">Edit</string>
<string name="welcome">Welcome!</string> <string name="welcome">Welcome!</string>
<string name="change_lang">Change language</string> <string name="change_lang">Change language</string>
@ -13,6 +13,7 @@
<string name="dark">Dark</string> <string name="dark">Dark</string>
<string name="licenses">Licenses</string> <string name="licenses">Licenses</string>
<string name="about">About</string> <string name="about">About</string>
<string name="rate">%1$d/%2$d</string>
<string name="beendroid_is_foss">BeenDroid is free and open source software, licensed under the GNU General Public License (version 3 or later)</string> <string name="beendroid_is_foss">BeenDroid is free and open source software, licensed under the GNU General Public License (version 3 or later)</string>
<string name="beendroid_repo">Project repository: https://git.helcel.net/helcel/beendroid\n Feel free to report issues or contribute to the project.</string> <string name="beendroid_repo">Project repository: https://git.helcel.net/helcel/beendroid\n Feel free to report issues or contribute to the project.</string>
<string name="foss_licenses">Free and open source dependencies and licenses</string> <string name="foss_licenses">Free and open source dependencies and licenses</string>

View File

@ -1,11 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Beendroid" parent="Theme.Material3.DayNight"> <style name="Theme.Beendroid" parent="Theme.Material3.DayNight">
<item name="colorPrimary">@color/teal_700</item> <item name="colorPrimary">@color/blue</item>
<item name="android:colorPrimary">@color/teal_700</item> <item name="android:colorPrimary">?attr/colorPrimary</item>
<item name="android:panelColorBackground">@color/lightgray</item> <item name="android:panelColorBackground">@color/lightgray</item>
<item name="android:statusBarColor">?attr/colorPrimary</item> <item name="android:statusBarColor">?attr/colorPrimary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="checkboxStyle">@style/Widget.App.CheckBox</item> <item name="checkboxStyle">@style/Widget.App.CheckBox</item>
</style> </style>