[DEV] add capabilities to display the adds upper or down on the GUI interface

This commit is contained in:
Edouard DUPIN 2014-06-03 23:34:15 +02:00
parent c73da6c4ac
commit 5c972caccd
2 changed files with 34 additions and 23 deletions

View File

@ -88,7 +88,8 @@ class Module:
"ANDROID_RESOURCES" : [], "ANDROID_RESOURCES" : [],
"ANDROID_APPL_TYPE" : "APPL", # the other mode is "WALLPAPER" ... and later "WIDGET" "ANDROID_APPL_TYPE" : "APPL", # the other mode is "WALLPAPER" ... and later "WIDGET"
"ANDROID_WALLPAPER_PROPERTIES" : [], # To create properties of the wallpaper (no use of EWOL display) "ANDROID_WALLPAPER_PROPERTIES" : [], # To create properties of the wallpaper (no use of EWOL display)
"RIGHT" : [] "RIGHT" : [],
"ADMOD_POSITION" : "top"
} }
@ -654,14 +655,7 @@ class Module:
# edu : Education # edu : Education
# pri : Private # pri : Private
# museum : ... # museum : ...
if "com" != value \ if value not in ["com", "net", "org", "gov", "mil", "edu", "pri", "museum"]:
and "net" != value \
and "org" != value \
and "gov" != value \
and "mil" != value \
and "edu" != value \
and "pri" != value \
and "museum" != value:
debug.error("can not set the value for this Input : '" + variable + "' : '" + value + "'") debug.error("can not set the value for this Input : '" + variable + "' : '" + value + "'")
else: else:
self.packageProp[variable] = value self.packageProp[variable] = value
@ -691,11 +685,7 @@ class Module:
elif "PRIORITY" == variable: elif "PRIORITY" == variable:
#list = ["required","important","standard","optional","extra"] #list = ["required","important","standard","optional","extra"]
#if isinstance(value, list): #if isinstance(value, list):
if "required" != value \ if value not in ["required", "important", "standard", "optional", "extra"]:
and "important" != value \
and "standard" != value \
and "optional" != value \
and "extra" != value:
debug.error("can not set the value for this Input : '" + variable + "' : '" + value + "'") debug.error("can not set the value for this Input : '" + variable + "' : '" + value + "'")
else: else:
self.packageProp[variable] = value self.packageProp[variable] = value
@ -721,8 +711,13 @@ class Module:
self.packageProp[variable] = value self.packageProp[variable] = value
elif "APPLE_APPLICATION_IOS_ID" == variable: elif "APPLE_APPLICATION_IOS_ID" == variable:
self.packageProp[variable] = value self.packageProp[variable] = value
elif "ADMOD_POSITION" == variable:
if value in ["top", "bottom"]:
self.packageProp[variable] = value
else:
debug.error("not know pkg element : '" + variable + "' with value : '" + value + "' must be [top|bottom]")
else: else:
debug.error("not know pak element : '" + variable + "'") debug.error("not know pkg element : '" + variable + "'")
def pkg_add(self, variable, value): def pkg_add(self, variable, value):
# TODO : Check values... # TODO : Check values...

View File

@ -226,30 +226,46 @@ class Target(lutinTarget.Target):
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkgProperties:
tmpFile.write( " mLayout = new LinearLayout(this);\n") tmpFile.write( " mLayout = new LinearLayout(this);\n")
tmpFile.write( " mLayout.setOrientation(android.widget.LinearLayout.VERTICAL);\n") tmpFile.write( " mLayout.setOrientation(android.widget.LinearLayout.VERTICAL);\n")
tmpFile.write( " setContentView(mLayout);\n") tmpFile.write( " LinearLayout.LayoutParams paramsWindows = new LinearLayout.LayoutParams(\n")
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT,\n")
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT);\n")
tmpFile.write( " \n") tmpFile.write( " \n")
tmpFile.write( " LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(\n") tmpFile.write( " setContentView(mLayout, paramsWindows);\n")
tmpFile.write( " LinearLayout.LayoutParams.WRAP_CONTENT,\n") tmpFile.write( " \n")
tmpFile.write( " LinearLayout.LayoutParams paramsAdds = new LinearLayout.LayoutParams(\n")
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT,\n")
tmpFile.write( " LinearLayout.LayoutParams.WRAP_CONTENT);\n") tmpFile.write( " LinearLayout.LayoutParams.WRAP_CONTENT);\n")
tmpFile.write( " paramsAdds.weight = 0;\n")
tmpFile.write( " \n") tmpFile.write( " \n")
tmpFile.write( " //params1.gravity = Gravity.TOP;\n") tmpFile.write( " LinearLayout.LayoutParams paramsGLView = new LinearLayout.LayoutParams(\n")
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT,\n")
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT);\n")
tmpFile.write( " paramsGLView.weight = 1;\n")
tmpFile.write( " paramsGLView.height = 0;\n")
tmpFile.write( " \n")
tmpFile.write( " mLayout.setGravity(android.view.Gravity.TOP);\n")
tmpFile.write( " \n") tmpFile.write( " \n")
tmpFile.write( " // Create an adds.\n") tmpFile.write( " // Create an adds.\n")
tmpFile.write( " adView = new AdView(this);\n") tmpFile.write( " adView = new AdView(this);\n")
tmpFile.write( " adView.setAdSize(AdSize.SMART_BANNER);\n") tmpFile.write( " adView.setAdSize(AdSize.SMART_BANNER);\n")
tmpFile.write( " adView.setAdUnitId(\"" + pkgProperties["ADMOD_ID"] + "\");\n") tmpFile.write( " adView.setAdUnitId(\"" + pkgProperties["ADMOD_ID"] + "\");\n")
tmpFile.write( " \n") tmpFile.write( " \n")
tmpFile.write( " // Add the AdView to the view hierarchy. The view will have no size until the ad is loaded.\n")
tmpFile.write( " mLayout.addView(adView, params1);\n")
tmpFile.write( " \n")
tmpFile.write( " // Create an ad request. Check logcat output for the hashed device ID to get test ads on a physical device.\n") tmpFile.write( " // Create an ad request. Check logcat output for the hashed device ID to get test ads on a physical device.\n")
tmpFile.write( " AdRequest adRequest = new AdRequest.Builder()\n") tmpFile.write( " AdRequest adRequest = new AdRequest.Builder()\n")
tmpFile.write( " .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)\n") tmpFile.write( " .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)\n")
tmpFile.write( " .build();\n") tmpFile.write( " .build();\n")
tmpFile.write( " \n") tmpFile.write( " \n")
tmpFile.write( " // Add the AdView to the view hierarchy. The view will have no size until the ad is loaded.\n")
if "ADMOD_POSITION" in pkgProperties.keys() \
and pkgProperties["ADMOD_POSITION"] == "top":
tmpFile.write( " mLayout.addView(adView, paramsAdds);\n")
tmpFile.write( " mLayout.addView(mGLView, paramsGLView);\n")
else:
tmpFile.write( " mLayout.addView(mGLView, paramsGLView);\n")
tmpFile.write( " mLayout.addView(adView, paramsAdds);\n")
tmpFile.write( " \n")
tmpFile.write( " // Start loading the ad in the background.\n") tmpFile.write( " // Start loading the ad in the background.\n")
tmpFile.write( " adView.loadAd(adRequest);\n") tmpFile.write( " adView.loadAd(adRequest);\n")
tmpFile.write( " mLayout.addView(mGLView, params1);\n")
tmpFile.write( " }\n") tmpFile.write( " }\n")
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkgProperties:
tmpFile.write( " @Override protected void onResume() {\n") tmpFile.write( " @Override protected void onResume() {\n")