Skip to content

Commit

Permalink
iOS UI
Browse files Browse the repository at this point in the history
  • Loading branch information
yujitach committed Aug 23, 2018
1 parent f83e84c commit 4fee8a9
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 89 deletions.
2 changes: 1 addition & 1 deletion ArticleFolder.m
Expand Up @@ -24,7 +24,7 @@ -(void)reload
#if TARGET_OS_IPHONE
-(UIImage*)icon
{
return [UIImage imageNamed:@"unread"];
return [UIImage imageNamed:@"folder"];
}
#else
-(NSImage*)icon
Expand Down
Binary file added folder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added folder@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions inspire.xcodeproj/project.pbxproj
Expand Up @@ -176,6 +176,8 @@
33D02B101B908D1500C6648C /* spires-blue.png in Resources */ = {isa = PBXBuildFile; fileRef = 334A8C3910C8DB51000337CC /* spires-blue.png */; };
33D02B111B908D1500C6648C /* spires-blue@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 33C82714180F096900D6C713 /* spires-blue@2x.png */; };
33D02B141B9094D700C6648C /* ArticleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 33D02B131B9094D700C6648C /* ArticleTableViewCell.m */; };
33D1FEF5212E88A30090A401 /* folder@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 33D1FEF3212E88A20090A401 /* folder@2x.png */; };
33D1FEF6212E88A30090A401 /* folder.png in Resources */ = {isa = PBXBuildFile; fileRef = 33D1FEF4212E88A30090A401 /* folder.png */; };
33D5CEC51BB6E89400B87F05 /* iCloud.m in Sources */ = {isa = PBXBuildFile; fileRef = 33D5CEC21BB6E89400B87F05 /* iCloud.m */; };
33D5CEC61BB6E89400B87F05 /* iCloudDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 33D5CEC41BB6E89400B87F05 /* iCloudDocument.m */; };
33D5CEC71BB6E8C100B87F05 /* Acknowledgments.html in Resources */ = {isa = PBXBuildFile; fileRef = 33255AAA0F3131F500538063 /* Acknowledgments.html */; };
Expand Down Expand Up @@ -423,6 +425,8 @@
33CDDBEB1B8F137C003D993D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
33D02B121B9094D700C6648C /* ArticleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArticleTableViewCell.h; sourceTree = "<group>"; };
33D02B131B9094D700C6648C /* ArticleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ArticleTableViewCell.m; sourceTree = "<group>"; };
33D1FEF3212E88A20090A401 /* folder@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "folder@2x.png"; sourceTree = "<group>"; };
33D1FEF4212E88A30090A401 /* folder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = folder.png; sourceTree = "<group>"; };
33D5CEC11BB6E89400B87F05 /* iCloud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCloud.h; sourceTree = "<group>"; };
33D5CEC21BB6E89400B87F05 /* iCloud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCloud.m; sourceTree = "<group>"; };
33D5CEC31BB6E89400B87F05 /* iCloudDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCloudDocument.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -754,6 +758,8 @@
33B09C7C10D4AB66001A9B50 /* UI graphics */ = {
isa = PBXGroup;
children = (
33D1FEF4212E88A30090A401 /* folder.png */,
33D1FEF3212E88A20090A401 /* folder@2x.png */,
33FFF37B17DE01A0007AF5E3 /* unread-hasPDF.png */,
33C8271E180F116C00D6C713 /* unread-hasPDF@2x.png */,
332F1B0D0EA597D300758683 /* spires.icns */,
Expand Down Expand Up @@ -1104,6 +1110,7 @@
files = (
339586961B91BB24004778C6 /* tex.js in Resources */,
33D02B0A1B908D1500C6648C /* arxiv.png in Resources */,
33D1FEF5212E88A30090A401 /* folder@2x.png in Resources */,
33D02B0E1B908D1500C6648C /* spires-red.png in Resources */,
33D02B0F1B908D1500C6648C /* spires-red@2x.png in Resources */,
339586971B91BB2A004778C6 /* magicRegExps.perl in Resources */,
Expand All @@ -1121,6 +1128,7 @@
33D5CEC71BB6E8C100B87F05 /* Acknowledgments.html in Resources */,
33CDDBE71B8F137C003D993D /* Assets.xcassets in Resources */,
33CDDBE51B8F137C003D993D /* Main.storyboard in Resources */,
33D1FEF6212E88A30090A401 /* folder.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
11 changes: 11 additions & 0 deletions inspire/ArticleListTableViewController.m
Expand Up @@ -9,6 +9,7 @@
#import "ArticleListTableViewController.h"
#import "ArticleTableViewController.h"
#import "AddFolderViewController.h"
#import "AllArticleList.h"
#import "ArticleList.h"
#import "ArticleFolder.h"
#import "MOC.h"
Expand All @@ -20,6 +21,12 @@ @interface ArticleListTableViewController ()

@implementation ArticleListTableViewController

-(IBAction)unwindByNewSearch:(UIStoryboardSegue*)segue
{
self.parent=[AllArticleList allArticleList];
[self performSegueWithIdentifier:@"ShowDetail" sender:self];
}

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
Expand Down Expand Up @@ -153,7 +160,11 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
ArticleList*al = (ArticleList*)[self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = al.name;
cell.imageView.contentMode=UIViewContentModeScaleAspectFit;
cell.imageView.image =al.icon;
if([al isKindOfClass:[ArticleFolder class]]){
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
}

#pragma mark - Fetched results controller
Expand Down
15 changes: 11 additions & 4 deletions inspire/ArticleTableViewController.m
Expand Up @@ -80,8 +80,7 @@ - (void)didReceiveMemoryWarning {

-(void)addToSomeListArticleAtIndexPath:(NSIndexPath*)indexPath
{
Article*article=[self.fetchedResultsController objectAtIndexPath:indexPath];
[self performSegueWithIdentifier:@"ChooseSimpleList" sender:article];
[self performSegueWithIdentifier:@"ChooseSimpleList" sender:indexPath];
}
-(void)toggleFlag:(NSIndexPath*)indexPath
{
Expand Down Expand Up @@ -297,12 +296,20 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
controller.fetchedResultsController=self.fetchedResultsController;
controller.indexPath=indexPath;
}else if([[segue identifier] isEqualToString:@"ChooseSimpleList"]){
Article*a=(Article*)sender;
NSIndexPath*indexPath=(NSIndexPath*)sender;
Article*article=[self.fetchedResultsController objectAtIndexPath:indexPath];
UINavigationController*nc=(UINavigationController*)[segue destinationViewController];
UITableViewCell*cell=[self.tableView cellForRowAtIndexPath:indexPath];
CGRect frame=cell.bounds;
frame.origin.x=frame.size.width*.8;
frame.origin.y=frame.size.height*.5;
frame.size=CGSizeMake(0, 0);
nc.popoverPresentationController.sourceView=cell;
nc.popoverPresentationController.sourceRect=frame;
SpecificArticleListTableViewController*vc=(SpecificArticleListTableViewController*)nc.topViewController;
vc.entityName=@"SimpleArticleList";
vc.actionBlock=^(ArticleList*al){
[al addArticlesObject:a];
[al addArticlesObject:article];
};
}
}
Expand Down
30 changes: 27 additions & 3 deletions inspire/ArticleViewController.m
Expand Up @@ -13,6 +13,8 @@
#import "AppDelegate.h"
#import "AbstractRefreshManager.h"
#import "DumbOperation.h"
#import "SpecificArticleListTableViewController.h"
#import "ArticleList.h"

@interface ArticleViewController ()

Expand Down Expand Up @@ -57,6 +59,10 @@ -(void)mocSaved:(NSNotification*)n
{
[self performSelectorOnMainThread:@selector(refresh) withObject:nil waitUntilDone:NO];
}
-(void)newSearchInitiated:(NSNotification*)n
{
[self performSegueWithIdentifier:@"unwind" sender:nil];
}
- (void)viewDidLoad {
[super viewDidLoad];
handlerDic=[NSMutableDictionary dictionary];
Expand Down Expand Up @@ -86,6 +92,7 @@ - (void)viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pdfDownloadFinished:) name:@"pdfDownloadFinished" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pdfDownloadProgress:) name:@"pdfDownloadProgress" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mocSaved:) name:NSManagedObjectContextDidSaveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(newSearchInitiated:) name:@"newSearchInitiated" object:nil];
// [self refresh];
// Do any additional setup after loading the view.
}
Expand Down Expand Up @@ -285,36 +292,53 @@ -(IBAction)prev:(id)sender
[self refresh];
}
}
-(IBAction)addTo:(id)sender
{
[self performSegueWithIdentifier:@"AddTo" sender:nil];
}
-(IBAction)other:(id)sender
{
UIAlertController*ac=[UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction*c=[UIAlertAction actionWithTitle:@"cited by" style:UIAlertActionStyleDefault handler:^(UIAlertAction*aa){[self citedBy:nil];}];
UIAlertAction*r=[UIAlertAction actionWithTitle:@"refers to" style:UIAlertActionStyleDefault handler:^(UIAlertAction*aa){[self refersTo:nil];}];

Article*a=[self.fetchedResultsController objectAtIndexPath:self.indexPath];
NSString*x=(a.flag&AFIsFlagged)?@"unflag":@"flag";
UIAlertAction*f=[UIAlertAction actionWithTitle:x style:UIAlertActionStyleDefault handler:^(UIAlertAction*aa){[self flag:nil];}];

UIAlertAction*t=[UIAlertAction actionWithTitle:@"add to a list..." style:UIAlertActionStyleDefault handler:^(UIAlertAction*aa){[self addTo:nil];}];

UIAlertAction*cancel=[UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:nil];


[ac addAction:c];
[ac addAction:r];
[ac addAction:f];
[ac addAction:t];
[ac addAction:cancel];

ac.popoverPresentationController.barButtonItem=otherButton;

[self presentViewController:ac animated:YES completion:nil];
}
/*

#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([[segue identifier] isEqualToString:@"AddTo"]){
UINavigationController*nc=(UINavigationController*)[segue destinationViewController];
nc.popoverPresentationController.barButtonItem=otherButton;
SpecificArticleListTableViewController*vc=(SpecificArticleListTableViewController*)nc.topViewController;
vc.entityName=@"SimpleArticleList";
Article*a=[self.fetchedResultsController objectAtIndexPath:self.indexPath];
vc.actionBlock=^(ArticleList*al){
[al addArticlesObject:a];
};
}
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/


@end
5 changes: 5 additions & 0 deletions inspire/Assets.xcassets/AppIcon.appiconset/Contents.json
Expand Up @@ -89,6 +89,11 @@
"idiom" : "ipad",
"filename" : "inspire-4.png",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down

0 comments on commit 4fee8a9

Please sign in to comment.