Better Folder & File Structure
This commit is contained in:
parent
cf18cbf7b4
commit
93bf3f101c
14 changed files with 48 additions and 98 deletions
|
@ -52,6 +52,7 @@
|
|||
<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/java/engine" 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" />
|
||||
|
|
|
@ -17,6 +17,7 @@ android {
|
|||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/java/engine'] } }
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
|
|
@ -21,7 +21,6 @@ package de.marcelkapfer.morseconverter;
|
|||
|
||||
*/
|
||||
|
||||
import android.app.Notification;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
|
@ -29,20 +28,25 @@ import android.content.Intent;
|
|||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import de.marcelkapfer.morseconverter.engine.DecodeNormalMorseManager;
|
||||
import de.marcelkapfer.morseconverter.engine.DecodeWrittenMorseManager;
|
||||
import de.marcelkapfer.morseconverter.engine.EncodeNormalMorseManager;
|
||||
import de.marcelkapfer.morseconverter.engine.EncodeWrittenMorseManager;
|
||||
import de.marcelkapfer.morseconverter.fragments.AboutFragment;
|
||||
import de.marcelkapfer.morseconverter.fragments.MainFragment;
|
||||
import de.marcelkapfer.morseconverter.fragments.MorseFragment;
|
||||
import de.marcelkapfer.morseconverter.fragments.writtenMorseListFragment;
|
||||
|
||||
import it.neokree.materialnavigationdrawer.MaterialNavigationDrawer;
|
||||
import it.neokree.materialnavigationdrawer.elements.MaterialSection;
|
||||
import it.neokree.materialnavigationdrawer.util.MaterialActionBarDrawerToggle;
|
||||
|
||||
import static android.view.inputmethod.InputMethodManager.*;
|
||||
|
||||
|
||||
public class MainActivity extends MaterialNavigationDrawer {
|
||||
|
||||
|
@ -79,6 +83,7 @@ public class MainActivity extends MaterialNavigationDrawer {
|
|||
|
||||
public void onDrawerOpened(View view){
|
||||
super.onDrawerOpened(view);
|
||||
// This closes the soft keyboard, when the drawer is opened
|
||||
try {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(
|
||||
Context.INPUT_METHOD_SERVICE);
|
||||
|
@ -108,8 +113,7 @@ public class MainActivity extends MaterialNavigationDrawer {
|
|||
if(cardView.getVisibility() == View.INVISIBLE){
|
||||
cardView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
EncodeNormalMorseManager message = new EncodeNormalMorseManager(input.getText().toString());
|
||||
output.setText(message.getEncodedString());
|
||||
output.setText(EncodeNormalMorseManager.getEncodedString(input.getText().toString()));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -123,8 +127,8 @@ public class MainActivity extends MaterialNavigationDrawer {
|
|||
if(cardView.getVisibility() == View.INVISIBLE){
|
||||
cardView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
DecodeNormalMorseManager message = new DecodeNormalMorseManager(input.getText().toString());
|
||||
output.setText(message.getDecodedString());
|
||||
output.setText(DecodeNormalMorseManager.getDecodedString(input.getText().toString()));
|
||||
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -138,8 +142,7 @@ public class MainActivity extends MaterialNavigationDrawer {
|
|||
if(cardView.getVisibility() == View.INVISIBLE){
|
||||
cardView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
EncodeWrittenMorseManager message = new EncodeWrittenMorseManager(input.getText().toString());
|
||||
output.setText(message.getEncodedString());
|
||||
output.setText(EncodeWrittenMorseManager.getEncodedString(input.getText().toString()));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -153,13 +156,13 @@ public class MainActivity extends MaterialNavigationDrawer {
|
|||
if(cardView.getVisibility() == View.INVISIBLE){
|
||||
cardView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
DecodeWrittenMorseManager message = new DecodeWrittenMorseManager(input.getText().toString());
|
||||
output.setText(message.getDecodedString());
|
||||
output.setText(DecodeWrittenMorseManager.getDecodedString(input.getText().toString()));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//called when clicking on the version entry in the about fragment
|
||||
//opens the app page (de.marcelkapfer.morseconverter)
|
||||
public void versionEntry(View view){
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
package de.marcelkapfer.morseconverter.adapter;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -6,10 +6,12 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import de.marcelkapfer.morseconverter.R;
|
||||
|
||||
/**
|
||||
* Created by mmk on 3/30/15.
|
||||
*/
|
||||
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> {
|
||||
public class WrittenMorseCodeAdapter extends RecyclerView.Adapter<WrittenMorseCodeAdapter.ViewHolder> {
|
||||
private String[] mLetter;
|
||||
private String[] mCode;
|
||||
private static String mType = "LETTER";
|
||||
|
@ -26,13 +28,13 @@ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> {
|
|||
|
||||
}
|
||||
|
||||
public MyAdapter(String[] myLetter, String[] myCode) {
|
||||
public WrittenMorseCodeAdapter(String[] myLetter, String[] myCode) {
|
||||
mLetter = myLetter;
|
||||
mCode = myCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
|
||||
public WrittenMorseCodeAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
|
||||
int viewType) {
|
||||
// create a new view
|
||||
View v = LayoutInflater.from(parent.getContext())
|
|
@ -1,4 +1,4 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
package de.marcelkapfer.morseconverter.engine;
|
||||
|
||||
/*
|
||||
This is a Android application for converting writtenMorse and normal morse code.
|
||||
|
@ -23,31 +23,12 @@ package de.marcelkapfer.morseconverter;
|
|||
|
||||
public class DecodeNormalMorseManager {
|
||||
|
||||
private String inputMessage;
|
||||
|
||||
DecodeNormalMorseManager(String string) {
|
||||
inputMessage = string;
|
||||
}
|
||||
|
||||
public void setString(String string) {
|
||||
inputMessage = string;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return inputMessage;
|
||||
}
|
||||
|
||||
/*
|
||||
* Code for converting normal letters into morse code
|
||||
*/
|
||||
|
||||
public String getDecodedString() {
|
||||
public static String getDecodedString(String inputMessage) {
|
||||
StringBuffer message = new StringBuffer(inputMessage);
|
||||
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();
|
|
@ -1,4 +1,4 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
package de.marcelkapfer.morseconverter.engine;
|
||||
|
||||
/*
|
||||
This is a Android application for converting writtenMorse and normal morse code.
|
||||
|
@ -23,24 +23,7 @@ package de.marcelkapfer.morseconverter;
|
|||
|
||||
public class DecodeWrittenMorseManager {
|
||||
|
||||
private String inputMessage;
|
||||
|
||||
DecodeWrittenMorseManager(String string) {
|
||||
inputMessage = string;
|
||||
}
|
||||
|
||||
public void setString(String string) {
|
||||
inputMessage = string;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return inputMessage;
|
||||
}
|
||||
|
||||
/*
|
||||
* Code for converting latin letters into written morse
|
||||
*/
|
||||
public String getDecodedString() {
|
||||
public static String getDecodedString(String inputMessage) {
|
||||
StringBuffer message = new StringBuffer(inputMessage);
|
||||
if (message.toString().endsWith(" ")) {
|
||||
message = message.deleteCharAt(message.length() - 1);
|
|
@ -1,4 +1,4 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
package de.marcelkapfer.morseconverter.engine;
|
||||
|
||||
/*
|
||||
This is a Android application for converting writtenMorse and normal morse code.
|
||||
|
@ -26,22 +26,7 @@ package de.marcelkapfer.morseconverter;
|
|||
*/
|
||||
public class EncodeNormalMorseManager {
|
||||
|
||||
private String inputMessage;
|
||||
|
||||
EncodeNormalMorseManager(String string) {
|
||||
inputMessage = string;
|
||||
}
|
||||
|
||||
public void setString(String string){
|
||||
inputMessage = string;
|
||||
}
|
||||
|
||||
public String getString(){
|
||||
return inputMessage;
|
||||
}
|
||||
|
||||
|
||||
public String getEncodedString() {
|
||||
public static String getEncodedString(String inputMessage) {
|
||||
// Converts the input string into a StringBuffer
|
||||
StringBuffer message = new StringBuffer(inputMessage);
|
||||
// Delete the space at the end which is automatically set through some keyboards
|
|
@ -1,4 +1,4 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
package de.marcelkapfer.morseconverter.engine;
|
||||
|
||||
/*
|
||||
This is a Android application for converting writtenMorse and normal morse code.
|
||||
|
@ -27,21 +27,7 @@ package de.marcelkapfer.morseconverter;
|
|||
|
||||
public class EncodeWrittenMorseManager {
|
||||
|
||||
private String inputMessage;
|
||||
|
||||
EncodeWrittenMorseManager(String string){
|
||||
inputMessage = string;
|
||||
}
|
||||
|
||||
public String getString(){
|
||||
return inputMessage;
|
||||
}
|
||||
|
||||
public void setString(String string){
|
||||
inputMessage = string;
|
||||
}
|
||||
|
||||
public String getEncodedString() {
|
||||
public static String getEncodedString(String inputMessage) {
|
||||
StringBuffer message = new StringBuffer(inputMessage);
|
||||
if (message.toString().endsWith(" ")) {
|
||||
message = message.deleteCharAt(message.length() - 1);
|
|
@ -1,4 +1,4 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
package de.marcelkapfer.morseconverter.fragments;
|
||||
|
||||
/*
|
||||
This is a Android application for converting writtenMorse and normal morse code.
|
||||
|
@ -27,6 +27,8 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import de.marcelkapfer.morseconverter.R;
|
||||
|
||||
/**
|
||||
* Created by mmk on 2/14/15.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
package de.marcelkapfer.morseconverter.fragments;
|
||||
|
||||
/*
|
||||
This is a Android application for converting writtenMorse and normal morse code.
|
||||
|
@ -27,6 +27,8 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import de.marcelkapfer.morseconverter.R;
|
||||
|
||||
/**
|
||||
* Created by mmk on 2/14/15.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
package de.marcelkapfer.morseconverter.fragments;
|
||||
|
||||
/*
|
||||
This is a Android application for converting writtenMorse and normal morse code.
|
||||
|
@ -27,6 +27,8 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import de.marcelkapfer.morseconverter.R;
|
||||
|
||||
/**
|
||||
* Created by mmk on 2/14/15.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package de.marcelkapfer.morseconverter;
|
||||
package de.marcelkapfer.morseconverter.fragments;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Bundle;
|
||||
|
@ -14,7 +14,9 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import de.marcelkapfer.morseconverter.adapter.WrittenMorseCodeAdapter;
|
||||
import de.marcelkapfer.morseconverter.R;
|
||||
|
||||
|
||||
public class writtenMorseListFragment extends Fragment {
|
||||
|
@ -40,7 +42,7 @@ public class writtenMorseListFragment extends Fragment {
|
|||
mLayoutManager = new LinearLayoutManager(getActivity());
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
getDataset();
|
||||
mAdapter = new MyAdapter(myLetter, myCode);
|
||||
mAdapter = new WrittenMorseCodeAdapter(myLetter, myCode);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
return rootView;
|
||||
}
|
|
@ -27,7 +27,7 @@
|
|||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/white</item>
|
||||
<item name="colorAccent">@color/colorPrimary</item>
|
||||
<item name="drawerType">@integer/DRAWERTYPE_IMAGE</item>
|
||||
<item name="rippleBackport">true</item>
|
||||
<item name="toolbarElevation">true</item>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/white</item>
|
||||
<item name="colorAccent">@color/colorPrimary</item>
|
||||
<item name="drawerType">@integer/DRAWERTYPE_IMAGE</item>
|
||||
<item name="rippleBackport">true</item>
|
||||
<item name="toolbarElevation">true</item>
|
||||
|
|
Reference in a new issue