diff --git a/app/src/main/java/com/maenle/bump/ui/MainActivity.kt b/app/src/main/java/com/maenle/bump/ui/MainActivity.kt index 2ac30fe..7333bf0 100644 --- a/app/src/main/java/com/maenle/bump/ui/MainActivity.kt +++ b/app/src/main/java/com/maenle/bump/ui/MainActivity.kt @@ -1,19 +1,24 @@ package com.maenle.bump.ui +import android.content.Intent +import android.graphics.Color +import android.net.Uri import android.os.Bundle +import android.text.SpannableString +import android.text.style.ForegroundColorSpan import android.util.Log -import com.google.android.material.snackbar.Snackbar +import android.view.Menu +import android.view.MenuItem import androidx.appcompat.app.AppCompatActivity import androidx.navigation.findNavController import androidx.navigation.ui.AppBarConfiguration import androidx.navigation.ui.navigateUp import androidx.navigation.ui.setupActionBarWithNavController -import android.view.Menu -import android.view.MenuItem import com.maenle.bump.R import com.maenle.bump.databinding.ActivityMainBinding import com.maenle.bump.util.BumpProcessor + class MainActivity : AppCompatActivity() { private lateinit var appBarConfiguration: AppBarConfiguration @@ -38,8 +43,24 @@ class MainActivity : AppCompatActivity() { } + fun showHelp() { + val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("http://raphael.maenle.net/post/projects/bump/")); + startActivity(browserIntent); + } + override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu) + for (i in 0 until menu.size()) { + val item = menu.getItem(i) + val spanString = SpannableString(menu.getItem(i).title.toString()) + spanString.setSpan( + ForegroundColorSpan(Color.WHITE), + 0, + spanString.length, + 0 + ) //fix the color to white + item.title = spanString + } return true } @@ -53,6 +74,10 @@ class MainActivity : AppCompatActivity() { BumpProcessor.clearLog(applicationContext) true } + R.id.action_info -> { + showHelp() + true + } else -> super.onOptionsItemSelected(item) } diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index caad1f0..6b9aa2f 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -7,9 +7,14 @@ android:orderInCategory="100" android:title="@string/action_clear_log" app:showAsAction="never" /> + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a2b3905..2eb3949 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,7 @@ Bump Settings + Help Clear Log Bump diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 2411a6f..ced12d0 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -12,6 +12,7 @@ ?attr/colorPrimaryVariant + @color/white