Instant converting

This commit is contained in:
mmk2410 2015-08-03 17:15:36 +02:00
parent bcd6deab0b
commit 6edd6ae637
7 changed files with 465 additions and 608 deletions

View file

@ -28,7 +28,6 @@ import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.util.DisplayMetrics;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
@ -94,14 +93,6 @@ public class MainActivity extends MaterialNavigationDrawer implements BillingPro
this.disableLearningPattern(); //Doesn't open the drawer always when the app starts this.disableLearningPattern(); //Doesn't open the drawer always when the app starts
setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_TO_FIRST); setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_TO_FIRST);
// Enables shadow only on devices with landscape. Necessary because of the list views
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
if(metrics.widthPixels < metrics.heightPixels){
enableToolbarElevation();
}
mDrawerToggle = new MaterialActionBarDrawerToggle(this, null, null, 0, 0){ mDrawerToggle = new MaterialActionBarDrawerToggle(this, null, null, 0, 0){
public void onDrawerClosed(View view){ public void onDrawerClosed(View view){

View file

@ -26,6 +26,8 @@ import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.CardView; import android.support.v7.widget.CardView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -36,8 +38,11 @@ import android.widget.TextView;
import de.marcelkapfer.morseconverter.MainActivity; import de.marcelkapfer.morseconverter.MainActivity;
import de.marcelkapfer.morseconverter.R; import de.marcelkapfer.morseconverter.R;
import de.marcelkapfer.morseconverter.engine.DecodeNormalMorseManager;
import de.marcelkapfer.morseconverter.engine.DecodeWrittenMorseManager; import de.marcelkapfer.morseconverter.engine.DecodeWrittenMorseManager;
import de.marcelkapfer.morseconverter.engine.EncodeNormalMorseManager;
import de.marcelkapfer.morseconverter.engine.EncodeWrittenMorseManager; import de.marcelkapfer.morseconverter.engine.EncodeWrittenMorseManager;
import de.marcelkapfer.morseconverter.intelligentCodeRecognization.NormalMorseCodeRecognization;
import de.marcelkapfer.morseconverter.intelligentCodeRecognization.WrittenMorseCodeRecognization; import de.marcelkapfer.morseconverter.intelligentCodeRecognization.WrittenMorseCodeRecognization;
/** /**
@ -52,15 +57,6 @@ public class MainFragment extends Fragment{
@Override @Override
public void onStart() { public void onStart() {
LinearLayout writtenMorseConvertButton = (LinearLayout) getActivity().findViewById(R.id.writtenMorseEncodeButton);
writtenMorseConvertButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
writtenMorseConvert(getActivity());
}
});
LinearLayout writtenMorseCopy = (LinearLayout) getActivity().findViewById(R.id.copyWrittenMorse); LinearLayout writtenMorseCopy = (LinearLayout) getActivity().findViewById(R.id.copyWrittenMorse);
writtenMorseCopy.setOnClickListener(new View.OnClickListener() { writtenMorseCopy.setOnClickListener(new View.OnClickListener() {
@ -79,27 +75,61 @@ public class MainFragment extends Fragment{
} }
}); });
EditText input = (EditText) getActivity().findViewById(R.id.editTextWrittenMorse);
final ConvertThread convertThread = new ConvertThread(getActivity());
input.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
convertThread.run();
}
});
super.onStart(); super.onStart();
} }
public void writtenMorseConvert(FragmentActivity fragmentActivity){ class ConvertThread extends Thread {
try {
EditText input = (EditText) fragmentActivity.findViewById(R.id.editTextWrittenMorse); FragmentActivity fragmentActivity;
TextView output = (TextView) fragmentActivity.findViewById(R.id.outputWrittenMorse);
CardView cardView = (CardView) fragmentActivity.findViewById(R.id.cardViewWrittenMorseOutput); ConvertThread(FragmentActivity fA) {
if(cardView.getVisibility() == View.INVISIBLE){ fragmentActivity = fA;
cardView.setVisibility(View.VISIBLE);
}
String inputString = input.getText().toString();
if(WrittenMorseCodeRecognization.isCode(inputString)) {
output.setText(EncodeWrittenMorseManager.getEncodedString(inputString));
} else {
output.setText(DecodeWrittenMorseManager.getDecodedString(inputString));
}
closeKeyboard();
} catch (Exception e){
e.printStackTrace();
} }
public void run() {
writtenMorseConvert(fragmentActivity);
}
public void writtenMorseConvert(FragmentActivity fragmentActivity) {
try {
EditText input = (EditText) fragmentActivity.findViewById(R.id.editTextWrittenMorse);
TextView output = (TextView) fragmentActivity.findViewById(R.id.outputWrittenMorse);
CardView cardView = (CardView) fragmentActivity.findViewById(R.id.cardViewWrittenMorseOutput);
if (cardView.getVisibility() == View.INVISIBLE) {
cardView.setVisibility(View.VISIBLE);
}
String inputString = input.getText().toString();
if (WrittenMorseCodeRecognization.isCode(inputString)) {
output.setText(EncodeWrittenMorseManager.getEncodedString(inputString));
} else {
output.setText(DecodeWrittenMorseManager.getDecodedString(inputString));
}
} catch (Exception e) {
e.printStackTrace();
}
}
} }
public void copyWrittenMorse(FragmentActivity fragmentActivity){ public void copyWrittenMorse(FragmentActivity fragmentActivity){
@ -112,11 +142,4 @@ public class MainFragment extends Fragment{
MainActivity.share(message.getText().toString(), fragmentActivity); MainActivity.share(message.getText().toString(), fragmentActivity);
} }
public void closeKeyboard(){
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
Context.INPUT_METHOD_SERVICE);
EditText myEditText = (EditText) getActivity().findViewById(R.id.editTextWrittenMorse);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
}
} }

View file

@ -58,15 +58,6 @@ public class MorseFragment extends Fragment {
@Override @Override
public void onStart() { public void onStart() {
LinearLayout normalMorseEncodeButton = (LinearLayout) getActivity().findViewById(R.id.normalMorseEncodeButton);
normalMorseEncodeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
normalMorseConvert(getActivity());
}
});
LinearLayout normalMorseCopy = (LinearLayout) getActivity().findViewById(R.id.copyNormalMorse); LinearLayout normalMorseCopy = (LinearLayout) getActivity().findViewById(R.id.copyNormalMorse);
normalMorseCopy.setOnClickListener(new View.OnClickListener() { normalMorseCopy.setOnClickListener(new View.OnClickListener() {
@ -85,28 +76,61 @@ public class MorseFragment extends Fragment {
} }
}); });
EditText input = (EditText) getActivity().findViewById(R.id.editTextNormalMorse);
final ConvertThread convertThread = new ConvertThread(getActivity());
input.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
convertThread.run();
}
});
super.onStart(); super.onStart();
} }
public void normalMorseConvert(FragmentActivity fragmentActivity) { class ConvertThread extends Thread {
try {
EditText input = (EditText) fragmentActivity.findViewById(R.id.editTextNormalMorse); FragmentActivity fragmentActivity;
TextView output = (TextView) fragmentActivity.findViewById(R.id.outputNormalMorse);
CardView cardView = (CardView) fragmentActivity.findViewById(R.id.cardViewNormalMorseOutput); ConvertThread(FragmentActivity fA) {
if (cardView.getVisibility() == View.INVISIBLE) { fragmentActivity = fA;
cardView.setVisibility(View.VISIBLE);
}
String inputString = input.getText().toString();
if (NormalMorseCodeRecognization.isCode(inputString)) {
output.setText(EncodeNormalMorseManager.getEncodedString(inputString));
} else {
output.setText(DecodeNormalMorseManager.getDecodedString(inputString));
}
closeKeyboard();
} catch (Exception e) {
e.printStackTrace();
} }
public void run() {
normalMorseConvert(fragmentActivity);
}
public void normalMorseConvert(FragmentActivity fragmentActivity) {
try {
EditText input = (EditText) fragmentActivity.findViewById(R.id.editTextNormalMorse);
TextView output = (TextView) fragmentActivity.findViewById(R.id.outputNormalMorse);
CardView cardView = (CardView) fragmentActivity.findViewById(R.id.cardViewNormalMorseOutput);
if (cardView.getVisibility() == View.INVISIBLE) {
cardView.setVisibility(View.VISIBLE);
}
String inputString = input.getText().toString();
if (NormalMorseCodeRecognization.isCode(inputString)) {
output.setText(EncodeNormalMorseManager.getEncodedString(inputString));
} else {
output.setText(DecodeNormalMorseManager.getDecodedString(inputString));
}
} catch (Exception e) {
e.printStackTrace();
}
}
} }
public void copyNormalMorse(FragmentActivity fragmentActivity) { public void copyNormalMorse(FragmentActivity fragmentActivity) {
@ -118,12 +142,4 @@ public class MorseFragment extends Fragment {
TextView message = (TextView) fragmentActivity.findViewById(R.id.outputNormalMorse); TextView message = (TextView) fragmentActivity.findViewById(R.id.outputNormalMorse);
MainActivity.share(message.getText().toString(), fragmentActivity); MainActivity.share(message.getText().toString(), fragmentActivity);
} }
public void closeKeyboard() {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
Context.INPUT_METHOD_SERVICE);
EditText myEditText = (EditText) getActivity().findViewById(R.id.editTextNormalMorse);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
}
} }

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
This is a Android application for converting writtenMorse and normal morse code. This is a Android application for converting writtenMorse and normal morse code.
Copyright (C) 2014-2015 Marcel Michael Kapfer Copyright (C) 2014-2015 Marcel Michael Kapfer
@ -25,181 +24,132 @@
android:id="@+id/main" android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" android:animateLayoutChanges="true"
tools:context=".MainActivity" android:orientation="vertical"
android:animateLayoutChanges="true"> tools:context=".MainActivity">
<ScrollView <ScrollView
android:id="@+id/scrollView2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:layout_weight="2"
android:id="@+id/scrollView2">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_gravity="top"
android:layout_margin="8dp"
card_view:cardCornerRadius="2dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_gravity="top">
<LinearLayout <LinearLayout
android:id="@+id/linearLayout1" android:id="@+id/linearLayout1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:gravity="center" android:gravity="center"
android:minHeight="48dp" android:minHeight="142dp"
android:orientation="vertical" android:orientation="vertical">
>
<EditText <EditText
android:id="@+id/editTextWrittenMorse" android:id="@+id/editTextWrittenMorse"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ems="10"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:hint="@string/edit_message"
android:scrollbars="vertical"
android:minLines="5"
android:singleLine="false"
android:background="@color/cardview_light_background" android:background="@color/cardview_light_background"
android:ems="10"
android:hint="@string/edit_message"
android:minLines="5"
android:scrollbars="vertical"
android:singleLine="false"
android:textColor="@color/primary_text_default_material_light" android:textColor="@color/primary_text_default_material_light"
android:textColorHint="@color/hint_foreground_material_light"/> android:textColorHint="@color/hint_foreground_material_light" />
<View
style="@style/Divider" </LinearLayout>
/> </android.support.v7.widget.CardView>
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewWrittenMorseOutput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:layout_marginLeft="80dp"
android:layout_marginRight="80dp"
android:visibility="invisible"
card_view:cardCornerRadius="2dp">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="48dp"
android:orientation="vertical">
<TextView
android:id="@+id/outputWrittenMorse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@color/cardview_light_background"
android:gravity="center_vertical"
android:hint="@string/output_message"
android:minHeight="64dp"
android:singleLine="false"
android:textColor="@color/primary_text_default_material_light"
android:textSize="16sp" />
<View style="@style/Divider" />
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_gravity="right"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_gravity="right" android:baselineAligned="false"
android:baselineAligned="false"> android:gravity="center"
android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/copyWrittenMorse"
style="@style/LinearLayoutButton" style="@style/LinearLayoutButton"
android:text="@string/button_convert" android:layout_marginRight="8dp"
android:id="@+id/writtenMorseEncodeButton"
android:clickable="true"> android:clickable="true">
<TextView <TextView
style="@style/LinearLayoutButtonText" style="@style/LinearLayoutButtonText"
android:text="@string/button_convert"/> android:text="@string/button_copy" />
</LinearLayout>
<LinearLayout
android:id="@+id/shareWrittenMorse"
style="@style/LinearLayoutButton"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_share" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:id="@+id/scrollView2r">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewWrittenMorseOutput"
android:layout_margin="8dp"
card_view:cardCornerRadius="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="48dp"
android:orientation="vertical"
>
<TextView
android:id="@+id/outputWrittenMorse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:minHeight="64dp"
android:gravity="center_vertical"
android:hint="@string/output_message"
android:singleLine="false"
android:background="@color/cardview_light_background"
android:textColor="@color/primary_text_default_material_light"/>
<View
style="@style/Divider"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_gravity="right"
android:baselineAligned="false">
<LinearLayout
style="@style/LinearLayoutButton"
android:layout_marginRight="8dp"
android:id="@+id/copyWrittenMorse"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_copy" />
</LinearLayout>
<LinearLayout
style="@style/LinearLayoutButton"
android:id="@+id/shareWrittenMorse"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_share"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
This is a Android application for converting writtenMorse and normal morse code. This is a Android application for converting writtenMorse and normal morse code.
Copyright (C) 2014-2015 Marcel Michael Kapfer Copyright (C) 2014-2015 Marcel Michael Kapfer
@ -25,41 +24,37 @@
android:id="@+id/main" android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="top"
android:orientation="horizontal"
tools:context=".MainActivity"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:scrollbars="vertical"> android:gravity="top"
android:orientation="vertical"
android:scrollbars="vertical"
tools:context=".MainActivity">
<ScrollView <ScrollView
android:id="@+id/scrollView3"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:layout_weight="2"
android:id="@+id/scrollView3">
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_gravity="top"
android:layout_margin="8dp"
card_view:cardCornerRadius="2dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_gravity="top">
<LinearLayout <LinearLayout
android:id="@+id/linearLayout1" android:id="@+id/linearLayout1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:gravity="center" android:gravity="center"
android:minHeight="48dp" android:minHeight="142dp"
android:orientation="vertical" android:orientation="vertical">
>
<EditText <EditText
android:id="@+id/editTextNormalMorse" android:id="@+id/editTextNormalMorse"
@ -67,140 +62,98 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:background="@color/cardview_light_background"
android:ems="10" android:ems="10"
android:hint="@string/edit_message" android:hint="@string/edit_message"
android:background="@color/cardview_light_background"
android:minLines="5" android:minLines="5"
android:scrollbars="vertical"
android:singleLine="false"
android:textColor="@color/primary_text_default_material_light" android:textColor="@color/primary_text_default_material_light"
android:textColorHint="@color/hint_foreground_material_light"> android:textColorHint="@color/hint_foreground_material_light" />
</EditText>
<View
style="@style/Divider" />
<LinearLayout </LinearLayout>
android:orientation="horizontal" </android.support.v7.widget.CardView>
android:layout_width="wrap_content"
android:layout_height="48dp" <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewNormalMorseOutput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:layout_marginLeft="80dp"
android:layout_marginRight="80dp"
android:visibility="invisible"
card_view:cardCornerRadius="2dp">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="48dp"
android:orientation="vertical">
<TextView
android:id="@+id/outputNormalMorse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:gravity="center" android:background="@color/cardview_light_background"
android:layout_marginBottom="8dp" android:gravity="center_vertical"
android:layout_marginTop="8dp" android:hint="@string/output_message"
android:layout_gravity="right" android:minHeight="64dp"
android:baselineAligned="false"> android:scrollbars="vertical"
android:singleLine="false"
android:textColor="@color/primary_text_default_material_light"
android:textSize="16sp" />
<View style="@style/Divider" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_gravity="right"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/copyNormalMorse"
style="@style/LinearLayoutButton" style="@style/LinearLayoutButton"
android:clickable="true" android:layout_marginRight="8dp"
android:id="@+id/normalMorseEncodeButton" > android:clickable="true">
<TextView <TextView
style="@style/LinearLayoutButtonText" style="@style/LinearLayoutButtonText"
android:text="@string/button_convert" /> android:text="@string/button_copy" />
</LinearLayout>
<LinearLayout
android:id="@+id/shareNormalMorse"
style="@style/LinearLayoutButton"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_share" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:id="@+id/scrollView3r">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewNormalMorseOutput"
android:layout_margin="8dp"
card_view:cardCornerRadius="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="48dp"
android:orientation="vertical"
>
<TextView
android:id="@+id/outputNormalMorse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:minHeight="64dp"
android:gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:hint="@string/output_message"
android:scrollbars="vertical"
android:singleLine="false"
android:background="@color/cardview_light_background"
android:textColor="@color/primary_text_default_material_light"/>
<View
style="@style/Divider"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_gravity="right"
android:baselineAligned="false">
<LinearLayout
style="@style/LinearLayoutButton"
android:layout_marginRight="8dp"
android:id="@+id/copyNormalMorse"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_copy" />
</LinearLayout>
<LinearLayout
style="@style/LinearLayoutButton"
android:id="@+id/shareNormalMorse"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_share"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
This is a Android application for converting writtenMorse and normal morse code. This is a Android application for converting writtenMorse and normal morse code.
Copyright (C) 2014-2015 Marcel Michael Kapfer Copyright (C) 2014-2015 Marcel Michael Kapfer
@ -25,169 +24,129 @@
android:id="@+id/main" android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:orientation="vertical" android:orientation="vertical"
tools:context=".MainActivity" tools:context=".MainActivity">
android:animateLayoutChanges="true">
<ScrollView <ScrollView
android:id="@+id/scrollView2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:id="@+id/scrollView2">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view"
android:id="@+id/card_view"
android:layout_gravity="top"
android:layout_margin="8dp"
card_view:cardCornerRadius="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="48dp"
android:orientation="vertical"
>
<EditText
android:id="@+id/editTextWrittenMorse"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ems="10" android:layout_gravity="top">
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:hint="@string/edit_message"
android:scrollbars="vertical"
android:minLines="5"
android:singleLine="false"
android:background="@color/cardview_light_background"
android:textColor="@color/primary_text_default_material_light"
android:textColorHint="@color/hint_foreground_material_light"/>
<View
style="@style/Divider"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_gravity="right"
android:baselineAligned="false">
<LinearLayout <LinearLayout
style="@style/LinearLayoutButton" android:id="@+id/linearLayout1"
android:text="@string/button_convert" android:layout_width="match_parent"
android:id="@+id/writtenMorseEncodeButton" android:layout_height="match_parent"
android:clickable="true"> android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="142dp"
android:orientation="vertical">
<EditText
android:id="@+id/editTextWrittenMorse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@color/cardview_light_background"
android:ems="10"
android:hint="@string/edit_message"
android:minLines="5"
android:scrollbars="vertical"
android:singleLine="false"
android:textColor="@color/primary_text_default_material_light"
android:textColorHint="@color/hint_foreground_material_light" />
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_convert"/>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout> <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewWrittenMorseOutput"
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewWrittenMorseOutput"
android:layout_margin="8dp"
card_view:cardCornerRadius="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="48dp"
android:orientation="vertical"
>
<TextView
android:id="@+id/outputWrittenMorse"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="16sp" android:layout_margin="8dp"
android:layout_marginLeft="16dp" android:visibility="invisible"
android:layout_marginRight="16dp" card_view:cardCornerRadius="2dp">
android:layout_marginBottom="8dp"
android:minHeight="64dp"
android:gravity="center_vertical"
android:hint="@string/output_message"
android:singleLine="false"
android:background="@color/cardview_light_background"
android:textColor="@color/primary_text_default_material_light"/>
<View
style="@style/Divider"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_gravity="right"
android:baselineAligned="false">
<LinearLayout <LinearLayout
style="@style/LinearLayoutButton" android:id="@+id/linearLayout2"
android:layout_marginRight="8dp" android:layout_width="match_parent"
android:id="@+id/copyWrittenMorse" android:layout_height="match_parent"
android:clickable="true"> android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="48dp"
android:orientation="vertical">
<TextView <TextView
style="@style/LinearLayoutButtonText" android:id="@+id/outputWrittenMorse"
android:text="@string/button_copy" /> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@color/cardview_light_background"
android:gravity="center_vertical"
android:hint="@string/output_message"
android:minHeight="64dp"
android:singleLine="false"
android:textColor="@color/primary_text_default_material_light"
android:textSize="16sp" />
<View style="@style/Divider" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_gravity="right"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/copyWrittenMorse"
style="@style/LinearLayoutButton"
android:layout_marginRight="8dp"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_copy" />
</LinearLayout>
<LinearLayout
android:id="@+id/shareWrittenMorse"
style="@style/LinearLayoutButton"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_share" />
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
style="@style/LinearLayoutButton"
android:id="@+id/shareWrittenMorse"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_share"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
This is a Android application for converting writtenMorse and normal morse code. This is a Android application for converting writtenMorse and normal morse code.
Copyright (C) 2014-2015 Marcel Michael Kapfer Copyright (C) 2014-2015 Marcel Michael Kapfer
@ -25,166 +24,132 @@
android:id="@+id/main" android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:gravity="top" android:gravity="top"
android:orientation="vertical" android:orientation="vertical"
tools:context=".MainActivity" android:scrollbars="vertical"
android:animateLayoutChanges="true" tools:context=".MainActivity">
android:scrollbars="vertical">
<ScrollView <ScrollView
android:id="@+id/scrollView3"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:id="@+id/scrollView3">
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view"
android:id="@+id/card_view"
android:layout_gravity="top"
android:layout_margin="8dp"
card_view:cardCornerRadius="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="48dp"
android:orientation="vertical"
>
<EditText
android:id="@+id/editTextNormalMorse"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_gravity="top">
android:layout_marginRight="16dp"
android:ems="10"
android:hint="@string/edit_message"
android:background="@color/cardview_light_background"
android:minLines="5"
android:textColor="@color/primary_text_default_material_light"
android:textColorHint="@color/hint_foreground_material_light">
</EditText>
<View
style="@style/Divider" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_gravity="right"
android:baselineAligned="false">
<LinearLayout <LinearLayout
style="@style/LinearLayoutButton" android:id="@+id/linearLayout1"
android:clickable="true" android:layout_width="match_parent"
android:id="@+id/normalMorseEncodeButton" > android:layout_height="match_parent"
<TextView android:layout_marginBottom="24dp"
style="@style/LinearLayoutButtonText" android:layout_marginTop="24dp"
android:text="@string/button_convert" /> android:gravity="center"
android:minHeight="142dp"
android:orientation="vertical">
<EditText
android:id="@+id/editTextNormalMorse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@color/cardview_light_background"
android:ems="10"
android:hint="@string/edit_message"
android:minLines="5"
android:scrollbars="vertical"
android:singleLine="false"
android:textColor="@color/primary_text_default_material_light"
android:textColorHint="@color/hint_foreground_material_light" />
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout> <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewNormalMorseOutput"
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewNormalMorseOutput"
android:layout_margin="8dp"
card_view:cardCornerRadius="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp"
android:gravity="center"
android:minHeight="48dp"
android:orientation="vertical"
>
<TextView
android:id="@+id/outputNormalMorse"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="16sp" android:layout_margin="8dp"
android:minHeight="64dp" android:visibility="invisible"
android:gravity="center_vertical" card_view:cardCornerRadius="2dp">
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:hint="@string/output_message"
android:scrollbars="vertical"
android:singleLine="false"
android:background="@color/cardview_light_background"
android:textColor="@color/primary_text_default_material_light"/>
<View
style="@style/Divider"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_gravity="right"
android:baselineAligned="false">
<LinearLayout <LinearLayout
style="@style/LinearLayoutButton" android:id="@+id/linearLayout2"
android:layout_marginRight="8dp" android:layout_width="match_parent"
android:id="@+id/copyNormalMorse" android:layout_height="match_parent"
android:clickable="true"> android:layout_marginTop="24dp"
<TextView android:gravity="center"
style="@style/LinearLayoutButtonText" android:minHeight="48dp"
android:text="@string/button_copy" /> android:orientation="vertical">
</LinearLayout>
<LinearLayout
style="@style/LinearLayoutButton"
android:id="@+id/shareNormalMorse"
android:clickable="true">
<TextView <TextView
style="@style/LinearLayoutButtonText" android:id="@+id/outputNormalMorse"
android:text="@string/button_share"/> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@color/cardview_light_background"
android:gravity="center_vertical"
android:hint="@string/output_message"
android:minHeight="64dp"
android:scrollbars="vertical"
android:singleLine="false"
android:textColor="@color/primary_text_default_material_light"
android:textSize="16sp" />
<View style="@style/Divider" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_gravity="right"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/copyNormalMorse"
style="@style/LinearLayoutButton"
android:layout_marginRight="8dp"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_copy" />
</LinearLayout>
<LinearLayout
android:id="@+id/shareNormalMorse"
style="@style/LinearLayoutButton"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_share" />
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>