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,29 +75,63 @@ 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 {
FragmentActivity fragmentActivity;
ConvertThread(FragmentActivity fA) {
fragmentActivity = fA;
}
public void run() {
writtenMorseConvert(fragmentActivity);
}
public void writtenMorseConvert(FragmentActivity fragmentActivity) {
try { try {
EditText input = (EditText) fragmentActivity.findViewById(R.id.editTextWrittenMorse); EditText input = (EditText) fragmentActivity.findViewById(R.id.editTextWrittenMorse);
TextView output = (TextView) fragmentActivity.findViewById(R.id.outputWrittenMorse); TextView output = (TextView) fragmentActivity.findViewById(R.id.outputWrittenMorse);
CardView cardView = (CardView) fragmentActivity.findViewById(R.id.cardViewWrittenMorseOutput); CardView cardView = (CardView) fragmentActivity.findViewById(R.id.cardViewWrittenMorseOutput);
if(cardView.getVisibility() == View.INVISIBLE){ if (cardView.getVisibility() == View.INVISIBLE) {
cardView.setVisibility(View.VISIBLE); cardView.setVisibility(View.VISIBLE);
} }
String inputString = input.getText().toString(); String inputString = input.getText().toString();
if(WrittenMorseCodeRecognization.isCode(inputString)) { if (WrittenMorseCodeRecognization.isCode(inputString)) {
output.setText(EncodeWrittenMorseManager.getEncodedString(inputString)); output.setText(EncodeWrittenMorseManager.getEncodedString(inputString));
} else { } else {
output.setText(DecodeWrittenMorseManager.getDecodedString(inputString)); output.setText(DecodeWrittenMorseManager.getDecodedString(inputString));
} }
closeKeyboard(); } catch (Exception e) {
} catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
} }
}
public void copyWrittenMorse(FragmentActivity fragmentActivity){ public void copyWrittenMorse(FragmentActivity fragmentActivity){
TextView message = (TextView) fragmentActivity.findViewById(R.id.outputWrittenMorse); TextView message = (TextView) fragmentActivity.findViewById(R.id.outputWrittenMorse);
MainActivity.copy(message.getText().toString(), fragmentActivity); MainActivity.copy(message.getText().toString(), 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,10 +76,42 @@ 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();
} }
class ConvertThread extends Thread {
FragmentActivity fragmentActivity;
ConvertThread(FragmentActivity fA) {
fragmentActivity = fA;
}
public void run() {
normalMorseConvert(fragmentActivity);
}
public void normalMorseConvert(FragmentActivity fragmentActivity) { public void normalMorseConvert(FragmentActivity fragmentActivity) {
try { try {
EditText input = (EditText) fragmentActivity.findViewById(R.id.editTextNormalMorse); EditText input = (EditText) fragmentActivity.findViewById(R.id.editTextNormalMorse);
@ -103,12 +126,13 @@ public class MorseFragment extends Fragment {
} else { } else {
output.setText(DecodeNormalMorseManager.getDecodedString(inputString)); output.setText(DecodeNormalMorseManager.getDecodedString(inputString));
} }
closeKeyboard();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
}
public void copyNormalMorse(FragmentActivity fragmentActivity) { public void copyNormalMorse(FragmentActivity fragmentActivity) {
TextView message = (TextView) fragmentActivity.findViewById(R.id.outputNormalMorse); TextView message = (TextView) fragmentActivity.findViewById(R.id.outputNormalMorse);
MainActivity.copy(message.getText().toString(), fragmentActivity); MainActivity.copy(message.getText().toString(), 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,110 +24,65 @@
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: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:text="@string/button_convert"
android:id="@+id/writtenMorseEncodeButton"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_convert"/>
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout> <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
</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:id="@+id/cardViewWrittenMorseOutput"
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:visibility="invisible"> android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:layout_marginLeft="80dp"
android:layout_marginRight="80dp"
android:visibility="invisible"
card_view:cardCornerRadius="2dp">
<LinearLayout <LinearLayout
android:id="@+id/linearLayout2" android:id="@+id/linearLayout2"
@ -137,44 +91,41 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:gravity="center" android:gravity="center"
android:minHeight="48dp" android:minHeight="48dp"
android:orientation="vertical" android:orientation="vertical">
>
<TextView <TextView
android:id="@+id/outputWrittenMorse" 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_marginBottom="8dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="8dp" android:background="@color/cardview_light_background"
android:minHeight="64dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:hint="@string/output_message" android:hint="@string/output_message"
android:minHeight="64dp"
android:singleLine="false" android:singleLine="false"
android:background="@color/cardview_light_background" android:textColor="@color/primary_text_default_material_light"
android:textColor="@color/primary_text_default_material_light"/> android:textSize="16sp" />
<View <View style="@style/Divider" />
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:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:id="@+id/copyWrittenMorse"
android:clickable="true"> android:clickable="true">
<TextView <TextView
@ -184,20 +135,19 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
style="@style/LinearLayoutButton"
android:id="@+id/shareWrittenMorse" android:id="@+id/shareWrittenMorse"
style="@style/LinearLayoutButton"
android:clickable="true"> android:clickable="true">
<TextView <TextView
style="@style/LinearLayoutButtonText" style="@style/LinearLayoutButtonText"
android:text="@string/button_share"/> android:text="@string/button_share" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</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,69 +62,30 @@
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
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:clickable="true"
android:id="@+id/normalMorseEncodeButton" >
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_convert" />
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout> <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
</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:id="@+id/cardViewNormalMorseOutput"
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:visibility="invisible">
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:layout_marginLeft="80dp"
android:layout_marginRight="80dp"
android:visibility="invisible"
card_view:cardCornerRadius="2dp">
<LinearLayout <LinearLayout
android:id="@+id/linearLayout2" android:id="@+id/linearLayout2"
@ -138,46 +94,44 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:gravity="center" android:gravity="center"
android:minHeight="48dp" android:minHeight="48dp"
android:orientation="vertical" android:orientation="vertical">
>
<TextView <TextView
android:id="@+id/outputNormalMorse" 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_marginBottom="8dp"
android:minHeight="64dp"
android:gravity="center_vertical"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="8dp" android:background="@color/cardview_light_background"
android:gravity="center_vertical"
android:hint="@string/output_message" android:hint="@string/output_message"
android:minHeight="64dp"
android:scrollbars="vertical" android:scrollbars="vertical"
android:singleLine="false" android:singleLine="false"
android:background="@color/cardview_light_background" android:textColor="@color/primary_text_default_material_light"
android:textColor="@color/primary_text_default_material_light"/> android:textSize="16sp" />
<View <View style="@style/Divider" />
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/copyNormalMorse"
style="@style/LinearLayoutButton" style="@style/LinearLayoutButton"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:id="@+id/copyNormalMorse"
android:clickable="true"> android:clickable="true">
<TextView <TextView
style="@style/LinearLayoutButtonText" style="@style/LinearLayoutButtonText"
android:text="@string/button_copy" /> android:text="@string/button_copy" />
@ -185,20 +139,19 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
style="@style/LinearLayoutButton"
android:id="@+id/shareNormalMorse" android:id="@+id/shareNormalMorse"
style="@style/LinearLayoutButton"
android:clickable="true"> android:clickable="true">
<TextView <TextView
style="@style/LinearLayoutButtonText" style="@style/LinearLayoutButtonText"
android:text="@string/button_share"/> android:text="@string/button_share" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</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,98 +24,62 @@
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_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: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:text="@string/button_convert"
android:id="@+id/writtenMorseEncodeButton"
android:clickable="true">
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_convert"/>
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
<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/cardViewWrittenMorseOutput" android:id="@+id/cardViewWrittenMorseOutput"
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:visibility="invisible"> android:layout_margin="8dp"
android:visibility="invisible"
card_view:cardCornerRadius="2dp">
<LinearLayout <LinearLayout
android:id="@+id/linearLayout2" android:id="@+id/linearLayout2"
@ -125,44 +88,41 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:gravity="center" android:gravity="center"
android:minHeight="48dp" android:minHeight="48dp"
android:orientation="vertical" android:orientation="vertical">
>
<TextView <TextView
android:id="@+id/outputWrittenMorse" 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_marginBottom="8dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="8dp" android:background="@color/cardview_light_background"
android:minHeight="64dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:hint="@string/output_message" android:hint="@string/output_message"
android:minHeight="64dp"
android:singleLine="false" android:singleLine="false"
android:background="@color/cardview_light_background" android:textColor="@color/primary_text_default_material_light"
android:textColor="@color/primary_text_default_material_light"/> android:textSize="16sp" />
<View <View style="@style/Divider" />
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:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:id="@+id/copyWrittenMorse"
android:clickable="true"> android:clickable="true">
<TextView <TextView
@ -172,20 +132,19 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
style="@style/LinearLayoutButton"
android:id="@+id/shareWrittenMorse" android:id="@+id/shareWrittenMorse"
style="@style/LinearLayoutButton"
android:clickable="true"> android:clickable="true">
<TextView <TextView
style="@style/LinearLayoutButtonText" style="@style/LinearLayoutButtonText"
android:text="@string/button_share"/> android:text="@string/button_share" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</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,40 +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: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_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"
@ -66,54 +62,26 @@
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
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:clickable="true"
android:id="@+id/normalMorseEncodeButton" >
<TextView
style="@style/LinearLayoutButtonText"
android:text="@string/button_convert" />
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
<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/cardViewNormalMorseOutput" android:id="@+id/cardViewNormalMorseOutput"
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:visibility="invisible"> android:layout_margin="8dp"
android:visibility="invisible"
card_view:cardCornerRadius="2dp">
<LinearLayout <LinearLayout
android:id="@+id/linearLayout2" android:id="@+id/linearLayout2"
@ -122,46 +90,44 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:gravity="center" android:gravity="center"
android:minHeight="48dp" android:minHeight="48dp"
android:orientation="vertical" android:orientation="vertical">
>
<TextView <TextView
android:id="@+id/outputNormalMorse" 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_marginBottom="8dp"
android:minHeight="64dp"
android:gravity="center_vertical"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="8dp" android:background="@color/cardview_light_background"
android:gravity="center_vertical"
android:hint="@string/output_message" android:hint="@string/output_message"
android:minHeight="64dp"
android:scrollbars="vertical" android:scrollbars="vertical"
android:singleLine="false" android:singleLine="false"
android:background="@color/cardview_light_background" android:textColor="@color/primary_text_default_material_light"
android:textColor="@color/primary_text_default_material_light"/> android:textSize="16sp" />
<View <View style="@style/Divider" />
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/copyNormalMorse"
style="@style/LinearLayoutButton" style="@style/LinearLayoutButton"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:id="@+id/copyNormalMorse"
android:clickable="true"> android:clickable="true">
<TextView <TextView
style="@style/LinearLayoutButtonText" style="@style/LinearLayoutButtonText"
android:text="@string/button_copy" /> android:text="@string/button_copy" />
@ -169,20 +135,19 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
style="@style/LinearLayoutButton"
android:id="@+id/shareNormalMorse" android:id="@+id/shareNormalMorse"
style="@style/LinearLayoutButton"
android:clickable="true"> android:clickable="true">
<TextView <TextView
style="@style/LinearLayoutButtonText" style="@style/LinearLayoutButtonText"
android:text="@string/button_share"/> android:text="@string/button_share" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>