diff --git a/.gitignore b/.gitignore index 9068cd0..62fa209 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,65 @@ # Built application files +/*/build/ +app/build/ *.apk *.ap_ -# Files for the Dalvik VM +# Crashlytics configuations +com_crashlytics_export_strings.xml + +# files for the dex VM *.dex # Java class files *.class -# Generated files +# generated files bin/ gen/ -# Gradle files -.gradle/ -build/ +# Eclipse project files +.classpath +.project # Local configuration file (sdk path, etc) local.properties -# Proguard folder generated by Eclipse -proguard/ +# Android Studio +.gradle +build/ +/*/out +/*/*/build +/*/*/production +*.iws +*.ipr +*~ +*.swp + +# Gradle generated files +.gradle/ + +# Signing files +.signing/ + +# User-specific configurations +.idea/libraries/ +.idea/workspace.xml +.idea/tasks.xml +.idea/.name +.idea/compiler.xml +.idea/copyright/profiles_settings.xml +.idea/encodings.xml +.idea/misc.xml +.idea/modules.xml +.idea/scopes/scope_settings.xml +.idea/vcs.xml +*.iml -# Log Files -*.log +# OS-specific files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..2cbb09b --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/README.md b/README.md index 4d3a3b0..fd00f82 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ RWLab48 ======= -Lab 48 (http://redmine.ruswizards.com:8100/redmine/boards/8/topics/48) +Lab 48 (http://redmine.weezlabs.com:8100/redmine/boards/8/topics/48) diff --git a/RWLab48.iml b/RWLab48.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/RWLab48.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/app.iml b/app/app.iml new file mode 100644 index 0000000..f15f948 --- /dev/null +++ b/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..781ccb8 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.1" + + defaultConfig { + applicationId "com.example.admin.rwlab48" + minSdkVersion 15 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.2' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..a74f29a --- /dev/null +++ b/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 d:\Projects\android-sdks/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/app/src/androidTest/java/com/example/admin/rwlab48/ApplicationTest.java b/app/src/androidTest/java/com/example/admin/rwlab48/ApplicationTest.java new file mode 100644 index 0000000..d12cabd --- /dev/null +++ b/app/src/androidTest/java/com/example/admin/rwlab48/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.example.admin.rwlab48; + +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/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..6ef0267 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/example/admin/rwlab48/MainActivity.java b/app/src/main/java/com/example/admin/rwlab48/MainActivity.java new file mode 100644 index 0000000..ede066a --- /dev/null +++ b/app/src/main/java/com/example/admin/rwlab48/MainActivity.java @@ -0,0 +1,92 @@ +/** + * Copyright (C) 2014 Rus Wizards + * + * Created: 11.12.2014 + * Vladimir Farafonov + */ +package com.example.admin.rwlab48; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.provider.MediaStore; +import android.support.v7.app.ActionBarActivity; +import android.view.View; +import android.widget.Toast; + +/** + * Main class of the app + */ +public class MainActivity extends ActionBarActivity implements View.OnClickListener { + + private static final String LATITUDE = "37.422006"; + private static final String LONGITUDE = "-122.084095"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } + + @Override + public void onClick(View v) { + Intent startNextIntent; + switch (v.getId()) { + case R.id.gallery_button: + /* + * Starts gallery app. + * Have some trouble here with gallery apps on emulator (both 4.4 and 5.0). No app + * can be found and started with CATEGORY_APP_GALLERY intent. So app tries to open + * standard gallery directly with package name if no apps is found by category. + */ + startNextIntent = new Intent(Intent.ACTION_MAIN); + startNextIntent.addCategory(Intent.CATEGORY_APP_GALLERY); + if (startNextIntent.resolveActivity(getPackageManager()) == null) { + startNextIntent = getPackageManager(). + getLaunchIntentForPackage("com.android.gallery"); + } + break; + case R.id.web_browser_button: + // Puts in intent browser category + startNextIntent = new Intent(Intent.ACTION_MAIN); + startNextIntent.addCategory(Intent.CATEGORY_APP_BROWSER); + break; + case R.id.map_button: + // Puts in intent action to view on a map app coordinates from constants + startNextIntent = new Intent(Intent.ACTION_VIEW); + startNextIntent.setData(Uri.parse("geo:" + LATITUDE + "," + LONGITUDE)); + break; + case R.id.gallery_image_button: + // Puts in intent action to get content for any type of images + startNextIntent = new Intent(Intent.ACTION_GET_CONTENT); + startNextIntent.setType("image/*"); + break; + case R.id.camera_photo_button: + // Puts in intent capture image action + startNextIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + break; + case R.id.camera_video_button: + // Puts in intent capture video action + startNextIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); + break; + case R.id.dictaphone_button: + // Puts in intent voice recording action + startNextIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION); + break; + default: + throw new IllegalStateException( + getString(R.string.wrong_button_illegal_state_exception)); + } + if ((startNextIntent.resolveActivity(getPackageManager()) != null)) { + startNextIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + // Start activity with apps chooser dialog (if it is more than one app) + Intent chooserIntent = Intent.createChooser( + startNextIntent, getString(R.string.title_application_chooser)); + startActivity(chooserIntent); + } else { + // Toast is shown up if apps not found + Toast.makeText(this, getString(R.string.toast_application_not_found), + Toast.LENGTH_SHORT).show(); + } + } +} diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..e47eb89 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,66 @@ + +