diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/.gitignore b/components/iot-plugins/androidsense-plugin/CatsAge/.gitignore new file mode 100644 index 000000000..c6cbe562a --- /dev/null +++ b/components/iot-plugins/androidsense-plugin/CatsAge/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/app/.gitignore b/components/iot-plugins/androidsense-plugin/CatsAge/app/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/components/iot-plugins/androidsense-plugin/CatsAge/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/app/build.gradle b/components/iot-plugins/androidsense-plugin/CatsAge/app/build.gradle new file mode 100644 index 000000000..dac38ae46 --- /dev/null +++ b/components/iot-plugins/androidsense-plugin/CatsAge/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.3" + + defaultConfig { + applicationId "com.wso2.catsage" + minSdkVersion 15 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.4.0' +} diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/app/proguard-rules.pro b/components/iot-plugins/androidsense-plugin/CatsAge/app/proguard-rules.pro new file mode 100644 index 000000000..2da8c6b1f --- /dev/null +++ b/components/iot-plugins/androidsense-plugin/CatsAge/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /home/dilan/Software/SDKs/Android/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# 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 *; +#} diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/app/src/androidTest/java/com/wso2/catsage/ApplicationTest.java b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/androidTest/java/com/wso2/catsage/ApplicationTest.java new file mode 100644 index 000000000..c6a21cfc3 --- /dev/null +++ b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/androidTest/java/com/wso2/catsage/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.wso2.catsage; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/AndroidManifest.xml b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..04977946b --- /dev/null +++ b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/java/com/wso2/catsage/HomeActivity.java b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/java/com/wso2/catsage/HomeActivity.java new file mode 100644 index 000000000..1a5f36e49 --- /dev/null +++ b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/java/com/wso2/catsage/HomeActivity.java @@ -0,0 +1,50 @@ +package com.wso2.catsage; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +public class HomeActivity extends AppCompatActivity { + + EditText editTextAge; + Button buttonCalculateAge; + TextView textViewCatsAge; + Button buttonSecondActivity; + + int catAge; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_home); + + textViewCatsAge = (TextView) findViewById(R.id.textViewCatsAge); + buttonCalculateAge = (Button) findViewById(R.id.buttonCalculateAge); + editTextAge = (EditText) findViewById(R.id.editTextAge); + buttonSecondActivity =(Button) findViewById(R.id.buttonSecond); + + buttonCalculateAge.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int age = Integer.valueOf(editTextAge.getText().toString()); + catAge = age * 7; + textViewCatsAge.setText("Cat's Age : " + catAge); + } + }); + + buttonSecondActivity.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(HomeActivity.this, SecondActivity.class); + intent.putExtra("catAge", catAge); + startActivity(intent); + } + }); + + + } +} diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/java/com/wso2/catsage/SecondActivity.java b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/java/com/wso2/catsage/SecondActivity.java new file mode 100644 index 000000000..9dd32f27f --- /dev/null +++ b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/java/com/wso2/catsage/SecondActivity.java @@ -0,0 +1,25 @@ +package com.wso2.catsage; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.widget.TextView; + +import org.w3c.dom.Text; + +public class SecondActivity extends AppCompatActivity { + + TextView textViewSecondCatAge; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_second); + + textViewSecondCatAge = (TextView) findViewById(R.id.textViewSecondCatAge); + + int catAge = getIntent().getExtras().getInt("catAge"); + + textViewSecondCatAge.setText(String.valueOf(catAge)); + + } +} diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/res/drawable/cat.jpg b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/res/drawable/cat.jpg new file mode 100644 index 000000000..e201b4545 Binary files /dev/null and b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/res/drawable/cat.jpg differ diff --git a/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/res/layout/activity_home.xml b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/res/layout/activity_home.xml new file mode 100644 index 000000000..881a944f0 --- /dev/null +++ b/components/iot-plugins/androidsense-plugin/CatsAge/app/src/main/res/layout/activity_home.xml @@ -0,0 +1,67 @@ + + + + + + + +