﻿### LICENSE:
#
# Copyright (C) 2011 Ahmad Amarullah ( http://amarullz.com/ )
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
### FILE INFO:
#
# AROMA Installer 2.00 - AROMA Installer Test Script Configuration
#       (c) 2011-2012 by Ahmad Amarullah
#           amarullz - xda-developers
#           http://www.amarullz.com/
#
#       Binary Version  : 2.56
#       Binary Codename : Edelweis
#
### INFO:
#
# * AROMA Resource Dir  = META-INF/com/google/android/aroma
#
# * AROMA Temporary Dir = /tmp/aroma/
#
# * About Icon          = @alert - show <AROMA Resource Dir>/icons/alert.png
#                         or if theme used it will find <themedir>/icon.alert.png
#                         you can still access it via "icons/alert"
#
# * dp                  = Device Pixelate. WVGA/QHD = 3, HVGA = 2.
#                         dp calculated with = round(min(width,height) / 160)
#
###

##
# Fix Colorspace Issue
#
# For device which have a problem with color ( not display the correct color )
# try to set "force_colorspace" with ini_set. It may caused by wrong framebuffer
# information that passed by kernel into framebuffer device.
#
# You can use one of following values:
#   "rgba", "abgr", "argb", "bgra"
#
# NOTE: It must be in top most script, or you will got the color flicker
#
# ini_set("force_colorspace","rgba");
#

##
# Set device pixel density
#
ini_set("dp","3");

##
# Initializing Kernel Information
#
ini_set("rom_name",             "arter97 kernel");
ini_set("rom_version",          "1.2");
ini_set("rom_author",           "arter97");
ini_set("rom_device",           "CyanogenMod");
ini_set("rom_date",             "2013");

##
# Show Simple Splash
#
splash(
  #-- Duration 2000ms / 2 seconds
    5000,
  
  #-- <AROMA Resource Dir>/arter97.png
    "arter97"
);

#
# Set Small Font to Support all fonts
#
fontresload( "0", "ttf/Roboto-Regular.ttf;ttf/DroidSansArabic.ttf;ttf/DroidSansFallback.ttf;", "12" ); #-- Use sets of font (Font Family)

###################################################################################################################
#
# LANGUAGE SELECTION
#
loadlang("langs/en.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" ); #-- "0" = Small Font ( Look at Fonts & UNICODE Demo Below )
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" ); #-- "1" = Big Font

###################################################################################################################
#
# THEME SELECTION
#
theme("ics");

###################################################################################################################
#
# LICENSE
#
agreebox(
  #-- Title
    "<~terms.title>",
  
  #-- Subtitle / Description
    "<~terms.desc>",
  
  #-- Icon
    "@license",
  
  #-- Text Content ( Read from <AROMA Resource Dir>/license.txt )
    resread("license.txt"),
  
  #-- Checkbox Text
    "<~terms.check>",
  
  #-- Unchecked Alert Message
    "<~terms.confirm>"
);

###################################################################################################################
#
# DISPLAY CHANGELOG
#
textbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version"),
  
  #-- Subtitle
    "<~changelog.desc>",
  
  #-- Icon
    "@update",
  
  #-- Arg 4
    resread("changelog.txt")
);

###################################################################################################################
#
# DISPLAY WARNING
#
# NB: Except if Yank555.lu settings
#
textbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version"),
  
  #-- Subtitle
    "Warning !!",
  
  #-- Icon
    "@alert",
  
  #-- Arg 4
    resread("warning.txt")
);


###################################################################################################################
#
# Kernel flashing
#
setvar("retstatus",
  install(
	#-- Title
      ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
	
	#-- Installation Process message
	  "Please wait while flashing <b>"+ini_get("rom_name")+
	  "</b>. This should be done quickly.",
	
	#-- Installation Icon
      "@install",
	
	#-- Installation Finish Message
    "The installation wizard has successfully installed <b>"+ini_get("rom_name")+
	  "</b>. Press Next to continue."
  )
);

##
#
# Next Button is "Finish"
#
ini_set("text_next", "Finish");

###################################################################################################################
#
# FINISH MESSAGE, Add Checkbox to Reboot or No. Save in "reboot_it" variable
#
# You can use return value or "reboot_it" variable to retrive checkbox value
# Example:
# if (checkviewbox(....)=="1" then
#    ... checked ...
# endif;
#
checkviewbox(
  #-- Title
    "Installation Completed",
  
  #-- Text
    "<#selectbg_g><b>Congratulation...</b></#>\n\n"+
    "<b>"+ini_get("rom_name")+"</b> has been flashed onto your device.\n\n"+
    "Installer Status: "+getvar("retstatus")+"\n\n",
	
  #-- Icon
    "@welcome",

  #-- Checkbox Text
    "Reboot your device now.",

  #-- Initial Checkbox value ( 0=unchecked, 1=checked ) -  (Optional, default:0)
    "0",

  #-- Save checked value in variable "reboot_it" (Optional)
    "reboot_it"
);

###
#
# Check if reboot checkbox was checked
if
  getvar("reboot_it")=="1"
then
  #
  # reboot("onfinish");   - Reboot if anything finished
  # reboot("now");        - Reboot Directly
  # reboot("disable");    - If you set reboot("onfinish") before, use this command to revert it.
  #
  reboot("onfinish");
endif;

#---- FINISH
