[iOS] Show bags in country download list

This commit is contained in:
Kirill Zhdanovich 2013-08-28 22:11:58 +03:00 committed by Alex Zolotarev
parent 1e0e9b8187
commit a4dff9392c
4 changed files with 44 additions and 1 deletions

View file

@ -31,6 +31,10 @@
CB252D6E16FF82C9001E41E9 /* libFlurry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CB252D6A16FF82C8001E41E9 /* libFlurry.a */; };
CB252D6F16FF82C9001E41E9 /* Statistics.m in Sources */ = {isa = PBXBuildFile; fileRef = CB252D6C16FF82C8001E41E9 /* Statistics.m */; };
CB252D7016FF82C9001E41E9 /* Statistics.m in Sources */ = {isa = PBXBuildFile; fileRef = CB252D6C16FF82C8001E41E9 /* Statistics.m */; };
ED2F9BEF17CE76490008C549 /* guide_bag@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = ED2F9BED17CE76490008C549 /* guide_bag@2x.png */; };
ED2F9BF017CE76490008C549 /* guide_bag@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = ED2F9BED17CE76490008C549 /* guide_bag@2x.png */; };
ED2F9BF117CE76490008C549 /* guide_bag.png in Resources */ = {isa = PBXBuildFile; fileRef = ED2F9BEE17CE76490008C549 /* guide_bag.png */; };
ED2F9BF217CE76490008C549 /* guide_bag.png in Resources */ = {isa = PBXBuildFile; fileRef = ED2F9BEE17CE76490008C549 /* guide_bag.png */; };
ED48BBB117BE6EA8003E7E92 /* MWMApi.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED48BBB017BE6EA8003E7E92 /* MWMApi.mm */; };
ED48BBB217BE6EA8003E7E92 /* MWMApi.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED48BBB017BE6EA8003E7E92 /* MWMApi.mm */; };
ED48BBB517C267F5003E7E92 /* ColorPickerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED48BBB417C267F5003E7E92 /* ColorPickerView.mm */; };
@ -1348,6 +1352,8 @@
CB252D6A16FF82C8001E41E9 /* libFlurry.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libFlurry.a; sourceTree = "<group>"; };
CB252D6B16FF82C8001E41E9 /* Statistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Statistics.h; sourceTree = "<group>"; };
CB252D6C16FF82C8001E41E9 /* Statistics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Statistics.m; sourceTree = "<group>"; };
ED2F9BED17CE76490008C549 /* guide_bag@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_bag@2x.png"; sourceTree = "<group>"; };
ED2F9BEE17CE76490008C549 /* guide_bag.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = guide_bag.png; sourceTree = "<group>"; };
ED48BBAF17BE6EA8003E7E92 /* MWMApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMApi.h; sourceTree = "<group>"; };
ED48BBB017BE6EA8003E7E92 /* MWMApi.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMApi.mm; sourceTree = "<group>"; };
ED48BBB317C267F5003E7E92 /* ColorPickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorPickerView.h; sourceTree = "<group>"; };
@ -2212,6 +2218,8 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
ED2F9BED17CE76490008C549 /* guide_bag@2x.png */,
ED2F9BEE17CE76490008C549 /* guide_bag.png */,
ED9CC5EE17CA18770051642E /* ios-guides.json */,
FA765AAF1737BC6D00279CFF /* 22x29-lite.png */,
FA765AB01737BC6D00279CFF /* 44x58-lite.png */,
@ -3687,6 +3695,8 @@
5797B6D716C931EE00FFE6D2 /* resources-xhdpi in Resources */,
FAF30A95173AB23900818BF6 /* 00_roboto_regular.ttf in Resources */,
ED9CC5EF17CA18770051642E /* ios-guides.json in Resources */,
ED2F9BEF17CE76490008C549 /* guide_bag@2x.png in Resources */,
ED2F9BF117CE76490008C549 /* guide_bag.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -4271,6 +4281,8 @@
FA765AB61737BC6D00279CFF /* 320-lite.png in Resources */,
FAF30A96173AB23900818BF6 /* 00_roboto_regular.ttf in Resources */,
ED9CC5F017CA18770051642E /* ios-guides.json in Resources */,
ED2F9BF017CE76490008C549 /* guide_bag@2x.png in Resources */,
ED2F9BF217CE76490008C549 /* guide_bag.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View file

@ -156,8 +156,22 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
Storage & s = frm.Storage();
string const & flag = s.CountryFlag(countryIndex);
if (!flag.empty())
guides::GuideInfo info;
if ((s.CountriesCount(countryIndex) == 0) && frm.GetGuideInfo(countryIndex, info))
{
cell.imageView.image = [UIImage imageNamed:@"guide_bag"];
[cell layoutSubviews];
UIButton * bt = [[[UIButton alloc] initWithFrame:cell.imageView.frame] autorelease];
bt.backgroundColor = [UIColor clearColor];
[bt addTarget:self action:@selector(showGuideAdvertise:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:bt];
}
else if (!flag.empty())
{
for (UIButton * v in cell.contentView.subviews)
[v removeFromSuperview];
cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%s.png", flag.c_str()]];
}
// do not show status for parent categories
if (![cell.reuseIdentifier isEqual: @"ParentCell"])
@ -480,4 +494,21 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours)
}
}
-(void)showGuideAdvertise:(UIButton *)bt
{
UITableViewCell * cell = (UITableViewCell *)(bt.superview.superview);
UITableView * v = (UITableView *)self.view;
NSIndexPath * indexPath = [v indexPathForCell:cell];
TIndex const index = CalculateIndex(m_index, indexPath);
guides::GuideInfo info;
if (!GetFramework().GetGuideInfo(index, info));
return;
NSURL * guideUrl = [NSURL URLWithString:[NSString stringWithUTF8String:info.GetAppID().c_str()]];
UIApplication * app = [UIApplication sharedApplication];
if ([app canOpenURL:guideUrl])
[app openURL:guideUrl];
else
[app openURL:[NSURL URLWithString:[NSString stringWithUTF8String:info.GetURL().c_str()]]];
}
@end

BIN
iphone/Maps/guide_bag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB