Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 13593 unify id button #291

Draft
wants to merge 2 commits into
base: feature_branch/unify_ids
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,22 @@ Other colors have been removed because UX team has decided to remove them from t
### Changes in FeedbackScreenView
- `TYPE_CUSTOM` has been removed. Use `TYPE_INFO` instead, it allows custom icon or animation.
- `shouldAnimateOnAttachedToWindow` is now private. Use method `setShouldAnimateOnAttached()` or xml attribute `app:shouldAnimateOnAttached` instead.

## Upgrade to version 9.3.0
9.3.0 version change the xml button implementation.

Please replace set functions by property access syntax

- `button.setText("some text")` -> `button.text = "some text"`
- `button.setLoadingText("some text")` -> `button.loadingText = "some text"`
- `button.setIsLoading(true)` -> `button.isLoading = true`
- `button.setIsLoading(false)` -> `button.isLoading = false`
- `button.showLoading` -> `button.isLoading = true`
- `button.hideLoading` -> `button.isLoading = false`

Please replace android xml attributes by Mistica attributes
- `android:text="some text"` -> `app:text="some text"`
- `android:enabled="false"` -> `app:enabled="false"`

Styles
- Removed all related xml button styles. Replace all by `app:style="XXXX"` attribute
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.FrameLayout
import android.widget.ImageView
import androidx.fragment.app.Fragment
import com.telefonica.mistica.badge.Badge
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import kotlin.random.Random

Expand Down Expand Up @@ -57,4 +57,4 @@ class BadgesCatalogFragment : Fragment() {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.ProgressButton
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R

class ButtonsCatalogFragment : Fragment() {

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
savedInstanceState: Bundle?,
): View? {
super.onCreateView(inflater, container, savedInstanceState)
return layoutInflater.inflate(R.layout.screen_buttons_catalog, container, false)
Expand All @@ -35,17 +35,17 @@ class ButtonsCatalogFragment : Fragment() {
R.id.secondary_small_inverse_progress,
R.id.link_inverse_progress
)
.map { view.findViewById<ProgressButton>(it) }
.map { view.findViewById<Button>(it) }
.forEach { button ->
button.setLoadingText("Loading")
button.loadingText = "Loading"
button.setOnClickListener {
button.showLoading()
button.postDelayed({ button.hideLoading() }, LOADING_TIME)
button.isLoading = true
button.postDelayed({ button.isLoading = false }, LOADING_TIME)
}
}
}

private companion object {
const val LOADING_TIME = 2000L
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.callout.CalloutView
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.input.CheckBoxInput
Expand Down Expand Up @@ -95,4 +95,4 @@ class CalloutsCatalogFragment : Fragment() {
BUTTONS_CONFIG_SECONDARY_LINK(CalloutView.BUTTONS_CONFIG_SECONDARY_LINK),
BUTTONS_CONFIG_LINK(CalloutView.BUTTONS_CONFIG_LINK),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.annotation.AttrRes
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.card.datacard.DataCardView
import com.telefonica.mistica.card.datacard.DataCardView.IconType.Companion.TYPE_CIRCULAR_ICON
import com.telefonica.mistica.card.datacard.DataCardView.IconType.Companion.TYPE_CIRCULAR_IMAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.emptystate.card.EmptyStateCardView
import com.telefonica.mistica.emptystate.card.EmptyStateCardView.ButtonsConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.annotation.StyleRes
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.catalog.ui.classic.activity.EmptyStateScreenCatalogActivity
import com.telefonica.mistica.emptystate.screen.EmptyStateScreenView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.header.HeaderView
import com.telefonica.mistica.input.CheckBoxInput
Expand Down Expand Up @@ -82,4 +82,4 @@ class HeadersCatalogFragment : Fragment() {
headerView.setBottomLayout(HeaderView.BOTTOM_VIEW_NONE)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import android.view.View
import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.highlightedcard.HighlightedCardView
import com.telefonica.mistica.input.CheckBoxInput
Expand Down Expand Up @@ -128,4 +128,4 @@ class HighlightedCardsCatalogFragment : Fragment() {
removeCloseButton()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import android.text.style.ClickableSpan
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.annotation.CallSuper
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.input.CheckBoxInput
import com.telefonica.mistica.input.DropDownInput
Expand Down Expand Up @@ -143,4 +143,4 @@ class InputsCatalogFragment : Fragment() {
TextInputValidationResult.Invalid("Message should be \"Mistica Rules\"")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.card.mediacard.MediaCardView
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.catalog.ui.classic.components.MediaCardAdapter.Companion.MEDIA_CARDS_CAROUSEL_SIZE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.Button
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.feedback.popover.PopOver
import com.telefonica.mistica.feedback.popover.PopOverView
Expand Down Expand Up @@ -100,4 +100,4 @@ class PopOverCatalogFragment : Fragment() {
context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputMethodManager.hideSoftInputFromWindow(windowToken, 0)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.contentindicator.ScrollContentIndicator

Expand Down Expand Up @@ -40,4 +40,4 @@ class ScrollContentIndicatorCatalogFragment : Fragment() {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.Button
import android.widget.RadioButton
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.feedback.SnackbarBuilder
import com.telefonica.mistica.feedback.SnackbarLength
Expand Down Expand Up @@ -76,4 +76,4 @@ class SnackBarCatalogFragment : Fragment() {
INFORMATIVE,
CRITICAL
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.input.DropDownInput
import com.telefonica.mistica.stepper.DeterminateStepperView
Expand Down
4 changes: 2 additions & 2 deletions catalog/src/main/res/layout/data_card_fragment_catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:text="Update" />
app:text="Update" />

</LinearLayout>
</ScrollView>
</ScrollView>
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:text="Update"
app:text="Update"
/>

</LinearLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:text="Show"
app:text="Show"
/>

</LinearLayout>
Expand Down
4 changes: 2 additions & 2 deletions catalog/src/main/res/layout/headers_fragment_catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="Update" />
app:text="Update" />

</LinearLayout>
</ScrollView>
</ScrollView>
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="Update" />
app:text="Update" />

</LinearLayout>

</ScrollView>
</ScrollView>
4 changes: 2 additions & 2 deletions catalog/src/main/res/layout/media_card_fragment_catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:text="Update" />
app:text="Update" />

</LinearLayout>
</ScrollView>
</ScrollView>
14 changes: 7 additions & 7 deletions catalog/src/main/res/layout/screen_badges_catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@
android:contentDescription="image" />
</FrameLayout>

<Button
<com.telefonica.mistica.button.Button
android:id="@+id/button_add_non_numeric_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="Toggle" />
app:text="Toggle" />

<Button
<com.telefonica.mistica.button.Button
android:id="@+id/button_add_numeric_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Toggle With Number > 0" />
app:text="Toggle With Number > 0" />

<Button
<com.telefonica.mistica.button.Button
android:id="@+id/button_remove_badge_if_numeric_with_count_zero"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Remove when number = 0" />
app:text="Remove when number = 0" />

</LinearLayout>
</LinearLayout>
Loading