Skip to content

Commit 0c3ff2a

Browse files
committed
Clicking on devices within the device navigation bar does not consider alias #1237
1 parent 7ba5772 commit 0c3ff2a

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

app/src/inapp/play/de-DE/whatsnew

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
* Beachte selbst-signierte Zertifikate beim Laden von devStateIcons
22
* Füge Hinweis für "column" Attribut bei der Konfiguration der Gerätetyp-Reihenfolge hinzu
3-
* Migriere als generische Geräte: OWDevice, Remotecontrol
3+
* Migriere als generische Geräte: OWDevice, Remotecontrol
4+
* Beachte alias beim Klicken auf Geräte in der Navigationsleiste (nur Tablets)

app/src/inapp/play/en-US/whatsnew

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
* Consider self-signed certificates when loading devStateIcons
22
* Add note for "column" attribute in device functionality order preference
3-
* Migrate as generic devices: OWDevice, remotecontrol
3+
* Migrate as generic devices: OWDevice, remotecontrol
4+
* Consider alias when clicking on devices within the navigation bar (tables only)

app/src/main/java/li/klass/fhem/devices/detail/ui/DeviceDetailFragment.kt

+3-7
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,9 @@ class DeviceDetailFragment : BaseFragment() {
158158

159159
private fun findScrollView(): ScrollView? = view!!.findViewById(R.id.deviceDetailView)
160160

161-
override fun getTitle(context: Context): CharSequence? {
162-
var name = arguments?.getString(DEVICE_DISPLAY_NAME)
163-
if (name == null) {
164-
name = arguments?.getString(DEVICE_NAME)
165-
}
166-
return name
167-
}
161+
override fun getTitle(context: Context): CharSequence? =
162+
arguments?.getString(DEVICE_DISPLAY_NAME)
163+
?: arguments?.getString(DEVICE_NAME)
168164

169165
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
170166
super.onCreateOptionsMenu(menu, inflater)

app/src/main/java/li/klass/fhem/domain/core/FhemDevice.java

-4
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ private void parseEventMap(String content) {
133133
eventMap = EventMapParser.INSTANCE.parseEventMap(content);
134134
}
135135

136-
protected void putEventToEventMap(String key, String value) {
137-
eventMap = eventMap.put(key, value);
138-
}
139-
140136
@ShowField(description = ResourceIdMapper.deviceName, showAfter = ShowField.FIRST)
141137
public String getAliasOrName() {
142138
String andFHEMAlias = getAndFHEMAlias();

app/src/main/java/li/klass/fhem/fragments/device/DeviceNameListFragment.kt

+8-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ abstract class DeviceNameListFragment : BaseFragment() {
137137
}
138138
}
139139

140-
protected fun deviceListReceived(elements: List<ViewableElementsCalculator.Element>) {
140+
private fun deviceListReceived(elements: List<ViewableElementsCalculator.Element>) {
141141
val devicesView = view?.devices ?: return
142142
devicesView.adapter = DeviceGroupAdapter(elements, DeviceGroupAdapter.Configuration(
143143
deviceResourceId = if (isNavigation) R.layout.device_name_selection_navigation else R.layout.device_name_selection,
@@ -148,11 +148,18 @@ abstract class DeviceNameListFragment : BaseFragment() {
148148
true -> R.color.android_green
149149
else -> android.R.color.transparent
150150
})
151+
view.tag = device.name
151152
}
152153
))
153154
devicesView.layoutManager = StaggeredGridLayoutManager(getNumberOfColumns(), StaggeredGridLayoutManager.VERTICAL)
154155
view?.invalidate()
155156

157+
val childViewToSelect = elements.indexOfFirst {
158+
it is ViewableElementsCalculator.Element.Device
159+
&& it.device.name == deviceName
160+
}
161+
devicesView.scrollToPosition(childViewToSelect)
162+
156163
if (elements.isNotEmpty()) {
157164
hideEmptyView()
158165
} else {

app/src/main/java/li/klass/fhem/fragments/device/DeviceNameListNavigationFragment.kt

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class DeviceNameListNavigationFragment : DeviceNameListFragment() {
4848
activity?.sendBroadcast(Intent(Actions.SHOW_FRAGMENT)
4949
.putExtra(FRAGMENT, FragmentType.DEVICE_DETAIL)
5050
.putExtra(DEVICE_NAME, child.name)
51+
.putExtra(DEVICE_DISPLAY_NAME, child.aliasOrName)
5152
.putExtra(CALLING_FRAGMENT, arguments?.getSerializable(CALLING_FRAGMENT))
5253
.putExtra(ROOM_NAME, roomName))
5354
}

0 commit comments

Comments
 (0)