Skip to content

Commit

Permalink
Merge pull request #3298 from osmandapp/ble_ui_fixes
Browse files Browse the repository at this point in the history
Ble UI fixes
  • Loading branch information
alex-osm authored Dec 13, 2023
2 parents d4ea587 + 3c73af6 commit d273e10
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -47,7 +46,7 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Upper label Wahoo SPEED 7D64" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sah-A4-PB2">
<rect key="frame" x="0.0" y="0.0" width="248" height="20.333333333333332"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<color key="textColor" name="textPrimary"/>
<color key="textColor" name="textColorPrimary"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" spacing="3" translatesAutoresizingMaskIntoConstraints="NO" id="Fvg-NW-EUh">
Expand All @@ -64,7 +63,7 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Disconnected" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yzi-QD-JYr">
<rect key="frame" x="23.000000000000007" y="0.0" width="83.666666666666686" height="20"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" name="textSecondary"/>
<color key="textColor" name="textColorSecondary"/>
<nil key="highlightedColor"/>
</label>
</subviews>
Expand All @@ -79,7 +78,7 @@
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Connect">
<color key="titleColor" name="active"/>
<color key="titleColor" name="textColorActive"/>
</state>
<connections>
<action selector="onConnectStatusButtonPressed:" destination="iN0-l3-epB" eventType="touchUpInside" id="fnT-4j-U9b"/>
Expand All @@ -94,21 +93,21 @@
</activityIndicatorView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NkN-F9-TSx" userLabel="dividerView">
<rect key="frame" x="20" y="97.666666666666671" width="453" height="0.3333333333333286"/>
<color key="backgroundColor" name="divider"/>
<color key="backgroundColor" name="separatorColor"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="uMs-Hq-NxD"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Xg5-ru-81P" userLabel="dividerBottomView">
<rect key="frame" x="0.0" y="147.66666666666666" width="473" height="0.33333333333334281"/>
<color key="backgroundColor" name="divider"/>
<color key="backgroundColor" name="separatorColor"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="7RV-6K-U0a"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<color key="backgroundColor" name="groupBgColor"/>
<constraints>
<constraint firstItem="jbx-xX-LM3" firstAttribute="centerY" secondItem="0uJ-Dc-WGi" secondAttribute="centerY" id="0Wu-sK-iqM"/>
<constraint firstItem="0uJ-Dc-WGi" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="3fa-2r-Zlu"/>
Expand Down Expand Up @@ -144,20 +143,23 @@
<namedColor name="active">
<color red="0.34099999070167542" green="0.078000001609325409" blue="0.80000001192092896" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="divider">
<namedColor name="groupBgColor">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="separatorColor">
<color red="0.79607843137254897" green="0.7803921568627451" blue="0.81960784313725488" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="textPrimary">
<namedColor name="textColorActive">
<color red="0.3411764705882353" green="0.078431372549019607" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="textColorPrimary">
<color red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="textSecondary">
<color red="0.49000000953674316" green="0.45100000500679016" blue="0.54900002479553223" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<namedColor name="textColorSecondary">
<color red="0.49019607843137253" green="0.45098039215686275" blue="0.5490196078431373" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="viewBgColor">
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.95294117647058818" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="cox-yX-wdY">
<rect key="frame" x="0.0" y="59" width="393" height="759"/>
<color key="backgroundColor" name="viewBgColor"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="SearchDeviceTableViewCell" rowHeight="72" id="Azm-Kk-kxe" customClass="SearchDeviceTableViewCell" customModule="OsmAnd_Maps" customModuleProvider="target">
<rect key="frame" x="0.0" y="50" width="393" height="72"/>
Expand Down Expand Up @@ -76,6 +77,7 @@
<constraint firstItem="0BF-D5-Iu6" firstAttribute="leading" secondItem="waX-JL-gZb" secondAttribute="trailing" constant="16" id="lGH-tk-AZH"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" name="groupBgColor"/>
<connections>
<outlet property="connectStatusLabel" destination="3xT-tE-29r" id="uEb-65-0fA"/>
<outlet property="deviceImageView" destination="waX-JL-gZb" id="uqi-CM-79i"/>
Expand Down Expand Up @@ -138,6 +140,9 @@
<namedColor name="buttonTextColorPrimary">
<color red="0.93725490196078431" green="0.90980392156862744" blue="0.99215686274509807" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="groupBgColor">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="textColorPrimary">
<color red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ final class BLEExternalSensorsViewController: OABaseNavbarViewController {
}
}

override func getTitleForHeader(_ section: Int) -> String! {
override func getTitleForHeader(_ section: Int) -> String? {
if DeviceHelper.shared.hasPairedDevices {
switch section {
case 0:
Expand Down Expand Up @@ -124,16 +124,21 @@ final class BLEExternalSensorsViewController: OABaseNavbarViewController {
cell = nib?.first as? OASimpleTableViewCell
cell?.descriptionVisibility(false)
cell?.leftIconVisibility(false)
// separators go edge to edge
cell?.separatorInset = .zero
cell?.layoutMargins = .zero
cell?.preservesSuperviewLayoutMargins = false
}
if let cell {
cell.setCustomLeftSeparatorInset(true)
cell.titleLabel.text = item.title
if let key = item.key, let item = ExternalSensorsCellData(rawValue: key) {
switch item {
case .title:
cell.titleLabel.textColor = UIColor.textColorPrimary
cell.selectionStyle = .none
case .learnMore:
cell.titleLabel.textColor = UIColor.buttonBgColorPrimary
cell.titleLabel.textColor = UIColor.textColorActive
cell.selectionStyle = .default
}
}
Expand Down Expand Up @@ -245,6 +250,7 @@ final class BLEExternalSensorsViewController: OABaseNavbarViewController {
headerEmptyView.addSubview(imageView)
headerEmptyView.frame.size.height = 201
headerEmptyView.frame.size.width = view.frame.width
headerEmptyView.backgroundColor = UIColor.groupBgColor
imageView.frame = headerEmptyView.frame
tableView.tableHeaderView = headerEmptyView
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Guc-jW-K1C" userLabel="dividerTopView">
<rect key="frame" x="0.0" y="0.0" width="393" height="0.6666666666666714"/>
<color key="backgroundColor" name="divider"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="0.66666666666666663"/>
<color key="backgroundColor" name="separatorColor"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="jzc-gT-FPh"/>
</constraints>
Expand Down Expand Up @@ -70,7 +70,7 @@
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ebP-O7-4Aq" userLabel="dividerBottomView">
<rect key="frame" x="0.0" y="156.66666666666666" width="393" height="0.33333333333334281"/>
<color key="backgroundColor" name="divider"/>
<color key="backgroundColor" name="separatorColor"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="RHS-8i-Liw"/>
</constraints>
Expand Down Expand Up @@ -109,9 +109,6 @@
</objects>
<resources>
<image name="ic_custom_bluetooth_off" width="49" height="48"/>
<namedColor name="divider">
<color red="0.32899999618530273" green="0.32400000095367432" blue="0.4779999852180481" alpha="0.33000001311302185" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="groupBgColor">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ final class BLEPairedSensorsViewController: OABaseNavbarViewController {
configureTripRecordingDataSource()
}
generateData()
tableView.reloadData()
}


// MARK: - Override's

override func registerObservers() {
Expand Down Expand Up @@ -256,6 +254,7 @@ final class BLEPairedSensorsViewController: OABaseNavbarViewController {
devices?.insert(anyConnectedDevice, at: 0)
}
}

private func configureTableView() {
tableView.isHidden = false
tableView.dataSource = self
Expand All @@ -270,9 +269,8 @@ final class BLEPairedSensorsViewController: OABaseNavbarViewController {

private func getPairedDevicesForCurrentWidgetType() -> [Device]? {
if let widgetType,
let devices = DeviceHelper.shared.getPairedDevicesFor(type: widgetType), !devices.isEmpty {
let devices = DeviceHelper.shared.getPairedDevicesFor(type: widgetType), !devices.isEmpty {
return devices
} else {
}
return nil
}
Expand All @@ -284,14 +282,9 @@ final class BLEPairedSensorsViewController: OABaseNavbarViewController {
}
}

private func reloadData() {
generateData()
tableView.reloadData()
}

@objc private func deviceDisconnected() {
guard view.window != nil else { return }
reloadData()
generateData()
}

// MARK: - @IBAction's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<constraint firstItem="lKe-KR-MQG" firstAttribute="centerY" secondItem="LNJ-lH-ZnF" secondAttribute="centerY" id="uxT-Ul-s7W"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" name="groupBgColor"/>
<connections>
<outlet property="connectStatusLabel" destination="Fdj-ZX-izt" id="pb5-IN-rXj"/>
<outlet property="deviceImageView" destination="lKe-KR-MQG" id="ulN-oa-UvA"/>
Expand Down Expand Up @@ -158,10 +159,10 @@
<rect key="frame" x="0.0" y="-40" width="430" height="286"/>
</imageView>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="mdf-qV-p4H">
<rect key="frame" x="205" y="63" width="20" height="20"/>
<rect key="frame" x="205" y="93" width="20" height="20"/>
</activityIndicatorView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="center" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="4Wl-rn-pk9">
<rect key="frame" x="30" y="181" width="370" height="84.333333333333314"/>
<rect key="frame" x="30" y="211" width="370" height="84.333333333333314"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Searching for sensors" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QzX-76-Tgh">
<rect key="frame" x="102.33333333333336" y="0.0" width="165.66666666666663" height="20.333333333333332"/>
Expand All @@ -170,7 +171,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wQV-O7-UKe" userLabel="Please hold the device close to the sensor. You need to activate the sensor so OsmAnd can find it.">
<rect key="frame" x="19" y="26.333333333333314" width="332" height="58"/>
<rect key="frame" x="4" y="26.333333333333314" width="362" height="58"/>
<string key="text">Please hold the device close to the sensor.
You need to activate the sensor so OsmAnd can find it.</string>
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
Expand All @@ -182,7 +183,7 @@ You need to activate the sensor so OsmAnd can find it.</string>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="mdf-qV-p4H" firstAttribute="top" secondItem="OMj-M0-oTs" secondAttribute="top" constant="63" id="3nZ-a1-PlV"/>
<constraint firstItem="mdf-qV-p4H" firstAttribute="top" secondItem="OMj-M0-oTs" secondAttribute="top" constant="93" id="3nZ-a1-PlV"/>
<constraint firstAttribute="trailing" secondItem="4Wl-rn-pk9" secondAttribute="trailing" constant="30" id="9aE-xj-4QS"/>
<constraint firstAttribute="trailing" secondItem="Y7B-4e-J3M" secondAttribute="trailing" id="BvU-b8-jWB"/>
<constraint firstItem="4Wl-rn-pk9" firstAttribute="leading" secondItem="OMj-M0-oTs" secondAttribute="leading" constant="30" id="EL6-8Q-hZk"/>
Expand Down Expand Up @@ -309,6 +310,9 @@ You need to activate the sensor so OsmAnd can find it.</string>
<namedColor name="buttonSecondary">
<color red="0.87800002098083496" green="0.86699998378753662" blue="0.88999998569488525" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="groupBgColor">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="textColorActive">
<color red="0.3411764705882353" green="0.078431372549019607" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
Expand Down
Loading

0 comments on commit d273e10

Please sign in to comment.