forked from mirrors/linphone-iphone
Add DropDown menu
This commit is contained in:
parent
0ee5e37374
commit
a6a811b059
5 changed files with 129 additions and 4 deletions
|
|
@ -21,6 +21,7 @@
|
|||
import UIKit
|
||||
import Foundation
|
||||
import linphonesw
|
||||
import DropDown
|
||||
|
||||
@objc class ChatConversationViewSwift: BackActionsNavigationView, UICompositeViewDelegate { // Replaces ChatConversationView
|
||||
|
||||
|
|
@ -32,16 +33,35 @@ import linphonesw
|
|||
|
||||
func compositeViewDescription() -> UICompositeViewDescription! { return type(of: self).compositeDescription }
|
||||
|
||||
let menu: DropDown = {
|
||||
let menu = DropDown()
|
||||
menu.dataSource = [
|
||||
"Item 1",
|
||||
"Item 2",
|
||||
"Item 3",
|
||||
"Item 4",
|
||||
"Item 5"
|
||||
]
|
||||
menu.cellNib = UINib(nibName: "DropDownCell", bundle: nil)
|
||||
menu.customCellConfiguration = { index, title, cell in
|
||||
guard let cell = cell as? MyCell else {
|
||||
return
|
||||
}
|
||||
cell.myImageView.image = UIImage(named: "security_2_indicator.png")
|
||||
}
|
||||
return menu
|
||||
}()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad(
|
||||
backAction: {
|
||||
self.goBackChatListView()
|
||||
},
|
||||
action1: {
|
||||
|
||||
|
||||
},
|
||||
action2: {
|
||||
|
||||
self.tapChooseMenuItem(self.action2Button)
|
||||
},
|
||||
title:"benoit.martins.test1"
|
||||
//title:"Coin à champis de François"
|
||||
|
|
@ -52,4 +72,14 @@ import linphonesw
|
|||
func goBackChatListView() {
|
||||
PhoneMainView.instance().pop(toView: ChatsListView.compositeViewDescription())
|
||||
}
|
||||
|
||||
func tapChooseMenuItem(_ sender: UIButton) {
|
||||
menu.anchorView = sender
|
||||
menu.bottomOffset = CGPoint(x: -UIScreen.main.bounds.width * 0.6, y: sender.frame.size.height)
|
||||
menu.show()
|
||||
|
||||
menu.selectionAction = { index, title in
|
||||
print("index \(index) and \(title)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
26
Classes/Swift/Chat/Views/DropDownCell.swift
Normal file
26
Classes/Swift/Chat/Views/DropDownCell.swift
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// MyCell.swift
|
||||
// linphone
|
||||
//
|
||||
// Created by Benoît Martins on 13/12/2022.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import DropDown
|
||||
|
||||
class MyCell: DropDownCell {
|
||||
|
||||
@IBOutlet var myImageView: UIImageView!
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
myImageView.contentMode = .scaleAspectFit
|
||||
}
|
||||
|
||||
override func setSelected(_ selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
}
|
||||
53
Classes/Swift/Chat/Views/DropDownCell.xib
Normal file
53
Classes/Swift/Chat/Views/DropDownCell.xib
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="DropDownCell" rowHeight="72" id="KGk-i7-Jjw" customClass="MyCell" customModule="linphoneapp" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="350" height="72"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="350" height="72"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="p2H-ZL-cwJ">
|
||||
<rect key="frame" x="310" y="21" width="30" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="30" id="T7j-qm-kur"/>
|
||||
<constraint firstAttribute="height" constant="30" id="Xxh-BC-eg9"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gXQ-5Z-Z7W">
|
||||
<rect key="frame" x="10" y="4" width="290" height="64"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="gXQ-5Z-Z7W" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="2VM-KK-mno"/>
|
||||
<constraint firstItem="gXQ-5Z-Z7W" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="4" id="3W8-Sp-Op6"/>
|
||||
<constraint firstAttribute="bottom" secondItem="gXQ-5Z-Z7W" secondAttribute="bottom" constant="4" id="58p-Vq-TIF"/>
|
||||
<constraint firstItem="gXQ-5Z-Z7W" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="4" id="BPM-Vb-6IV"/>
|
||||
<constraint firstItem="p2H-ZL-cwJ" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="C1J-DC-iVA"/>
|
||||
<constraint firstAttribute="bottom" secondItem="gXQ-5Z-Z7W" secondAttribute="bottom" constant="4" id="RGu-L9-5La"/>
|
||||
<constraint firstAttribute="trailing" secondItem="p2H-ZL-cwJ" secondAttribute="trailing" constant="10" id="T9l-t0-h70"/>
|
||||
<constraint firstItem="p2H-ZL-cwJ" firstAttribute="leading" secondItem="gXQ-5Z-Z7W" secondAttribute="trailing" constant="10" id="pge-0N-hit"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
|
||||
<connections>
|
||||
<outlet property="myImageView" destination="p2H-ZL-cwJ" id="hwZ-fL-pEC"/>
|
||||
<outlet property="optionLabel" destination="gXQ-5Z-Z7W" id="rhQ-sW-3Mf"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="154.19847328244273" y="-22.535211267605636"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
|
|
@ -56,7 +56,8 @@ import linphonesw
|
|||
var isChecked = false
|
||||
let checkBoxText = UILabel()
|
||||
|
||||
let isSecure : Bool = true
|
||||
let isSecure : Bool = false
|
||||
let isGroupChat : Bool = false
|
||||
let levelMaxSecure : Bool = false
|
||||
let floatingButton = CallControlButton(buttonTheme:VoipTheme.nav_button(""))
|
||||
|
||||
|
|
@ -79,9 +80,16 @@ import linphonesw
|
|||
action2Button.alignParentRight(withMargin: side_buttons_margin).matchParentHeight().done()
|
||||
action2Button.onClickAction = action2
|
||||
|
||||
if(isGroupChat){
|
||||
action1Button.setImage(UIImage(named:"voip_conference_new.png"), for: .normal)
|
||||
action1Button.setImage(UIImage(named:"voip_conference_new_selected.png"), for: .highlighted)
|
||||
}
|
||||
|
||||
topBar.addSubview(action1Button)
|
||||
action1Button.toLeftOf(action2Button, withRightMargin: 20).matchParentHeight().done()
|
||||
action1Button.size(w: 35, h: 35).done()
|
||||
if(!isGroupChat){
|
||||
action1Button.size(w: 35, h: 35).done()
|
||||
}
|
||||
action1Button.onClickAction = action1
|
||||
|
||||
topBar.addSubview(titleLabel)
|
||||
|
|
|
|||
|
|
@ -948,6 +948,8 @@
|
|||
D74A44912923BAF90017D063 /* BackActionsNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74A44902923BAF90017D063 /* BackActionsNavigationView.swift */; };
|
||||
D77057F1292E4A340031A970 /* ChatConversationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77057F0292E4A340031A970 /* ChatConversationViewModel.swift */; };
|
||||
D7C6DE7D2947331A00756E03 /* UIAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C6DE7C2947331A00756E03 /* UIAlertController.swift */; };
|
||||
D7C6DE832948CF3100756E03 /* DropDownCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C6DE812948CF3100756E03 /* DropDownCell.swift */; };
|
||||
D7C6DE842948CF3100756E03 /* DropDownCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D7C6DE822948CF3100756E03 /* DropDownCell.xib */; };
|
||||
EA0007A62356008F003CC6BF /* msgNotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = EA5F25D9232BD3E200475F2E /* msgNotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
EA3650DB2330D2E30001148A /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5F25DB232BD3E200475F2E /* NotificationService.swift */; };
|
||||
EA88A405242A6216007FEC61 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 63AADBC41B6A0FF200AA16FD /* Localizable.strings */; };
|
||||
|
|
@ -2184,6 +2186,8 @@
|
|||
D74A44902923BAF90017D063 /* BackActionsNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackActionsNavigationView.swift; sourceTree = "<group>"; };
|
||||
D77057F0292E4A340031A970 /* ChatConversationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatConversationViewModel.swift; sourceTree = "<group>"; };
|
||||
D7C6DE7C2947331A00756E03 /* UIAlertController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIAlertController.swift; sourceTree = "<group>"; };
|
||||
D7C6DE812948CF3100756E03 /* DropDownCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropDownCell.swift; sourceTree = "<group>"; };
|
||||
D7C6DE822948CF3100756E03 /* DropDownCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DropDownCell.xib; sourceTree = "<group>"; };
|
||||
DF241FDC6C7431777AB3BD58 /* Pods-msgNotificationContent.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-msgNotificationContent.debug.xcconfig"; path = "Target Support Files/Pods-msgNotificationContent/Pods-msgNotificationContent.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
E19FC645A566E91D4EEB9C8F /* Pods-msgNotificationService.distributionadhoc.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-msgNotificationService.distributionadhoc.xcconfig"; path = "Target Support Files/Pods-msgNotificationService/Pods-msgNotificationService.distributionadhoc.xcconfig"; sourceTree = "<group>"; };
|
||||
EA5F25D9232BD3E200475F2E /* msgNotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = msgNotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
|
|
@ -3839,6 +3843,8 @@
|
|||
children = (
|
||||
D7421D9D29228A5200290CAB /* ChatConversationViewSwift.swift */,
|
||||
D7013DB72940AA12004EEAAE /* MessageView.swift */,
|
||||
D7C6DE812948CF3100756E03 /* DropDownCell.swift */,
|
||||
D7C6DE822948CF3100756E03 /* DropDownCell.xib */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -4693,6 +4699,7 @@
|
|||
633FEDF31D3CD5590014B822 /* call_video_start_default@2x.png in Resources */,
|
||||
24BFAAA2209B0630004F47A7 /* linphone_user~ipad@2x.png in Resources */,
|
||||
633FEDBA1D3CD5590014B822 /* call_audio_start_default.png in Resources */,
|
||||
D7C6DE842948CF3100756E03 /* DropDownCell.xib in Resources */,
|
||||
61586B8F217A174F0038AC45 /* menu_options@2x.png in Resources */,
|
||||
633FEE131D3CD5590014B822 /* chat_message_not_delivered@2x.png in Resources */,
|
||||
615A282A21805B4C0060F920 /* security_toogle_icon_grey@2x.png in Resources */,
|
||||
|
|
@ -5072,6 +5079,7 @@
|
|||
C63F7239285A24B10066163B /* ConferenceParticipantDeviceData.swift in Sources */,
|
||||
C63F7238285A24B10066163B /* ConferenceParticipantData.swift in Sources */,
|
||||
63B81A0D1B57DA33009604A6 /* TPKeyboardAvoidingCollectionView.m in Sources */,
|
||||
D7C6DE832948CF3100756E03 /* DropDownCell.swift in Sources */,
|
||||
C63F726D285A24B10066163B /* ProviderDelegate.swift in Sources */,
|
||||
C63F7266285A24B10066163B /* UICallTimer.swift in Sources */,
|
||||
C6548821292D32FA00BF646B /* ConferenceCallView.swift in Sources */,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue