Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timob-16436: Update KS to work with appcompat #141

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Resources/ui/common/ControlsWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function ControlsWindow(title) {
];

if (Titanium.Platform.name == 'android') {
if (Ti.Platform.Android.API_LEVEL > 10) {
if (Ti.version >= "3.3.0" || Ti.Platform.Android.API_LEVEL > 10) {
data.push({title:'Action Bar', hasChild:true, test:'ui/handheld/android/controls/actionbar'});
}
}
Expand Down
33 changes: 16 additions & 17 deletions Resources/ui/handheld/android/controls/actionbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ function actionbar_demo(_args) {
font:{fontSize:'20dp',fontWeight:'bold'}
});
return title;
}
};

var getButtonView = function(theTitle){
var btn = Ti.UI.createButton({
title:theTitle,
top:'10dp'
})
});
return btn;
}
};

var sv = Ti.UI.createScrollView({
layout:'vertical'
})
});
var theActionBar = null;

var title1 = getTitleView('APPEARANCE OPTIONS');
Expand All @@ -43,7 +43,7 @@ function actionbar_demo(_args) {
color:'white',
font:{fontSize:'14dp',fontWeight:'normal'},
top:'10dp'
})
});

var barHidden = false;
b1.addEventListener('click',function(){
Expand All @@ -59,7 +59,7 @@ function actionbar_demo(_args) {
else {
alert('NO ACTION BAR');
}
})
});

var barTitle = '';
var switched = false;
Expand All @@ -77,28 +77,27 @@ function actionbar_demo(_args) {
else {
alert('NO ACTION BAR');
}
})
});

var iconSet = false;
b3.addEventListener('click',function(){
if (theActionBar != undefined) {
if (Ti.Platform.Android.API_LEVEL > 13) {
if (Ti.version >= "3.3.0" || Ti.Platform.Android.API_LEVEL > 13) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to have a SDK version check

if (iconSet == false) {
theActionBar.setIcon('images/camera.png');
}
else {
theActionBar.setIcon('appicon.png')
theActionBar.setIcon('appicon.png');
}
iconSet = !iconSet;
}
else {
alert('FEATURE REQUIRES API LEVEL >= 14');
} else {
alert('FEATURE REQUIRES API LEVEL >= 14 or SDK 3.3.0+');
}
}
else {
alert('NO ACTION BAR');
}
})
});

var homeEnabled = true;
b4.addEventListener('click',function(){
Expand All @@ -109,21 +108,21 @@ function actionbar_demo(_args) {
else {
alert('NO ACTION BAR');
}
})
});

var theAction = Ti.Android.SHOW_AS_ACTION_NEVER;
b5.addEventListener('click',function(){
theAction = Ti.Android.SHOW_AS_ACTION_ALWAYS;
win.activity.invalidateOptionsMenu();
})
});
b6.addEventListener('click',function(){
theAction = Ti.Android.SHOW_AS_ACTION_IF_ROOM;
win.activity.invalidateOptionsMenu();
})
});
b7.addEventListener('click',function(){
theAction = Ti.Android.SHOW_AS_ACTION_NEVER;
win.activity.invalidateOptionsMenu();
})
});

sv.add(title1);
sv.add(b1);
Expand Down
3 changes: 1 addition & 2 deletions tiapp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@
</intent-filter>
</activity>
</application>
<uses-sdk android:targetSdkVersion="11"/>
<uses-sdk android:targetSdkVersion="14"/>
</manifest>
<tool-api-level>11</tool-api-level>
<activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity"/>
<services>
<service type="interval" url="testservice.js"/>
Expand Down