Version 1.0
1
.idea/.name
Normal file
|
@ -0,0 +1 @@
|
|||
MorseConverter
|
23
.idea/compiler.xml
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
|
3
.idea/copyright/profiles_settings.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
5
.idea/encodings.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
</project>
|
||||
|
18
.idea/gradle.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
|
8
.idea/inspectionProfiles/Project_Default.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0" is_locked="false">
|
||||
<option name="myName" value="Project Default" />
|
||||
<option name="myLocal" value="false" />
|
||||
<inspection_tool class="AndroidDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintGradleOverrides" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
7
.idea/inspectionProfiles/profiles_settings.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
11
.idea/libraries/support_v4_19_1_0.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<component name="libraryTable">
|
||||
<library name="support-v4-19.1.0">
|
||||
<CLASSES>
|
||||
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/19.1.0/support-v4-19.1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/19.1.0/support-v4-19.1.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
10
.idea/misc.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
|
10
.idea/modules.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/MorseConverter.iml" filepath="$PROJECT_DIR$/MorseConverter.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
5
.idea/scopes/scope_settings.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<component name="DependencyValidationManager">
|
||||
<state>
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</state>
|
||||
</component>
|
7
.idea/vcs.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="" />
|
||||
</component>
|
||||
</project>
|
||||
|
1677
.idea/workspace.xml
Normal file
21
MorseConverter.iml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module 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="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/classes/main" />
|
||||
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
morse-converter-android
|
||||
=======================
|
||||
Morse Converter Android App
|
||||
===========================
|
||||
|
||||
A writtenMorse and normal morse code converter for Android
|
||||
|
|
89
app/app.iml
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module 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="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" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||
<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" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<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/generated/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
|
||||
<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/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/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" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
23
app/build.gradle
Normal file
|
@ -0,0 +1,23 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 19
|
||||
buildToolsVersion "21.1.1"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "de.marcelkapfer.morseconverter"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 19
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-v4:19.1.0'
|
||||
}
|
4
app/lint.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<lint>
|
||||
<issue id="DefaultLocale" severity="ignore" />
|
||||
</lint>
|
69
app/manifest-merger-release-report.txt
Normal file
|
@ -0,0 +1,69 @@
|
|||
-- Merging decision tree log ---
|
||||
manifest
|
||||
ADDED from AndroidManifest.xml:2:1
|
||||
package
|
||||
ADDED from AndroidManifest.xml:2:11
|
||||
INJECTED from AndroidManifest.xml:0:0
|
||||
INJECTED from AndroidManifest.xml:0:0
|
||||
android:versionName
|
||||
ADDED from AndroidManifest.xml:4:5
|
||||
android:versionCode
|
||||
ADDED from AndroidManifest.xml:3:5
|
||||
INJECTED from AndroidManifest.xml:0:0
|
||||
INJECTED from AndroidManifest.xml:0:0
|
||||
xmlns:android
|
||||
ADDED from AndroidManifest.xml:4:31
|
||||
uses-sdk
|
||||
ADDED from AndroidManifest.xml:6:5
|
||||
android:targetSdkVersion
|
||||
ADDED from AndroidManifest.xml:8:9
|
||||
INJECTED from AndroidManifest.xml:0:0
|
||||
INJECTED from AndroidManifest.xml:0:0
|
||||
android:minSdkVersion
|
||||
ADDED from AndroidManifest.xml:7:9
|
||||
INJECTED from AndroidManifest.xml:0:0
|
||||
INJECTED from AndroidManifest.xml:0:0
|
||||
application
|
||||
ADDED from AndroidManifest.xml:10:5
|
||||
android:label
|
||||
ADDED from AndroidManifest.xml:13:9
|
||||
android:allowBackup
|
||||
ADDED from AndroidManifest.xml:11:9
|
||||
android:icon
|
||||
ADDED from AndroidManifest.xml:12:9
|
||||
android:theme
|
||||
ADDED from AndroidManifest.xml:14:9
|
||||
activity#de.marcelkapfer.morseconverter.MainActivity
|
||||
ADDED from AndroidManifest.xml:16:8
|
||||
android:label
|
||||
ADDED from AndroidManifest.xml:18:13
|
||||
android:windowSoftInputMode
|
||||
ADDED from AndroidManifest.xml:19:13
|
||||
android:name
|
||||
ADDED from AndroidManifest.xml:17:13
|
||||
intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER
|
||||
ADDED from AndroidManifest.xml:20:13
|
||||
action#android.intent.action.MAIN
|
||||
ADDED from AndroidManifest.xml:21:17
|
||||
android:name
|
||||
ADDED from AndroidManifest.xml:21:25
|
||||
category#android.intent.category.LAUNCHER
|
||||
ADDED from AndroidManifest.xml:23:17
|
||||
android:name
|
||||
ADDED from AndroidManifest.xml:23:27
|
||||
activity#de.marcelkapfer.morseconverter.DisplayMessageActivity
|
||||
ADDED from AndroidManifest.xml:26:9
|
||||
android:label
|
||||
ADDED from AndroidManifest.xml:28:13
|
||||
android:parentActivityName
|
||||
ADDED from AndroidManifest.xml:29:13
|
||||
android:immersive
|
||||
ADDED from AndroidManifest.xml:29:86
|
||||
android:name
|
||||
ADDED from AndroidManifest.xml:27:13
|
||||
meta-data#android.support.PARENT_ACTIVITY
|
||||
ADDED from AndroidManifest.xml:30:13
|
||||
android:value
|
||||
ADDED from AndroidManifest.xml:32:17
|
||||
android:name
|
||||
ADDED from AndroidManifest.xml:31:17
|
36
app/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="de.marcelkapfer.morseconverter"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
android:targetSdkVersion="19" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/CustomActionBarTheme">
|
||||
|
||||
<activity
|
||||
android:name="de.marcelkapfer.morseconverter.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="de.marcelkapfer.morseconverter.DisplayMessageActivity"
|
||||
android:label="@string/title_activity_display_message"
|
||||
android:parentActivityName="de.marcelkapfer.morseconverter.MainActivity" android:immersive="true">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="de.marcelkapfer.morseconverter.MainActivity" />
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,87 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class DisplayMessageActivity extends FragmentActivity {
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Get the message from the intent
|
||||
Intent intent = getIntent();
|
||||
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
|
||||
|
||||
|
||||
// Create the text view
|
||||
TextView textView = new TextView(this);
|
||||
textView.setTextSize(20);
|
||||
textView.setText(message);
|
||||
textView.setTextIsSelectable(true);
|
||||
textView.setPadding(10, 10, 10, 10);
|
||||
|
||||
|
||||
// Set the text view as the activity layout
|
||||
setContentView(textView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu items for use in the action bar
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.display_message_activity_actions, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_share:
|
||||
share();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public static class PlaceholderFragment extends Fragment {
|
||||
|
||||
public PlaceholderFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_display_message,
|
||||
container, false);
|
||||
return rootView;
|
||||
}
|
||||
}
|
||||
|
||||
public void share(){
|
||||
Intent intent = getIntent();
|
||||
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
|
||||
Intent sendIntent = new Intent();
|
||||
sendIntent.setAction(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, message);
|
||||
sendIntent.setType("text/plain");
|
||||
startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,999 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class MainActivity extends FragmentActivity {
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mDrawerList;
|
||||
private ActionBarDrawerToggle mDrawerToggle;
|
||||
|
||||
private CharSequence mDrawerTitle;
|
||||
private CharSequence mTitle;
|
||||
private String[] mMenuTitles;
|
||||
public String[] fragments = new String[] {"R.id.main", "R.id.morse", "R.id.about"};
|
||||
private static int[] fragment = new int[] {R.layout.fragment_main, R.layout.fragment_morse, R.layout.fragment_about };
|
||||
public static int mainPosition;
|
||||
|
||||
public final static String EXTRA_MESSAGE = "de.marcelkapfer.morseconverter.MESSAGE";
|
||||
public String tfOutput = "";
|
||||
int lastFragment = 0;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
mTitle = mDrawerTitle = getTitle();
|
||||
mMenuTitles = getResources().getStringArray(R.array.menu_array);
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
mDrawerList = (ListView) findViewById(R.id.left_drawer);
|
||||
|
||||
// set a custom shadow that overlays the main content when the drawer opens
|
||||
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
||||
// set up the drawer's list view with items and click listener
|
||||
mDrawerList.setAdapter(new ArrayAdapter<String>(this,
|
||||
R.layout.drawer_list_item, mMenuTitles));
|
||||
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
|
||||
|
||||
// enable ActionBar app icon to behave as action to toggle nav drawer
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getActionBar().setHomeButtonEnabled(true);
|
||||
|
||||
// ActionBarDrawerToggle ties together the the proper interactions
|
||||
// between the sliding drawer and the action bar app icon
|
||||
mDrawerToggle = new ActionBarDrawerToggle(
|
||||
this, /* host Activity */
|
||||
mDrawerLayout, /* DrawerLayout object */
|
||||
R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
|
||||
R.string.drawer_open, /* "open drawer" description for accessibility */
|
||||
R.string.drawer_close /* "close drawer" description for accessibility */
|
||||
) {
|
||||
|
||||
/** Called when a drawer has settled in a completely closed state. */
|
||||
public void onDrawerClosed(View view) {
|
||||
super.onDrawerClosed(view);
|
||||
getActionBar().setTitle(mTitle);
|
||||
}
|
||||
|
||||
/** Called when a drawer has settled in a completely open state. */
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
super.onDrawerOpened(drawerView);
|
||||
getActionBar().setTitle(mDrawerTitle);
|
||||
}
|
||||
|
||||
};
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
|
||||
|
||||
if(savedInstanceState == null) {
|
||||
changeFragment(lastFragment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* The click listner for ListView in the navigation drawer */
|
||||
private class DrawerItemClickListener implements ListView.OnItemClickListener {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
changeFragment(position);
|
||||
mainPosition = position;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void changeFragment(int position){
|
||||
|
||||
|
||||
fragment_main newFragment = new fragment_main();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(fragments[position], position);
|
||||
newFragment.setArguments(args);
|
||||
|
||||
// Insert the fragment by replacing any existing fragment
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.container, newFragment).commit();
|
||||
|
||||
mDrawerList.setItemChecked(position, true);
|
||||
setTitle(mMenuTitles[position]);
|
||||
mDrawerLayout.closeDrawer(mDrawerList);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Pass the event to ActionBarDrawerToggle, if it returns
|
||||
// true, then it has handled the app icon touch event
|
||||
if (mDrawerToggle.onOptionsItemSelected(item)) {
|
||||
return true;
|
||||
}
|
||||
// Handle your other action bar items...
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setTitle(CharSequence title) {
|
||||
mTitle = title;
|
||||
getActionBar().setTitle(mTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* When using the ActionBarDrawerToggle, you must call it during
|
||||
* onPostCreate() and onConfigurationChanged()...
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
// Sync the toggle state after onRestoreInstanceState has occurred.
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class fragment_main extends Fragment {
|
||||
public static final String ARG_POSITION = "menu_number";
|
||||
|
||||
|
||||
public fragment_main() {
|
||||
// Empty subclass required for fragment subclass
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(fragment[MainActivity.mainPosition], container, false);
|
||||
//int i = getArguments().getInt(ARG_POSITION);
|
||||
//String menu = getResources().getStringArray(R.array.menu_array)[i];
|
||||
//getActivity().setTitle(menu);
|
||||
return rootView;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Code for converting latin letters into written morse
|
||||
*/
|
||||
public void decode(View view) {
|
||||
EditText editText = (EditText) findViewById(R.id.edit_message);
|
||||
StringBuffer message = new StringBuffer(editText.getText());
|
||||
if (message.toString().endsWith(" ")){
|
||||
message = message.deleteCharAt(message.length() - 1);
|
||||
}
|
||||
// Variables
|
||||
StringBuffer input = new StringBuffer();
|
||||
input = input.replace(0, input.length(), message.toString().toUpperCase());
|
||||
StringBuffer output = new StringBuffer();
|
||||
if (input.toString().equals("")) {
|
||||
tfOutput = "Please enter at least one character";
|
||||
After(view);
|
||||
} else if (input.toString().equals("LETTERSPACE")) {
|
||||
tfOutput = "#";
|
||||
After(view);
|
||||
} else if (input.toString().equals("END OF WORK")) {
|
||||
tfOutput = "000101";
|
||||
After(view);
|
||||
} else if (input.toString().equals("ERROR")) {
|
||||
tfOutput = "00000000";
|
||||
After(view);
|
||||
} else if (input.toString().equals("STARTING SIGNAL")) {
|
||||
tfOutput = "10101";
|
||||
After(view);
|
||||
} else if (input.toString().equals("ENDING SIGNAL")) {
|
||||
tfOutput = "01010";
|
||||
After(view);
|
||||
} else if (input.toString().equals("UNDERSTOOD")) {
|
||||
tfOutput = "00010";
|
||||
After(view);
|
||||
} else if (input.toString().equals("WAIT")) {
|
||||
tfOutput = "01000";
|
||||
After(view);
|
||||
} else if (input.toString().equals("SOS")) {
|
||||
tfOutput = "000111000";
|
||||
After(view);
|
||||
} else if (input.toString().equals("LETTER SPACE")) {
|
||||
tfOutput = "#";
|
||||
After(view);
|
||||
} else if (input.toString().equals("WORD SPACE")) {
|
||||
tfOutput = "+";
|
||||
After(view);
|
||||
} else {
|
||||
for (int c = input.length(); c > 0; c--) {
|
||||
if (input.toString().startsWith(" ")) {
|
||||
output.append("+");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("A")) {
|
||||
output.append("01#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("B")) {
|
||||
output.append("1000#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("C")) {
|
||||
output.append("1010#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("D")) {
|
||||
output.append("100#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("E")) {
|
||||
output.append("0#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("F")) {
|
||||
output.append("0010#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("G")) {
|
||||
output.append("110#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("H")) {
|
||||
output.append("0000#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("I")) {
|
||||
output.append("00#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("J")) {
|
||||
output.append("0111#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("K")) {
|
||||
output.append("101#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("L")) {
|
||||
output.append("0100#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("M")) {
|
||||
output.append("11#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("N")) {
|
||||
output.append("10#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("O")) {
|
||||
output.append("111#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("P")) {
|
||||
output.append("0110#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Q")) {
|
||||
output.append("1101#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("R")) {
|
||||
output.append("010#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("S")) {
|
||||
output.append("000#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("T")) {
|
||||
output.append("1#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("U")) {
|
||||
output.append("001#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("V")) {
|
||||
output.append("0001#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("W")) {
|
||||
output.append("011#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("X")) {
|
||||
output.append("1001#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Y")) {
|
||||
output.append("1011#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Z")) {
|
||||
output.append("1100#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("0")) {
|
||||
output.append("11111#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("1")) {
|
||||
output.append("01111#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("2")) {
|
||||
output.append("00111#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("3")) {
|
||||
output.append("00011#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("4")) {
|
||||
output.append("00001#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("5")) {
|
||||
output.append("00000#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("6")) {
|
||||
output.append("10000#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("7")) {
|
||||
output.append("11000#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("8")) {
|
||||
output.append("11100#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("9")) {
|
||||
output.append("11110#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Ä")) {
|
||||
output.append("0101#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Ö")) {
|
||||
output.append("1110#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Ü")) {
|
||||
output.append("0011#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("ß")) {
|
||||
output.append("00011000#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(".")) {
|
||||
output.append("010101#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(",")) {
|
||||
output.append("110011#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(":")) {
|
||||
output.append("111000#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(";")) {
|
||||
output.append("101010#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("?")) {
|
||||
output.append("001100#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("!")) {
|
||||
output.append("101011#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("-")) {
|
||||
output.append("100001#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("_")) {
|
||||
output.append("001101#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("(")) {
|
||||
output.append("10110#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(")")) {
|
||||
output.append("101101#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("=")) {
|
||||
output.append("10001#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("+")) {
|
||||
output.append("01010#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("/")) {
|
||||
output.append("10010#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("@")) {
|
||||
output.append("011010#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("'")) {
|
||||
output.append("011110#");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("$")) {
|
||||
output.append("0001001#");
|
||||
input.delete(0, 1);
|
||||
} else {
|
||||
tfOutput = "Code not listed or wrong.";
|
||||
}
|
||||
}
|
||||
if (output.toString().endsWith("#")
|
||||
&& (output.toString().equals("#") == false)) {
|
||||
output.delete(output.length() - 1, output.length());
|
||||
}
|
||||
tfOutput = output.toString();
|
||||
lastFragment = 0;
|
||||
After(view);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Code for converting writtenMorse to latin letters
|
||||
*/
|
||||
public void encode (View view) {
|
||||
EditText editText = (EditText) findViewById(R.id.edit_message);
|
||||
StringBuffer message = new StringBuffer(editText.getText());
|
||||
if (message.toString().endsWith(" ")){
|
||||
message = message.deleteCharAt(message.length() - 1);
|
||||
}
|
||||
// Variables
|
||||
String input;
|
||||
StringBuffer output = new StringBuffer();
|
||||
input = message.toString().toUpperCase() + "#";
|
||||
StringBuffer inputToSign = new StringBuffer(input);
|
||||
while (inputToSign.toString().equals("#") == false) {
|
||||
int d = 0;
|
||||
boolean signFull = true;
|
||||
StringBuffer sign = new StringBuffer();
|
||||
while (signFull) {
|
||||
if (inputToSign.toString().charAt(d) == '+'
|
||||
|| inputToSign.toString().charAt(d) == '#') {
|
||||
if (d == 0) {
|
||||
if (inputToSign.toString().startsWith("+")) {
|
||||
output.append(" ");
|
||||
}
|
||||
inputToSign.deleteCharAt(0);
|
||||
} else {
|
||||
sign.replace(0, sign.length(), inputToSign
|
||||
.toString().substring(0, d));
|
||||
inputToSign.delete(0, d);
|
||||
signFull = false;
|
||||
}
|
||||
} else {
|
||||
d++;
|
||||
}
|
||||
}
|
||||
if (input.equals("°")) {
|
||||
break;
|
||||
} else if (sign.toString().equals("01")) {
|
||||
output.append("A");
|
||||
} else if (sign.toString().equals("1000")) {
|
||||
output.append("B");
|
||||
} else if (sign.toString().equals("1010")) {
|
||||
output.append("C");
|
||||
} else if (sign.toString().equals("100")) {
|
||||
output.append("D");
|
||||
} else if (sign.toString().equals("0")) {
|
||||
output.append("E");
|
||||
} else if (sign.toString().equals("0010")) {
|
||||
output.append("F");
|
||||
} else if (sign.toString().equals("110")) {
|
||||
output.append("G");
|
||||
} else if (sign.toString().equals("0000")) {
|
||||
output.append("H");
|
||||
} else if (sign.toString().equals("00")) {
|
||||
output.append("I");
|
||||
} else if (sign.toString().equals("0111")) {
|
||||
output.append("J");
|
||||
} else if (sign.toString().equals("101")) {
|
||||
output.append("K");
|
||||
} else if (sign.toString().equals("0100")) {
|
||||
output.append("L");
|
||||
} else if (sign.toString().equals("11")) {
|
||||
output.append("M");
|
||||
} else if (sign.toString().equals("10")) {
|
||||
output.append("N");
|
||||
} else if (sign.toString().equals("111")) {
|
||||
output.append("O");
|
||||
} else if (sign.toString().equals("0110")) {
|
||||
output.append("P");
|
||||
} else if (sign.toString().equals("1101")) {
|
||||
output.append("Q");
|
||||
} else if (sign.toString().equals("010")) {
|
||||
output.append("R");
|
||||
} else if (sign.toString().equals("000")) {
|
||||
output.append("S");
|
||||
} else if (sign.toString().equals("1")) {
|
||||
output.append("T");
|
||||
} else if (sign.toString().equals("001")) {
|
||||
output.append("U");
|
||||
} else if (sign.toString().equals("0001")) {
|
||||
output.append("V");
|
||||
} else if (sign.toString().equals("011")) {
|
||||
output.append("W");
|
||||
} else if (sign.toString().equals("1001")) {
|
||||
output.append("X");
|
||||
} else if (sign.toString().equals("1011")) {
|
||||
output.append("Y");
|
||||
} else if (sign.toString().equals("1100")) {
|
||||
output.append("Z");
|
||||
} else if (sign.toString().equals("11111")) {
|
||||
output.append("0 (zero)");
|
||||
} else if (sign.toString().equals("01111")) {
|
||||
output.append("1");
|
||||
} else if (sign.toString().equals("00111")) {
|
||||
output.append("2");
|
||||
} else if (sign.toString().equals("00011")) {
|
||||
output.append("3");
|
||||
} else if (sign.toString().equals("00001")) {
|
||||
output.append("4");
|
||||
} else if (sign.toString().equals("00000")) {
|
||||
output.append("5");
|
||||
} else if (sign.toString().equals("10000")) {
|
||||
output.append("6");
|
||||
} else if (sign.toString().equals("11000")) {
|
||||
output.append("7");
|
||||
} else if (sign.toString().equals("11100")) {
|
||||
output.append("8");
|
||||
} else if (sign.toString().equals("11110")) {
|
||||
output.append("9");
|
||||
} else if (sign.toString().equals("0101")) {
|
||||
output.append("Ä");
|
||||
} else if (sign.toString().equals("1110")) {
|
||||
output.append("Ö");
|
||||
} else if (sign.toString().equals("0011")) {
|
||||
output.append("Ü");
|
||||
} else if (sign.toString().equals("00011000")) {
|
||||
output.append("ß");
|
||||
} else if (sign.toString().equals("1111")) {
|
||||
output.append("CH");
|
||||
} else if (sign.toString().equals("010101")) {
|
||||
output.append(".");
|
||||
} else if (sign.toString().equals("110011")) {
|
||||
output.append(",");
|
||||
} else if (sign.toString().equals("111000")) {
|
||||
output.append(":");
|
||||
} else if (sign.toString().equals("101010")) {
|
||||
output.append(";");
|
||||
} else if (sign.toString().equals("001100")) {
|
||||
output.append("?");
|
||||
} else if (sign.toString().equals("101011")) {
|
||||
output.append("!");
|
||||
} else if (sign.toString().equals("100001")) {
|
||||
output.append("-");
|
||||
} else if (sign.toString().equals("001101")) {
|
||||
output.append("_");
|
||||
} else if (sign.toString().equals("10110")) {
|
||||
output.append("(");
|
||||
} else if (sign.toString().equals("101101")) {
|
||||
output.append(")");
|
||||
} else if (sign.toString().equals("011110")) {
|
||||
output.append("'");
|
||||
} else if (sign.toString().equals("10001")) {
|
||||
output.append("=");
|
||||
} else if (sign.toString().equals("01010")) {
|
||||
output.append("+ or End of the signal");
|
||||
} else if (sign.toString().equals("10010")) {
|
||||
output.append("/");
|
||||
} else if (sign.toString().equals("011010")) {
|
||||
output.append("@");
|
||||
} else if (sign.toString().equals("10101")) {
|
||||
output.append("Begin of the signal");
|
||||
} else if (sign.toString().equals("10001")) {
|
||||
output.append("Wait");
|
||||
} else if (sign.toString().equals("00010")) {
|
||||
output.append("Understood");
|
||||
} else if (sign.toString().equals("000101")) {
|
||||
output.append("End of work");
|
||||
} else if (sign.toString().equals("000111000")) {
|
||||
output.append("SOS");
|
||||
} else if (sign.toString().equals("00000000")) {
|
||||
output.append("Error");
|
||||
} else {
|
||||
tfOutput = "Code not listed or wrong.";
|
||||
}
|
||||
}
|
||||
tfOutput = output.toString();
|
||||
lastFragment = 0;
|
||||
After(view);
|
||||
/*} catch (Exception e) {
|
||||
tfOutput.setText("Some error occured. I'm sorry!");
|
||||
}*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Code for converting normal letters into morse code
|
||||
*/
|
||||
|
||||
public void llm(View view) {
|
||||
EditText editText = (EditText) findViewById(R.id.edit_message);
|
||||
StringBuffer message = new StringBuffer(editText.getText());
|
||||
if (message.toString().endsWith(" ")){
|
||||
message = message.deleteCharAt(message.length() - 1);
|
||||
}
|
||||
// Variables
|
||||
// Variables
|
||||
StringBuffer input = new StringBuffer();
|
||||
input = input.replace(0, input.length(), message.toString().toUpperCase());
|
||||
StringBuffer output = new StringBuffer();
|
||||
if (input.toString().equals("")) {
|
||||
tfOutput = "Please enter at least one character";
|
||||
After(view);
|
||||
} else if (input.toString().equals("LETTERSPACE")) {
|
||||
tfOutput = " ";
|
||||
After(view);
|
||||
} else if (input.toString().equals("END OF WORK")) {
|
||||
tfOutput = "...-.-";
|
||||
After(view);
|
||||
} else if (input.toString().equals("ERROR")) {
|
||||
tfOutput = "........";
|
||||
After(view);
|
||||
} else if (input.toString().equals("STARTING SIGNAL")) {
|
||||
tfOutput = "-.-.-";
|
||||
After(view);
|
||||
} else if (input.toString().equals("ENDING SIGNAL")) {
|
||||
tfOutput = ".-.-.";
|
||||
After(view);
|
||||
} else if (input.toString().equals("UNDERSTOOD")) {
|
||||
tfOutput = "...-.";
|
||||
After(view);
|
||||
} else if (input.toString().equals("WAIT")) {
|
||||
tfOutput = ".-...";
|
||||
After(view);
|
||||
} else if (input.toString().equals("SOS")) {
|
||||
tfOutput = "...---...";
|
||||
After(view);
|
||||
} else if (input.toString().equals("LETTER SPACE")) {
|
||||
tfOutput = " ";
|
||||
After(view);
|
||||
} else if (input.toString().equals("WORD SPACE")) {
|
||||
tfOutput = " ";
|
||||
After(view);
|
||||
} else {
|
||||
for (int c = input.length(); c > 0; c--) {
|
||||
if (input.toString().startsWith(" ")) {
|
||||
output.append(" ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("A")) {
|
||||
output.append(".- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("B")) {
|
||||
output.append("-... ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("C")) {
|
||||
output.append("-.-. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("D")) {
|
||||
output.append("-.. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("E")) {
|
||||
output.append(". ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("F")) {
|
||||
output.append("..-. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("G")) {
|
||||
output.append("--. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("H")) {
|
||||
output.append(".... ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("I")) {
|
||||
output.append(".. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("J")) {
|
||||
output.append(".--- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("K")) {
|
||||
output.append("-.- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("L")) {
|
||||
output.append(".-.. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("M")) {
|
||||
output.append("-- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("N")) {
|
||||
output.append("-. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("O")) {
|
||||
output.append("--- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("P")) {
|
||||
output.append(".--. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Q")) {
|
||||
output.append("--.- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("R")) {
|
||||
output.append(".-. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("S")) {
|
||||
output.append("... ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("T")) {
|
||||
output.append("- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("U")) {
|
||||
output.append("..- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("V")) {
|
||||
output.append("...- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("W")) {
|
||||
output.append(".-- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("X")) {
|
||||
output.append("-..- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Y")) {
|
||||
output.append("-.-- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Z")) {
|
||||
output.append("--.. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("0")) {
|
||||
output.append("----- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("1")) {
|
||||
output.append(".---- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("2")) {
|
||||
output.append("..--- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("3")) {
|
||||
output.append("...-- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("4")) {
|
||||
output.append("....- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("5")) {
|
||||
output.append("..... ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("6")) {
|
||||
output.append("-.... ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("7")) {
|
||||
output.append("--... ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("8")) {
|
||||
output.append("---.. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("9")) {
|
||||
output.append("----. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Ä")) {
|
||||
output.append(".-.- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Ö")) {
|
||||
output.append("---. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("Ü")) {
|
||||
output.append("..-- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("ß")) {
|
||||
output.append("...--... ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(".")) {
|
||||
output.append(".-.-.- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(",")) {
|
||||
output.append("--..-- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(":")) {
|
||||
output.append("---... ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(";")) {
|
||||
output.append("-.-.-. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("?")) {
|
||||
output.append("..--.. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("!")) {
|
||||
output.append("-.-.-- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("-")) {
|
||||
output.append("-....- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("_")) {
|
||||
output.append("..--.- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("(")) {
|
||||
output.append("-.--. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith(")")) {
|
||||
output.append("-.--.- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("=")) {
|
||||
output.append("-...- ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("+")) {
|
||||
output.append(".-.-. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("/")) {
|
||||
output.append("-..-. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("@")) {
|
||||
output.append(".--.-. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("'")) {
|
||||
output.append(".----. ");
|
||||
input.delete(0, 1);
|
||||
} else if (input.toString().startsWith("$")) {
|
||||
output.append("...-..- ");
|
||||
input.delete(0, 1);
|
||||
} else {
|
||||
tfOutput = "Code not listed or wrong.";
|
||||
}
|
||||
}
|
||||
if (output.toString().endsWith(" ")
|
||||
&& (output.toString().equals(" ") == false)) {
|
||||
output.delete(output.length() - 3, output.length());
|
||||
}
|
||||
tfOutput = output.toString();
|
||||
lastFragment = 1;
|
||||
After(view);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Code for converting morse code into latin letters
|
||||
*/
|
||||
public void mll(View view) {
|
||||
EditText editText = (EditText) findViewById(R.id.edit_message);
|
||||
StringBuffer message = new StringBuffer(editText.getText());
|
||||
if (message.toString().endsWith(" ")){
|
||||
message = message.deleteCharAt(message.length() - 1);
|
||||
}
|
||||
// Variables
|
||||
String input;
|
||||
StringBuffer output = new StringBuffer();
|
||||
input = message.toString().toUpperCase() + "#";
|
||||
StringBuffer inputToSign = new StringBuffer(input);
|
||||
while (inputToSign.toString().equals("#") == false) {
|
||||
int d = 0;
|
||||
boolean signFull = true;
|
||||
StringBuffer sign = new StringBuffer();
|
||||
while (signFull) {
|
||||
if (inputToSign.toString().charAt(d) == '+'
|
||||
|| inputToSign.toString().charAt(d) == '#') {
|
||||
if (d == 0) {
|
||||
if (inputToSign.toString().startsWith("+")) {
|
||||
output.append(" ");
|
||||
}
|
||||
inputToSign.deleteCharAt(0);
|
||||
} else {
|
||||
sign.replace(0, sign.length(), inputToSign
|
||||
.toString().substring(0, d));
|
||||
inputToSign.delete(0, d);
|
||||
signFull = false;
|
||||
}
|
||||
} else {
|
||||
d++;
|
||||
}
|
||||
}
|
||||
if (sign.toString().equals(".-")) {
|
||||
output.append("A");
|
||||
} else if (sign.toString().equals("-...")) {
|
||||
output.append("B");
|
||||
} else if (sign.toString().equals("-.-.")) {
|
||||
output.append("C");
|
||||
} else if (sign.toString().equals("-..")) {
|
||||
output.append("D");
|
||||
} else if (sign.toString().equals(".")) {
|
||||
output.append("E");
|
||||
} else if (sign.toString().equals("..-.")) {
|
||||
output.append("F");
|
||||
} else if (sign.toString().equals("--.")) {
|
||||
output.append("G");
|
||||
} else if (sign.toString().equals("....")) {
|
||||
output.append("H");
|
||||
} else if (sign.toString().equals("..")) {
|
||||
output.append("I");
|
||||
} else if (sign.toString().equals(".---")) {
|
||||
output.append("J");
|
||||
} else if (sign.toString().equals("-.-")) {
|
||||
output.append("K");
|
||||
} else if (sign.toString().equals(".-..")) {
|
||||
output.append("L");
|
||||
} else if (sign.toString().equals("--")) {
|
||||
output.append("M");
|
||||
} else if (sign.toString().equals("-.")) {
|
||||
output.append("N");
|
||||
} else if (sign.toString().equals("---")) {
|
||||
output.append("O");
|
||||
} else if (sign.toString().equals(".--.")) {
|
||||
output.append("P");
|
||||
} else if (sign.toString().equals("--.-")) {
|
||||
output.append("Q");
|
||||
} else if (sign.toString().equals(".-.")) {
|
||||
output.append("R");
|
||||
} else if (sign.toString().equals("...")) {
|
||||
output.append("S");
|
||||
} else if (sign.toString().equals("-")) {
|
||||
output.append("T");
|
||||
} else if (sign.toString().equals("..-")) {
|
||||
output.append("U");
|
||||
} else if (sign.toString().equals("...-")) {
|
||||
output.append("V");
|
||||
} else if (sign.toString().equals(".--")) {
|
||||
output.append("W");
|
||||
} else if (sign.toString().equals("-..-")) {
|
||||
output.append("X");
|
||||
} else if (sign.toString().equals("-.--")) {
|
||||
output.append("Y");
|
||||
} else if (sign.toString().equals("--..")) {
|
||||
output.append("Z");
|
||||
} else if (sign.toString().equals("-----")) {
|
||||
output.append(". (zero)");
|
||||
} else if (sign.toString().equals(".----")) {
|
||||
output.append("-");
|
||||
} else if (sign.toString().equals("..---")) {
|
||||
output.append("2");
|
||||
} else if (sign.toString().equals("...--")) {
|
||||
output.append("3");
|
||||
} else if (sign.toString().equals("....-")) {
|
||||
output.append("4");
|
||||
} else if (sign.toString().equals(".....")) {
|
||||
output.append("5");
|
||||
} else if (sign.toString().equals("-....")) {
|
||||
output.append("6");
|
||||
} else if (sign.toString().equals("--...")) {
|
||||
output.append("7");
|
||||
} else if (sign.toString().equals("---..")) {
|
||||
output.append("8");
|
||||
} else if (sign.toString().equals("----.")) {
|
||||
output.append("9");
|
||||
} else if (sign.toString().equals(".-.-")) {
|
||||
output.append("Ä");
|
||||
} else if (sign.toString().equals("---.")) {
|
||||
output.append("Ö");
|
||||
} else if (sign.toString().equals("..--")) {
|
||||
output.append("Ü");
|
||||
} else if (sign.toString().equals("...--...")) {
|
||||
output.append("ß");
|
||||
} else if (sign.toString().equals("----")) {
|
||||
output.append("CH");
|
||||
} else if (sign.toString().equals(".-.-.-")) {
|
||||
output.append(".");
|
||||
} else if (sign.toString().equals("--..--")) {
|
||||
output.append(",");
|
||||
} else if (sign.toString().equals("---...")) {
|
||||
output.append(":");
|
||||
} else if (sign.toString().equals("-.-.-.")) {
|
||||
output.append(";");
|
||||
} else if (sign.toString().equals("..--..")) {
|
||||
output.append("?");
|
||||
} else if (sign.toString().equals("-.-.--")) {
|
||||
output.append("!");
|
||||
} else if (sign.toString().equals("-....-")) {
|
||||
output.append("-");
|
||||
} else if (sign.toString().equals("..--.-")) {
|
||||
output.append("_");
|
||||
} else if (sign.toString().equals("-.--.")) {
|
||||
output.append("(");
|
||||
} else if (sign.toString().equals("-.--.-")) {
|
||||
output.append(")");
|
||||
} else if (sign.toString().equals(".----.")) {
|
||||
output.append("'");
|
||||
} else if (sign.toString().equals("-...-")) {
|
||||
output.append("=");
|
||||
} else if (sign.toString().equals(".-.-.")) {
|
||||
output.append("+ or End of the signal");
|
||||
} else if (sign.toString().equals("-..-.")) {
|
||||
output.append("/");
|
||||
} else if (sign.toString().equals(".--.-.")) {
|
||||
output.append("@");
|
||||
} else if (sign.toString().equals("-.-.-")) {
|
||||
output.append("Begin of the signal");
|
||||
} else if (sign.toString().equals("-...-")) {
|
||||
output.append("Wait");
|
||||
} else if (sign.toString().equals("...-.")) {
|
||||
output.append("Understood");
|
||||
} else if (sign.toString().equals("...-.-")) {
|
||||
output.append("End of work");
|
||||
} else if (sign.toString().equals("...---...")) {
|
||||
output.append("SOS");
|
||||
} else if (sign.toString().equals("........")) {
|
||||
output.append("Error");
|
||||
} else {
|
||||
tfOutput = "Code not listed or wrong.";
|
||||
}
|
||||
}
|
||||
tfOutput = output.toString();
|
||||
lastFragment = 1;
|
||||
After(view);
|
||||
}
|
||||
|
||||
|
||||
public void After(View view){
|
||||
Intent intent = new Intent(this, DisplayMessageActivity.class);
|
||||
intent.putExtra(EXTRA_MESSAGE, tfOutput );
|
||||
startActivity(intent);
|
||||
tfOutput = "";
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-hdpi/drawer_shadow.9.png
Normal file
After Width: | Height: | Size: 161 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_search.png
Normal file
After Width: | Height: | Size: 650 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_share.png
Normal file
After Width: | Height: | Size: 513 B |
BIN
app/src/main/res/drawable-hdpi/ic_drawer.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/drawable-mdpi/drawer_shadow.9.png
Normal file
After Width: | Height: | Size: 142 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_search.png
Normal file
After Width: | Height: | Size: 449 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_share.png
Normal file
After Width: | Height: | Size: 383 B |
BIN
app/src/main/res/drawable-mdpi/ic_drawer.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/drawable-xhdpi/drawer_shadow.9.png
Normal file
After Width: | Height: | Size: 174 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_search.png
Normal file
After Width: | Height: | Size: 827 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_share.png
Normal file
After Width: | Height: | Size: 666 B |
BIN
app/src/main/res/drawable-xhdpi/ic_drawer.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png
Normal file
After Width: | Height: | Size: 208 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_search.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_share.png
Normal file
After Width: | Height: | Size: 969 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_drawer.png
Normal file
After Width: | Height: | Size: 217 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 9.6 KiB |
BIN
app/src/main/res/drawable/actionbar.png
Normal file
After Width: | Height: | Size: 233 B |
7
app/src/main/res/layout/activity_display_message.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="de.marcelkapfer.myfirstapp.DisplayMessageActivity"
|
||||
tools:ignore="MergeRootFrame" />
|
36
app/src/main/res/layout/activity_main.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- As the main content view, the view below consumes the entire
|
||||
space available using match_parent in both dimensions. -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="de.marcelkapfer.myfirstapp.MainActivity"
|
||||
tools:ignore="MergeRootFrame" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- android:layout_gravity="start" tells DrawerLayout to treat
|
||||
this as a sliding drawer on the left side for left-to-right
|
||||
languages and on the right side for right-to-left languages.
|
||||
The drawer is given a fixed width in dp and extends the full height of
|
||||
the container. A solid background is used for contrast
|
||||
with the content view. -->
|
||||
<ListView
|
||||
android:id="@+id/left_drawer"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:choiceMode="singleChoice"
|
||||
android:divider="@android:color/transparent"
|
||||
android:dividerHeight="0dp"
|
||||
android:background="#fff"/>
|
||||
</android.support.v4.widget.DrawerLayout>
|
27
app/src/main/res/layout/drawer_list_item.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="#000"
|
||||
android:background="?android:attr/activatedBackgroundIndicator"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
|
22
app/src/main/res/layout/fragment_about.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/about"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".AboutActivity$PlaceholderFragment" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="@string/about1" />
|
||||
|
||||
</RelativeLayout>
|
26
app/src/main/res/layout/fragment_display_message.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/display_message_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/editText1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="@string/output_message"
|
||||
android:textIsSelectable="true" >
|
||||
<requestFocus />
|
||||
</TextView>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:onClick="encode"
|
||||
android:text="@string/share" />
|
||||
|
||||
</LinearLayout>
|
57
app/src/main/res/layout/fragment_main.xml
Normal file
|
@ -0,0 +1,57 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/linearLayout1" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="@string/edit_message"
|
||||
android:padding="10dp"
|
||||
android:scrollbars="vertical" >
|
||||
</EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:id="@+id/linearLayout1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/actionbar"
|
||||
android:fitsSystemWindows="true"
|
||||
android:gravity="center"
|
||||
android:minHeight="48dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="decode"
|
||||
android:text="@string/button_decode"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textColorLink="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="encode"
|
||||
android:text="@string/button_encode"
|
||||
android:textColor="#FFFFFF" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
61
app/src/main/res/layout/fragment_morse.xml
Normal file
|
@ -0,0 +1,61 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/morse"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/linearLayout2" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="@string/edit_message"
|
||||
android:padding="10dp"
|
||||
android:scrollbars="vertical" >
|
||||
</EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/actionbar"
|
||||
android:fitsSystemWindows="true"
|
||||
android:gravity="center"
|
||||
android:minHeight="48dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="llm"
|
||||
android:text="@string/button_decode"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textColorLink="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="mll"
|
||||
android:text="@string/button_encode"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
9
app/src/main/res/menu/about.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="de.marcelkapfer.myfirstapp.AboutActivity" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_settings"/>
|
||||
</menu>
|
10
app/src/main/res/menu/display_message.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="de.marcelkapfer.myfirstapp.DisplayMessageActivity" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item android:id="@+id/action_share"
|
||||
android:title="@string/share"
|
||||
android:icon="@drawable/ic_action_share"
|
||||
android:showAsAction="always"/>
|
||||
</menu>
|
7
app/src/main/res/menu/main.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="de.marcelkapfer.myfirstapp.MainActivity" >
|
||||
|
||||
|
||||
|
||||
</menu>
|
4
app/src/main/res/menu/main_activity_actions.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
</menu>
|
33
app/src/main/res/values-de/strings.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- German translations -->
|
||||
<resources>
|
||||
<string name="app_name">Morse Converter</string>
|
||||
<string name="action_settings">Einstellungen</string>
|
||||
<string name="edit_message">Geben Sie einen Text ein</string>
|
||||
<string name="button_decode">Verschlüsseln</string>
|
||||
<string name="button_encode">Entschlüsseln</string>
|
||||
<string name="title_activity_display_message">Ihr Text</string>
|
||||
<string name="hello_world">Hallo Welt</string>
|
||||
<string name="action_search">Suche</string>
|
||||
<string name="output_message">Ihr Text</string>
|
||||
<string name="share">Teilen</string>
|
||||
<string name="send_to">Teilen Sie Ihren Text:</string>
|
||||
<string name="title_activity_about">Über</string>
|
||||
<string name="title_section1">Version</string>
|
||||
<string name="title_section2">Entwickler</string>
|
||||
<string name="title_section3">Spenden</string>
|
||||
<string name="about1">Über die App \nVersion: 1.0.0 11. Dezember 2014 \Entwickler: Marcel Michael Kapfer \nWebsite: marcel-kapfer.de/projects/morse/ \nKontakt: marcelmichaelkapfer@yahoo.co.nz \nLizens: GNU GPL v3.0
|
||||
\n \nFehler \nWenn Du einen Fehler gefunden hast, schreibe mit bitte ein Email an marcelmichaelkapfer@yahoo.co.nz mit einer kurzen Problembeschreibung.
|
||||
\n \nVerwendung \nDu kannst eine ausführliche Anwendung auf marcel-kapfer.de/projects/morse/index.html#howto_android finden.
|
||||
\n \nFehlender Code \nWenn du auf einen fehlenden Code aufmerksam geworden bist, dann schreibe eine Email an marcelmichaelkapfer@yahoo.co.nz.</string>
|
||||
|
||||
<string name="about">Über</string>
|
||||
|
||||
<string name="drawer_open">Navigationsmenü öffnen</string>
|
||||
<string name="drawer_close">Navigationsmenü schließen</string>
|
||||
<string-array name="menu_array">
|
||||
<item>writtenMorse</item>
|
||||
<item>Normal Morse</item>
|
||||
<item>Über</item>
|
||||
</string-array>
|
||||
</resources>
|
20
app/src/main/res/values-v14/styles.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme, dependent on API level. This theme is replaced
|
||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light">
|
||||
<!--
|
||||
Theme customizations available in newer API levels than 13 can go in
|
||||
res/values-vXX/styles.xml, while customizations related to
|
||||
backward-compatibility can go here.
|
||||
-->
|
||||
</style>
|
||||
|
||||
<!-- Application theme. -->
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
26
app/src/main/res/values-v19/styles.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme, dependent on API level. This theme is replaced
|
||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light">
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<!--
|
||||
Theme customizations available in newer API levels can go in
|
||||
res/values-vXX/styles.xml, while customizations related to
|
||||
backward-compatibility can go here.
|
||||
-->
|
||||
</style>
|
||||
|
||||
<!-- Application theme. -->
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
10
app/src/main/res/values-w820dp/dimens.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<resources>
|
||||
|
||||
<!--
|
||||
Example customization of dimensions originally defined in res/values/dimens.xml
|
||||
(such as screen margins) for screens with more than 820dp of available width. This
|
||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
|
||||
-->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
|
||||
</resources>
|
7
app/src/main/res/values/dimens.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<resources>
|
||||
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
</resources>
|
33
app/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">Morse Converter</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="edit_message">Enter a Message</string>
|
||||
<string name="button_decode">Encrypt</string>
|
||||
<string name="button_encode">Decrypt</string>
|
||||
<string name="title_activity_display_message">Your Message</string>
|
||||
<string name="hello_world">Hello world!</string>
|
||||
<string name="action_search">Search</string>
|
||||
<string name="output_message">Your Message</string>
|
||||
<string name="share">Share</string>
|
||||
<string name="send_to">Share your text:</string>
|
||||
<string name="title_activity_about">About Activity</string>
|
||||
<string name="title_section1">Version</string>
|
||||
<string name="title_section2">Developer</string>
|
||||
<string name="title_section3">Donate</string>
|
||||
<string name="about1">About \nVersion: 1.0.0 11th December 2014 \nDeveloper: Marcel Michael Kapfer \nWebsite: marcel-kapfer.de/projects/morse/ \nContact: marcelmichaelkapfer@yahoo.co.nz \nLicense: GNU GPL v3.0
|
||||
\n \nBug \nIf you found a bug, please write me a mail to marcelmichaelkapfer@yahoo.co.nz with a short description of the problem.
|
||||
\n \nHow to \nYou can find a detailed guide on marcel-kapfer.de/projects/morse/index.html#howto_android
|
||||
\n \nMissing Code \nIf you discovered, that code is missing, then write me a mail to marcelmichaelkapfer@yahoo.co.nz and tell me about it.</string>
|
||||
<string name="about">About</string>
|
||||
|
||||
<string name="drawer_open">Open navigation drawer</string>
|
||||
<string name="drawer_close">Close navigation drawer</string>
|
||||
<string-array name="menu_array">
|
||||
<item>writtenMorse</item>
|
||||
<item>Normal Morse</item>
|
||||
<item>About</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
20
app/src/main/res/values/styles.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme, dependent on API level. This theme is replaced
|
||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light">
|
||||
<!--
|
||||
Theme customizations available in newer API levels can go in
|
||||
res/values-vXX/styles.xml, while customizations related to
|
||||
backward-compatibility can go here.
|
||||
-->
|
||||
</style>
|
||||
|
||||
<!-- Application theme. -->
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
22
app/src/main/res/values/themes.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- the theme applied to the application or activity -->
|
||||
<style name="CustomActionBarTheme"
|
||||
parent="@android:Theme.Holo.Light.DarkActionBar">
|
||||
<item name="android:actionBarStyle">@style/MyActionBar</item>
|
||||
<item name="android:actionBarTabTextStyle">@style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
|
||||
|
||||
</style>
|
||||
|
||||
<!-- ActionBar styles -->
|
||||
<style name="MyActionBar"
|
||||
parent="@android:style/Widget.Holo.Light.ActionBar">
|
||||
<item name="android:background">@drawable/actionbar</item>
|
||||
<item name="android:titleTextStyle">@style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.MyAppTheme.ActionBar.TitleTextStyle"
|
||||
parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
|
||||
<item name="android:textColor">#FFFFFF</item>
|
||||
</style>
|
||||
</resources>
|
15
build.gradle
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.0.0-rc4'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
#Wed Apr 10 15:27:10 PDT 2013
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
|
164
gradlew
vendored
Executable file
|
@ -0,0 +1,164 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
49
import-summary.txt
Normal file
|
@ -0,0 +1,49 @@
|
|||
ECLIPSE ANDROID PROJECT IMPORT SUMMARY
|
||||
======================================
|
||||
|
||||
Ignored Files:
|
||||
--------------
|
||||
The following files were *not* copied into the new Gradle project; you
|
||||
should evaluate whether these are still needed in your project and if
|
||||
so manually move them:
|
||||
|
||||
* ic_launcher-web.png
|
||||
* proguard-project.txt
|
||||
|
||||
Replaced Jars with Dependencies:
|
||||
--------------------------------
|
||||
The importer recognized the following .jar files as third party
|
||||
libraries and replaced them with Gradle dependencies instead. This has
|
||||
the advantage that more explicit version information is known, and the
|
||||
libraries can be updated automatically. However, it is possible that
|
||||
the .jar file in your project was of an older version than the
|
||||
dependency we picked, which could render the project not compileable.
|
||||
You can disable the jar replacement in the import wizard and try again:
|
||||
|
||||
android-support-v4.jar => com.android.support:support-v4:19.1.0
|
||||
|
||||
Moved Files:
|
||||
------------
|
||||
Android Gradle projects use a different directory structure than ADT
|
||||
Eclipse projects. Here's how the projects were restructured:
|
||||
|
||||
* AndroidManifest.xml => app/src/main/AndroidManifest.xml
|
||||
* assets/ => app/src/main/assets/
|
||||
* lint.xml => app/lint.xml
|
||||
* res/ => app/src/main/res/
|
||||
* src/ => app/src/main/java/
|
||||
|
||||
Next Steps:
|
||||
-----------
|
||||
You can now build the project. The Gradle project needs network
|
||||
connectivity to download dependencies.
|
||||
|
||||
Bugs:
|
||||
-----
|
||||
If for some reason your project does not build, and you determine that
|
||||
it is due to a bug or limitation of the Eclipse to Gradle importer,
|
||||
please file a bug at http://b.android.com with category
|
||||
Component-Tools.
|
||||
|
||||
(This import summary is for your information only, and can be deleted
|
||||
after import once you are satisfied with the results.)
|
1
settings.gradle
Normal file
|
@ -0,0 +1 @@
|
|||
include ':app'
|