redesigning the Licenses screen + some files renamed
This commit is contained in:
parent
b18291f2a8
commit
61b172fe4f
11 changed files with 41 additions and 32 deletions
|
@ -3,12 +3,16 @@ package com.simplemobiletools.commons.activities
|
|||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
import android.widget.LinearLayout
|
||||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.launchViewIntent
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.License
|
||||
import kotlinx.android.synthetic.main.activity_license.*
|
||||
import kotlinx.android.synthetic.main.license_item.view.*
|
||||
import kotlinx.android.synthetic.main.item_license.view.*
|
||||
import java.util.*
|
||||
|
||||
class LicenseActivity : BaseSimpleActivity() {
|
||||
|
@ -20,7 +24,8 @@ class LicenseActivity : BaseSimpleActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_license)
|
||||
|
||||
val linkColor = getAdjustedPrimaryColor()
|
||||
val dividerMargin = resources.getDimension(R.dimen.medium_margin).toInt()
|
||||
val titleColor = getAdjustedPrimaryColor()
|
||||
val textColor = baseConfig.textColor
|
||||
updateTextColors(licenses_holder)
|
||||
|
||||
|
@ -29,19 +34,22 @@ class LicenseActivity : BaseSimpleActivity() {
|
|||
val licenseMask = intent.getIntExtra(APP_LICENSES, 0) or LICENSE_KOTLIN
|
||||
licenses.filter { licenseMask and it.id != 0 }.forEach {
|
||||
val license = it
|
||||
inflater.inflate(R.layout.license_item, null).apply {
|
||||
inflater.inflate(R.layout.item_license, null).apply {
|
||||
license_title.apply {
|
||||
text = getString(license.titleId)
|
||||
underlineText()
|
||||
setTextColor(linkColor)
|
||||
setTextColor(titleColor)
|
||||
setOnClickListener {
|
||||
launchViewIntent(license.urlId)
|
||||
}
|
||||
}
|
||||
|
||||
license_text.text = getString(license.textId)
|
||||
license_text.setTextColor(textColor)
|
||||
license_text.apply {
|
||||
text = getString(license.textId)
|
||||
setTextColor(textColor)
|
||||
}
|
||||
|
||||
licenses_holder.addView(this)
|
||||
(layoutParams as LinearLayout.LayoutParams).bottomMargin = dividerMargin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,13 @@ import com.simplemobiletools.commons.extensions.*
|
|||
import com.simplemobiletools.commons.helpers.getFilePlaceholderDrawables
|
||||
import com.simplemobiletools.commons.models.FileDirItem
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import kotlinx.android.synthetic.main.filepicker_list_item.view.*
|
||||
import kotlinx.android.synthetic.main.item_filepicker_list.view.*
|
||||
import java.util.*
|
||||
|
||||
class FilepickerItemsAdapter(activity: BaseSimpleActivity, val fileDirItems: List<FileDirItem>, recyclerView: MyRecyclerView,
|
||||
itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) {
|
||||
class FilepickerItemsAdapter(
|
||||
activity: BaseSimpleActivity, val fileDirItems: List<FileDirItem>, recyclerView: MyRecyclerView,
|
||||
itemClick: (Any) -> Unit
|
||||
) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) {
|
||||
|
||||
private lateinit var fileDrawable: Drawable
|
||||
private lateinit var folderDrawable: Drawable
|
||||
|
@ -38,7 +40,7 @@ class FilepickerItemsAdapter(activity: BaseSimpleActivity, val fileDirItems: Lis
|
|||
|
||||
override fun getActionMenuId() = 0
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.filepicker_list_item, parent)
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.item_filepicker_list, parent)
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val fileDirItem = fileDirItems[position]
|
||||
|
|
|
@ -17,7 +17,7 @@ import com.simplemobiletools.commons.extensions.*
|
|||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.FileDirItem
|
||||
import kotlinx.android.synthetic.main.dialog_properties.view.*
|
||||
import kotlinx.android.synthetic.main.property_item.view.*
|
||||
import kotlinx.android.synthetic.main.item_property.view.*
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
|
@ -263,7 +263,7 @@ class PropertiesDialog() {
|
|||
return
|
||||
}
|
||||
|
||||
mInflater.inflate(R.layout.property_item, mPropertyView, false).apply {
|
||||
mInflater.inflate(R.layout.item_property, mPropertyView, false).apply {
|
||||
property_value.setTextColor(mActivity.baseConfig.textColor)
|
||||
property_label.setTextColor(mActivity.baseConfig.textColor)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import androidx.core.view.ViewCompat
|
|||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.models.FileDirItem
|
||||
import kotlinx.android.synthetic.main.breadcrumb_item.view.*
|
||||
import kotlinx.android.synthetic.main.item_breadcrumb.view.*
|
||||
|
||||
class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView(context, attrs) {
|
||||
private val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
|
@ -179,7 +179,7 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView(
|
|||
private fun addBreadcrumb(item: FileDirItem, index: Int, addPrefix: Boolean) {
|
||||
|
||||
if (itemsLayout.childCount == 0) {
|
||||
inflater.inflate(R.layout.breadcrumb_first_item, itemsLayout, false).apply {
|
||||
inflater.inflate(R.layout.item_breadcrumb_first, itemsLayout, false).apply {
|
||||
resources.apply {
|
||||
breadcrumb_text.background = ContextCompat.getDrawable(context, R.drawable.button_background)
|
||||
breadcrumb_text.background.applyColorFilter(textColor)
|
||||
|
@ -206,7 +206,7 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView(
|
|||
tag = item
|
||||
}
|
||||
} else {
|
||||
inflater.inflate(R.layout.breadcrumb_item, itemsLayout, false).apply {
|
||||
inflater.inflate(R.layout.item_breadcrumb, itemsLayout, false).apply {
|
||||
var textToAdd = item.name
|
||||
if (addPrefix) {
|
||||
textToAdd = "> $textToAdd"
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/contributors_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contributors_holder"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/license_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@ -10,13 +9,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/license_notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/notice"/>
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingEnd="@dimen/medium_margin">
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -3,18 +3,23 @@
|
|||
android:id="@+id/license_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:background="@drawable/section_holder_stroke"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/license_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:textColor="@color/color_primary" />
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/license_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in a new issue