Merge pull request #50 from finnmglas/feature/intent-actions

Add ability to launch other internal activities
This commit is contained in:
Finn M Glas 2020-06-17 09:49:03 +02:00 committed by GitHub
commit a828b90bb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 488 additions and 101 deletions

View file

@ -24,15 +24,15 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TutorialActivity"
<activity android:name=".tutorial.TutorialActivity"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
</activity>
<activity android:name=".ChooseActivity"
<activity android:name=".choose.ChooseActivity"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
</activity>
<activity android:name=".SettingsActivity"
<activity android:name=".settings.SettingsActivity"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
</activity>

View file

@ -11,8 +11,9 @@ import android.view.*
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.GestureDetectorCompat
import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.choose.AppsRecyclerAdapter
import com.finnmglas.launcher.choose.apps.AppsRecyclerAdapter
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.tutorial.TutorialActivity
import kotlinx.android.synthetic.main.activity_main.*
import java.text.SimpleDateFormat
import java.util.*
@ -79,10 +80,15 @@ class MainActivity : AppCompatActivity(),
showSettingsIcon()
// As older APIs somehow do not recognize the xml defined onClick
activity_main_settings_icon.setOnClickListener() { openSettings() }
activity_main_settings_icon.setOnClickListener() {
openSettings(this)
overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
}
// Load apps list first - speed up settings that way
AsyncTask.execute { viewAdapter = AppsRecyclerAdapter( this, "", "") }
AsyncTask.execute { viewAdapter =
AppsRecyclerAdapter(this, "", "")
}
// First Startup
if (!sharedPref.getBoolean("startedBefore", false)){
@ -139,22 +145,17 @@ class MainActivity : AppCompatActivity(),
clockTimer.cancel()
}
private fun openSettings(){
startActivity(Intent(this, SettingsActivity::class.java))
overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
}
/** Touch- and Key-related functions to start activities */
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (settingsIconShown) hideSettingsIcon() }
else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) launchApp(volumeUpApp, this)
else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) launchApp(volumeDownApp, this)
else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) launch(volumeUpApp, this)
else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) launch(volumeDownApp, this)
return true
}
fun dateViewOnTouch(v: View) { launchApp(calendarApp, this) }
fun timeViewOnTouch(v: View) { launchApp(clockApp, this) }
fun dateViewOnTouch(v: View) { launch(calendarApp, this) }
fun timeViewOnTouch(v: View) { launch(clockApp, this) }
override fun onFling(e1: MotionEvent, e2: MotionEvent, dX: Float, dY: Float): Boolean {
@ -167,21 +168,24 @@ class MainActivity : AppCompatActivity(),
val strictness = 4 // how distinguished the swipe has to be to be accepted
// Only open if the swipe was not from the phones top edge
if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) launchApp(downApp, this)
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) launchApp(upApp, this)
else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) launchApp(leftApp, this)
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) launchApp(rightApp, this)
if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) launch(downApp, this)
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) {
launch(upApp, this)
overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
}
else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) launch(leftApp, this)
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) launch(rightApp, this)
return true
}
override fun onLongPress(event: MotionEvent) {
if(longClickApp != "") launchApp(longClickApp, this)
else openSettings()
if(longClickApp != "") launch(longClickApp, this)
else openSettings(this)
}
override fun onDoubleTap(event: MotionEvent): Boolean {
launchApp(doubleClickApp, this)
launch(doubleClickApp, this)
return false
}
@ -213,7 +217,7 @@ class MainActivity : AppCompatActivity(),
settingsIconShown = false
}
fun settingsIconOnTouch(view: View){ openSettings() }
fun settingsIconOnTouch(view: View){ openSettings(this) }
override fun onTouchEvent(event: MotionEvent): Boolean {
return if (mDetector.onTouchEvent(event)) { false } else { super.onTouchEvent(event) }

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher
package com.finnmglas.launcher.choose
import android.app.Activity
import android.content.Intent
@ -7,13 +7,20 @@ import android.view.View
import android.view.WindowManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.finnmglas.launcher.choose.AppsRecyclerAdapter
import androidx.viewpager.widget.ViewPager
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.settings.intendedSettingsPause
import com.google.android.material.tabs.TabLayout
import kotlinx.android.synthetic.main.activity_choose.*
var intendedChoosePause = false // know when to close
// TODO: Better solution for this (used in choose-fragments)
var action = "view"
var forApp = ""
class ChooseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@ -42,24 +49,27 @@ class ChooseActivity : AppCompatActivity() {
// get info about which action this activity is open for
val bundle = intent.extras
val action = bundle!!.getString("action") // why choose an app
val forApp = bundle.getString("forApp") // which app we choose
if (bundle != null) {
action = bundle.getString("action")!! // why choose an app
if (action != "view")
forApp = bundle.getString("forApp")!! // which app we choose
}
// Hide tabs for the "view" action
if (action == "view") {
activity_choose_tabs.visibility = View.GONE
}
when (action) {
"view" -> activity_choose_heading.text = getString(R.string.choose_title_view)
"pick" -> activity_choose_heading.text = getString(R.string.choose_title)
}
// set up the list / recycler
viewManager = LinearLayoutManager(this)
viewAdapter = AppsRecyclerAdapter( this, action, forApp)
activity_choose_apps_recycler_view.apply {
// improve performance (since content changes don't change the layout size)
setHasFixedSize(true)
layoutManager = viewManager
adapter = viewAdapter
}
val sectionsPagerAdapter = ChooseSectionsPagerAdapter(this, supportFragmentManager)
val viewPager: ViewPager = findViewById(R.id.activity_choose_view_pager)
viewPager.adapter = sectionsPagerAdapter
val tabs: TabLayout = findViewById(R.id.activity_choose_tabs)
tabs.setupWithViewPager(viewPager)
}
override fun onPause() {

View file

@ -0,0 +1,38 @@
package com.finnmglas.launcher.choose
import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.finnmglas.launcher.*
import com.finnmglas.launcher.choose.apps.ChooseFragmentApps
import com.finnmglas.launcher.choose.other.ChooseFragmentOther
private val TAB_TITLES = arrayOf(
R.string.choose_tab_app,
R.string.choose_tab_other
)
/** Returns the fragment corresponding to the selected tab.*/
class ChooseSectionsPagerAdapter(private val context: Context, fm: FragmentManager)
: FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
override fun getItem(position: Int): Fragment {
return when (position){
0 -> ChooseFragmentApps()
1 -> ChooseFragmentOther()
else -> Fragment()
}
}
override fun getPageTitle(position: Int): CharSequence? {
return context.resources.getString(TAB_TITLES[position])
}
override fun getCount(): Int {
return when (action) {
"view" -> 1
else -> 2
}
}
}

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.choose
package com.finnmglas.launcher.choose.apps
import android.graphics.drawable.Drawable

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.choose
package com.finnmglas.launcher.choose.apps
import android.app.Activity
import android.content.Context
@ -14,7 +14,7 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedChoosePause
import com.finnmglas.launcher.choose.intendedChoosePause
class AppsRecyclerAdapter(val activity: Activity, val action: String?, val forApp: String?):
RecyclerView.Adapter<AppsRecyclerAdapter.ViewHolder>() {
@ -73,6 +73,10 @@ class AppsRecyclerAdapter(val activity: Activity, val action: String?, val forAp
viewHolder.menuDots.setOnLongClickListener{ showOptionsPopup(viewHolder, appPackageName) }
viewHolder.textView.setOnLongClickListener{ showOptionsPopup(viewHolder, appPackageName) }
viewHolder.img.setOnLongClickListener{ showOptionsPopup(viewHolder, appPackageName) }
// ensure onClicks are actually caught
viewHolder.textView.setOnClickListener{ viewHolder.onClick(viewHolder.textView) }
viewHolder.img.setOnClickListener{ viewHolder.onClick(viewHolder.img) }
}
}

View file

@ -0,0 +1,52 @@
package com.finnmglas.launcher.choose.apps
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.finnmglas.launcher.R
import com.finnmglas.launcher.choose.action
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.choose.forApp
import kotlinx.android.synthetic.main.fragment_choose_apps.*
/** The 'Apps' Tab associated Fragment in the Chooser */
class ChooseFragmentApps : Fragment() {
/** Lifecycle functions */
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_choose_apps, container, false)
}
override fun onStart() {
super.onStart()
if (getSavedTheme(context!!) == "custom") {
fragment_choose_apps_container.setBackgroundColor(dominantColor)
}
// set up the list / recycler
val viewManager = LinearLayoutManager(context)
val viewAdapter = AppsRecyclerAdapter(
activity!!,
action,
forApp
)
fragment_choose_apps_recycler_view.apply {
// improve performance (since content changes don't change the layout size)
setHasFixedSize(true)
layoutManager = viewManager
adapter = viewAdapter
}
}
}

View file

@ -0,0 +1,45 @@
package com.finnmglas.launcher.choose.other
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.dominantColor
import com.finnmglas.launcher.extern.getSavedTheme
import kotlinx.android.synthetic.main.fragment_choose_other.*
/** The 'Other' Tab associated Fragment in the Chooser */
class ChooseFragmentOther : Fragment() {
/** Lifecycle functions */
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_choose_other, container, false)
}
override fun onStart() {
if (getSavedTheme(context!!) == "custom") {
fragment_choose_other_container.setBackgroundColor(dominantColor)
}
// set up the list / recycler
val viewManager = LinearLayoutManager(context)
val viewAdapter = OtherRecyclerAdapter(activity!!)
fragment_choose_other_recycler_view.apply {
// improve performance (since content changes don't change the layout size)
setHasFixedSize(true)
layoutManager = viewManager
adapter = viewAdapter
}
super.onStart()
}
}

View file

@ -0,0 +1,7 @@
package com.finnmglas.launcher.choose.other
class OtherInfo(label: String, data: String, icon: String) {
var label: CharSequence? = label
var data: CharSequence? = data
var icon: CharSequence? = icon
}

View file

@ -0,0 +1,72 @@
package com.finnmglas.launcher.choose.other
import android.app.Activity
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.choose.forApp
/* Will only be used if an app / action is picked */
class OtherRecyclerAdapter(val activity: Activity):
RecyclerView.Adapter<OtherRecyclerAdapter.ViewHolder>() {
private val othersList: MutableList<OtherInfo>
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
View.OnClickListener {
var textView: TextView = itemView.findViewById(R.id.row_other_name)
var iconView: FontAwesome = itemView.findViewById(R.id.row_other_fa_icon)
override fun onClick(v: View) {
val pos = adapterPosition
val content = othersList[pos]
returnChoiceIntent(forApp, content.data.toString())
}
init { itemView.setOnClickListener(this) }
}
override fun onBindViewHolder(viewHolder: ViewHolder, i: Int) {
val otherLabel = othersList[i].label.toString()
val icon = othersList[i].icon.toString()
viewHolder.textView.text = otherLabel
viewHolder.iconView.text = icon
}
override fun getItemCount(): Int { return othersList.size }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val inflater = LayoutInflater.from(parent.context)
val view: View = inflater.inflate(R.layout.recycler_other_row, parent, false)
return ViewHolder(view)
}
init {
othersList = ArrayList()
othersList.add(
OtherInfo("Launcher Settings",
"launcher:settings",
activity.getString(R.string.fas_settings)))
othersList.add(
OtherInfo("Launcher AppsList",
"launcher:choose",
activity.getString(R.string.fas_bars)))
}
/* */
private fun returnChoiceIntent(forAction: String, value: String) {
val returnIntent = Intent()
returnIntent.putExtra("value", value)
returnIntent.putExtra("forApp", forApp)
activity.setResult(REQUEST_CHOOSE_APP, returnIntent)
activity.finish()
}
}

View file

@ -17,7 +17,10 @@ import android.view.animation.*
import android.widget.Button
import android.widget.ImageView
import android.widget.Toast
import com.finnmglas.launcher.choose.ChooseActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.settings.SettingsActivity
import com.finnmglas.launcher.settings.intendedSettingsPause
import kotlin.math.roundToInt
@ -134,16 +137,22 @@ private fun getIntent(packageName: String, context: Context): Intent? {
return intent
}
// select what to launch
fun launch(data: String, activity: Activity) {
if (data.startsWith("launcher:")) // [type]:[info]
when(data.split(":")[1]) {
"settings" -> openSettings(activity)
"choose" -> openAppsList(activity)
}
else launchApp(data, activity) // app
}
fun launchApp(packageName: String, context: Context) {
val intent =
getIntent(packageName, context)
val intent = getIntent(packageName, context)
if (intent != null) {
context.startActivity(intent)
if (context is Activity) {
context.overridePendingTransition(0, 0)
}
} else {
if (isInstalled(packageName, context)){
@ -203,6 +212,17 @@ fun openAppSettings(pkg :String, context:Context){
context.startActivity(intent)
}
fun openSettings(activity: Activity){
activity.startActivity(Intent(activity, SettingsActivity::class.java))
}
fun openAppsList(activity: Activity){
val intent = Intent(activity, ChooseActivity::class.java)
intent.putExtra("action", "view")
intendedSettingsPause = true
activity.startActivity(intent)
}
fun loadSettings(sharedPref : SharedPreferences){
upApp = sharedPref.getString("action_upApp", "").toString()
downApp = sharedPref.getString("action_downApp", "").toString()

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher
package com.finnmglas.launcher.settings
import android.content.Context
import android.content.Intent
@ -9,8 +9,8 @@ import android.view.View
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager.widget.ViewPager
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.settings.SectionsPagerAdapter
import com.google.android.material.tabs.TabLayout
import kotlinx.android.synthetic.main.activity_settings.*
@ -36,7 +36,7 @@ class SettingsActivity : AppCompatActivity() {
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
val sectionsPagerAdapter = SectionsPagerAdapter(this, supportFragmentManager)
val sectionsPagerAdapter = SettingsSectionsPagerAdapter(this, supportFragmentManager)
val viewPager: ViewPager = findViewById(R.id.activity_settings_view_pager)
viewPager.adapter = sectionsPagerAdapter
val tabs: TabLayout = findViewById(R.id.activity_settings_tabs)

View file

@ -5,6 +5,9 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.finnmglas.launcher.*
import com.finnmglas.launcher.settings.actions.SettingsFragmentApps
import com.finnmglas.launcher.settings.meta.SettingsFragmentMeta
import com.finnmglas.launcher.settings.theme.SettingsFragmentTheme
private val TAB_TITLES = arrayOf(
R.string.settings_tab_app,
@ -13,7 +16,7 @@ private val TAB_TITLES = arrayOf(
)
/** Returns the fragment corresponding to the selected tab.*/
class SectionsPagerAdapter(private val context: Context, fm: FragmentManager)
class SettingsSectionsPagerAdapter(private val context: Context, fm: FragmentManager)
: FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
override fun getItem(position: Int): Fragment {

View file

@ -11,11 +11,11 @@ import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.ChooseActivity
import com.finnmglas.launcher.choose.ChooseActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.FontAwesome
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedSettingsPause
import com.finnmglas.launcher.settings.intendedSettingsPause
import java.lang.Exception
@ -27,6 +27,7 @@ class ActionsRecyclerAdapter(val activity: Activity):
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
View.OnClickListener {
var textView: TextView = itemView.findViewById(R.id.row_action_name)
var fontAwesome: FontAwesome = itemView.findViewById(R.id.row_app_fa_icon)
var img: ImageView = itemView.findViewById(R.id.row_app_icon) as ImageView
var chooseButton: Button = itemView.findViewById(R.id.row_choose_button)
var removeAction: FontAwesome = itemView.findViewById(R.id.row_remove_action)
@ -48,20 +49,44 @@ class ActionsRecyclerAdapter(val activity: Activity):
val content = actionsList[i].content
viewHolder.textView.text = actionText
try {
viewHolder.img.setImageDrawable(activity.packageManager.getApplicationIcon(content.toString()))
viewHolder.img.setOnClickListener{ chooseApp(actionName.toString()) }
if (getSavedTheme(activity) == "dark") transformGrayscale(viewHolder.img)
viewHolder.removeAction.setOnClickListener{
val sharedPref = activity.getSharedPreferences(
activity.getString(R.string.preference_file_key), Context.MODE_PRIVATE)
viewHolder.removeAction.setOnClickListener{
val sharedPref = activity.getSharedPreferences(
activity.getString(R.string.preference_file_key), Context.MODE_PRIVATE)
val editor : SharedPreferences.Editor = sharedPref.edit()
editor.putString("action_$actionName", "") // clear it
editor.apply()
val editor : SharedPreferences.Editor = sharedPref.edit()
editor.putString("action_$actionName", "") // clear it
editor.apply()
viewHolder.fontAwesome.visibility = View.INVISIBLE
viewHolder.img.visibility = View.INVISIBLE
viewHolder.removeAction.visibility = View.GONE
viewHolder.chooseButton.visibility = View.VISIBLE
viewHolder.chooseButton.setOnClickListener{ chooseApp(actionName.toString()) }
if (getSavedTheme(activity) =="custom")
setButtonColor(viewHolder.chooseButton, vibrantColor)
}
if (content!!.startsWith("launcher")) {
// Set fontAwesome icon
viewHolder.fontAwesome.visibility = View.VISIBLE
viewHolder.fontAwesome.setOnClickListener{ chooseApp(actionName.toString()) }
when (content.split(":")[1]) {
"settings" ->
viewHolder.fontAwesome.text = activity.getString(R.string.fas_settings)
"choose" ->
viewHolder.fontAwesome.text = activity.getString(R.string.fas_bars)
}
} else {
// Set image icon (by packageName)
try {
viewHolder.img.setImageDrawable(activity.packageManager.getApplicationIcon(content.toString()))
viewHolder.img.setOnClickListener{ chooseApp(actionName.toString()) }
if (getSavedTheme(activity) == "dark") transformGrayscale(viewHolder.img)
} catch (e : Exception) { // the button is shown, user asked to select an action
viewHolder.img.visibility = View.INVISIBLE
viewHolder.removeAction.visibility = View.GONE
viewHolder.chooseButton.visibility = View.VISIBLE
@ -69,14 +94,6 @@ class ActionsRecyclerAdapter(val activity: Activity):
if (getSavedTheme(activity) =="custom")
setButtonColor(viewHolder.chooseButton, vibrantColor)
}
} catch (e : Exception) {
viewHolder.img.visibility = View.INVISIBLE
viewHolder.removeAction.visibility = View.GONE
viewHolder.chooseButton.visibility = View.VISIBLE
viewHolder.chooseButton.setOnClickListener{ chooseApp(actionName.toString()) }
if (getSavedTheme(activity) =="custom")
setButtonColor(viewHolder.chooseButton, vibrantColor)
}
}

View file

@ -1,9 +1,7 @@
package com.finnmglas.launcher.settings
package com.finnmglas.launcher.settings.actions
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
@ -12,11 +10,10 @@ import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.finnmglas.launcher.ChooseActivity
import com.finnmglas.launcher.choose.ChooseActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedSettingsPause
import com.finnmglas.launcher.settings.actions.ActionsRecyclerAdapter
import com.finnmglas.launcher.settings.intendedSettingsPause
import kotlinx.android.synthetic.main.fragment_settings_apps.*

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.settings
package com.finnmglas.launcher.settings.meta
import android.app.AlertDialog
import android.content.ActivityNotFoundException
@ -13,10 +13,10 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.finnmglas.launcher.TutorialActivity
import com.finnmglas.launcher.tutorial.TutorialActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedSettingsPause
import com.finnmglas.launcher.settings.intendedSettingsPause
import kotlinx.android.synthetic.main.fragment_settings_meta.*
/** The 'Meta' Tab associated Fragment in Settings */

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.settings
package com.finnmglas.launcher.settings.theme
import android.Manifest
import android.content.Context
@ -18,9 +18,7 @@ import androidx.core.content.ContextCompat
import androidx.palette.graphics.Palette
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedSettingsPause
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_settings.*
import com.finnmglas.launcher.settings.intendedSettingsPause
import kotlinx.android.synthetic.main.fragment_settings_theme.*
/** The 'Theme' Tab associated Fragment in Settings */

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher
package com.finnmglas.launcher.tutorial
import android.content.Context
import android.content.SharedPreferences
@ -6,6 +6,7 @@ import android.os.Bundle
import android.util.TypedValue
import android.view.*
import androidx.appcompat.app.AppCompatActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import kotlinx.android.synthetic.main.activity_tutorial.*

View file

@ -5,6 +5,6 @@
android:fromYDelta="75%p"
android:toYDelta="0%p"
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="150"/>
android:duration="100"/>
</set>

View file

@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
tools:context=".ChooseActivity">
tools:context=".choose.ChooseActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/activity_choose_app_bar"
@ -56,20 +56,22 @@
custom:type="solid" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.tabs.TabLayout
android:id="@+id/activity_choose_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
custom:tabTextColor="?attr/android:textColor" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/activity_choose_apps_recycler_view"
android:layout_width="match_parent"
<androidx.viewpager.widget.ViewPager
android:id="@+id/activity_choose_view_pager"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/activity_choose_app_bar" />
app:layout_constraintTop_toBottomOf="@id/activity_choose_app_bar"
custom:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -7,7 +7,7 @@
android:id="@+id/activity_settings_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SettingsActivity">
tools:context=".settings.SettingsActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/activity_settings_app_bar"

View file

@ -8,7 +8,7 @@
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
android:onClick="clickAnywhere"
tools:context=".TutorialActivity">
tools:context=".tutorial.TutorialActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/activity_firststartup_app_bar"

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/fragment_choose_apps_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
android:gravity="center|top"
android:orientation="vertical"
tools:context=".choose.apps.ChooseFragmentApps">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/fragment_choose_apps_recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/fragment_choose_other_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
android:gravity="center|top"
android:orientation="vertical"
tools:context=".choose.other.ChooseFragmentOther">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/fragment_choose_other_recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View file

@ -11,7 +11,7 @@
android:paddingLeft="32sp"
android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentApps">
tools:context=".settings.actions.SettingsFragmentApps">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View file

@ -12,7 +12,7 @@
android:paddingLeft="32sp"
android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentMeta">
tools:context=".settings.meta.SettingsFragmentMeta">
<Button
android:id="@+id/fragment_settings_meta_select_launcher_btn"

View file

@ -13,7 +13,7 @@
android:paddingLeft="32sp"
android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentMeta">
tools:context=".settings.meta.SettingsFragmentMeta">
<ScrollView
android:layout_width="match_parent"

View file

@ -30,6 +30,18 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/row_app_fa_icon"
android:layout_width="@dimen/app_icon_side"
android:layout_height="@dimen/app_icon_side"
android:gravity="center"
android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/row_choose_button"
app:layout_constraintHorizontal_bias="0.2"
app:layout_constraintStart_toStartOf="@+id/row_choose_button"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/row_app_icon"
android:layout_width="@dimen/app_icon_side"

View file

@ -0,0 +1,36 @@
<?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="wrap_content"
android:layout_margin="15sp">
<com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/row_other_fa_icon"
android:layout_width="40sp"
android:layout_height="40sp"
android:gravity="center"
android:text=""
android:textSize="35sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/row_other_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="60sp"
android:layout_marginLeft="60sp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:gravity="start"
android:text=""
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -61,6 +61,9 @@
<string name="choose_title">Choose App</string>
<string name="choose_title_view">All Apps</string>
<string name="choose_tab_app" translatable="false">Apps</string>
<string name="choose_tab_other" translatable="false">Other</string>
<string name="choose_back_settings">Back to Settings</string>
<string name="choose_removed_toast">Removed the selected application</string>