diff options
Diffstat (limited to 'IGetAndroid/app')
58 files changed, 1886 insertions, 0 deletions
diff --git a/IGetAndroid/app/.DS_Store b/IGetAndroid/app/.DS_Store Binary files differnew file mode 100644 index 00000000..5172429f --- /dev/null +++ b/IGetAndroid/app/.DS_Store diff --git a/IGetAndroid/app/.gitignore b/IGetAndroid/app/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/IGetAndroid/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/IGetAndroid/app/CMakeLists.txt b/IGetAndroid/app/CMakeLists.txt new file mode 100644 index 00000000..95019c1d --- /dev/null +++ b/IGetAndroid/app/CMakeLists.txt @@ -0,0 +1,83 @@ +# For more information about using CMake with Android Studio, read the +# documentation: https://d.android.com/studio/projects/add-native-code.html + +# Sets the minimum version of CMake required to build the native library. + +cmake_minimum_required(VERSION 3.4.1) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +set(CMAKE_FIND_ROOT_PATH "$ENV{DISTILLERY_ROOT_DIR}/usr_${CMAKE_SYSTEM_PROCESSOR};${CMAKE_FIND_ROOT_PATH}") +include_directories(${PROJECT_SOURCE_DIR}) + + +find_package(Boost 1.53.0 COMPONENTS system REQUIRED) +include_directories(SYSTEM ${Boost_INCLUDE_DIR}) + +include_directories($ENV{CCNX_DEPENDENCIES}/include) +set(OPENSSL_ROOT_DIR $ENV{CCNX_DEPENDENCIES}) + +find_package( LongBow REQUIRED ) +include_directories(${LONGBOW_INCLUDE_DIRS}) + +find_package( LibEvent REQUIRED ) +include_directories(${LIBEVENT_INCLUDE_DIRS}) + +find_package( Libparc REQUIRED ) +include_directories(${LIBPARC_INCLUDE_DIRS}) + +find_package( CCNX_Common REQUIRED ) +include_directories(${CCNX_COMMON_INCLUDE_DIRS}) + +find_package( CCNX_Transport_Rta REQUIRED ) +include_directories(${CCNX_TRANSPORT_RTA_INCLUDE_DIRS}) + +find_package( CCNX_Portal REQUIRED ) +include_directories(${CCNX_PORTAL_INCLUDE_DIRS}) + +find_package ( Threads REQUIRED ) + +find_package(Libicnet REQUIRED) +include_directories(${LIBICNET_INCLUDE_DIRS}) + +find_package ( OpenSSL REQUIRED ) + + +# Creates and names a library, sets it as either STATIC +# or SHARED, and provides the relative paths to its source code. +# You can define multiple libraries, and CMake builds them for you. +# Gradle automatically packages shared libraries with your APK. + +add_library( # Sets the name of the library. + IGetWrapper + + # Sets the library as a shared library. + SHARED + + # Provides a relative path to your source file(s). + src/main/cpp/IGetWrapper.cpp ) + +# Searches for a specified prebuilt library and stores the path as a +# variable. Because CMake includes system libraries in the search path by +# default, you only need to specify the name of the public NDK library +# you want to add. CMake verifies that the library exists before +# completing its build. + +find_library( # Sets the name of the path variable. + log-lib + + # Specifies the name of the NDK library that + # you want CMake to locate. + log ) + +# Specifies libraries CMake should link to your target library. You +# can link multiple libraries, such as libraries you define in this +# build script, prebuilt third-party libraries, or system libraries. + +target_link_libraries( # Specifies the target library. + IGetWrapper + + # Links the target library to the log library + # included in the NDK. + ${log-lib} ${LIBICNET_LIBRARIES} ${Boost_LIBRARIES} ${CCNX_PORTAL_LIBRARIES} ${CCNX_TRANSPORT_RTA_LIBRARIES} ${CCNX_COMMON_LIBRARIES} ${LIBPARC_LIBRARIES} ${LONGBOW_LIBRARIES} ${LIBEVENT_LIBRARIES} ${OPENSSL_LIBRARIES}) diff --git a/IGetAndroid/app/app.iml b/IGetAndroid/app/app.iml new file mode 100644 index 00000000..c6d0aaff --- /dev/null +++ b/IGetAndroid/app/app.iml @@ -0,0 +1,161 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4"> + <component name="FacetManager"> + <facet type="android-gradle" name="Android-Gradle"> + <configuration> + <option name="GRADLE_PROJECT_PATH" value=":app" /> + </configuration> + </facet> + <facet type="native-android-gradle" name="Native-Android-Gradle"> + <configuration> + <option name="SELECTED_BUILD_VARIANT" value="release" /> + </configuration> + </facet> + <facet type="android" name="Android"> + <configuration> + <option name="SELECTED_BUILD_VARIANT" value="debug" /> + <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" /> + <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" /> + <afterSyncTasks> + <task>generateDebugSources</task> + </afterSyncTasks> + <option name="ALLOW_USER_CONFIGURATION" value="false" /> + <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" /> + <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" /> + <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" /> + <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> + </configuration> + </facet> + </component> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7"> + <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" /> + <output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" /> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/main/cpp" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/jni" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> + <excludeFolder url="file://$MODULE_DIR$/build/.DS_Store" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/cmake" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" /> + <excludeFolder url="file://$MODULE_DIR$/build/outputs" /> + <excludeFolder url="file://$MODULE_DIR$/build/reports" /> + <excludeFolder url="file://$MODULE_DIR$/build/tmp" /> + </content> + <orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="com.android.support:support-media-compat-26.1.0" level="project" /> + <orderEntry type="library" scope="TEST" name="junit:junit:4.12@jar" level="project" /> + <orderEntry type="library" name="android.arch.lifecycle:common:1.0.0@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-core-3.0.1" level="project" /> + <orderEntry type="library" name="com.android.support:support-fragment-26.1.0" level="project" /> + <orderEntry type="library" scope="TEST" name="javax.inject:javax.inject:1@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="com.squareup:javawriter:2.1.1@jar" level="project" /> + <orderEntry type="library" name="com.android.support:support-vector-drawable-26.1.0" level="project" /> + <orderEntry type="library" name="android.arch.lifecycle:runtime-1.0.0" level="project" /> + <orderEntry type="library" name="com.android.support:appcompat-v7-26.1.0" level="project" /> + <orderEntry type="library" name="com.android.support:support-annotations:26.1.0@jar" level="project" /> + <orderEntry type="library" name="com.android.support.constraint:constraint-layout-solver:1.0.2@jar" level="project" /> + <orderEntry type="library" name="com.android.support:support-core-utils-26.1.0" level="project" /> + <orderEntry type="library" name="com.android.support.constraint:constraint-layout-1.0.2" level="project" /> + <orderEntry type="library" name="com.android.support:support-core-ui-26.1.0" level="project" /> + <orderEntry type="library" scope="TEST" name="com.android.support.test:runner-1.0.1" level="project" /> + <orderEntry type="library" scope="TEST" name="com.android.support.test:rules-1.0.1" level="project" /> + <orderEntry type="library" scope="TEST" name="com.google.code.findbugs:jsr305:2.0.1@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-idling-resource-3.0.1" level="project" /> + <orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-core:1.3@jar" level="project" /> + <orderEntry type="library" name="com.android.support:support-compat-26.1.0" level="project" /> + <orderEntry type="library" name="android.arch.core:common:1.0.0@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-library:1.3@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-integration:1.3@jar" level="project" /> + <orderEntry type="library" name="com.android.support:support-v4-26.1.0" level="project" /> + <orderEntry type="library" scope="TEST" name="net.sf.kxml:kxml2:2.3.0@jar" level="project" /> + <orderEntry type="library" name="com.android.support:animated-vector-drawable-26.1.0" level="project" /> + </component> +</module>
\ No newline at end of file diff --git a/IGetAndroid/app/build.gradle b/IGetAndroid/app/build.gradle new file mode 100644 index 00000000..b17b0ae4 --- /dev/null +++ b/IGetAndroid/app/build.gradle @@ -0,0 +1,73 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + defaultConfig { + applicationId "icn.iget.com.igetandroid" + minSdkVersion 24 + targetSdkVersion 26 + versionCode 7 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + externalNativeBuild { + cmake { + cppFlags "-std=c++11 -frtti -fexceptions" + } + } + + ndk { + // Specifies the ABI configurations of your native + // libraries Gradle should build and package with your APK. + abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' + } + } + + + signingConfigs { + release { + storeFile file("iget.keystore") + storePassword "igetandroid" + keyAlias "iget" + keyPassword "igetandroid" + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.release + } + } + + android.applicationVariants.all { variant -> + variant.outputs.all { output -> + def outputFile = output.outputFile + outputFile + if (outputFile != null && outputFile.name.endsWith('.apk')) { + project.ext { + appName = 'iget'} + def fileName = outputFile.name.replace("app", + "$project.ext.appName") + outputFileName = fileName + + } + + } + } + + externalNativeBuild { + cmake { + path "CMakeLists.txt" + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support.constraint:constraint-layout:1.0.2' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' +} diff --git a/IGetAndroid/app/cmake/Modules/FindCCNX_Common.cmake b/IGetAndroid/app/cmake/Modules/FindCCNX_Common.cmake new file mode 100644 index 00000000..2629c160 --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/FindCCNX_Common.cmake @@ -0,0 +1,39 @@ +######################################## +# +# Find the Libparc libraries and includes +# This module sets: +# CCNX_COMMON_FOUND: True if Libparc was found +# CCNX_COMMON_LIBRARY: The Libparc library +# CCNX_COMMON_LIBRARIES: The Libparc library and dependencies +# CCNX_COMMON_INCLUDE_DIR: The Libparc include dir +# + +set(CCNX_COMMON_SEARCH_PATH_LIST + ${CCNX_COMMON_HOME} + $ENV{CCNX_COMMON_HOME} + $ENV{CCNX_HOME} + $ENV{PARC_HOME} + $ENV{FOUNDATION_HOME} + /usr/local/parc + /usr/local/ccnx + /usr/local/ccn + /usr/local + /opt + /usr + ) + +find_path(CCNX_COMMON_INCLUDE_DIR ccnx/common/libccnxCommon_About.h + HINTS ${CCNX_COMMON_SEARCH_PATH_LIST} + PATH_SUFFIXES include + DOC "Find the Libccnx-common includes" ) + +find_library(CCNX_COMMON_LIBRARY NAMES ccnx_common + HINTS ${CCNX_COMMON_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the Libccnx-common libraries" ) + +set(CCNX_COMMON_LIBRARIES ${CCNX_COMMON_LIBRARY}) +set(CCNX_COMMON_INCLUDE_DIRS ${CCNX_COMMON_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CCNX_Common DEFAULT_MSG CCNX_COMMON_LIBRARY CCNX_COMMON_INCLUDE_DIR) diff --git a/IGetAndroid/app/cmake/Modules/FindCCNX_Portal.cmake b/IGetAndroid/app/cmake/Modules/FindCCNX_Portal.cmake new file mode 100644 index 00000000..68384bab --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/FindCCNX_Portal.cmake @@ -0,0 +1,40 @@ +######################################## +# +# Find the Libccnx-transport libraries and includes +# This module sets: +# CCNX_PORTAL_FOUND: True if Libparc was found +# CCNX_PORTAL_LIBRARY: The Libparc library +# CCNX_PORTAL_LIBRARIES: The Libparc library and dependencies +# CCNX_PORTAL_INCLUDE_DIR: The Libparc include dir +# + +set(CCNX_PORTAL_SEARCH_PATH_LIST + ${CCNX_PORTAL_HOME} + $ENV{CCNX_PORTAL_HOME} + $ENV{CCNX_HOME} + $ENV{PARC_HOME} + $ENV{FOUNDATION_HOME} + /usr/local/parc + /usr/local/ccnx + /usr/local/ccn + /usr/local + /opt + /usr + ) + +find_path(CCNX_PORTAL_INCLUDE_DIR ccnx/api/ccnx_Portal/ccnxPortal_About.h + HINTS ${CCNX_PORTAL_SEARCH_PATH_LIST} + PATH_SUFFIXES include + DOC "Find the Libccnx-portal includes" ) + +find_library(CCNX_PORTAL_LIBRARY NAMES ccnx_api_portal + HINTS ${CCNX_PORTAL_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the Libccnx-portal libraries" ) + +set(CCNX_PORTAL_LIBRARIES ${CCNX_PORTAL_LIBRARY}) + +set(CCNX_PORTAL_INCLUDE_DIRS ${CCNX_PORTAL_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CCNX_Portal DEFAULT_MSG CCNX_PORTAL_LIBRARY CCNX_PORTAL_INCLUDE_DIR) diff --git a/IGetAndroid/app/cmake/Modules/FindCCNX_Transport_Rta.cmake b/IGetAndroid/app/cmake/Modules/FindCCNX_Transport_Rta.cmake new file mode 100644 index 00000000..c43436d1 --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/FindCCNX_Transport_Rta.cmake @@ -0,0 +1,50 @@ +######################################## +# +# Find the Libccnx-transport libraries and includes +# This module sets: +# CCNX_TRANSPORT_RTA_FOUND: True if Libparc was found +# CCNX_TRANSPORT_RTA_LIBRARY: The Libparc library +# CCNX_TRANSPORT_RTA_LIBRARIES: The Libparc library and dependencies +# CCNX_TRANSPORT_RTA_INCLUDE_DIR: The Libparc include dir +# + +set(CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST + ${CCNX_TRANSPORT_RTA_HOME} + $ENV{CCNX_TRANSPORT_RTA_HOME} + $ENV{CCNX_HOME} + $ENV{PARC_HOME} + $ENV{FOUNDATION_HOME} + /usr/local/parc + /usr/local/ccnx + /usr/local/ccn + /usr/local + /opt + /usr + ) + +find_path(CCNX_TRANSPORT_RTA_INCLUDE_DIR ccnx/transport/librta_About.h + HINTS ${CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST} + PATH_SUFFIXES include + DOC "Find the Libccnx-transport-rta includes" ) + +find_library(CCNX_TRANSPORT_RTA_LIBRARY NAMES ccnx_transport_rta + HINTS ${CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the Libccnx-transport-rta libraries" ) + +find_library(CCNX_API_NOTIFY_LIBRARY NAMES ccnx_api_notify + HINTS ${CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the Libccnx-transport-rta libraries" ) + +find_library(CCNX_API_CONTROL_LIBRARY NAMES ccnx_api_control + HINTS ${CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the Libccnx-transport-rta libraries" ) + +set(CCNX_TRANSPORT_RTA_LIBRARIES ${CCNX_TRANSPORT_RTA_LIBRARY} ${CCNX_API_CONTROL_LIBRARY} ${CCNX_API_NOTIFY_LIBRARY}) + +set(CCNX_TRANSPORT_RTA_INCLUDE_DIRS ${CCNX_TRANSPORT_RTA_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CCNX_Transport_Api DEFAULT_MSG CCNX_TRANSPORT_RTA_LIBRARY CCNX_TRANSPORT_RTA_INCLUDE_DIR) diff --git a/IGetAndroid/app/cmake/Modules/FindLibEvent.cmake b/IGetAndroid/app/cmake/Modules/FindLibEvent.cmake new file mode 100644 index 00000000..2d1ca4fe --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/FindLibEvent.cmake @@ -0,0 +1,47 @@ +######################################## +# +# Find the LibEvent libraries and includes +# This module sets: +# LIBEVENT_FOUND: True if LibEvent was found +# LIBEVENT_LIBRARY: The LibEvent library +# LIBEVENT_LIBRARIES: The LibEvent library and dependencies +# LIBEVENT_INCLUDE_DIR: The LibEvent include dir +# +# This module will look for the libraries in various locations +# See the LIBEVENT_SEARCH_PATH_LIST for a full list. +# +# The caller can hint at locations using the following variables: +# +# LIBEVENT_HOME (passed as -D to cmake) +# CCNX_DEPENDENCIES (in environment) +# LIBEVENT_HOME (in environment) +# CCNX_HOME (in environment) +# + +set(LIBEVENT_SEARCH_PATH_LIST + ${LIBEVENT_HOME} + $ENV{CCNX_DEPENDENCIES} + $ENV{LIBEVENT_HOME} + $ENV{CCNX_HOME} + /usr/local/ccnx + /usr/local/ccn + /usr/local + /opt + /usr + ) + +find_path(LIBEVENT_INCLUDE_DIR event2/event.h + HINTS ${LIBEVENT_SEARCH_PATH_LIST} + PATH_SUFFIXES include + DOC "Find the LibEvent includes" ) + +find_library(LIBEVENT_LIBRARY NAMES event + HINTS ${LIBEVENT_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the LibEvent libraries" ) + +set(LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARY}) +set(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LibEvent DEFAULT_MSG LIBEVENT_LIBRARY LIBEVENT_INCLUDE_DIR) diff --git a/IGetAndroid/app/cmake/Modules/FindLibicnet.cmake b/IGetAndroid/app/cmake/Modules/FindLibicnet.cmake new file mode 100644 index 00000000..4472060b --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/FindLibicnet.cmake @@ -0,0 +1,39 @@ +######################################## +# +# Find the Libparc libraries and includes +# This module sets: +# LIBICNET_FOUND: True if Libconsumer-producer was found +# LIBICNETR_LIBRARY: The Libconsumer-producer library +# LIBICNET_LIBRARIES: The Libconsumer-producer library and dependencies +# LIBICNET_INCLUDE_DIR: The Libconsumer-producer include dir +# + +set(LIBICNET_SEARCH_PATH_LIST + ${LIBICNET_HOME} + $ENV{LIBICNETHOME} + $ENV{CCNX_HOME} + $ENV{PARC_HOME} + $ENV{FOUNDATION_HOME} + /usr/local/parc + /usr/local/ccnx + /usr/local/ccn + /usr/local + /opt + /usr + ) + +find_path(LIBICNET_INCLUDE_DIR icnet/icnet_transport_common.h + HINTS ${LIBICNET_SEARCH_PATH_LIST} + PATH_SUFFIXES include + DOC "Find the libicnet includes") + +find_library(LIBICNET_LIBRARY NAMES icnet + HINTS ${LIBICNET_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the libicnet libraries") +message("---->${LIBICNET_LIBRARY} ${LIBICNET_INCLUDE_DIR}") +set(LIBICNET_LIBRARIES ${LIBICNET_LIBRARY}) +set(LIBICNET_INCLUDE_DIRS ${LIBICNET_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libicnet DEFAULT_MSG LIBICNET_LIBRARY LIBICNET_INCLUDE_DIR)
\ No newline at end of file diff --git a/IGetAndroid/app/cmake/Modules/FindLibparc.cmake b/IGetAndroid/app/cmake/Modules/FindLibparc.cmake new file mode 100644 index 00000000..02835161 --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/FindLibparc.cmake @@ -0,0 +1,39 @@ +######################################## +# +# Find the Libparc libraries and includes +# This module sets: +# LIBPARC_FOUND: True if Libparc was found +# LIBPARC_LIBRARY: The Libparc library +# LIBPARC_LIBRARIES: The Libparc library and dependencies +# LIBPARC_INCLUDE_DIR: The Libparc include dir +# + +set(LIBPARC_SEARCH_PATH_LIST + ${LIBPARC_HOME} + $ENV{LIBPARC_HOME} + $ENV{CCNX_HOME} + $ENV{PARC_HOME} + $ENV{FOUNDATION_HOME} + /usr/local/parc + /usr/local/ccnx + /usr/local/ccn + /usr/local + /opt + /usr + ) + +find_path(LIBPARC_INCLUDE_DIR parc/libparc_About.h + HINTS ${LIBPARC_SEARCH_PATH_LIST} + PATH_SUFFIXES include + DOC "Find the Libparc includes" ) + +find_library(LIBPARC_LIBRARY NAMES parc + HINTS ${LIBPARC_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the Libparc libraries" ) + +set(LIBPARC_LIBRARIES ${LIBPARC_LIBRARY}) +set(LIBPARC_INCLUDE_DIRS ${LIBPARC_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libparc DEFAULT_MSG LIBPARC_LIBRARY LIBPARC_INCLUDE_DIR) diff --git a/IGetAndroid/app/cmake/Modules/FindLongBow.cmake b/IGetAndroid/app/cmake/Modules/FindLongBow.cmake new file mode 100644 index 00000000..e35888eb --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/FindLongBow.cmake @@ -0,0 +1,44 @@ +######################################## +# +# Find the LongBow libraries and includes +# This module sets: +# LONGBOW_FOUND: True if LongBow was found +# LONGBOW_LIBRARY: The LongBow library +# LONGBOW_LIBRARIES: The LongBow library and dependencies +# LONGBOW_INCLUDE_DIR: The LongBow include dir +# + +set(LONGBOW_SEARCH_PATH_LIST + ${LONGBOW_HOME} + $ENV{LONGBOW_HOME} + $ENV{CCNX_HOME} + $ENV{PARC_HOME} + $ENV{FOUNDATION_HOME} + /usr/local/parc + /usr/local/ccnx + /usr/local/ccn + /usr/local + /opt + /usr + ) + +find_path(LONGBOW_INCLUDE_DIR LongBow/longBow_About.h + HINTS ${LONGBOW_SEARCH_PATH_LIST} + PATH_SUFFIXES include + DOC "Find the LongBow includes" ) + +find_library(LONGBOW_LIBRARY NAMES longbow + HINTS ${LONGBOW_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the LongBow libraries" ) + +find_library(LONGBOW_REPORT_LIBRARY NAMES longbow-textplain longbow-ansiterm + HINTS ${LONGBOW_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the LongBow report libraries" ) + +set(LONGBOW_LIBRARIES ${LONGBOW_LIBRARY} ${LONGBOW_REPORT_LIBRARY}) +set(LONGBOW_INCLUDE_DIRS ${LONGBOW_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LongBow DEFAULT_MSG LONGBOW_LIBRARY LONGBOW_INCLUDE_DIR) diff --git a/IGetAndroid/app/cmake/Modules/FindUncrustify.cmake b/IGetAndroid/app/cmake/Modules/FindUncrustify.cmake new file mode 100644 index 00000000..e53f65fe --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/FindUncrustify.cmake @@ -0,0 +1,8 @@ +# Find uncrustify program +# +find_program( UNCRUSTIFY_BIN uncrustify + PATHS + $ENV{UNCRUSTIFY_HOME} + ) + +message( "-- UNCRUSTIFY found in ${UNCRUSTIFY_BIN}" ) diff --git a/IGetAndroid/app/cmake/Modules/detectCacheSize.cmake b/IGetAndroid/app/cmake/Modules/detectCacheSize.cmake new file mode 100644 index 00000000..469d2627 --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/detectCacheSize.cmake @@ -0,0 +1,21 @@ +# Detect the cache size +# +# XXX: TODO: This is a bug when cross compiling. We are detecting the local +# Cache Line size and not the target cache line size. We should provide some +# way to define this + +set(LEVEL1_DCACHE_LINESIZE 32) + +if( APPLE ) + execute_process(COMMAND sysctl -n hw.cachelinesize + OUTPUT_VARIABLE LEVEL1_DCACHE_LINESIZE + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif( APPLE ) + +if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) + execute_process(COMMAND getconf LEVEL1_DCACHE_LINESIZE + OUTPUT_VARIABLE LEVEL1_DCACHE_LINESIZE + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +message("-- Cache line size: ${LEVEL1_DCACHE_LINESIZE}") diff --git a/IGetAndroid/app/cmake/Modules/version.cmake b/IGetAndroid/app/cmake/Modules/version.cmake new file mode 100644 index 00000000..74831674 --- /dev/null +++ b/IGetAndroid/app/cmake/Modules/version.cmake @@ -0,0 +1,15 @@ +# +# Get a version to pass on the command line +# +execute_process(COMMAND ${PROJECT_SOURCE_DIR}/cmake/get_version.sh ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE RELEASE_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + +execute_process(COMMAND date -u +%Y-%m-%dT%H:%M:%SZ + OUTPUT_VARIABLE ISO_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE) + +MESSAGE( STATUS "Configuring version ${RELEASE_VERSION}" ) + +add_definitions("-DRELEASE_VERSION=\"${RELEASE_VERSION}\"") + diff --git a/IGetAndroid/app/cmake/get_version.sh b/IGetAndroid/app/cmake/get_version.sh new file mode 100755 index 00000000..34c6ddb2 --- /dev/null +++ b/IGetAndroid/app/cmake/get_version.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +DATE_VERSION=`date "+%Y%m%d"` + +if [ ! -d $1 ]; then + echo 0.$DATE_VERSION + exit +fi + +if [ -f $1/BASE_VERSION ]; then + BASE_VERSION=`cat $1/BASE_VERSION`. +fi + +GIT=`which git` + +if test -x $GIT -a -f $1/.git/config; then + GIT_VERSION=.`git -C $1 rev-parse HEAD | cut -c 1-8` +fi + +echo $BASE_VERSION$DATE_VERSION$GIT_VERSION diff --git a/IGetAndroid/app/iget.keystore b/IGetAndroid/app/iget.keystore Binary files differnew file mode 100644 index 00000000..f0b06a7a --- /dev/null +++ b/IGetAndroid/app/iget.keystore diff --git a/IGetAndroid/app/proguard-rules.pro b/IGetAndroid/app/proguard-rules.pro new file mode 100644 index 00000000..f1b42451 --- /dev/null +++ b/IGetAndroid/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/IGetAndroid/app/src/.DS_Store b/IGetAndroid/app/src/.DS_Store Binary files differnew file mode 100644 index 00000000..0787fb7b --- /dev/null +++ b/IGetAndroid/app/src/.DS_Store diff --git a/IGetAndroid/app/src/androidTest/java/icn/iget/com/igetandroid/ExampleInstrumentedTest.java b/IGetAndroid/app/src/androidTest/java/icn/iget/com/igetandroid/ExampleInstrumentedTest.java new file mode 100644 index 00000000..68650929 --- /dev/null +++ b/IGetAndroid/app/src/androidTest/java/icn/iget/com/igetandroid/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package icn.iget.com.igetandroid; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("icn.iget.com.igetandroid", appContext.getPackageName()); + } +} diff --git a/IGetAndroid/app/src/main/.DS_Store b/IGetAndroid/app/src/main/.DS_Store Binary files differnew file mode 100644 index 00000000..cf4f5edd --- /dev/null +++ b/IGetAndroid/app/src/main/.DS_Store diff --git a/IGetAndroid/app/src/main/AndroidManifest.xml b/IGetAndroid/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..107d059c --- /dev/null +++ b/IGetAndroid/app/src/main/AndroidManifest.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="icn.iget.com.igetandroid"> + + <application + android:allowBackup="true" + android:configChanges="orientation|screenSize|keyboard" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/AppTheme"> + <activity + android:name=".IGetAndroidActivity" + android:screenOrientation="portrait"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission + android:name="android.permission.READ_EXTERNAL_STORAGE" + android:maxSdkVersion="26" /> + +</manifest>
\ No newline at end of file diff --git a/IGetAndroid/app/src/main/cpp/IGetWrapper.cpp b/IGetAndroid/app/src/main/cpp/IGetWrapper.cpp new file mode 100644 index 00000000..a5a92058 --- /dev/null +++ b/IGetAndroid/app/src/main/cpp/IGetWrapper.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018 Cisco and/or its affiliates. + * 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. + */ +#include <jni.h> +#include <string> +#include <icnet/icnet_http_facade.h> +libl4::http::HTTPClientConnection connection; + +extern "C" +JNIEXPORT jbyteArray JNICALL +Java_icn_iget_com_igetandroid_IGetAndroidActivity_downloadFile(JNIEnv *env, jobject instance, + jstring path_) { + const char *path = env->GetStringUTFChars(path_, 0); + std::string name(path); + env->ReleaseStringUTFChars(path_, path); + connection.get(name); + auto response = connection.response(); + if (response.getPayload().size() == 0) { + jbyte a[] = {}; + jbyteArray ret = env->NewByteArray(0); + env->SetByteArrayRegion (ret, 0, 0, a); + return ret; + } + jbyteArray ret = env->NewByteArray(response.getPayload().size()); + env->SetByteArrayRegion (ret, 0, response.getPayload().size(), (jbyte *)response.getPayload().data()); + return ret; +} + +extern "C" +JNIEXPORT void JNICALL +Java_icn_iget_com_igetandroid_IGetAndroidActivity_stopDownload(JNIEnv *env, jobject instance) { + connection.stop(); +}
\ No newline at end of file diff --git a/IGetAndroid/app/src/main/ic_launcher-web.png b/IGetAndroid/app/src/main/ic_launcher-web.png Binary files differnew file mode 100644 index 00000000..8a9d5774 --- /dev/null +++ b/IGetAndroid/app/src/main/ic_launcher-web.png diff --git a/IGetAndroid/app/src/main/java/.DS_Store b/IGetAndroid/app/src/main/java/.DS_Store Binary files differnew file mode 100644 index 00000000..67c36481 --- /dev/null +++ b/IGetAndroid/app/src/main/java/.DS_Store diff --git a/IGetAndroid/app/src/main/java/icn/.DS_Store b/IGetAndroid/app/src/main/java/icn/.DS_Store Binary files differnew file mode 100644 index 00000000..6b392bb4 --- /dev/null +++ b/IGetAndroid/app/src/main/java/icn/.DS_Store diff --git a/IGetAndroid/app/src/main/java/icn/iget/com/adapter/ListViewAdapter.java b/IGetAndroid/app/src/main/java/icn/iget/com/adapter/ListViewAdapter.java new file mode 100644 index 00000000..f6e4f808 --- /dev/null +++ b/IGetAndroid/app/src/main/java/icn/iget/com/adapter/ListViewAdapter.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2018 Cisco and/or its affiliates. + * 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. + */ + +package icn.iget.com.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; + + +import java.io.File; +import java.util.ArrayList; + +import icn.iget.com.igetandroid.R; +import icn.iget.com.utility.Constants; + +public class ListViewAdapter extends BaseAdapter { + + Context context; + ArrayList<OutputListViewElement> outputListViewElementArrayList; + private static LayoutInflater inflater = null; + + public ListViewAdapter(Context context, ArrayList<OutputListViewElement> outputListViewElementArrayList) { + this.context = context; + this.outputListViewElementArrayList = outputListViewElementArrayList; + inflater = (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + @Override + public int getCount() { + return outputListViewElementArrayList.size(); + } + + @Override + public Object getItem(int position) { + return outputListViewElementArrayList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View view = convertView; + if (view == null) + view = inflater.inflate(R.layout.list_view_row, null); + TextView urlTextView = (TextView) view.findViewById(R.id.urlTextView); + urlTextView.setText(outputListViewElementArrayList.get(position).getUrl()); + + TextView savedPathTextView = (TextView) view.findViewById(R.id.savedPathTextView); + savedPathTextView.setText(outputListViewElementArrayList.get(position).getSavedPath() + File.separator + outputListViewElementArrayList.get(position).getNameFile()); + + TextView md5TextView = (TextView) view.findViewById(R.id.md5TextView); + md5TextView.setText(outputListViewElementArrayList.get(position).getMd5()); + + TextView sizeTextView = (TextView) view.findViewById(R.id.sizeTextView); + sizeTextView.setText(Integer.toString(outputListViewElementArrayList.get(position).getSize())); + + TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView); + dateTextView.setText(outputListViewElementArrayList.get(position).getDateSting(Constants.FORMAT_DATA)); + + + return view; + } +} diff --git a/IGetAndroid/app/src/main/java/icn/iget/com/adapter/OutputListViewElement.java b/IGetAndroid/app/src/main/java/icn/iget/com/adapter/OutputListViewElement.java new file mode 100644 index 00000000..87815a7a --- /dev/null +++ b/IGetAndroid/app/src/main/java/icn/iget/com/adapter/OutputListViewElement.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2018 Cisco and/or its affiliates. + * 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. + */ + +package icn.iget.com.adapter; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; + + +public class OutputListViewElement implements Serializable { + + String url; + String savedPath; + String nameFile; + String md5; + int size; + Date date; + + public OutputListViewElement(String url, String savedPath, String nameFile, String md5, int size) { + this.url = url; + this.savedPath = savedPath; + this.nameFile = nameFile; + this.md5 = md5; + this.size = size; + this.date = new Date(); + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getSavedPath() { + return savedPath; + } + + public void setSavedPath(String savedPath) { + this.savedPath = savedPath; + } + + public String getNameFile() { + return nameFile; + } + + public void setNameFile(String nameFile) { + this.nameFile = nameFile; + } + + public String getMd5() { + return md5; + } + + public void setMd5(String md5) { + this.md5 = md5; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getDateSting(String format) { + return new SimpleDateFormat(format).format(date); + } + + + +} diff --git a/IGetAndroid/app/src/main/java/icn/iget/com/igetandroid/IGetAndroidActivity.java b/IGetAndroid/app/src/main/java/icn/iget/com/igetandroid/IGetAndroidActivity.java new file mode 100644 index 00000000..43eae0d2 --- /dev/null +++ b/IGetAndroid/app/src/main/java/icn/iget/com/igetandroid/IGetAndroidActivity.java @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2018 Cisco and/or its affiliates. + * 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. + */ + +package icn.iget.com.igetandroid; + +import android.Manifest; +import android.app.Dialog; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.os.Environment; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ListView; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.concurrent.Executors; + +import icn.iget.com.adapter.ListViewAdapter; +import icn.iget.com.adapter.OutputListViewElement; +import icn.iget.com.igetandroid.R; +import icn.iget.com.utility.Constants; +import icn.iget.com.utility.ResourcesEnumerator; + +public class IGetAndroidActivity extends AppCompatActivity { + + private static String TAG = "IGetAndroidAcrivity"; + + // Used to load the 'native-lib' library on application startup. + static { + System.loadLibrary("IGetWrapper"); + } + + ArrayList<OutputListViewElement> outputListViewElementArrayList = new ArrayList<OutputListViewElement>(); + ListViewAdapter adapter; + + + static int fCount = 0; + SharedPreferences sharedPreferences; + EditText urlEditText; + EditText downloadPathEditText; + Button downloadButton; + Button stopButton; + ListView resultListView; + Button yesButtonDialog; + Button noButtonDialog; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_i_get_android); + adapter = new ListViewAdapter(this, outputListViewElementArrayList); + resultListView = (ListView) findViewById(R.id.resultsListView); + resultListView.setAdapter(adapter); + checkEnabledPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE); + checkEnabledPermission(Manifest.permission.READ_EXTERNAL_STORAGE); + if (!checkMetis(Constants.METIS_ID)) { + final Dialog dialog = new Dialog(this); + dialog.setContentView(R.layout.popup_message); + yesButtonDialog = (Button) dialog.findViewById(R.id.yesButtonDialog); + noButtonDialog = (Button) dialog.findViewById(R.id.noButtonDialog); + yesButtonDialog.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + try { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + Constants.METIS_ID))); + } catch (android.content.ActivityNotFoundException anfe) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + Constants.METIS_ID))); + } + dialog.hide(); + } + }); + noButtonDialog.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dialog.hide(); + } + }); + dialog.show(); + + } + init(); + } + + public static final String md5(final byte[] s) { + final String MD5 = "MD5"; + try { + // Create MD5 Hash + MessageDigest digest = java.security.MessageDigest + .getInstance(MD5); + digest.update(s); + byte messageDigest[] = digest.digest(); + + // Create Hex String + StringBuilder hexString = new StringBuilder(); + for (byte aMessageDigest : messageDigest) { + String h = Integer.toHexString(0xFF & aMessageDigest); + while (h.length() < 2) + h = "0" + h; + hexString.append(h); + } + return hexString.toString(); + + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return ""; + } + + private void init() { + Log.v("storage path", Environment.getExternalStorageDirectory().toString()); + sharedPreferences = getSharedPreferences(Constants.I_GET_PREFERENCES, MODE_PRIVATE); + urlEditText = (EditText) findViewById(R.id.urlEditText); + urlEditText.setText(sharedPreferences.getString(ResourcesEnumerator.URL.key(), Constants.DEFAULT_URL)); + downloadPathEditText = (EditText) findViewById(R.id.downloadPathEditText); + downloadPathEditText.setText(sharedPreferences.getString(ResourcesEnumerator.DOWNLOAD_PATH.key(), Constants.DEFAULT_DOWNLOAD_PATH)); + downloadButton = (Button) findViewById(R.id.downloadButton); + + downloadButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + urlEditText.setEnabled(false); + downloadPathEditText.setEnabled(false); + downloadButton.setEnabled(false); + stopButton.setEnabled(true); + Executors.newSingleThreadExecutor().execute(new Runnable() { + @Override + public void run() { + + SharedPreferences.Editor sharedPreferencesEditor = getSharedPreferences(Constants.I_GET_PREFERENCES, MODE_PRIVATE).edit(); + sharedPreferencesEditor.putString(ResourcesEnumerator.URL.key(), urlEditText.getText().toString()); + sharedPreferencesEditor.putString(ResourcesEnumerator.DOWNLOAD_PATH.key(), downloadPathEditText.getText().toString()); + sharedPreferencesEditor.commit(); + String[] urlSplitted = urlEditText.getText().toString().split(File.separator); + File downloadPath = new File(downloadPathEditText.getText().toString()); + if (!downloadPath.exists()) { + downloadPath.mkdirs(); + } + + byte[] content = downloadFile(urlEditText.getText().toString()); + if (content.length > 0) { + String nameFile = writeToFile(content, downloadPathEditText.getText().toString(), urlSplitted[urlSplitted.length - 1]); + outputListViewElementArrayList.add(0, new OutputListViewElement(urlEditText.getText().toString(), downloadPathEditText.getText().toString(), nameFile, md5(content), content.length)); + } else { + outputListViewElementArrayList.add(0, new OutputListViewElement(urlEditText.getText().toString(), Constants.DASH, Constants.DASH, Constants.DASH, 0)); + } + runOnUiThread(new Runnable() { + @Override + public void run() { + adapter.notifyDataSetChanged(); + urlEditText.setEnabled(true); + downloadPathEditText.setEnabled(true); + downloadButton.setEnabled(true); + stopButton.setEnabled(false); + } + }); + } + }); + + + } + }); + stopButton = (Button) findViewById(R.id.stopButton); + stopButton.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View view) { + stopDownload(); + } + }); + } + + + @Override + protected void onSaveInstanceState(Bundle outState) { + outState.putSerializable(Constants.LIST_ITEMS_ID, outputListViewElementArrayList); + super.onSaveInstanceState(outState); + } + + @Override + protected void onRestoreInstanceState(Bundle savedInstanceState) { + if (savedInstanceState != null) { + outputListViewElementArrayList = (ArrayList<OutputListViewElement>) savedInstanceState.getSerializable(Constants.LIST_ITEMS_ID); + adapter = new ListViewAdapter(this, outputListViewElementArrayList); + resultListView = (ListView) findViewById(R.id.resultsListView); + resultListView.setAdapter(adapter); + } + super.onRestoreInstanceState(savedInstanceState); + } + + + public native void stopDownload(); + + public native byte[] downloadFile(String path); + + + private void checkEnabledPermission(String permission) { + if (ContextCompat.checkSelfPermission(this, + permission) + != PackageManager.PERMISSION_GRANTED) { + if (ActivityCompat.shouldShowRequestPermissionRationale(this, + permission)) { + } else { + ActivityCompat.requestPermissions(this, + new String[]{permission}, + 1); + } + } + } + + private String writeToFile(byte[] content, String path, String nameFile) { + try { + Log.v("name", nameFile); + nameFile = checkGenerateNameFile(path, nameFile.trim()); + Log.v("name", nameFile); + + FileOutputStream fos = new FileOutputStream(path + File.separator + nameFile); + fos.write(content); + fos.close(); + + } catch (FileNotFoundException e) { + Log.v(TAG, e.toString()); + } catch (IOException e) { + Log.v(TAG, e.toString()); + } + return nameFile; + } + + /* private void checkMetis() { + boolean isAppInstalled = appInstalledOrNot("icn.forwarder.com.icnforwarderandroid"); + + + final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object + try { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=icn.forwarder.com.icnforwarderandroid"))); + } catch (android.content.ActivityNotFoundException anfe) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=icn.forwarder.com.icnforwarderandroid"))); + } + if (isAppInstalled) { + //This intent will help you to launch if the package is already installed + Log.i("iget", "Application is already installed."); + } else { + // Do whatever we want to do if application not installed + // For example, Redirect to play store + + Log.i("iget", "Application is not currently installed."); + } + }*/ + + private boolean checkMetis(String uri) { + PackageManager pm = getPackageManager(); + try { + pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); + return true; + } catch (PackageManager.NameNotFoundException e) { + return false; + } + } + + private String checkGenerateNameFile(String path, String nameFile) { + String newNameFile = nameFile.trim(); + + File file; + int count = 1; + do { + file = new File(path + File.separator + newNameFile); + + + if (file.exists()) { + + newNameFile = nameFile.trim() + Constants.UNDERSCORE + Integer.toString(count); + count++; + } + } while (file.exists()); + return newNameFile; + } +} diff --git a/IGetAndroid/app/src/main/java/icn/iget/com/utility/Constants.java b/IGetAndroid/app/src/main/java/icn/iget/com/utility/Constants.java new file mode 100644 index 00000000..37922939 --- /dev/null +++ b/IGetAndroid/app/src/main/java/icn/iget/com/utility/Constants.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2018 Cisco and/or its affiliates. + * 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. + */ + +package icn.iget.com.utility; + +public class Constants { + public static final String LIST_ITEMS_ID = "LIST_ITEMS_ID"; + public static final String I_GET_PREFERENCES = "I_GET_PREFERENCES"; + public static final String DEFAULT_URL = "http://systemx-cicn.enst.fr/video/sintel/mpd"; + public static final String DEFAULT_DOWNLOAD_PATH = "/sdcard/iGetAndroid"; + public static final String FORMAT_DATA = "yyyy-MM-dd hh:mm:ss"; + public static final String UNDERSCORE = "_"; + public static final String DASH = "-"; + public static int FOREGROUND_SERVICE = 101; + public static final String METIS_ID = "icn.forwarder.com.icnforwarderandroid"; +} diff --git a/IGetAndroid/app/src/main/java/icn/iget/com/utility/ResourcesEnumerator.java b/IGetAndroid/app/src/main/java/icn/iget/com/utility/ResourcesEnumerator.java new file mode 100644 index 00000000..13f9c4c7 --- /dev/null +++ b/IGetAndroid/app/src/main/java/icn/iget/com/utility/ResourcesEnumerator.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2018 Cisco and/or its affiliates. + * 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. + */ +package icn.iget.com.utility; + +public enum ResourcesEnumerator { + URL("url"), + DOWNLOAD_PATH("downloadPath"); + + private String key; + + ResourcesEnumerator(String key) { + this.key = key; + } + + public String key() { + return key; + } +} diff --git a/IGetAndroid/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/IGetAndroid/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..c7bd21db --- /dev/null +++ b/IGetAndroid/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt" + android:width="108dp" + android:height="108dp" + android:viewportHeight="108" + android:viewportWidth="108"> + <path + android:fillType="evenOdd" + android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z" + android:strokeColor="#00000000" + android:strokeWidth="1"> + <aapt:attr name="android:fillColor"> + <gradient + android:endX="78.5885" + android:endY="90.9159" + android:startX="48.7653" + android:startY="61.0927" + android:type="linear"> + <item + android:color="#44000000" + android:offset="0.0" /> + <item + android:color="#00000000" + android:offset="1.0" /> + </gradient> + </aapt:attr> + </path> + <path + android:fillColor="#FFFFFF" + android:fillType="nonZero" + android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z" + android:strokeColor="#00000000" + android:strokeWidth="1" /> +</vector> diff --git a/IGetAndroid/app/src/main/res/drawable/ic_launcher_background.xml b/IGetAndroid/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..d5fccc53 --- /dev/null +++ b/IGetAndroid/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="108dp" + android:height="108dp" + android:viewportHeight="108" + android:viewportWidth="108"> + <path + android:fillColor="#26A69A" + android:pathData="M0,0h108v108h-108z" /> + <path + android:fillColor="#00000000" + android:pathData="M9,0L9,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M19,0L19,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M29,0L29,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M39,0L39,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M49,0L49,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M59,0L59,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M69,0L69,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M79,0L79,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M89,0L89,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M99,0L99,108" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,9L108,9" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,19L108,19" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,29L108,29" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,39L108,39" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,49L108,49" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,59L108,59" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,69L108,69" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,79L108,79" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,89L108,89" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M0,99L108,99" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M19,29L89,29" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M19,39L89,39" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M19,49L89,49" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M19,59L89,59" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M19,69L89,69" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M19,79L89,79" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M29,19L29,89" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M39,19L39,89" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M49,19L49,89" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M59,19L59,89" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M69,19L69,89" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> + <path + android:fillColor="#00000000" + android:pathData="M79,19L79,89" + android:strokeColor="#33FFFFFF" + android:strokeWidth="0.8" /> +</vector> diff --git a/IGetAndroid/app/src/main/res/layout/activity_i_get_android.xml b/IGetAndroid/app/src/main/res/layout/activity_i_get_android.xml new file mode 100644 index 00000000..453b56fc --- /dev/null +++ b/IGetAndroid/app/src/main/res/layout/activity_i_get_android.xml @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="utf-8"?> +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="icn.iget.com.igetandroid.IGetAndroidActivity"> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical">`` + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_weight="0.25" + android:orientation="horizontal"> + + <TextView + android:id="@+id/urlLabel" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="20" + android:text="URL" + android:textAlignment="textEnd" /> + + <EditText + android:id="@+id/urlEditText" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="80" + android:ems="10" + android:inputType="text" + android:text="http://webserver/sintel/mpd" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingTop="10dp"> + + <TextView + android:id="@+id/downloadPathLabel" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="20" + android:text="Download Path" + android:textAlignment="textEnd" /> + + <EditText + android:id="@+id/downloadPathEditText" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="80" + android:ems="10" + android:inputType="text" + android:text="Name" /> + </LinearLayout> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingLeft="4.0dip" + android:paddingRight="4.0dip" + android:paddingTop="10dp"> + + <Button + android:id="@+id/downloadButton" + android:layout_width="0dip" + android:layout_height="fill_parent" + android:layout_weight="1.0" + android:text="Download" /> + + <Button + android:id="@+id/stopButton" + android:layout_width="0dip" + android:layout_height="fill_parent" + android:layout_weight="1.0" + android:text="Stop" /> + + </LinearLayout> + + + </LinearLayout> + + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingTop="10dp"> + + <TextView + android:id="@+id/resumeLabel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingLeft="15dp" + android:text="Resume" + android:textAlignment="textStart" + android:textSize="30sp" + android:textStyle="bold" /> + + <ListView + android:id="@+id/resultsListView" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + </LinearLayout> + + </LinearLayout> + + +</android.support.constraint.ConstraintLayout> diff --git a/IGetAndroid/app/src/main/res/layout/list_view_row.xml b/IGetAndroid/app/src/main/res/layout/list_view_row.xml new file mode 100644 index 00000000..5063c521 --- /dev/null +++ b/IGetAndroid/app/src/main/res/layout/list_view_row.xml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_weight="0.5" + android:orientation="horizontal"> + + <TextView + android:id="@+id/urlLabel" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="20" + android:text="URL:" + android:textAlignment="textEnd" /> + + <TextView + android:id="@+id/urlTextView" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_marginLeft="5dp" + android:layout_weight="80" + android:text="urlTextVew" /> + </LinearLayout> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_weight="0.5" + android:orientation="horizontal"> + + <TextView + android:id="@+id/savedPathLabel" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="20" + android:text="Saved Path:" + android:textAlignment="textEnd" /> + + <TextView + android:id="@+id/savedPathTextView" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_marginLeft="5dp" + android:layout_weight="80" + android:text="savedPathTextView" /> + </LinearLayout> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <TextView + android:id="@+id/md5Label" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="20" + android:text="MD5:" + android:textAlignment="textEnd" /> + + <TextView + android:id="@+id/md5TextView" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_marginLeft="5dp" + android:layout_weight="80" + android:text="savedPathTextView" /> + </LinearLayout> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <TextView + android:id="@+id/sizeLabel" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="20" + android:text="Size:" + android:textAlignment="textEnd" /> + + <TextView + android:id="@+id/sizeTextView" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_marginLeft="5dp" + android:layout_weight="80" + android:text="sizeTextView" /> + </LinearLayout> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <TextView + android:id="@+id/dateLabel" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="20" + android:text="Date:" + android:textAlignment="textEnd" /> + + <TextView + android:id="@+id/dateTextView" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_marginLeft="5dp" + android:layout_weight="80" + android:text="dateTextView" /> + </LinearLayout> + </LinearLayout> + + +</LinearLayout>
\ No newline at end of file diff --git a/IGetAndroid/app/src/main/res/layout/popup_message.xml b/IGetAndroid/app/src/main/res/layout/popup_message.xml new file mode 100644 index 00000000..a2631820 --- /dev/null +++ b/IGetAndroid/app/src/main/res/layout/popup_message.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#FFFFFF" + android:orientation="vertical"> + + <TextView + android:id="@+id/txt_dia" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_margin="10dp" + android:text="Metis is not installed.\nDo you want to install it?" + android:textColor="#1B90CD" + android:textSize="15dp" + android:textStyle="bold" /> + + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:orientation="horizontal"> + + <Button + android:id="@+id/yesButtonDialog" + android:layout_width="100dp" + android:layout_height="wrap_content" + android:clickable="true" + android:text="Yes" + android:textStyle="bold" /> + + <Button + android:id="@+id/noButtonDialog" + android:layout_width="100dp" + android:layout_height="wrap_content" + android:layout_marginLeft="5dp" + android:clickable="true" + android:text="No" + android:textStyle="bold" /> + </LinearLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/IGetAndroid/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/IGetAndroid/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..036d09bc --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@color/ic_launcher_background"/> + <foreground android:drawable="@mipmap/ic_launcher_foreground"/> +</adaptive-icon>
\ No newline at end of file diff --git a/IGetAndroid/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/IGetAndroid/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..036d09bc --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@color/ic_launcher_background"/> + <foreground android:drawable="@mipmap/ic_launcher_foreground"/> +</adaptive-icon>
\ No newline at end of file diff --git a/IGetAndroid/app/src/main/res/mipmap-hdpi/ic_launcher.png b/IGetAndroid/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..2b8496e4 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/IGetAndroid/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/IGetAndroid/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 00000000..54e366bf --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png diff --git a/IGetAndroid/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/IGetAndroid/app/src/main/res/mipmap-hdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..6dac2349 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/IGetAndroid/app/src/main/res/mipmap-mdpi/ic_launcher.png b/IGetAndroid/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..b19affc6 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/IGetAndroid/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/IGetAndroid/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 00000000..0ab99abc --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png diff --git a/IGetAndroid/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/IGetAndroid/app/src/main/res/mipmap-mdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..93d06591 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/IGetAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/IGetAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..3b4fed61 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/IGetAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/IGetAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 00000000..573fcce3 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png diff --git a/IGetAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/IGetAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..770275fa --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/IGetAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/IGetAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..1cbd6c91 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/IGetAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/IGetAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 00000000..86367ca0 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png diff --git a/IGetAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/IGetAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..0bb64aa9 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/IGetAndroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/IGetAndroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..1befed99 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/IGetAndroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/IGetAndroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 00000000..f3cf9401 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png diff --git a/IGetAndroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/IGetAndroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 00000000..d3339629 --- /dev/null +++ b/IGetAndroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/IGetAndroid/app/src/main/res/values/colors.xml b/IGetAndroid/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..3ab3e9cb --- /dev/null +++ b/IGetAndroid/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="colorPrimary">#3F51B5</color> + <color name="colorPrimaryDark">#303F9F</color> + <color name="colorAccent">#FF4081</color> +</resources> diff --git a/IGetAndroid/app/src/main/res/values/ic_launcher_background.xml b/IGetAndroid/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 00000000..fb66f3a0 --- /dev/null +++ b/IGetAndroid/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="ic_launcher_background">#FEFEFE</color> +</resources>
\ No newline at end of file diff --git a/IGetAndroid/app/src/main/res/values/strings.xml b/IGetAndroid/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..5f9b9704 --- /dev/null +++ b/IGetAndroid/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ +<resources> + <string name="app_name">ICN iGet</string> +</resources> diff --git a/IGetAndroid/app/src/main/res/values/styles.xml b/IGetAndroid/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..5885930d --- /dev/null +++ b/IGetAndroid/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ +<resources> + + <!-- Base application theme. --> + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> + <!-- Customize your theme here. --> + <item name="colorPrimary">@color/colorPrimary</item> + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> + <item name="colorAccent">@color/colorAccent</item> + </style> + +</resources> diff --git a/IGetAndroid/app/src/test/java/icn/iget/com/igetandroid/ExampleUnitTest.java b/IGetAndroid/app/src/test/java/icn/iget/com/igetandroid/ExampleUnitTest.java new file mode 100644 index 00000000..35716741 --- /dev/null +++ b/IGetAndroid/app/src/test/java/icn/iget/com/igetandroid/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package icn.iget.com.igetandroid; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +}
\ No newline at end of file |