Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

Commit

Permalink
Clock removed in moment bar and dark theme fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Javi Pacheco committed Nov 25, 2016
1 parent faa160a commit 227b7a2
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 93 deletions.
47 changes: 0 additions & 47 deletions modules/app/src/main/res/layout-v17/moment_bar_view_panel.xml

This file was deleted.

2 changes: 1 addition & 1 deletion modules/app/src/main/res/layout/edit_moment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<TextView
android:id="@+id/edit_moment_name_message"
style="@style/EditMomentHeaderCollectionName"/>
style="@style/EditMomentHeaderSpecificMessageName"/>

</LinearLayout>

Expand Down
4 changes: 0 additions & 4 deletions modules/app/src/main/res/layout/moment_bar_view_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
style="@style/LauncherMomentText"
android:id="@+id/launcher_moment_text"/>

<DigitalClock
style="@style/LauncherMomentClock"
android:id="@+id/launcher_moment_text_digital_clock"/>

</LinearLayout>

<cards.nine.app.ui.components.widgets.TintableImageView
Expand Down
4 changes: 0 additions & 4 deletions modules/app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
<string name="move">Mover</string>
<string name="delete">Eliminar</string>

<string name="atHour">a las</string>

<string name="itemAddedToCollectionSuccessful">Tarjeta añadida a %1$s</string>

<!-- Menu -->
Expand Down Expand Up @@ -557,8 +555,6 @@

<string name="momentsPrefTitle">Momentos</string>
<string name="momentsPrefSummary">Configura opciones para tus Momentos</string>
<string name="showClockTitle">Mostrar reloj</string>
<string name="showClockSummary">La hora es mostrada en la barra del Momento</string>

<string name="showMicSearchTitle">Mostrar micro</string>
<string name="showMicSearchSummary">Micro es mostrado en la barra del Momento</string>
Expand Down
5 changes: 0 additions & 5 deletions modules/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
<string name="move">Move</string>
<string name="delete">Delete</string>

<string name="atHour">at</string>

<string name="itemAddedToCollectionSuccessful">Item added to <xliff:g id="collection" example="Social">%1$s</xliff:g></string>

<!-- Menu -->
Expand Down Expand Up @@ -571,9 +569,6 @@
<string name="momentsPrefTitle">Moments</string>
<string name="momentsPrefSummary">Configure options for your Moments</string>

<string name="showClockTitle">Show Clock</string>
<string name="showClockSummary">Clock is now shown in the Moment bar</string>

<string name="showMicSearchTitle">Show Mic Search</string>
<string name="showMicSearchSummary">Mic Search icon is now shown in the Moment bar</string>

Expand Down
5 changes: 5 additions & 0 deletions modules/app/src/main/res/values/styles_actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@
<item name="android:layout_margin">@dimen/padding_large</item>
</style>

<style name="EditMomentHeaderSpecificMessageName" parent="EditMomentHeaderName">
<item name="android:lines">1</item>
<item name="android:ellipsize">end</item>
</style>

<style name="EditMomentHeaderSpecificMessage">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
Expand Down
6 changes: 0 additions & 6 deletions modules/app/src/main/res/xml/preferences_moments.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@

<PreferenceCategory android:title="@string/momentsPrefTitle">

<CheckBoxPreference
android:key="showClockMoment"
android:defaultValue="false"
android:title="@string/showClockTitle"
android:summary="@string/showClockSummary"/>

<CheckBoxPreference
android:key="showMicSearchMoment"
android:defaultValue="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import cards.nine.app.ui.components.widgets.tweaks.TintableImageViewTweaks._
import cards.nine.commons._
import cards.nine.commons.ops.ColorOps._
import cards.nine.commons.services.TaskService.{TaskService, _}
import cards.nine.models.types.{CarMoment, MusicMoment, OutAndAboutMoment, SportMoment}
import cards.nine.models.types.theme.{DrawerIconColor, DrawerTextColor}
import cards.nine.models.types.{CarMoment, MusicMoment, OutAndAboutMoment}
import cards.nine.models.{Collection, Moment, MomentTimeSlot}
import com.fortysevendeg.ninecardslauncher.R
import macroid.FullDsl._
import macroid._
import macroid.extras.ImageViewTweaks._
import macroid.extras.ResourcesExtras._
import macroid.extras.TextViewTweaks._
import macroid.extras.ImageViewTweaks._
import macroid.extras.UIActionsExtras._
import macroid.extras.ViewGroupTweaks._
import macroid.extras.ViewTweaks._
Expand Down Expand Up @@ -84,6 +84,8 @@ trait EditMomentUiActions
(addHourAction <~ tivDefaultColor(iconColor) <~ On.click(Ui(addHour()))) ~
(nameWifi <~ tvColor(textColor)) ~
(nameHour <~ tvColor(textColor)) ~
(messageName <~ tvColor(textColor)) ~
(messageText <~ tvColor(textColor)) ~
(nameLinkCollection <~ tvColor(textColor)) ~
(momentCollection <~
tvColor(textColor) <~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ class TopBarLayout(context: Context, attrs: AttributeSet, defStyle: Int)

lazy val momentText = findView(TR.launcher_moment_text)

// Lower to API 17
lazy val momentDigitalClock = Option(findView(TR.launcher_moment_text_digital_clock))

// API 17 and more
lazy val momentClock = Option(findView(TR.launcher_moment_text_clock))

lazy val momentUnpin = findView(TR.launcher_moment_unpin)

lazy val momentWeather = findView(TR.launcher_moment_weather)
Expand Down Expand Up @@ -129,8 +123,6 @@ class TopBarLayout(context: Context, attrs: AttributeSet, defStyle: Int)
(momentIconContent <~ vBackground(iconBackground)) ~
(momentIcon <~ tivDefaultColor(iconColor) <~ tivPressedColor(iconColor)) ~
(momentText <~ tvSizeResource(sizeRes)) ~
(momentDigitalClock <~ tvSizeResource(sizeRes)) ~
(momentClock <~ tvSizeResource(sizeRes)) ~
(collectionsSearchPanel <~
vBackgroundBoxWorkspace(theme.get(SearchBackgroundColor))) ~
(collectionsBurgerIcon <~
Expand Down Expand Up @@ -161,11 +153,7 @@ class TopBarLayout(context: Context, attrs: AttributeSet, defStyle: Int)
}

def reloadMoment(moment: NineCardsMoment)(implicit navigationJobs: NavigationJobs, launcherJobs: LauncherJobs, theme: NineCardsTheme): Ui[Any] = {
val showClock = ShowClockMoment.readValue
val showMicSearch = ShowMicSearchMoment.readValue
val text = if (showClock) {
s"${moment.getName} ${resGetString(R.string.atHour)}"
} else moment.getName

def unpinTweak = if (persistMoment.getPersistMoment.contains(moment)) {
vVisible +
Expand Down Expand Up @@ -193,12 +181,10 @@ class TopBarLayout(context: Context, attrs: AttributeSet, defStyle: Int)
val bundle = navigationJobs.navigationUiActions.dom.createBundle(resGetColor(R.color.collection_fab_button_item_1), momentMap)
navigationJobs.launchEditMoment(bundle).resolveAsync()
} ~ Ui(true))) ~
(momentDigitalClock <~ (if (showClock) vVisible else vGone)) ~
(momentClock <~ (if (showClock) vVisible else vGone)) ~
(momentIcon <~
ivSrc(moment.getIconCollectionDetail)) ~
(momentText <~
tvText(text)) ~
tvText(moment.getName)) ~
(momentUnpin <~ unpinTweak) ~
(momentWeather <~ weatherTweak) ~
(momentGoogleIcon <~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ class LauncherJobs(
AppDrawerSelectItemsInScroller.name)).nonEmpty

def uiAction(prefKey: String): TaskService[Unit] = prefKey match {
case ShowClockMoment.name => topBarUiActions.reloadMomentTopBar()
case ShowMicSearchMoment.name => topBarUiActions.reloadMomentTopBar()
case ShowWeatherMoment.name => topBarUiActions.reloadMomentTopBar()
case GoogleLogo.name => topBarUiActions.reloadTopBar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ sealed trait NineCardsPreferenceValue[T]

// Moments Preferences

case object ShowClockMoment
extends NineCardsPreferenceValue[Boolean] {
override val name: String = "showClockMoment"
override val default: Boolean = false

override def readValueWith(context: Context): Boolean = getBoolean(context, name, default)
}

case object ShowMicSearchMoment
extends NineCardsPreferenceValue[Boolean] {
override val name: String = "showMicSearchMoment"
Expand Down

0 comments on commit 227b7a2

Please sign in to comment.