mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Preliminary drag-and-drop, although it doesn't seem to work when dropping a URL.
This commit is contained in:
parent
531bc5fc88
commit
a286be68a9
5 changed files with 47 additions and 12 deletions
|
@ -21,7 +21,8 @@
|
|||
<UITableViewDelegate, UITableViewDataSource,
|
||||
UIPopoverControllerDelegate,
|
||||
MCSwipeTableViewCellDelegate,
|
||||
UIGestureRecognizerDelegate, UISearchBarDelegate> {
|
||||
UIGestureRecognizerDelegate, UISearchBarDelegate,
|
||||
UITableViewDragDelegate> {
|
||||
NewsBlurAppDelegate *appDelegate;
|
||||
|
||||
BOOL pageFetching;
|
||||
|
|
|
@ -86,6 +86,10 @@
|
|||
|
||||
self.storyTitlesTable.backgroundColor = UIColorFromRGB(0xf4f4f4);
|
||||
self.storyTitlesTable.separatorColor = UIColorFromRGB(0xE9E8E4);
|
||||
if (@available(iOS 11.0, *)) {
|
||||
self.storyTitlesTable.dragDelegate = self;
|
||||
self.storyTitlesTable.dragInteractionEnabled = YES;
|
||||
}
|
||||
self.view.backgroundColor = UIColorFromRGB(0xf4f4f4);
|
||||
|
||||
spacerBarButton = [[UIBarButtonItem alloc]
|
||||
|
@ -106,6 +110,9 @@
|
|||
[self.searchBar setAutocapitalizationType:UITextAutocapitalizationTypeNone];
|
||||
self.storyTitlesTable.tableHeaderView = self.searchBar;
|
||||
self.storyTitlesTable.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
|
||||
self.storyTitlesTable.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
self.messageView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
// self.view.translatesAutoresizingMaskIntoConstraints = NO; // No autolayout until UISplitViewController is built
|
||||
|
||||
UIImage *separatorImage = [UIImage imageNamed:@"bar-separator.png"];
|
||||
if ([ThemeManager themeManager].isDarkTheme) {
|
||||
|
@ -2426,4 +2433,30 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state
|
|||
[appDelegate informError:error];
|
||||
}
|
||||
|
||||
#pragma mark - Drag Delegate
|
||||
|
||||
- (NSArray<UIDragItem *> *)tableView:(UITableView *)tableView itemsForBeginningDragSession:(id<UIDragSession>)session atIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) {
|
||||
NSDictionary *story = [self getStoryAtRow:indexPath.row];
|
||||
NSItemProvider *itemProvider = [[NSItemProvider alloc] init];
|
||||
[itemProvider registerDataRepresentationForTypeIdentifier:(NSString *)kUTTypeURL visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress * _Nullable(void (^ _Nonnull completionHandler)(NSData * _Nullable, NSError * _Nullable)) {
|
||||
completionHandler(story[@"story_permalink"], nil);
|
||||
return nil;
|
||||
}];
|
||||
|
||||
[itemProvider registerDataRepresentationForTypeIdentifier:(NSString *)kUTTypeUTF8PlainText visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress * _Nullable(void (^ _Nonnull completionHandler)(NSData * _Nullable, NSError * _Nullable)) {
|
||||
completionHandler(story[@"story_title"], nil);
|
||||
return nil;
|
||||
}];
|
||||
|
||||
return [NSArray arrayWithObjects:[[UIDragItem alloc] initWithItemProvider:itemProvider], nil];
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView dragSessionWillBegin:(id<UIDragSession>)session API_AVAILABLE(ios(11.0)) {
|
||||
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView dragSessionDidEnd:(id<UIDragSession>)session API_AVAILABLE(ios(11.0)) {
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -105,6 +105,7 @@ static UIFont *userLabelFont;
|
|||
self.refreshControl.backgroundColor = UIColorFromRGB(0xE3E6E0);
|
||||
[self.refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
|
||||
[self.feedTitlesTable addSubview:self.refreshControl];
|
||||
self.feedViewToolbar.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
userLabelFont = [UIFont fontWithName:@"Helvetica-Bold" size:14.0];
|
||||
|
||||
|
@ -163,6 +164,7 @@ static UIFont *userLabelFont;
|
|||
|
||||
self.feedTitlesTable.backgroundColor = UIColorFromRGB(0xf4f4f4);
|
||||
self.feedTitlesTable.separatorColor = [UIColor clearColor];
|
||||
self.feedTitlesTable.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
userAvatarButton.customView.hidden = YES;
|
||||
userInfoBarButton.customView.hidden = YES;
|
||||
|
|
|
@ -197,7 +197,7 @@
|
|||
<extendedEdge key="edgesForExtendedLayout"/>
|
||||
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="blackOpaque"/>
|
||||
<navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="174">
|
||||
<rect key="frame" x="0.0" y="0.0" width="1000" height="1000"/>
|
||||
<rect key="frame" x="0.0" y="20" width="768" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<viewControllers>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<device id="retina5_5" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
|
@ -22,11 +22,11 @@
|
|||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="1">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" bouncesZoom="NO" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="4">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<connections>
|
||||
|
@ -34,17 +34,17 @@
|
|||
<outlet property="delegate" destination="-1" id="37"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<view hidden="YES" opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6Mr-6Q-kKI">
|
||||
<rect key="frame" x="8" y="80.5" width="304" height="204.5"/>
|
||||
<view hidden="YES" opaque="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6Mr-6Q-kKI">
|
||||
<rect key="frame" x="0.0" y="220.33333333333337" width="414" height="180.66666666666663"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="No stories to display. No stories to display. No stories to display. No stories to display." textAlignment="center" lineBreakMode="wordWrap" numberOfLines="8" baselineAdjustment="alignBaselines" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="Ryt-Dy-u2n">
|
||||
<rect key="frame" x="20" y="96" width="264" height="95.5"/>
|
||||
<rect key="frame" x="20" y="95.999999999999972" width="374" height="71.666666666666657"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
|
||||
<color key="textColor" red="0.75644385814666748" green="0.75644385814666748" blue="0.75644385814666748" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" alpha="0.40000000596046448" contentMode="scaleToFill" image="big_world.png" translatesAutoresizingMaskIntoConstraints="NO" id="Kdh-D5-esJ">
|
||||
<rect key="frame" x="120" y="24" width="64" height="64"/>
|
||||
<rect key="frame" x="175.33333333333334" y="24" width="64" height="64"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="64" id="1c2-mE-46C"/>
|
||||
<constraint firstAttribute="width" constant="64" id="Odo-if-TOJ"/>
|
||||
|
@ -63,16 +63,15 @@
|
|||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="3cs-AJ-WzR" firstAttribute="trailing" secondItem="6Mr-6Q-kKI" secondAttribute="trailing" constant="8" id="4oQ-NR-Xjf"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6Mr-6Q-kKI" secondAttribute="trailing" id="4oQ-NR-Xjf"/>
|
||||
<constraint firstItem="4" firstAttribute="leading" secondItem="3cs-AJ-WzR" secondAttribute="leading" id="6SF-3m-dmB"/>
|
||||
<constraint firstItem="4" firstAttribute="bottom" secondItem="1" secondAttribute="bottom" id="FtD-pN-AaO"/>
|
||||
<constraint firstItem="4" firstAttribute="top" secondItem="1" secondAttribute="top" id="Gtv-2z-WY8"/>
|
||||
<constraint firstItem="6Mr-6Q-kKI" firstAttribute="leading" secondItem="3cs-AJ-WzR" secondAttribute="leading" constant="8" id="MNk-r4-01O"/>
|
||||
<constraint firstItem="6Mr-6Q-kKI" firstAttribute="leading" secondItem="1" secondAttribute="leading" id="MNk-r4-01O"/>
|
||||
<constraint firstItem="4" firstAttribute="trailing" secondItem="3cs-AJ-WzR" secondAttribute="trailing" id="MvI-qm-bdt"/>
|
||||
<constraint firstItem="6Mr-6Q-kKI" firstAttribute="centerY" secondItem="4" secondAttribute="centerYWithinMargins" constant="-67.5" id="umc-BG-1FN"/>
|
||||
</constraints>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<viewLayoutGuide key="safeArea" id="3cs-AJ-WzR"/>
|
||||
</view>
|
||||
</objects>
|
||||
|
|
Loading…
Add table
Reference in a new issue