commit 65c00a0b0234b1c18cdd1caf3e44b3111a9eafc7 Author: erichhasl Date: Sat Feb 23 20:10:18 2019 +0100 initial commit diff --git a/androidTest/java/de/erich/railcontrol/ApplicationTest.java b/androidTest/java/de/erich/railcontrol/ApplicationTest.java new file mode 100644 index 0000000..481bc03 --- /dev/null +++ b/androidTest/java/de/erich/railcontrol/ApplicationTest.java @@ -0,0 +1,13 @@ +package de.erich.railcontrol; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/main/AndroidManifest.xml b/main/AndroidManifest.xml new file mode 100644 index 0000000..db95f7e --- /dev/null +++ b/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + diff --git a/main/java/de/erich/railcontrol/AddLok.java b/main/java/de/erich/railcontrol/AddLok.java new file mode 100644 index 0000000..c9498e7 --- /dev/null +++ b/main/java/de/erich/railcontrol/AddLok.java @@ -0,0 +1,43 @@ +package de.erich.railcontrol; + + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; + + +public class AddLok extends Fragment { + + public static Button btn_addlok_save; + static EditText et_addlok_name; + static EditText et_addlok_adresse; + static EditText et_addlok_maxspeed; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View frag = inflater.inflate(R.layout.fragment_addlok, container, false); + btn_addlok_save = (Button) frag.findViewById(R.id.btn_addlok_save); + et_addlok_name = (EditText) frag.findViewById(R.id.et_addlok_name); + et_addlok_adresse = (EditText) frag.findViewById(R.id.et_addlok_adresse); + et_addlok_maxspeed = (EditText) frag.findViewById(R.id.et_addlok_maxspeed); + + btn_addlok_save.setOnClickListener(new btn_listeners()); + + return frag; + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + } +} diff --git a/main/java/de/erich/railcontrol/EditLok.java b/main/java/de/erich/railcontrol/EditLok.java new file mode 100644 index 0000000..06f76df --- /dev/null +++ b/main/java/de/erich/railcontrol/EditLok.java @@ -0,0 +1,48 @@ +package de.erich.railcontrol; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; + +public class EditLok extends Fragment { + + public static Button btn_editLok_save; + public static Button btn_editLok_delete; + public static EditText et_editLok_name; + public static EditText et_editLok_adresse; + public static EditText et_editLok_maxspeed; + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + System.out.println("onCreateView"); + View frag = inflater.inflate(R.layout.fragment_edit_lok, container, false); + btn_editLok_save = (Button) frag.findViewById(R.id.btn_editLok_save); + btn_editLok_delete = (Button) frag.findViewById(R.id.btn_editLok_delete); + et_editLok_adresse = (EditText) frag.findViewById(R.id.et_editLok_adresse); + et_editLok_name = (EditText) frag.findViewById(R.id.et_editLok_name); + et_editLok_maxspeed = (EditText) frag.findViewById(R.id.et_editLok_maxspeed); + + btn_editLok_save.setOnClickListener(new MyActivity()); + btn_editLok_delete.setOnClickListener(new MyActivity()); + + + return frag; + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + } + +} diff --git a/main/java/de/erich/railcontrol/Konfiguration.java b/main/java/de/erich/railcontrol/Konfiguration.java new file mode 100644 index 0000000..0e5cc64 --- /dev/null +++ b/main/java/de/erich/railcontrol/Konfiguration.java @@ -0,0 +1,61 @@ +package de.erich.railcontrol; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + + +public class Konfiguration extends Fragment { + + public static Button btn_accept; + public static TextView tv_ip; + public static TextView tv_port; + public static EditText et_ip; + public static EditText et_port; + public static Button btn_add_lok; + public static Button btn_saveConfig; + + public static String ip_cfg; + public static int port_cfg = 0; + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View frag = inflater.inflate(R.layout.fragment_config, container, false); + btn_accept = (Button) frag.findViewById(R.id.btn_accept); + tv_ip = (TextView) frag.findViewById(R.id.tv_ip); + tv_port = (TextView) frag.findViewById(R.id.tv_port); + et_ip = (EditText) frag.findViewById(R.id.et_ip); + et_port = (EditText) frag.findViewById(R.id.et_port); + btn_add_lok = (Button) frag.findViewById(R.id.btn_add_lok); + btn_saveConfig = (Button) frag.findViewById(R.id.btn_saveConfig); + + btn_accept.setOnClickListener(new btn_listeners()); + btn_add_lok.setOnClickListener(new btn_listeners()); + btn_saveConfig.setOnClickListener(new btn_listeners()); + + System.out.println("Ip: " + ParseLoksConfiguration.ip + ", port: " + ParseLoksConfiguration.port); + if(!(ParseLoksConfiguration.ip.equals("") || ParseLoksConfiguration.port == 0)) { + et_ip.setText(ParseLoksConfiguration.ip); + String string_port = String.valueOf(ParseLoksConfiguration.port); + et_port.setText(string_port); + } + return frag; + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + } +} diff --git a/main/java/de/erich/railcontrol/Lok1.java b/main/java/de/erich/railcontrol/Lok1.java new file mode 100644 index 0000000..573e043 --- /dev/null +++ b/main/java/de/erich/railcontrol/Lok1.java @@ -0,0 +1,75 @@ +package de.erich.railcontrol; + +import android.app.Activity; +import android.app.Fragment; +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.net.Uri; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.SeekBar; +import android.widget.TextView; + +import org.w3c.dom.Text; + + +public class Lok1 extends Fragment { + + public static Button btn_richtung; + public static SeekBar speed; + public static CheckBox funktion_1; + public static CheckBox funktion_2; + public static CheckBox funktion_3; + public static CheckBox funktion_4; + public static TextView tv_direction; + TextView tv_lokName; + FragmentManager fragManager; + FragmentTransaction fragTransaction; + zug fragsLok; + Lok1 fragment; + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + System.out.println("onCreateView"); + View frag = inflater.inflate(R.layout.fragment_lok1, container, false); + btn_richtung = (Button) frag.findViewById(R.id.btn_richtung); + btn_richtung.setOnClickListener(new btn_listeners()); + speed = (SeekBar) frag.findViewById(R.id.seekBar); + speed.setMax(fragsLok.maxspeed); + speed.setOnSeekBarChangeListener(new btn_listeners()); + funktion_1 = (CheckBox) frag.findViewById(R.id.funktion_1); + funktion_2 = (CheckBox) frag.findViewById(R.id.funktion_2); + funktion_3 = (CheckBox) frag.findViewById(R.id.funktion_3); + funktion_4 = (CheckBox) frag.findViewById(R.id.funktion_4); + tv_lokName = (TextView) frag.findViewById(R.id.lok_name); + tv_direction = (TextView) frag.findViewById(R.id.tv_direction); + System.out.println(fragsLok); + tv_lokName.setText(fragsLok.name); + if(fragsLok.direction == 0) { + tv_direction.setText("\u2192"); + } else if (fragsLok.direction == 1) { + tv_direction.setText("\u2190"); + } + return frag; + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + } + + public void initFragment(zug Zug) { + fragsLok = Zug; + } +} diff --git a/main/java/de/erich/railcontrol/MainCall.java b/main/java/de/erich/railcontrol/MainCall.java new file mode 100644 index 0000000..c868e3f --- /dev/null +++ b/main/java/de/erich/railcontrol/MainCall.java @@ -0,0 +1,25 @@ +package de.erich.railcontrol; + +import java.io.IOException; + +public class MainCall { + + /** + * @param args + */ + + static ParseLoksConfiguration lConf = new ParseLoksConfiguration(); + + public MainCall(String directory) throws IOException { + + lConf.parseConfiguration(directory + "/configuration.txt"); + + /*try { + lConf.printConfiguration(directory + "/configuration.out"); + } catch (IOException e) { + System.out.println("Error: " + e); + System.exit(0); + } */ + } + +} diff --git a/main/java/de/erich/railcontrol/MyActivity.java b/main/java/de/erich/railcontrol/MyActivity.java new file mode 100644 index 0000000..a3867ae --- /dev/null +++ b/main/java/de/erich/railcontrol/MyActivity.java @@ -0,0 +1,366 @@ +package de.erich.railcontrol; + +import android.app.Activity; + +import android.app.ActionBar; +import android.app.Fragment; +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.support.v4.widget.DrawerLayout; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.Switch; +import android.widget.Toast; + +import java.io.IOException; + + +public class MyActivity extends Activity + implements NavigationDrawerFragment.NavigationDrawerCallbacks, View.OnClickListener { + + + public Konfiguration fragm_config; + public FragmentManager fragManager; + public FragmentTransaction fragTransaction; + public static zug E_10 = new zug(10, "E 12", 28); + public zug E_12 = new zug(200, "Hans", 28); + public static Lok1 currentFrag; + public Lok1 [] loks = new Lok1[10]; + public static zug [] zuege = new zug[10]; + public zug BR_86 = new zug(86, "BR 86" , 28); + static String defaultDataDir; + static boolean power; + + /** + * Fragment managing the behaviors, interactions and presentation of the navigation drawer. + */ + private NavigationDrawerFragment mNavigationDrawerFragment; + + /** + * Used to store the last screen title. For use in {@link #restoreActionBar()}. + */ + private CharSequence mTitle; + + @Override + protected void onCreate(Bundle savedInstanceState) { + System.out.println("OnCreate"); + defaultDataDir = "/data/data/" + getPackageName(); + + try { + MainCall maincall = new MainCall(defaultDataDir); + } catch (IOException e) { + e.printStackTrace(); + } + + /*zuege[0] = E_10; + zuege[1] = E_12; + zuege[2] = BR_86; */ + + int zuegeLength = 0; + for (int i = 0; i < MyActivity.zuege.length; i++) { + if(!(MyActivity.zuege[i] == null)) { + zuegeLength++; + } + } + NavigationDrawerFragment.titles = new String[zuegeLength + 3]; + System.out.println("Anzahl Züge: " + zuegeLength); + NavigationDrawerFragment.titles[0] = getString(R.string.title_section1); + NavigationDrawerFragment.titles[1] = getString(R.string.title_section2); + NavigationDrawerFragment.titles[2] = "Neue Lok"; + for (int i = 3; i < zuege.length; i++) { + if(!(MyActivity.zuege[i - 3] == null)) { + NavigationDrawerFragment.titles[i] = zuege[i - 3].name; + System.out.println("Created: " + i); + } + else { + System.out.println("Something is null."); + } + } + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_my); + + mNavigationDrawerFragment = (NavigationDrawerFragment) + getFragmentManager().findFragmentById(R.id.navigation_drawer); + mTitle = getTitle(); + + // Set up the drawer. + mNavigationDrawerFragment.setUp( + R.id.navigation_drawer, + (DrawerLayout) findViewById(R.id.drawer_layout)); + + fragm_config = (Konfiguration) Fragment.instantiate(this, Konfiguration.class.getName(), null); + } + + @Override + public void onNavigationDrawerItemSelected(int position) { + // update the main content by replacing fragments + FragmentManager fragmentManager = getFragmentManager(); + fragmentManager.beginTransaction() + .replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) + .commit(); + System.out.println(position); + } + + public void onSectionAttached(int number) { + System.out.println("onSectionAttached: "+number); + + switch (number) { + case 1: + mTitle = getString(R.string.title_section1); + System.out.println("Section Attached"); + break; + case 2: + mTitle = getString(R.string.title_section2); + fragManager = getFragmentManager(); + fragTransaction = fragManager.beginTransaction(); + fragTransaction.replace(R.id.container,fragm_config); + fragTransaction.commit(); + break; + case 3: + mTitle = "Lok hinzufügen"; + AddLok addlok = new AddLok(); + fragManager = getFragmentManager(); + fragTransaction = fragManager.beginTransaction(); + fragTransaction.replace(R.id.container, addlok); + fragTransaction.commit(); + System.out.println("Lok hinzufügen - Fragment"); + break; + + default: + System.out.println("Section: " + number); + if(loks[number-4] == null) { + Lok1 lok1 = new Lok1(); + loks[number-4] = lok1; + lok1.initFragment(zuege[number-4]); + } + Lok1 lok1 = loks[number-4]; + fragManager = getFragmentManager(); + fragTransaction = fragManager.beginTransaction(); + fragTransaction.replace(R.id.container, lok1); + fragTransaction.commit(); + mTitle = lok1.fragsLok.name; + //lok1.initFragment(E_10); + currentFrag = lok1; + break; + } + } + + public void restoreActionBar() { + ActionBar actionBar = getActionBar(); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setTitle(mTitle); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + System.out.println("OnCreateOptionsMenu"); + +/* try { + MySAXApp.initReader(); + } catch (Exception e) { + e.printStackTrace(); + } */ + if (!mNavigationDrawerFragment.isDrawerOpen()) { + // Only show items in the action bar relevant to this screen + // if the drawer is not showing. Otherwise, let the drawer + // decide what to show in the action bar. + getMenuInflater().inflate(R.menu.my, menu); + restoreActionBar(); + return true; + } + + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + if (id == R.id.action_settings) { + if(currentFrag == null) { + System.out.println("Erst Lok auswählen"); + Toast.makeText(this, "Erst Lok auswählen", Toast.LENGTH_SHORT).show(); + } + else { + mTitle = "Lok ändern"; + EditLok editlok = new EditLok(); + fragManager = getFragmentManager(); + fragTransaction = fragManager.beginTransaction(); + fragTransaction.replace(R.id.container, editlok); + fragTransaction.commit(); + } + return true; + } + return super.onOptionsItemSelected(item); + } + + /*@Override + public void onDestroy() { + System.out.println("OnDestroy"); + try { + MainCall.lConf.printConfiguration(defaultDataDir + "/configuration.txt"); + } catch (IOException e) { + System.out.println("Error: " + e); + System.exit(0); + } + }*/ + + public void onCheckboxClicked(View view) { + int status = 0; + boolean checked = ((CheckBox) view).isChecked(); + if(checked) { + status = 1; + } + else if(!checked) { + status = 0; + } + if(view == Lok1.funktion_1) { + currentFrag.fragsLok.setFunction(1, status); + } + else if(view == Lok1.funktion_2) { + currentFrag.fragsLok.setFunction(2, status); + } + else if(view == Lok1.funktion_3) { + currentFrag.fragsLok.setFunction(3, status); + } + else if(view == Lok1.funktion_4) { + currentFrag.fragsLok.setFunction(4, status); + } + + } + + @Override + public void onClick(View view) { + if(view == EditLok.btn_editLok_save) { + int number = 100; + String name = EditLok.et_editLok_name.getText().toString(); + int adresse; + int maxspeed; + try { + adresse = Integer.parseInt(EditLok.et_editLok_adresse.getText().toString()); + maxspeed = Integer.parseInt(EditLok.et_editLok_maxspeed.getText().toString()); + } catch (NumberFormatException e) { + adresse = 0; + maxspeed = 0; + } + for (int i = 0;i < MyActivity.zuege.length; i++) { + if (MyActivity.zuege[i].equals(MyActivity.currentFrag.fragsLok)) { + number = i; + i = MyActivity.zuege.length; + System.out.println("Runned"); + } + } + if(!(name.equals("") || adresse == 0 || maxspeed == 0)) { + System.out.println("Setzen der Werte, Number :"+number); + MyActivity.currentFrag.fragsLok.name = name; + MyActivity.currentFrag.fragsLok.adresse = adresse; + MyActivity.currentFrag.fragsLok.maxspeed = maxspeed; + if(!(number == 100)) { + System.out.println("Nicht 100"); + MyActivity.zuege[number].name = name; + MyActivity.zuege[number].adresse = adresse; + MyActivity.zuege[number].maxspeed = maxspeed; + System.out.println("Gespeichert"); + Toast.makeText(EditLok.btn_editLok_save.getContext(), "Lok gespeichert", Toast.LENGTH_SHORT).show(); + } + else { + System.out.println("Error occurred, EditLok"); + Toast.makeText(EditLok.btn_editLok_save.getContext(), "Es ist ein Fehler aufgetreten :(", Toast.LENGTH_SHORT).show(); + + } + } + else { + System.out.println("Fehlende Eingaben"); + Toast.makeText(EditLok.btn_editLok_save.getContext(), "Fehlende/Fehlerhafte Eingaben", Toast.LENGTH_SHORT).show(); + } + + } + else if (view == EditLok.btn_editLok_delete) { + int number = 100; + for (int i = 0;i < MyActivity.zuege.length; i++) { + if (MyActivity.zuege[i].equals(MyActivity.currentFrag.fragsLok)) { + number = i; + i = MyActivity.zuege.length; + } + } + MyActivity.zuege[number] = null; + /*for (int i = number; i < MyActivity.zuege.length; i++) { + if(i == number) { + System.out.println("Lok selber hihihi"); + } + else { + MyActivity.zuege[i - 1] = MyActivity.zuege[i]; + } + }*/ + System.out.println(MyActivity.zuege[number]); + Toast.makeText(EditLok.btn_editLok_save.getContext(), "Lok gelöscht", Toast.LENGTH_SHORT).show(); + + } + } + + + /** + * A placeholder fragment containing a simple view. + */ + public static class PlaceholderFragment extends Fragment { + + public static Button btn_connect; + public static Button btn_quit; + public static Switch ip_selector; + /** + * The fragment argument representing the section number for this + * fragment. + */ + private static final String ARG_SECTION_NUMBER = "section_number"; + + /** + * Returns a new instance of this fragment for the given section + * number. + */ + public static PlaceholderFragment newInstance(int sectionNumber) { + PlaceholderFragment fragment = new PlaceholderFragment(); + Bundle args = new Bundle(); + args.putInt(ARG_SECTION_NUMBER, sectionNumber); + fragment.setArguments(args); + return fragment; + } + + public PlaceholderFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_my, container, false); + this.btn_quit = (Button) rootView.findViewById(R.id.btn_quit); + this.btn_connect = (Button) rootView.findViewById(R.id.btn_connect); + System.out.println("Buttons gesetzt"); + System.out.println(this.btn_connect + ", " + this.btn_quit); + btn_quit.setOnClickListener(new btn_listeners()); + btn_connect.setOnClickListener(new btn_listeners()); + ip_selector = (Switch) rootView.findViewById(R.id.select_ip); + + return rootView; + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + ((MyActivity) activity).onSectionAttached( + getArguments().getInt(ARG_SECTION_NUMBER)); + } + } + + + +} diff --git a/main/java/de/erich/railcontrol/NavigationDrawerFragment.java b/main/java/de/erich/railcontrol/NavigationDrawerFragment.java new file mode 100644 index 0000000..783c636 --- /dev/null +++ b/main/java/de/erich/railcontrol/NavigationDrawerFragment.java @@ -0,0 +1,310 @@ +package de.erich.railcontrol; + + +import android.app.Activity; +import android.app.ActionBar; +import android.app.Fragment; +import android.support.v4.app.ActionBarDrawerToggle; +import android.support.v4.view.GravityCompat; +import android.support.v4.widget.DrawerLayout; +import android.content.SharedPreferences; +import android.content.res.Configuration; +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.Toast; + +import java.io.IOException; + +/** + * Fragment used for managing interactions for and presentation of a navigation drawer. + * See the + * design guidelines for a complete explanation of the behaviors implemented here. + */ +public class NavigationDrawerFragment extends Fragment { + + /** + * Remember the position of the selected item. + */ + private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position"; + + /** + * Per the design guidelines, you should show the drawer on launch until the user manually + * expands it. This shared preference tracks this. + */ + private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned"; + + /** + * A pointer to the current callbacks instance (the Activity). + */ + private NavigationDrawerCallbacks mCallbacks; + + /** + * Helper component that ties the action bar to the navigation drawer. + */ + private ActionBarDrawerToggle mDrawerToggle; + + private DrawerLayout mDrawerLayout; + private ListView mDrawerListView; + private View mFragmentContainerView; + + private int mCurrentSelectedPosition = 0; + private boolean mFromSavedInstanceState; + private boolean mUserLearnedDrawer; + + public static String titles[]; + + public NavigationDrawerFragment() { + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Read in the flag indicating whether or not the user has demonstrated awareness of the + // drawer. See PREF_USER_LEARNED_DRAWER for details. + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); + mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); + + if (savedInstanceState != null) { + mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); + mFromSavedInstanceState = true; + } + + // Select either the default item (0) or the last selected item. + selectItem(mCurrentSelectedPosition); + } + + @Override + public void onActivityCreated (Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + // Indicate that this fragment would like to influence the set of actions in the action bar. + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + System.out.println("NavDrawerOnCreateView"); + mDrawerListView = (ListView) inflater.inflate( + R.layout.fragment_navigation_drawer, container, false); + mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + selectItem(position); + } + }); + mDrawerListView.setAdapter(new ArrayAdapter( + getActionBar().getThemedContext(), + android.R.layout.simple_list_item_activated_1, + android.R.id.text1, titles + /*new String[]{ + getString(R.string.title_section1), + getString(R.string.title_section2), + getString(R.string.title_section3), + "Test", + + }*/ + )); + mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); + return mDrawerListView; + } + + public boolean isDrawerOpen() { + return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView); + } + + /** + * Users of this fragment must call this method to set up the navigation drawer interactions. + * + * @param fragmentId The android:id of this fragment in its activity's layout. + * @param drawerLayout The DrawerLayout containing this fragment's UI. + */ + public void setUp(int fragmentId, DrawerLayout drawerLayout) { + mFragmentContainerView = getActivity().findViewById(fragmentId); + mDrawerLayout = drawerLayout; + + // set a custom shadow that overlays the main content when the drawer opens + mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); + // set up the drawer's list view with items and click listener + + ActionBar actionBar = getActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setHomeButtonEnabled(true); + + // ActionBarDrawerToggle ties together the the proper interactions + // between the navigation drawer and the action bar app icon. + mDrawerToggle = new ActionBarDrawerToggle( + getActivity(), /* host Activity */ + mDrawerLayout, /* DrawerLayout object */ + R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ + R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ + R.string.navigation_drawer_close /* "close drawer" description for accessibility */ + ) { + @Override + public void onDrawerClosed(View drawerView) { + super.onDrawerClosed(drawerView); + if (!isAdded()) { + return; + } + + getActivity().invalidateOptionsMenu(); // calls onPrepareOptionsMenu() + } + + @Override + public void onDrawerOpened(View drawerView) { + super.onDrawerOpened(drawerView); + if (!isAdded()) { + return; + } + + if (!mUserLearnedDrawer) { + // The user manually opened the drawer; store this flag to prevent auto-showing + // the navigation drawer automatically in the future. + mUserLearnedDrawer = true; + SharedPreferences sp = PreferenceManager + .getDefaultSharedPreferences(getActivity()); + sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply(); + } + + getActivity().invalidateOptionsMenu(); // calls onPrepareOptionsMenu() + } + }; + + // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, + // per the navigation drawer design guidelines. + if (!mUserLearnedDrawer && !mFromSavedInstanceState) { + mDrawerLayout.openDrawer(mFragmentContainerView); + } + + // Defer code dependent on restoration of previous instance state. + mDrawerLayout.post(new Runnable() { + @Override + public void run() { + mDrawerToggle.syncState(); + } + }); + + mDrawerLayout.setDrawerListener(mDrawerToggle); + } + + private void selectItem(int position) { + mCurrentSelectedPosition = position; + if (mDrawerListView != null) { + mDrawerListView.setItemChecked(position, true); + } + if (mDrawerLayout != null) { + mDrawerLayout.closeDrawer(mFragmentContainerView); + } + if (mCallbacks != null) { + mCallbacks.onNavigationDrawerItemSelected(position); + } + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + try { + mCallbacks = (NavigationDrawerCallbacks) activity; + } catch (ClassCastException e) { + throw new ClassCastException("Activity must implement NavigationDrawerCallbacks."); + } + } + + @Override + public void onDetach() { + super.onDetach(); + mCallbacks = null; + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + // Forward the new configuration the drawer toggle component. + mDrawerToggle.onConfigurationChanged(newConfig); + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + // If the drawer is open, show the global app actions in the action bar. See also + // showGlobalContextActionBar, which controls the top-left area of the action bar. + if (mDrawerLayout != null && isDrawerOpen()) { + inflater.inflate(R.menu.global, menu); + showGlobalContextActionBar(); + } + super.onCreateOptionsMenu(menu, inflater); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (mDrawerToggle.onOptionsItemSelected(item)) { + return true; + } + + if (item.getItemId() == R.id.action_example) { + if(!(btn_listeners.client == null || btn_listeners.client.connected == false)) { + if (MyActivity.power == true) { + try { + btn_listeners.client.sendMessage("SET 1 POWER OFF"); + MyActivity.power = false; + Toast.makeText(getActivity(), "Strom aus", Toast.LENGTH_SHORT).show(); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + try { + btn_listeners.client.sendMessage("SET 1 POWER ON"); + MyActivity.power = true; + Toast.makeText(getActivity(), "Strom an", Toast.LENGTH_SHORT).show(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } else { + Toast.makeText(getActivity(), "Nicht Verbunden!", Toast.LENGTH_SHORT).show(); + } + return true; + } + + return super.onOptionsItemSelected(item); + } + + /** + * Per the navigation drawer design guidelines, updates the action bar to show the global app + * 'context', rather than just what's in the current screen. + */ + private void showGlobalContextActionBar() { + ActionBar actionBar = getActionBar(); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + actionBar.setTitle(R.string.app_name); + } + + private ActionBar getActionBar() { + return getActivity().getActionBar(); + } + + /** + * Callbacks interface that all activities using this fragment must implement. + */ + public static interface NavigationDrawerCallbacks { + /** + * Called when an item in the navigation drawer is selected. + */ + void onNavigationDrawerItemSelected(int position); + } +} diff --git a/main/java/de/erich/railcontrol/ParseLoksConfiguration.java b/main/java/de/erich/railcontrol/ParseLoksConfiguration.java new file mode 100644 index 0000000..620d854 --- /dev/null +++ b/main/java/de/erich/railcontrol/ParseLoksConfiguration.java @@ -0,0 +1,109 @@ +package de.erich.railcontrol; + +import android.util.Log; + +import java.io.BufferedReader; +import java.io.FileInputStream; +//import java.io.FileReader; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class ParseLoksConfiguration { + + static String ip; + static int port; + static int numLoks = 0; + + public enum Section { + NONE, CONFIGURATION, GENERAL, LOKS + } + + + public void parseConfiguration(String fileName) throws IOException { + + try{ + InputStream fis=new FileInputStream(fileName); + BufferedReader br=new BufferedReader(new InputStreamReader(fis)); + + String Line = br.readLine(); + Section sec = Section.NONE; + while(Line != null){ + String[] words=Line.split("\t"); + if ( words[0].equalsIgnoreCase("/>")) { + sec = Section.NONE; + } else if ( words[0].equalsIgnoreCase(" 3) { + if ( words.length > 1 ) { + if (sec == Section.GENERAL) { + if ( words[1].equalsIgnoreCase("ip:")) ip = words[2]; + else if (words[1].equalsIgnoreCase("port:")) + port = Integer.parseInt(words[2]); + } else if (sec == Section.LOKS) { + MyActivity.zuege[numLoks-1].setProperty(words); + } + } + } + try { + Line = br.readLine(); + } catch (Exception e){ + System.err.println("Error in Parseloop: " + e); + } + } + br.close(); + } + catch(FileNotFoundException e){ + this.printConfiguration(fileName); + } + Log.d("printConfig", "Parsed Configuration"); + + } + + public void printConfiguration(String fileName ) throws IOException { + FileWriter outStream = null; + + /* + try { + + Runtime.getRuntime().exec("cp " + fileName + " " + fileName + ".bck"); + } catch (Exception e) { + System.out.println("Error: " + e); + System.exit(0); + } + */ + + try { + outStream = new FileWriter(fileName); + } catch (IOException e) { + System.out.println("Error " + e); + } + + outStream.write("\n"); + outStream.write("\n"); + outStream.write("\n"); + + if ( MyActivity.zuege != null ) { + for (int i = 0; i < numLoks; i++) { + if(MyActivity.zuege[i] != null) { + MyActivity.zuege[i].printConfiguration(outStream); + } + } + } + outStream.write("\n"); +// if (outStream != null) { + outStream.close(); + Log.d("printConfig", "Printed Configuration"); + +// } + } + +} diff --git a/main/java/de/erich/railcontrol/TCPClient.java b/main/java/de/erich/railcontrol/TCPClient.java new file mode 100644 index 0000000..2d77fc7 --- /dev/null +++ b/main/java/de/erich/railcontrol/TCPClient.java @@ -0,0 +1,75 @@ +package de.erich.railcontrol; + +import java.io.*; +import java.net.*; + +class CommunicationClient +{ + + String sentence; + String modifiedSentence; + Socket clientSocket; + InputStreamReader isr; + BufferedReader inFromStdIn; + DataOutputStream outToServer; + boolean connected; + + public CommunicationClient() { + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + String ip; + int port; + isr = new InputStreamReader(System.in); + inFromStdIn = new BufferedReader(isr); + if(MyActivity.PlaceholderFragment.ip_selector.isChecked()) { + System.out.println("Online"); + if(ParseLoksConfiguration.ip == null || ParseLoksConfiguration.port == 0) { + ip = "192.168.4.29"; + port = 4303; + } else { + ip = ParseLoksConfiguration.ip; + port = ParseLoksConfiguration.port; + } + } else { + System.out.println("Default"); + ip = "192.168.4.24"; + port = 6789; + } + System.out.println(ip + " " + port); + try { + clientSocket = new Socket(ip, port); + System.out.println("Verbunden"); + connected = true; + } catch (IOException e) { + e.printStackTrace(); + connected = false; + } + } + }); + thread.setPriority(1); + thread.start(); + } + + public void sendMessage(String message) throws IOException { + + System.out.printf("Enter: "); + outToServer = new DataOutputStream(clientSocket.getOutputStream()); + //BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); + sentence = message; + outToServer.writeBytes(sentence + '\n'); + //modifiedSentence = inFromServer.readLine(); + System.out.println("FROM SERVER: " + modifiedSentence); + } + + public void killClient() throws IOException { + System.out.println("Kill Client"); + sendMessage("." + "\n"); + clientSocket.close(); + System.out.println("CLient killed"); + } + + + + +} diff --git a/main/java/de/erich/railcontrol/btn_listeners.java b/main/java/de/erich/railcontrol/btn_listeners.java new file mode 100644 index 0000000..3201410 --- /dev/null +++ b/main/java/de/erich/railcontrol/btn_listeners.java @@ -0,0 +1,156 @@ +package de.erich.railcontrol; + +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.content.Intent; +import android.view.View; +import android.widget.SeekBar; +import android.widget.Toast; + +import java.io.IOException; + +public class btn_listeners implements View.OnClickListener, SeekBar.OnSeekBarChangeListener { + + public static CommunicationClient client; + String ip; + String port; + int progress; + FragmentManager fragManager; + FragmentTransaction fragTransaction; + + @Override + public void onClick(View view) { + if(view == MyActivity.PlaceholderFragment.btn_quit) { + System.out.println(this.client); + if(!(client == null)) { + if(this.client.connected) { + try { + client.sendMessage("SET 1 POWER OFF"); + MyActivity.power = false; + client.killClient(); + client.connected = false; + Toast.makeText(MyActivity.PlaceholderFragment.btn_quit.getContext(), "Verbindung getrennt", Toast.LENGTH_SHORT).show(); + for(int i = 0; i < MyActivity.zuege.length; i++){ + if(MyActivity.zuege[i] != null) { + MyActivity.zuege[i].initialized = false; + MyActivity.zuege[i].firstTime = true; + } + } + } catch (IOException e) { + e.printStackTrace(); + } + } + else { + System.out.println("Nicht Verbunden"); + Toast.makeText(MyActivity.PlaceholderFragment.btn_quit.getContext(), "Nicht Verbunden!", Toast.LENGTH_SHORT).show(); + } + } + else { + System.out.println("Nicht Verbunden. Client nicht generiert."); + Toast.makeText(MyActivity.PlaceholderFragment.btn_quit.getContext(), "Nicht Verbunden. Client nicht generiert.", Toast.LENGTH_LONG).show(); + } + } + else if(view == MyActivity.PlaceholderFragment.btn_connect) { + this.client = new CommunicationClient(); + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (client.connected) { + try { + client.sendMessage("GO"); + client.sendMessage("SET 1 POWER ON"); + MyActivity.power = true; + Toast.makeText(MyActivity.PlaceholderFragment.btn_quit.getContext(), "Verbunden", Toast.LENGTH_SHORT).show(); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + Toast.makeText(MyActivity.PlaceholderFragment.btn_quit.getContext(), "Fehler bei der Verbindung!", Toast.LENGTH_SHORT).show(); + } + System.out.println(client); + } + else if(view == Lok1.btn_richtung) { + int i = MyActivity.currentFrag.fragsLok.changeDirection(); + if (i == 0) { + Lok1.tv_direction.setText("\u2192"); + } else if(i == 1) { + Lok1.tv_direction.setText("\u2190"); + } + //MyActivity.E_10.changeDirection(); + } + else if(view == Konfiguration.btn_accept) { + ParseLoksConfiguration.ip = Konfiguration.et_ip.getText().toString(); + try { + ParseLoksConfiguration.port = Integer.parseInt(Konfiguration.et_port.getText().toString()); + } catch (NumberFormatException e) { + Toast.makeText(Konfiguration.btn_accept.getContext(), "Port keine Zahl!", Toast.LENGTH_SHORT).show(); + return; + } + System.out.println("Ip: " + ParseLoksConfiguration.ip); + System.out.println("Gespeichert"); + Toast.makeText(Konfiguration.btn_accept.getContext(), "Gespeichert", Toast.LENGTH_SHORT).show(); + } + else if (view == AddLok.btn_addlok_save) { + System.out.println("btn listener: btnAddlokSave"); + String name = AddLok.et_addlok_name.getText().toString(); + int adresse = 0; + int maxspeed = 0; + try { + adresse = Integer.parseInt(AddLok.et_addlok_adresse.getText().toString()); + } catch(Exception e) { + System.out.println("Fehler: " + e); + Toast.makeText(AddLok.btn_addlok_save.getContext(), "Adresse keine Zahl!", Toast.LENGTH_SHORT).show(); + } + try { + maxspeed = Integer.parseInt(AddLok.et_addlok_maxspeed.getText().toString()); + } catch(Exception e) { + System.out.println("Fehler: " + e); + Toast.makeText(AddLok.btn_addlok_save.getContext(), "Geschwindigkeitsstufen keine Zahl!", Toast.LENGTH_SHORT).show(); + } + if(!(adresse == 0 || maxspeed == 0 || name == null || name.equals(""))) { + MyActivity.zuege[ParseLoksConfiguration.numLoks] = new zug(adresse, name, maxspeed); + ParseLoksConfiguration.numLoks++; + + Toast.makeText(AddLok.btn_addlok_save.getContext(), "Lok erstellt", Toast.LENGTH_SHORT).show(); + System.out.println("Lok erstellt"); + AddLok.et_addlok_maxspeed.setText("28"); + AddLok.et_addlok_adresse.setText(""); + AddLok.et_addlok_name.setText(""); + } else { + Toast.makeText(AddLok.btn_addlok_save.getContext(), "Fehlende/Fehlerhafte Eingaben", Toast.LENGTH_SHORT).show(); + System.out.println("Fehlerhafte Eingaben"); + } + + } else if (view == Konfiguration.btn_saveConfig) { + System.out.println("btn listener: btn_SaveConfig"); + try { + MainCall.lConf.printConfiguration(MyActivity.defaultDataDir + "/configuration.txt"); + Toast.makeText(Konfiguration.btn_saveConfig.getContext(), "Konfiguration gespeichert. Neustart erforderlich!", Toast.LENGTH_SHORT).show(); + } catch (IOException e) { + System.out.println("Error: " + e); + System.exit(0); + } + } + } + + @Override + public void onProgressChanged(SeekBar seekBar, int i, boolean b) { + if(seekBar == Lok1.speed) { + progress = i; + System.out.println(progress); + MyActivity.currentFrag.fragsLok.setSpeed(progress); + } + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + } + +} diff --git a/main/java/de/erich/railcontrol/zug.java b/main/java/de/erich/railcontrol/zug.java new file mode 100644 index 0000000..969c8fd --- /dev/null +++ b/main/java/de/erich/railcontrol/zug.java @@ -0,0 +1,141 @@ +package de.erich.railcontrol; + +import android.widget.Toast; + +import java.io.FileWriter; +import java.io.IOException; + +public class zug { + + int adresse; + int direction; + int speed; + String name; + int maxspeed; + + boolean initialized; + boolean firstTime; + + int funktion_1; + int funktion_2; + int funktion_3; + int funktion_4; + + public zug(int adresse, String name, int maxspeed) { + + this.adresse = adresse; + this.name = name; + this.maxspeed = maxspeed; + this.initialized = false; + firstTime = true; + + } + + public zug() { + this.initialized = false; + firstTime = true; + } + + public boolean initZug() { + if(btn_listeners.client == null) { + if(firstTime) { + Toast.makeText(Lok1.btn_richtung.getContext(), "Noch nicht verbunden!", Toast.LENGTH_SHORT).show(); + firstTime = false; + } + return false; + } + try { + btn_listeners.client.sendMessage("INIT 1 GL " + this.adresse + " N 1 " + maxspeed +" 4"); + initialized = true; + return true; + } catch (IOException e) { + e.printStackTrace(); + return false; + } + } + + public void setSpeed(int speed) { + if(!(this.initialized)) { + if(!(this.initZug())) { + return; + } + } + try { + btn_listeners.client.sendMessage("SET 1 GL " + this.adresse + " " + this.direction + " " + speed + " " + maxspeed + " " + funktion_1 + " "+ funktion_2 + " "+ funktion_3 + " " + funktion_4); + this.speed = speed; + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void setDirection(int direction) { + this.direction = direction; + } + + public int changeDirection() { + if(!(this.initialized)) { + if(!(this.initZug())) { + return this.direction; + } + } + if(this.direction == 0) { + this.direction = 1; + } + else if(this.direction == 1) { + this.direction = 0; + } + if(this.speed == 0) { + try { + btn_listeners.client.sendMessage("SET 1 GL " + this.adresse + " " + this.direction + " 0 28 " + funktion_1 + " "+ funktion_2 + " "+ funktion_3 + " " + funktion_4); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + Lok1.speed.setProgress(0); + } + return this.direction; + } + + public void setFunction(int function, int status) { + if(!(this.initialized)) { + if(!(this.initZug())) { + return; + } + } + switch(function) { + case 1: + funktion_1 = status; + break; + case 2: + funktion_2 = status; + break; + case 3: + funktion_3 = status; + break; + case 4: + funktion_4 = status; + break; + } + try { + btn_listeners.client.sendMessage("SET 1 GL " + this.adresse + " " + this.direction + " " + this.speed + " " + maxspeed + " " + funktion_1 + " "+ funktion_2 + " "+ funktion_3 + " " + funktion_4); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void printConfiguration(FileWriter outStream) throws IOException { + outStream.write("\n"); + } + + public void setProperty(String[] words) { + if ( words[1].equalsIgnoreCase("name:")) name = words[2]; + else if (words[1].equalsIgnoreCase("adresse:")) + adresse = Integer.parseInt(words[2]); + else if (words[1].equalsIgnoreCase("maxspeed:")) + maxspeed = Integer.parseInt(words[2]); + } + +} diff --git a/main/res/configuration.txt b/main/res/configuration.txt new file mode 100644 index 0000000..5a49bff --- /dev/null +++ b/main/res/configuration.txt @@ -0,0 +1,17 @@ + + + + + + diff --git a/main/res/drawable-hdpi/drawer_shadow.9.png b/main/res/drawable-hdpi/drawer_shadow.9.png new file mode 100644 index 0000000..236bff5 Binary files /dev/null and b/main/res/drawable-hdpi/drawer_shadow.9.png differ diff --git a/main/res/drawable-hdpi/ic_drawer.png b/main/res/drawable-hdpi/ic_drawer.png new file mode 100644 index 0000000..c59f601 Binary files /dev/null and b/main/res/drawable-hdpi/ic_drawer.png differ diff --git a/main/res/drawable-hdpi/ic_launcher.png b/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/main/res/drawable-hdpi/th.jpeg b/main/res/drawable-hdpi/th.jpeg new file mode 100644 index 0000000..4ec2ec5 Binary files /dev/null and b/main/res/drawable-hdpi/th.jpeg differ diff --git a/main/res/drawable-mdpi/drawer_shadow.9.png b/main/res/drawable-mdpi/drawer_shadow.9.png new file mode 100644 index 0000000..ffe3a28 Binary files /dev/null and b/main/res/drawable-mdpi/drawer_shadow.9.png differ diff --git a/main/res/drawable-mdpi/ic_drawer.png b/main/res/drawable-mdpi/ic_drawer.png new file mode 100644 index 0000000..1ed2c56 Binary files /dev/null and b/main/res/drawable-mdpi/ic_drawer.png differ diff --git a/main/res/drawable-mdpi/ic_launcher.png b/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/main/res/drawable-mdpi/th.jpeg b/main/res/drawable-mdpi/th.jpeg new file mode 100644 index 0000000..4ec2ec5 Binary files /dev/null and b/main/res/drawable-mdpi/th.jpeg differ diff --git a/main/res/drawable-xhdpi/drawer_shadow.9.png b/main/res/drawable-xhdpi/drawer_shadow.9.png new file mode 100644 index 0000000..fabe9d9 Binary files /dev/null and b/main/res/drawable-xhdpi/drawer_shadow.9.png differ diff --git a/main/res/drawable-xhdpi/ic_drawer.png b/main/res/drawable-xhdpi/ic_drawer.png new file mode 100644 index 0000000..a5fa74d Binary files /dev/null and b/main/res/drawable-xhdpi/ic_drawer.png differ diff --git a/main/res/drawable-xhdpi/ic_launcher.png b/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/main/res/drawable-xhdpi/th.jpeg b/main/res/drawable-xhdpi/th.jpeg new file mode 100644 index 0000000..4ec2ec5 Binary files /dev/null and b/main/res/drawable-xhdpi/th.jpeg differ diff --git a/main/res/drawable-xxhdpi/drawer_shadow.9.png b/main/res/drawable-xxhdpi/drawer_shadow.9.png new file mode 100644 index 0000000..b91e9d7 Binary files /dev/null and b/main/res/drawable-xxhdpi/drawer_shadow.9.png differ diff --git a/main/res/drawable-xxhdpi/ic_drawer.png b/main/res/drawable-xxhdpi/ic_drawer.png new file mode 100644 index 0000000..9c4685d Binary files /dev/null and b/main/res/drawable-xxhdpi/ic_drawer.png differ diff --git a/main/res/drawable-xxhdpi/ic_launcher.png b/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/main/res/drawable-xxhdpi/th.jpeg b/main/res/drawable-xxhdpi/th.jpeg new file mode 100644 index 0000000..4ec2ec5 Binary files /dev/null and b/main/res/drawable-xxhdpi/th.jpeg differ diff --git a/main/res/layout/activity_my.xml b/main/res/layout/activity_my.xml new file mode 100644 index 0000000..6d57cb5 --- /dev/null +++ b/main/res/layout/activity_my.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + diff --git a/main/res/layout/fragment_addlok.xml b/main/res/layout/fragment_addlok.xml new file mode 100644 index 0000000..697ca0f --- /dev/null +++ b/main/res/layout/fragment_addlok.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + +