Prepare Dark Theme

Observe user interface theme change.

https://github.com/vector-im/riot-meta/issues/22
This commit is contained in:
Giom Foret
2017-07-21 11:28:17 +02:00
parent 45491d73c9
commit 4e5fa4ef5e
29 changed files with 795 additions and 70 deletions
@@ -37,6 +37,11 @@
The currently selected media. Nil when the multiselection is not active.
*/
NSMutableArray <PHAsset*> *selectedAssets;
/**
Observe kRiotDesignValuesDidChangeThemeNotification to handle user interface theme change.
*/
id kRiotDesignValuesDidChangeThemeNotificationObserver;
}
@end
@@ -64,7 +69,6 @@
[super finalizeInit];
// Setup `MXKViewControllerHandling` properties
self.defaultBarTintColor = kRiotNavBarTintColor;
self.enableBarTintColorStatusChange = NO;
self.rageShakeManager = [RageShakeManager sharedManager];
}
@@ -95,11 +99,30 @@
{
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedStringFromTable(@"media_picker_select", @"Vector", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onSelect:)];
}
// Observe user interface theme change.
kRiotDesignValuesDidChangeThemeNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kRiotDesignValuesDidChangeThemeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
[self userInterfaceThemeDidChange];
}];
[self userInterfaceThemeDidChange];
}
- (void)dealloc
- (void)userInterfaceThemeDidChange
{
self.defaultBarTintColor = kRiotSecondaryBgColor;
}
- (void)destroy
{
[super destroy];
if (kRiotDesignValuesDidChangeThemeNotificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kRiotDesignValuesDidChangeThemeNotificationObserver];
kRiotDesignValuesDidChangeThemeNotificationObserver = nil;
}
}
- (void)didReceiveMemoryWarning
@@ -189,13 +212,6 @@
[self.assetsCollectionView reloadData];
}
#pragma mark - Override MXKViewController
- (void)destroy
{
[super destroy];
}
#pragma mark - UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section