Skip to content

Commit

Permalink
Merge pull request #5377 from hieupham007/timob-16487
Browse files Browse the repository at this point in the history
[TIMOB-16487] remove support for navbar-hidden
  • Loading branch information
ayeung committed Mar 28, 2014
2 parents 24113db + 7138cdb commit dbe154c
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 62 deletions.
18 changes: 4 additions & 14 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2023,13 +2023,6 @@ AndroidBuilder.prototype.checkIfShouldForceRebuild = function checkIfShouldForce
return true;
}

if (this.tiapp['navbar-hidden'] != manifest['navbar-hidden']) {
this.logger.info(__('Forcing rebuild: tiapp.xml navbar-hidden changed since last build'));
this.logger.info(' ' + __('Was: %s', manifest['navbar-hidden']));
this.logger.info(' ' + __('Now: %s', this.tiapp['navbar-hidden']));
return true;
}

if (this.minSDK != manifest.minSDK) {
this.logger.info(__('Forcing rebuild: Android minimum SDK changed since last build'));
this.logger.info(' ' + __('Was: %s', manifest.minSDK));
Expand Down Expand Up @@ -3278,11 +3271,9 @@ AndroidBuilder.prototype.generateTheme = function generateTheme(next) {
this.logger.info(__('Generating %s', themeFile.cyan));

var flags = 'Theme.AppCompat';
if ((this.tiapp.fullscreen || this.tiapp['statusbar-hidden']) && this.tiapp['navbar-hidden']) {
flags += '.NoTitleBar.Fullscreen';
} else if (this.tiapp['navbar-hidden']) {
flags += '.NoTitleBar';
}
if (this.tiapp.fullscreen || this.tiapp['statusbar-hidden'] ) {
flags += '.Fullscreen';
}

fs.writeFileSync(themeFile, ejs.render(fs.readFileSync(path.join(this.templatesDir, 'theme.xml')).toString(), {
flags: flags
Expand Down Expand Up @@ -3362,7 +3353,7 @@ AndroidBuilder.prototype.generateAndroidManifest = function generateAndroidManif
'activity': {
'name': 'ti.modules.titanium.media.TiVideoActivity',
'configChanges': ['keyboardHidden', 'orientation'],
'theme': '@style/Theme.AppCompat.NoTitleBar.Fullscreen',
'theme': '@style/Theme.AppCompat.Fullscreen',
'launchMode': 'singleTask'
}
},
Expand Down Expand Up @@ -4091,7 +4082,6 @@ AndroidBuilder.prototype.writeBuildManifest = function writeBuildManifest(callba
guid: this.tiapp.guid,
icon: this.tiapp.icon,
fullscreen: this.tiapp.fullscreen,
'navbar-hidden': this.tiapp['navbar-hidden'],
skipJSMinification: !!this.cli.argv['skip-js-minify'],
mergeCustomAndroidManifest: this.config.get('android.mergeCustomAndroidManifest', false),
encryptJS: this.encryptJS,
Expand Down
1 change: 0 additions & 1 deletion android/cli/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@
"Forcing rebuild: tiapp.xml guid changed since last build": "Forcing rebuild: tiapp.xml guid changed since last build",
"Forcing rebuild: tiapp.xml icon changed since last build": "Forcing rebuild: tiapp.xml icon changed since last build",
"Forcing rebuild: tiapp.xml fullscreen changed since last build": "Forcing rebuild: tiapp.xml fullscreen changed since last build",
"Forcing rebuild: tiapp.xml navbar-hidden changed since last build": "Forcing rebuild: tiapp.xml navbar-hidden changed since last build",
"Forcing rebuild: Android minimum SDK changed since last build": "Forcing rebuild: Android minimum SDK changed since last build",
"Forcing rebuild: Android target SDK changed since last build": "Forcing rebuild: Android target SDK changed since last build",
"Forcing rebuild: tiapp.xml properties changed since last build": "Forcing rebuild: tiapp.xml properties changed since last build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
public void onCreate(Bundle savedInstanceState)
{
setFullscreen(true);
setNavBarHidden(true);

super.onCreate(savedInstanceState);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,6 @@ private void fillIntent(ActionBarActivity activity, Intent intent)
if (hasProperty(TiC.PROPERTY_FULLSCREEN)) {
intent.putExtra(TiC.PROPERTY_FULLSCREEN, TiConvert.toBoolean(getProperty(TiC.PROPERTY_FULLSCREEN)));
}
if (hasProperty(TiC.PROPERTY_NAV_BAR_HIDDEN)) {
intent.putExtra(TiC.PROPERTY_NAV_BAR_HIDDEN, TiConvert.toBoolean(getProperty(TiC.PROPERTY_NAV_BAR_HIDDEN)));
}
if (hasProperty(TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE)) {
intent.putExtra(TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE, TiConvert.toInt(getProperty(TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ public void open(@Kroll.argument(optional = true) Object arg)
lightweight = false;

// If "ti.android.useLegacyWindow" is set to true in the tiapp.xml, follow the old window behavior:
// create a HW window if any of the four properties, "fullscreen", "navBarHidden", "windowSoftInputMode" and
// create a HW window if any of the three properties, "fullscreen", "windowSoftInputMode" and
// "modal", is specified; otherwise create a LW window.
} else if (TiApplication.USE_LEGACY_WINDOW && !hasProperty(TiC.PROPERTY_FULLSCREEN)
&& !hasProperty(TiC.PROPERTY_NAV_BAR_HIDDEN) && !hasProperty(TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE)
&& !hasProperty(TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE)
&& !hasProperty(TiC.PROPERTY_MODAL)) {
lightweight = true;
}
Expand Down Expand Up @@ -341,9 +341,6 @@ private void fillIntent(Activity activity, Intent intent)
if (hasProperty(TiC.PROPERTY_FULLSCREEN)) {
intent.putExtra(TiC.PROPERTY_FULLSCREEN, TiConvert.toBoolean(getProperty(TiC.PROPERTY_FULLSCREEN), false));
}
if (hasProperty(TiC.PROPERTY_NAV_BAR_HIDDEN)) {
intent.putExtra(TiC.PROPERTY_NAV_BAR_HIDDEN, TiConvert.toBoolean(getProperty(TiC.PROPERTY_NAV_BAR_HIDDEN), false));
}
if (hasProperty(TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE)) {
intent.putExtra(TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE, TiConvert.toInt(getProperty(TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE), -1));
}
Expand Down
3 changes: 0 additions & 3 deletions android/templates/AppInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,4 @@ public boolean isFullscreen() {
return ${app_info['fullscreen']};
}

public boolean isNavBarHidden() {
return ${app_info['navbar-hidden']};
}
}
4 changes: 0 additions & 4 deletions android/templates/build/AppInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,4 @@ public String getGUID() {
public boolean isFullscreen() {
return <%- !!tiapp.fullscreen %>;
}

public boolean isNavBarHidden() {
return <%- !!tiapp['navbar-hidden'] %>;
}
}
5 changes: 1 addition & 4 deletions android/templates/build/theme.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AppCompat.NoTitleBar">
<style name="Theme.AppCompat.Fullscreen">
<item name="android:windowNoTitle">true</item>
</style>

<style name="Theme.AppCompat.NoTitleBar.Fullscreen">
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ public interface ITiAppInfo
public boolean isAnalyticsEnabled();
public String getGUID();
public boolean isFullscreen();
public boolean isNavBarHidden();
public String getDeployType();
}
Original file line number Diff line number Diff line change
Expand Up @@ -406,35 +406,19 @@ protected void setFullscreen(boolean fullscreen)
}
}

protected void setNavBarHidden(boolean hidden)
{
if (!hidden) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
// Do not enable these features on Honeycomb or later since it will break the action bar.
this.requestWindowFeature(Window.FEATURE_LEFT_ICON);
this.requestWindowFeature(Window.FEATURE_RIGHT_ICON);
}

this.requestWindowFeature(Window.FEATURE_PROGRESS);
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

} else {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
}

// Subclasses can override to handle post-creation (but pre-message fire) logic
protected void windowCreated()
{
boolean fullscreen = getIntentBoolean(TiC.PROPERTY_FULLSCREEN, false);
boolean navBarHidden = getIntentBoolean(TiC.PROPERTY_NAV_BAR_HIDDEN, false);
boolean modal = getIntentBoolean(TiC.PROPERTY_MODAL, false);
int softInputMode = getIntentInt(TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE, -1);
boolean hasSoftInputMode = softInputMode != -1;

setFullscreen(fullscreen);
setNavBarHidden(navBarHidden);

this.requestWindowFeature(Window.FEATURE_PROGRESS);
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

if (modal) {
if (Build.VERSION.SDK_INT < TiC.API_LEVEL_ICE_CREAM_SANDWICH) {
// This flag is deprecated in API 14. On ICS, the background is not blurred but straight black.
Expand Down
5 changes: 0 additions & 5 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -1590,11 +1590,6 @@ public class TiC
* @module.api
*/
public static final String PROPERTY_NAME = "name";

/**
* @module.api
*/
public static final String PROPERTY_NAV_BAR_HIDDEN = "navBarHidden";

/**
* @module.api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ protected void windowCreated()
// Use settings from tiapp.xml
ITiAppInfo appInfo = getTiApp().getAppInfo();
getIntent().putExtra(TiC.PROPERTY_FULLSCREEN, appInfo.isFullscreen());
getIntent().putExtra(TiC.PROPERTY_NAV_BAR_HIDDEN, appInfo.isNavBarHidden());
super.windowCreated();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
@Kroll.proxy(propertyAccessors={
TiC.PROPERTY_EXIT_ON_CLOSE,
TiC.PROPERTY_FULLSCREEN,
TiC.PROPERTY_NAV_BAR_HIDDEN,
TiC.PROPERTY_TITLE,
TiC.PROPERTY_TITLEID,
TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE
Expand Down

0 comments on commit dbe154c

Please sign in to comment.