diff --git a/create-signed-android-release.sh b/create-signed-android-release.sh index 9ef27c30c..7b1a3b25a 100755 --- a/create-signed-android-release.sh +++ b/create-signed-android-release.sh @@ -1,7 +1,7 @@ #!/bin/bash function usage { - echo "Usage: $0 kiwix-android.keystore [PACKAGE] [APP_NAME] [APP_VERSION]" + echo "Usage: $0 kiwix-android.keystore [PACKAGE] [APP_VERSION]" echo "You must specify the path of the certificate keystore." exit 1 } @@ -21,20 +21,6 @@ function die { exit 1 } -if [ "x$2" = "x" ]; - then - PACKAGE=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('package').strip() for e in d.getElementsByTagName('manifest')][-1])"` -else - PACKAGE=$2 -fi - -if [ "x$3" = "x" ]; - then - APP_VERSION=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('android:versionName').strip() for e in d.getElementsByTagName('manifest')][-1])"` -else - APP_VERSION=$3 -fi - # default values are guessed from repo (AndroidManifest and res/values/branding) APP_NAME=`python -c "from xml.dom.minidom import parse; d=parse('res/values/branding.xml'); print([e.childNodes[0].data.strip() for e in d.getElementsByTagName('string') if e.getAttribute('name') == 'app_name'][-1])"` TARGET_VERSION=`grep "compileSdkVersion" build.gradle | awk '{print $2}'` @@ -45,14 +31,10 @@ if [ "x$2" != "x" ]; PACKAGE=$2 fi + if [ "x$3" != "x" ]; then - APP_NAME=$3 -fi - -if [ "x$4" != "x" ]; - then - APP_VERSION=$4 + APP_VERSION=$3 fi ../src/dependencies/android-sdk/tools/android update project -p . -n kiwix -t android-${TARGET_VERSION} diff --git a/gen-custom-android-build.py b/gen-custom-android-build.py index df447bfcd..18552891b 100755 --- a/gen-custom-android-build.py +++ b/gen-custom-android-build.py @@ -47,7 +47,6 @@ DEFAULT_JSDATA = { # 'package': "org.kiwix.zim.custom", # 'version_name': "1.0", # 'zim_file': "wikipedia_bm.zim", - # 'license': None, 'enforced_lang': None, 'embed_zim': False, @@ -70,6 +69,8 @@ DEFAULT_JSDATA = { } SIZE_MATRIX = { + 'xxxhdpi': 192, + 'xxhdpi': 144, 'xhdpi': 96, 'mdpi': 72, 'ldpi': 48, @@ -231,7 +232,7 @@ def step_prepare_launcher_icons(jsdata, **options): .format(inf=os.path.join(ANDROID_PATH, 'ic_launcher_512.png'), p=pixels, outf=os.path.join(ANDROID_PATH, 'res', - 'drawable-{}'.format(density), + 'mipmap-{}'.format(density), 'kiwix_icon.png'))) @@ -295,7 +296,7 @@ def step_update_main_menu_xml(jsdata, **options): flushxml(soup, 'menu', menu_xml, head=False) -def step_update_preferences_xml(jsdata, **options): +def step_update_xml_nodes(jsdata, **options): ''' change package-named item reference in preference UI xml ''' move_to_android_placeholder() @@ -309,6 +310,14 @@ def step_update_preferences_xml(jsdata, **options): item.name = '{}.settings.SliderPreference'.format(jsdata.get('package')) flushxml(soup, 'PreferenceScreen', preferences_xml, head=False) + # rename AnimatedProgressBar node in res/layout/toolbar.xml + toolbar_xml = os.path.join(ANDROID_PATH, 'res', 'layout', 'toolbar.xml') + soup = soup = BeautifulSoup(open(toolbar_xml, 'r'), + 'xml', from_encoding='utf-8') + item = soup.find('org.kiwix.kiwixmobile.AnimatedProgressBar') + item.name = '{}.AnimatedProgressBar'.format(jsdata.get('package')) + flushxml(soup, 'LinearLayout', toolbar_xml, head=False) + def step_update_gradle(jsdata, **options): ''' uncomment compiling the content-libs.jar file into the APK ''' @@ -489,7 +498,7 @@ ARGS_MATRIX = OrderedDict([ ('branding', step_update_branding_xml), ('constants', step_gen_constants_java), ('menu', step_update_main_menu_xml), - ('preferences', step_update_preferences_xml), + ('xmlnodes', step_update_xml_nodes), ('manifest', step_update_android_manifest), ('jni', step_update_kiwix_c), ('libkiwix', step_compile_libkiwix), diff --git a/upload-apk.py b/upload-apk.py index 6c7c9627c..c726496aa 100755 --- a/upload-apk.py +++ b/upload-apk.py @@ -181,7 +181,7 @@ def upload_to_play_store(jsdata, channel=None): packageName=package_name, body={'versionCodes': [apk_response['versionCode']]}).execute() - logger.debug("Publicatio set to {} for version code {}" + logger.debug("Publication set to {} for version code {}" .format(track_response['track'], str(track_response['versionCodes']))) @@ -213,7 +213,7 @@ STORES = { } -def main(json_path, store='{}:{}'.format(PLAY_STORE, ALPHA)): +def main(json_path, store='{}:{}'.format(PLAY_STORE, ALPHA), *args): jsdata = json.load(get_local_remote_fd(json_path)) logger.info("Uploading {} APK to {}".format(jsdata['package'], store))