Add clock bottom margin, fixes #50

This commit is contained in:
Tommaso Berlose 2020-05-04 18:27:42 +02:00
parent c97127e3ab
commit e990b229c8
36 changed files with 153 additions and 94 deletions

View File

@ -7,63 +7,11 @@ object Constants {
const val RESULT_APP_NAME = "RESULT_APP_NAME"
const val RESULT_APP_PACKAGE = "RESULT_APP_PACKAGE"
const val PREF_SHOW_EVENTS = "PREF_SHOW_EVENTS"
const val PREF_SHOW_WEATHER = "PREF_SHOW_WEATHER"
const val PREF_WEATHER_ICON = "PREF_WEATHER_ICON"
const val PREF_WEATHER_TEMP = "PREF_WEATHER_TEMP"
const val PREF_WEATHER_TEMP_UNIT = "PREF_WEATHER_TEMP_UNIT"
const val PREF_WEATHER_REAL_TEMP_UNIT = "PREF_WEATHER_REAL_TEMP_UNIT"
const val PREF_CALENDAR_ALL_DAY = "PREF_CALENDAR_ALL_DAY"
const val PREF_CALENDAR_FILTER = "PREF_CALENDAR_FILTER"
const val PREF_EVENT_ID = "PREF_EVENT_ID"
const val PREF_NEXT_EVENT_ID = "PREF_NEXT_EVENT_ID"
const val PREF_NEXT_EVENT_NAME = "PREF_NEXT_EVENT_NAME"
const val PREF_NEXT_EVENT_START_DATE = "PREF_NEXT_EVENT_START_DATE"
const val PREF_NEXT_EVENT_ALL_DAY = "PREF_NEXT_EVENT_ALL_DAY"
const val PREF_NEXT_EVENT_LOCATION = "PREF_NEXT_EVENT_LOCATION"
const val PREF_NEXT_EVENT_END_DATE = "PREF_NEXT_EVENT_END_DATE"
const val PREF_NEXT_EVENT_CALENDAR_ID = "PREF_NEXT_EVENT_CALENDAR_ID"
const val PREF_CUSTOM_LOCATION_LAT = "PREF_CUSTOM_LOCATION_LAT"
const val PREF_CUSTOM_LOCATION_LON = "PREF_CUSTOM_LOCATION_LON"
const val PREF_CUSTOM_LOCATION_ADD = "PREF_CUSTOM_LOCATION_ADD"
const val PREF_HOUR_FORMAT = "PREF_HOUR_FORMAT"
const val PREF_ITA_FORMAT_DATE = "PREF_ITA_FORMAT_DATE"
const val PREF_WEATHER_REFRESH_PERIOD = "PREF_WEATHER_REFRESH_PERIOD"
const val PREF_SHOW_UNTIL = "PREF_SHOW_UNTIL"
const val PREF_CALENDAR_APP_NAME = "PREF_CALENDAR_APP_NAME"
const val PREF_CALENDAR_APP_PACKAGE = "PREF_CALENDAR_APP_PACKAGE"
const val PREF_WEATHER_APP_NAME = "PREF_WEATHER_APP_NAME"
const val PREF_WEATHER_APP_PACKAGE = "PREF_WEATHER_APP_PACKAGE"
const val PREF_WEATHER_PROVIDER_API_KEY = "PREF_WEATHER_PROVIDER_API_KEY"
const val PREF_EVENT_APP_NAME = "PREF_EVENT_APP_NAME"
const val PREF_EVENT_APP_PACKAGE = "PREF_EVENT_APP_PACKAGE"
const val PREF_SHOW_EVENT_LOCATION = "PREF_SHOW_EVENT_LOCATION"
const val PREF_TEXT_COLOR = "PREF_TEXT_COLOR"
const val PREF_TEXT_MAIN_SIZE = "PREF_TEXT_MAIN_SIZE"
const val PREF_TEXT_SECOND_SIZE = "PREF_TEXT_SECOND_SIZE"
const val PREF_TEXT_CLOCK_SIZE = "PREF_TEXT_CLOCK_SIZE"
const val PREF_WEATHER_PROVIDER = "PREF_WEATHER_PROVIDER"
const val PREF_SHOW_CLOCK = "PREF_SHOW_CLOCK"
const val PREF_CLOCK_APP_NAME = "PREF_CLOCK_APP_NAME"
const val PREF_CLOCK_APP_PACKAGE = "PREF_CLOCK_APP_PACKAGE"
const val PREF_TEXT_SHADOW = "PREF_TEXT_SHADOW"
const val PREF_SHOW_DIFF_TIME = "PREF_SHOW_DIFF_TIME"
const val PREF_SHOW_DECLINED_EVENTS = "PREF_SHOW_DECLINED_EVENTS"
const val PREF_OPEN_WEATHER_API_KEY = "PREF_OPEN_WEATHER_API_KEY"
const val PREF_DARK_SKY_API_KEY = "PREF_DARK_SKY_API_KEY"
const val PREF_WU_API_KEY = "PREF_WU_API_KEY"
const val PREF_SECOND_ROW_INFORMATION = "PREF_SECOND_ROW_INFORMATION"
const val PREF_CUSTOM_FONT = "PREF_CUSTOM_FONT"
const val PREF_CUSTOM_FONT_FILE = "PREF_CUSTOM_FONT_FILE"
const val PREF_SHOW_NEXT_EVENT = "PREF_SHOW_NEXT_EVENT"
const val PREF_SHOW_WIDGET_PREVIEW = "PREF_SHOW_WIDGET_PREVIEW"
const val PREF_SHOW_GPS_NOTIFICATION = "PREF_SHOW_GPS_NOTIFICATION"
const val CUSTOM_FONT_PRODUCT_SANS = 1
const val itDateFormat = "EEEE, d MMM"
const val engDateFormat = "EEEE, MMM d"
const val goodHourFormat = "HH:mm"
const val badHourFormat = "hh:mm a"
enum class ClockBottomMargin(val value: Int) {
NONE(0),
SMALL(1),
MEDIUM(2),
LARGE(3)
}
}

View File

@ -45,6 +45,7 @@ object Preferences : KotprefModel() {
var textMainSize by floatPref(key = "PREF_TEXT_MAIN_SIZE", default = 26f)
var textSecondSize by floatPref(key = "PREF_TEXT_SECOND_SIZE", default = 18f)
var clockTextSize by floatPref(key = "PREF_TEXT_CLOCK_SIZE", default = 90f)
var clockBottomMargin by intPref(default = Constants.ClockBottomMargin.MEDIUM.value)
var showClock by booleanPref(key = "PREF_SHOW_CLOCK", default = false)
var clockAppName by stringPref(key = "PREF_CLOCK_APP_NAME", default = "")
var clockAppPackage by stringPref(key = "PREF_CLOCK_APP_PACKAGE", default = "")

View File

@ -19,6 +19,7 @@ import androidx.lifecycle.lifecycleScope
import com.google.android.material.tabs.TabLayoutMediator
import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.global.Actions
import com.tommasoberlose.anotherwidget.global.Constants
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.global.RequestCode
import com.tommasoberlose.anotherwidget.helpers.BitmapHelper
@ -32,6 +33,7 @@ import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
import com.tommasoberlose.anotherwidget.utils.getCurrentWallpaper
import com.tommasoberlose.anotherwidget.utils.toPixel
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.the_widget_sans.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
@ -69,10 +71,9 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
}.attach()
// Init clock
clock.setTextColor(ColorHelper.getFontColor())
clock.setTextSize(TypedValue.COMPLEX_UNIT_SP, Preferences.clockTextSize.toPixel(this@MainActivity))
clock.format12Hour = "hh:mm"
clock.isVisible = Preferences.showClock
time.setTextColor(ColorHelper.getFontColor())
time.setTextSize(TypedValue.COMPLEX_UNIT_SP, Preferences.clockTextSize.toPixel(this@MainActivity))
time.isVisible = Preferences.showClock
preview.layoutParams = preview.layoutParams.apply {
height = 160.toPixel(this@MainActivity) + if (Preferences.showClock) 100.toPixel(this@MainActivity) else 0
@ -99,18 +100,24 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
val bitmap = BitmapHelper.getBitmapFromView(generatedView, if (preview.width > 0) preview.width else generatedView.measuredWidth, generatedView.measuredHeight)
withContext(Dispatchers.Main) {
// Clock
clock.setTextColor(ColorHelper.getFontColor())
clock.setTextSize(TypedValue.COMPLEX_UNIT_SP, Preferences.clockTextSize.toPixel(this@MainActivity))
clock.format12Hour = "hh:mm"
time.setTextColor(ColorHelper.getFontColor())
time.setTextSize(TypedValue.COMPLEX_UNIT_SP, Preferences.clockTextSize.toPixel(this@MainActivity))
time.format12Hour = "hh:mm"
if ((Preferences.showClock && !clock.isVisible) || (!Preferences.showClock && clock.isVisible)) {
// Clock bottom margin
clock_bottom_margin_none.isVisible = Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.NONE.value
clock_bottom_margin_small.isVisible = Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.SMALL.value
clock_bottom_margin_medium.isVisible = Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.MEDIUM.value
clock_bottom_margin_large.isVisible = Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.LARGE.value
if ((Preferences.showClock && !time.isVisible) || (!Preferences.showClock && time.isVisible)) {
if (Preferences.showClock) {
clock.layoutParams = clock.layoutParams.apply {
time.layoutParams = time.layoutParams.apply {
height = RelativeLayout.LayoutParams.WRAP_CONTENT
}
clock.measure(0, 0)
time.measure(0, 0)
}
val initialHeight = clock.measuredHeight
val initialHeight = time.measuredHeight
ValueAnimator.ofFloat(
if (Preferences.showClock) 0f else 1f,
if (Preferences.showClock) 1f else 0f
@ -118,19 +125,19 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
duration = 500L
addUpdateListener {
val animatedValue = animatedValue as Float
clock.layoutParams = clock.layoutParams.apply {
time.layoutParams = time.layoutParams.apply {
height = (initialHeight * animatedValue).toInt()
}
}
addListener(
onStart = {
if (Preferences.showClock) {
clock.isVisible = true
time.isVisible = true
}
},
onEnd = {
if (!Preferences.showClock) {
clock.isVisible = false
time.isVisible = false
}
}
)
@ -149,13 +156,13 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
}
}.start()
} else {
clock.layoutParams = clock.layoutParams.apply {
time.layoutParams = time.layoutParams.apply {
height = RelativeLayout.LayoutParams.WRAP_CONTENT
}
clock.measure(0, 0)
time.measure(0, 0)
}
widget_bitmap.setImageBitmap(bitmap)
bitmap_container.setImageBitmap(bitmap)
widget_loader.animate().scaleX(0f).scaleY(0f).start()
widget.animate().alpha(1f).start()
}

View File

@ -83,6 +83,17 @@ class ClockSettingsFragment : Fragment() {
}
})
viewModel.clockBottomMargin.observe(viewLifecycleOwner, Observer {
maintainScrollPosition {
clock_bottom_margin_label.text = when (it) {
Constants.ClockBottomMargin.NONE.value -> getString(R.string.settings_clock_bottom_margin_subtitle_none)
Constants.ClockBottomMargin.SMALL.value -> getString(R.string.settings_clock_bottom_margin_subtitle_small)
Constants.ClockBottomMargin.LARGE.value -> getString(R.string.settings_clock_bottom_margin_subtitle_large)
else -> getString(R.string.settings_clock_bottom_margin_subtitle_medium)
}
}
})
viewModel.showNextAlarm.observe(viewLifecycleOwner, Observer {
maintainScrollPosition {
show_next_alarm_label.text = if (it) getString(R.string.settings_visible) else getString(R.string.settings_not_visible)
@ -116,6 +127,17 @@ class ClockSettingsFragment : Fragment() {
}.show()
}
action_clock_bottom_margin_size.setOnClickListener {
BottomSheetMenu<Int>(requireContext(), header = getString(R.string.settings_show_next_alarm_title)).setSelectedValue(Preferences.clockBottomMargin)
.addItem(getString(R.string.settings_clock_bottom_margin_subtitle_none), Constants.ClockBottomMargin.NONE.value)
.addItem(getString(R.string.settings_clock_bottom_margin_subtitle_small), Constants.ClockBottomMargin.SMALL.value)
.addItem(getString(R.string.settings_clock_bottom_margin_subtitle_medium), Constants.ClockBottomMargin.MEDIUM.value)
.addItem(getString(R.string.settings_clock_bottom_margin_subtitle_large), Constants.ClockBottomMargin.LARGE.value)
.addOnSelectItemListener { value ->
Preferences.clockBottomMargin = value
}.show()
}
action_clock_app.setOnClickListener {
if (Preferences.showClock) {
startActivityForResult(Intent(requireContext(), ChooseApplicationActivity::class.java),

View File

@ -33,6 +33,7 @@ class MainViewModel : ViewModel() {
val clockAppName = Preferences.asLiveData(Preferences::clockAppName)
val showNextAlarm = Preferences.asLiveData(Preferences::showNextAlarm)
val dateFormat = Preferences.asLiveData(Preferences::dateFormat)
val clockBottomMargin = Preferences.asLiveData(Preferences::clockBottomMargin)
val showBigClockWarning = Preferences.asLiveData(Preferences::showBigClockWarning)

View File

@ -208,12 +208,21 @@ class MainWidget : AppWidgetProvider() {
private fun updateClockView(context: Context, views: RemoteViews, widgetID: Int): RemoteViews {
if (!Preferences.showClock) {
views.setViewVisibility(R.id.time, View.GONE)
views.setViewVisibility(R.id.clock_bottom_margin_none, View.GONE)
views.setViewVisibility(R.id.clock_bottom_margin_small, View.GONE)
views.setViewVisibility(R.id.clock_bottom_margin_medium, View.GONE)
views.setViewVisibility(R.id.clock_bottom_margin_large, View.GONE)
} else {
views.setTextColor(R.id.time, ColorHelper.getFontColor())
views.setTextViewTextSize(R.id.time, TypedValue.COMPLEX_UNIT_SP, Preferences.clockTextSize.toPixel(context))
val clockPIntent = PendingIntent.getActivity(context, widgetID, IntentHelper.getClockIntent(context), 0)
views.setOnClickPendingIntent(R.id.time, clockPIntent)
views.setViewVisibility(R.id.time, View.VISIBLE)
views.setViewVisibility(R.id.clock_bottom_margin_none, if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.NONE.value) View.VISIBLE else View.GONE)
views.setViewVisibility(R.id.clock_bottom_margin_small, if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.SMALL.value) View.VISIBLE else View.GONE)
views.setViewVisibility(R.id.clock_bottom_margin_medium, if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.MEDIUM.value) View.VISIBLE else View.GONE)
views.setViewVisibility(R.id.clock_bottom_margin_large, if (Preferences.clockBottomMargin == Constants.ClockBottomMargin.LARGE.value) View.VISIBLE else View.GONE)
}
return views

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M7.29,7c0.45,0 0.67,-0.54 0.35,-0.85l-2.29,-2.3c-0.2,-0.2 -0.51,-0.2 -0.71,0l-2.29,2.3c-0.31,0.31 -0.09,0.85 0.36,0.85L4,7v10L2.71,17c-0.45,0 -0.67,0.54 -0.35,0.85l2.29,2.29c0.2,0.2 0.51,0.2 0.71,0l2.29,-2.29c0.31,-0.31 0.09,-0.85 -0.36,-0.85L6,17L6,7h1.29zM11,7h10c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L11,5c-0.55,0 -1,0.45 -1,1s0.45,1 1,1zM21,17L11,17c-0.55,0 -1,0.45 -1,1s0.45,1 1,1h10c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1zM21,11L11,11c-0.55,0 -1,0.45 -1,1s0.45,1 1,1h10c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1z"/>
</vector>

View File

@ -76,22 +76,7 @@
android:id="@+id/widget"
android:alpha="0"
android:gravity="center">
<TextClock
android:id="@+id/clock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:lineSpacingMultiplier="1"
android:lineSpacingExtra="0dp"
android:includeFontPadding="false"
android:visibility="gone"
android:padding="0dp"
style="@style/AnotherWidget.Title" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/widget_bitmap"
tools:ignore="ContentDescription" />
<include layout="@layout/the_widget_sans" />
</LinearLayout>
<ProgressBar
android:layout_width="48dp"

View File

@ -141,6 +141,43 @@
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_clock_bottom_margin_size"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_format_line_spacing"
android:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="@string/settings_clock_bottom_margin_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/clock_bottom_margin_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -19,8 +19,32 @@
android:visibility="gone"
android:lines="1"
android:maxLines="1"
android:layout_marginBottom="16dp"
style="@style/AnotherWidget.Title"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="-16dp"
android:orientation="horizontal"
android:id="@+id/clock_bottom_margin_none" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="-8dp"
android:visibility="gone"
android:orientation="horizontal"
android:id="@+id/clock_bottom_margin_small" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:visibility="gone"
android:orientation="horizontal"
android:id="@+id/clock_bottom_margin_medium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="10dp"
android:visibility="gone"
android:orientation="horizontal"
android:id="@+id/clock_bottom_margin_large" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">

View File

@ -171,4 +171,9 @@
<string name="support_dev_subtitle">Ceci est un projet de développeur unique,\ndonc merci pour le soutien!</string>
<string name="settings_feedback_subtitle">Ceci est un projet open-source, n\'hésitez pas à aider.</string>
<string name="settings_feedback_title">Commentaires et suggestions</string>
<string name="settings_clock_bottom_margin_title">Marge inférieure de l\'horloge</string>
<string name="settings_clock_bottom_margin_subtitle_none">Aucun</string>
<string name="settings_clock_bottom_margin_subtitle_small">Petit</string>
<string name="settings_clock_bottom_margin_subtitle_medium">Moyen</string>
<string name="settings_clock_bottom_margin_subtitle_large">Grand</string>
</resources>

View File

@ -172,4 +172,9 @@
<string name="support_dev_subtitle">Grazie per supportare il progetto!</string>
<string name="settings_feedback_subtitle">Contribuisci a questo progetto open source.</string>
<string name="settings_feedback_title">Feedback</string>
<string name="settings_clock_bottom_margin_title">Margine inferiore orologio</string>
<string name="settings_clock_bottom_margin_subtitle_none">Nessuno</string>
<string name="settings_clock_bottom_margin_subtitle_small">Piccolo</string>
<string name="settings_clock_bottom_margin_subtitle_medium">Medio</string>
<string name="settings_clock_bottom_margin_subtitle_large">Grande</string>
</resources>

View File

@ -183,4 +183,9 @@
<string name="settings_feedback_subtitle">This is an open-source project, feel free to help.</string>
<string name="settings_feedback_title">Feedback and feature requests</string>
<string name="title_tasksintegration" translatable="false">Google Tasks</string>
<string name="settings_clock_bottom_margin_title">Clock bottom margin</string>
<string name="settings_clock_bottom_margin_subtitle_none">None</string>
<string name="settings_clock_bottom_margin_subtitle_small">Small</string>
<string name="settings_clock_bottom_margin_subtitle_medium">Medium</string>
<string name="settings_clock_bottom_margin_subtitle_large">Large</string>
</resources>

View File

@ -1 +1 @@
#Mon May 04 02:02:08 CEST 2020
#Mon May 04 17:41:28 CEST 2020

View File

@ -1,4 +1,4 @@
#Mon May 04 17:33:06 CEST 2020
#Mon May 04 18:04:57 CEST 2020
base.0=/Users/tommaso/Documents/MyCode/another-widget/tasksintegration/build/intermediates/dex/debug/mergeProjectDexDebug/out/classes.dex
path.0=classes.dex
renamed.0=classes.dex