Skip to content

Commit

Permalink
Merge branch 'master' into ui-callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Moskalchuk committed Feb 3, 2011
2 parents 3f0ca19 + 9ba5b87 commit 52859b3
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_NATIVEBAR, "com/rhomobile/rhodes/Nati
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_NAVBAR, "com/rhomobile/rhodes/NavBar")
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_PHONEBOOK, "com/rhomobile/rhodes/phonebook/Phonebook")
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_RHODES_SERVICE, "com/rhomobile/rhodes/RhodesService")
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_RHODES_ACTIVITY, "com/rhomobile/rhodes/RhodesActivity")
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_RHOFILEAPI, "com/rhomobile/rhodes/file/RhoFileApi")
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_RHOSOCKADDR, "com/rhomobile/rhodes/socket/RhoSockAddr")
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_RINGTONE_MANAGER, "com/rhomobile/rhodes/RingtoneManager")
Expand Down
7 changes: 6 additions & 1 deletion platform/android/Rhodes/jni/src/webview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ RHO_GLOBAL const char* rho_webview_execute_js(const char* js, int index)

RHO_GLOBAL void rho_webview_full_screen_mode(int enable)
{
//TODO: rho_webview_full_screen_mode
JNIEnv *env = jnienv();
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_ACTIVITY);
if (!cls) return;
jmethodID mid = getJNIClassStaticMethod(env, cls, "setFullscreen", "(I)V");
if (!mid) return;
env->CallStaticVoidMethod(cls, mid, enable);
}

RHO_GLOBAL void rho_webview_set_cookie(const char *url, const char *cookie)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
Expand Down Expand Up @@ -71,8 +72,8 @@ protected void onCreate(Bundle savedInstanceState) {
Thread ct = Thread.currentThread();
//ct.setPriority(Thread.MAX_PRIORITY);
uiThreadId = ct.getId();
getWindow().setFlags(RhodesService.WINDOW_FLAGS, RhodesService.WINDOW_MASK);

//requestWindowFeature(Window.FEATURE_NO_TITLE);

requestWindowFeature(Window.FEATURE_PROGRESS);
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, 10000);
Expand All @@ -99,6 +100,24 @@ public void run() {
}
});
}

public static void setFullscreen(int enable) {
//Utils.platformLog(TAG, "setFullscreen("+String.valueOf(enable)+")");
final int en = enable;
PerformOnUiThread.exec( new Runnable() {
public void run() {
if (en != 0) {
getInstance().getWindow().clearFlags( WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getInstance().getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
else {
getInstance().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getInstance().getWindow().setFlags( WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
}
}
, false);
}

@Override
public void onStart() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,14 @@ private void setFullscreenParameters() {
if (fullScreen) {
WINDOW_FLAGS = WindowManager.LayoutParams.FLAG_FULLSCREEN;
WINDOW_MASK = WindowManager.LayoutParams.FLAG_FULLSCREEN;
RhodesActivity.setFullscreen(1);
}
else {
WINDOW_FLAGS = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
WINDOW_MASK = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
RhodesActivity.setFullscreen(0);
}
//Utils.platformLog(TAG, "rhoconfig full_screen = "+String.valueOf(fullScreen)+" ");
}

private void initForegroundServiceApi() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,11 @@ public SimpleMainView(MainView v, Object params) {
init(v, params);
}

public void setWebBackgroundColor(int color) {
view.setBackgroundColor(color);
webView.setBackgroundColor(color);
}

public void back(int index) {
RhodesService.navigateBack();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ else if (params instanceof Map<?,?>) {
String action = (String)actionObj;
String icon = null;
boolean reload = false;

boolean disabled = false;
int web_bkg_color = 0xFFFFFFFF;

Object iconObj = hash.get("icon");
if (iconObj != null && (iconObj instanceof String))
Expand All @@ -516,6 +516,11 @@ else if (params instanceof Map<?,?>) {
if (disabled_Obj != null && (disabled_Obj instanceof String))
disabled = ((String)disabled_Obj).equalsIgnoreCase("true");

Object web_bkg_color_Obj = hash.get("web_bkg_color");
if (web_bkg_color_Obj != null && (web_bkg_color_Obj instanceof String)) {
web_bkg_color = Integer.parseInt((String)web_bkg_color_Obj) | 0xFF000000;
}

spec = host.newTabSpec(Integer.toString(i));

// Set label and icon
Expand Down Expand Up @@ -554,6 +559,12 @@ else if (params instanceof Map<?,?>) {

// Set view factory
SimpleMainView view = new SimpleMainView();

if (web_bkg_color_Obj != null) {
view.setWebBackgroundColor(web_bkg_color);
host.setBackgroundColor(web_bkg_color);
}

TabData data = new TabData();
data.view = view;
data.url = action;
Expand Down
4 changes: 2 additions & 2 deletions platform/bb/build/bb.rake
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ namespace "config" do
$bbver = $app_config["bbver"].to_s
$bb6 = true if $bbver == "6.0"

use_hsqldb = $app_config[$config["platform"]] && $app_config[$config["platform"]]['use_hsqldb']
$use_sqlite = $bbver[0].to_i >= 5 && (use_hsqldb && use_hsqldb == '0') ? true : false
use_sqlite = $app_config[$current_platform] && $app_config[$current_platform]['use_sqlite'] && $app_config[$current_platform]['use_sqlite'].to_s == '1'
$use_sqlite = $bbver[0].to_i >= 5 && use_sqlite ? true : false
puts "$use_sqlite : #{$use_sqlite}"

$builddir = $config["build"]["bbpath"] + "/build"
Expand Down
2 changes: 1 addition & 1 deletion rhodes.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.date = Time.now
s.description = %q{Rhodes mobile framework}
s.email = %q{[email protected]}
s.extra_rdoc_files = ["README.textile", "LICENSE"]
s.extra_rdoc_files = ["README.md", "LICENSE"]
files = Array.new
IO.read("Manifest.txt").each_line {|x| files << x.chomp}
s.files = files
Expand Down

0 comments on commit 52859b3

Please sign in to comment.