diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c6cbe56
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..ad59d57
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+Tubes1-Android
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..d390b65
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..1a3eaff
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..b0ce46e
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..6564d52
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 5ce4793..cde22c5 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,33 @@
-# IF3111-2016-Tugas1-Android
\ No newline at end of file
+<<<<<<< HEAD
+# Mappie
+Tugas Besar I IF3111
+Android App mencari lokasi-lokasi di ITB dari lokasi yang diberikan oleh server. Pengguna dapat:
+* melihat marker lokasi yang diberikan server
+* mendapatkan reply dari server berbentuk Toast
+* menggunakan intent kamera native dari aplikasi
+* mengetahui arah utara dari kompas
+
+### Screenshots
+#### Map
+Memperlihatkan halaman utama yang berisi Google maps dan marker untuk lokasi pertama.
+
+![map](screenshots/map.png)
+![map-land](screenshots/map-land.png)
+
+
+#### Submit
+Submit page untuk memberikan jawaban
+
+![submit](screenshots/submit.png)
+
+Toast akan diberikan setiap ada response dari server
+
+![toast](screenshots/toast.png)
+
+[src](http://gitlab.informatika.org/ariezanadya/Tubes1-Android/tree/master/app/src/main/java/com/example/atia/tubes1android)
+[apk](http://gitlab.informatika.org/ariezanadya/Tubes1-Android/tree/master/apk-debug.apk)
+
+Arieza Nadya/13512017
+=======
+# IF3111-2016-Tugas1-Android
+>>>>>>> 099a80cba97c50ea788525b655f4ab9669133a24
diff --git a/app-debug.apk b/app-debug.apk
new file mode 100644
index 0000000..18eefa7
Binary files /dev/null and b/app-debug.apk differ
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..32d595e
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,28 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion "23.0.1"
+
+ defaultConfig {
+ applicationId "com.example.atia.tubes1android"
+ minSdkVersion 12
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:23.2.0'
+ compile 'com.android.support:design:23.2.0'
+ compile 'com.google.android.gms:play-services-maps:8.4.0'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..dcaf84c
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\User\AppData\Local\Android\android-sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/app/src/androidTest/java/com/example/atia/tubes1android/ApplicationTest.java b/app/src/androidTest/java/com/example/atia/tubes1android/ApplicationTest.java
new file mode 100644
index 0000000..e637db4
--- /dev/null
+++ b/app/src/androidTest/java/com/example/atia/tubes1android/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.example.atia.tubes1android;
+
+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/app/src/debug/res/values/google_maps_api.xml b/app/src/debug/res/values/google_maps_api.xml
new file mode 100644
index 0000000..0fffbcf
--- /dev/null
+++ b/app/src/debug/res/values/google_maps_api.xml
@@ -0,0 +1,21 @@
+
+
+
+ AIzaSyAB1QP2XHGwyJvEksVGXI0_IjRAdfbls08
+
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..1efa34e
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/example/atia/tubes1android/MapActivity.java b/app/src/main/java/com/example/atia/tubes1android/MapActivity.java
new file mode 100644
index 0000000..59b0b80
--- /dev/null
+++ b/app/src/main/java/com/example/atia/tubes1android/MapActivity.java
@@ -0,0 +1,339 @@
+package com.example.atia.tubes1android;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.location.LocationManager;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.provider.MediaStore;
+import android.provider.Settings;
+import android.support.design.widget.Snackbar;
+import android.support.v4.content.ContextCompat;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.util.Log;
+import android.view.View;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.WindowManager;
+import android.view.animation.Animation;
+import android.view.animation.RotateAnimation;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.Toast;
+
+import com.google.android.gms.maps.CameraUpdateFactory;
+import com.google.android.gms.maps.GoogleMap;
+import com.google.android.gms.maps.OnMapReadyCallback;
+import com.google.android.gms.maps.SupportMapFragment;
+import com.google.android.gms.maps.model.LatLng;
+import com.google.android.gms.maps.model.Marker;
+import com.google.android.gms.maps.model.MarkerOptions;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.nio.charset.StandardCharsets;
+
+public class MapActivity extends AppCompatActivity implements OnMapReadyCallback, SensorEventListener
+{
+
+ private Socket socket;
+ private static GoogleMap mMap;
+ static final boolean FIRST_VAL = true;
+ private boolean first;
+ public static final int SERVERPORT = 3111;
+ public static final String ServerIP = "89.36.220.146";
+ private static String token;
+ private static double lat;
+ private static double lng;
+ private String response;
+ private static Marker marker;
+
+ private ImageView compassImage;
+
+ private SensorManager mSensorManager;
+ private float curDegree = 0f;
+
+ static final int REQUEST_IMAGE_CAPTURE = 1;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_map);
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setTitle("Map");
+
+ if (savedInstanceState != null) {
+ first = savedInstanceState.getBoolean("FIRST_VAL");
+ } else {
+ first = true;
+ }
+
+ Log.i("log", "First: " + first);
+
+ // show map fragment
+ SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
+ .findFragmentById(R.id.map);
+ mapFragment.getMapAsync(this);
+ mapFragment.setRetainInstance(true);
+
+ final ImageButton ibCam = (ImageButton) findViewById(R.id.ibCamera);
+ ibCam.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+// Snackbar.make(v, "Camera Snackbar", Snackbar.LENGTH_SHORT).setAction("Action", null).show();
+ dispatchTakePictureIntent();
+ }
+ });
+
+ final ImageButton ibMes = (ImageButton) findViewById(R.id.ibMessage);
+ ibMes.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ Intent subIntent = new Intent(MapActivity.this, SubmitActivity.class);
+ subIntent.putExtra("LAT_VALUE", lat);
+ subIntent.putExtra("LONG_VALUE", lng);
+ subIntent.putExtra("TOKEN", token);
+ MapActivity.this.startActivity(subIntent);
+ }
+ });
+
+ if (first) {
+ new FirstRequest().execute();
+ first = false;
+ }
+
+ compassImage = (ImageView) findViewById(R.id.compass);
+
+ // initialize sensor
+ mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.menu_map, menu);
+ return true;
+ }
+
+ @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();
+
+ //noinspection SimplifiableIfStatement
+ if (id == R.id.action_settings) {
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ public void onMapReady(GoogleMap googleMap) {
+ mMap = googleMap;
+
+ // check if GPS is enabled
+ checkGPSStatus(this);
+
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
+ == PackageManager.PERMISSION_GRANTED) {
+ mMap.setMyLocationEnabled(true);
+ } else {
+ // Show rationale and request permission.
+ }
+
+ // Add a marker
+// LatLng itb = new LatLng(-6.891453, 107.610642);
+// mMap.addMarker(new MarkerOptions().position(itb).title("Your school dumbass"));
+// mMap.moveCamera(CameraUpdateFactory.newLatLng(itb));
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if(data!=null){
+ // nothing happens?
+ // app will crash if data is null / user presses back key without taking anything... for some reason?
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ mSensorManager.registerListener(this, mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_GAME);
+ if (marker != null) {
+ mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(marker.getPosition(), 7));
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ mSensorManager.unregisterListener(this);
+ }
+
+ @Override
+ public void onSensorChanged(SensorEvent event) {
+ float degree = Math.round(event.values[0]);
+ curDegree = -degree;
+ compassImage.setRotation(curDegree);
+ }
+
+ @Override
+ public void onAccuracyChanged(Sensor sensor, int accuracy) {
+
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle savedInstanceState) {
+ savedInstanceState.putBoolean("FIRST_VAL", first);
+ super.onSaveInstanceState(savedInstanceState);
+ }
+
+ private void dispatchTakePictureIntent() {
+ Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
+ startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
+ }
+ }
+
+ private void checkGPSStatus(final Activity activity) {
+
+ LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
+ boolean enabled = service.isProviderEnabled(LocationManager.GPS_PROVIDER);
+ if (!enabled) {
+// Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
+// startActivity(intent);
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS;
+ final String message = "Please go to Settings to enable GPS";
+
+ builder.setMessage(message).setPositiveButton("Settings", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface d, int id) {
+ activity.startActivity(new Intent(action));
+ d.dismiss();
+ }
+ })
+ .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface d, int id) {
+ d.cancel();
+ }
+ });
+ builder.create().show();
+ }
+ }
+
+ public static void setMarker(LatLng latlong) {
+ if (marker != null) {
+ marker.remove();
+ }
+ marker = mMap.addMarker(new MarkerOptions().position(latlong).title("The Location"));
+ }
+
+ public static void setParam(double newlat, double newlng, String newtoken) {
+ lat = newlat;
+ lng = newlng;
+ token = newtoken;
+ }
+
+ private class FirstRequest extends AsyncTask {
+
+ @Override
+ protected String doInBackground(Void... args) {
+ Socket socket = null;
+ response = null;
+
+ try {
+ Log.i("log", "Connecting to " + ServerIP);
+ socket = new Socket(ServerIP, SERVERPORT);
+
+ JSONObject obj = new JSONObject();
+ obj.put("com", "req_loc");
+ obj.put("nim", "13512017");
+
+ Log.i("log", "requesting first location");
+ Log.i("log", obj.toString());
+
+ PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
+ out.println(obj);
+
+ Handler handler1 = new Handler(Looper.getMainLooper());
+ handler1.post(new Runnable() {
+ public void run() {
+ Toast.makeText(MapActivity.this, "Requesting location", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ response = in.readLine();
+ Log.i("log", response);
+
+ Handler handler = new Handler(Looper.getMainLooper());
+ handler.post(new Runnable() {
+ public void run() {
+ Toast.makeText(MapActivity.this, response, Toast.LENGTH_LONG).show();
+ }
+ });
+
+
+ socket.close();
+
+ return response;
+
+ } catch (JSONException e) {
+ Log.e("log", "json exception occurred");
+ e.printStackTrace();
+ } catch (Exception e) {
+ Log.e("log", "exception occurred");
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(String response) {
+ try {
+ JSONObject jsonresponse = new JSONObject(response);
+ lat = jsonresponse.getDouble("latitude");
+ lng = jsonresponse.getDouble("longitude");
+ token = jsonresponse.getString("token");
+ LatLng latlng = new LatLng(lat, lng);
+
+ Log.i("log", "Location: " + lat + "," + lng);
+ setMarker(latlng);
+ } catch (JSONException e) {
+ Log.e("log", "JSONException occurred");
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/example/atia/tubes1android/SubmitActivity.java b/app/src/main/java/com/example/atia/tubes1android/SubmitActivity.java
new file mode 100644
index 0000000..eaf08c2
--- /dev/null
+++ b/app/src/main/java/com/example/atia/tubes1android/SubmitActivity.java
@@ -0,0 +1,194 @@
+package com.example.atia.tubes1android;
+
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.util.Log;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.Spinner;
+import android.widget.Toast;
+
+import com.google.android.gms.maps.model.LatLng;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.Socket;
+
+public class SubmitActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
+
+ private double lat;
+ private double lng;
+ private String token;
+ private String response;
+ private String answerstr;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_submit);
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setTitle("Submit Answer");
+
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ lat = extras.getDouble("LAT_VALUE");
+ lng = extras.getDouble("LONG_VALUE");
+ token = extras.getString("TOKEN");
+ }
+
+ Spinner spinner = (Spinner) findViewById(R.id.loc_spinner);
+ ArrayAdapter adapter = ArrayAdapter.createFromResource(this,
+ R.array.loc_array, android.R.layout.simple_spinner_item);
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ spinner.setAdapter(adapter);
+ spinner.setOnItemSelectedListener(this);
+
+ final Button submitButton = (Button) findViewById(R.id.submit_button);
+ submitButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ String answer = ((Spinner) findViewById(R.id.loc_spinner)).getSelectedItem().toString();
+ new SubmitLocation().execute(answerstr);
+ }
+ });
+ }
+
+ @Override
+ public void onItemSelected(AdapterView> parent, View view, int position, long id) {
+ switch (position) {
+ case 0:
+ answerstr = "gku_barat";
+ break;
+ case 1:
+ answerstr = "gku_timur";
+ break;
+ case 2:
+ answerstr = "intel";
+ break;
+ case 3:
+ answerstr = "cc_barat";
+ break;
+ case 4:
+ answerstr = "cc_timur";
+ break;
+ case 5:
+ answerstr = "dpr";
+ break;
+ case 6:
+ answerstr = "oktagon";
+ break;
+ case 7:
+ answerstr = "perpustakaan";
+ break;
+ case 8:
+ answerstr = "pau";
+ break;
+ case 9:
+ answerstr = "kubus";
+ break;
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parent) {
+
+ }
+
+ private class SubmitLocation extends AsyncTask {
+
+ @Override
+ protected String doInBackground(String... answer) {
+
+ response = null;
+
+ try {
+
+ JSONObject obj = new JSONObject();
+ obj.put("com", "answer");
+ obj.put("nim", "13512017");
+ obj.put("answer", answerstr);
+ obj.put("longitude", lng);
+ obj.put("latitude", lat);
+ obj.put("token", token);
+
+ Log.i("log", "Submit Request: " + obj.toString());
+
+ Socket socket = new Socket(MapActivity.ServerIP, MapActivity.SERVERPORT);
+
+ PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
+ out.println(obj);
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ response = in.readLine();
+
+ Log.i("log", "Server Response: " + response);
+ Handler handler = new Handler(Looper.getMainLooper());
+ handler.post(new Runnable() {
+ public void run() {
+ Toast.makeText(SubmitActivity.this, response, Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ socket.close();
+
+ return response;
+
+ } catch (JSONException e) {
+ Log.e("log", "jso");
+ e.printStackTrace();
+ } catch (IOException e) {
+ Log.e("log", "ioexception");
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(String response) {
+ try {
+ JSONObject jsonresponse = new JSONObject(response);
+ String status = jsonresponse.getString("status");
+
+ if (status.equals("ok")) {
+ lat = jsonresponse.getDouble("latitude");
+ lng = jsonresponse.getDouble("longitude");
+ token = jsonresponse.getString("token");
+
+ LatLng latlng = new LatLng(lat,lng);
+
+ MapActivity.setParam(lat, lng, token);
+ MapActivity.setMarker(latlng);
+
+ Toast.makeText(SubmitActivity.this, "Location marker set", Toast.LENGTH_SHORT).show();
+
+ } else if (status.equals("wrong_answer")) {
+ Toast.makeText(SubmitActivity.this, "Wrong answer", Toast.LENGTH_LONG).show();
+ } else if (status.equals("err")) {
+ Toast.makeText(SubmitActivity.this, "No NIM or no com", Toast.LENGTH_LONG).show();
+ } else if (status.equals("finish")) {
+ Toast.makeText(SubmitActivity.this, "Finish", Toast.LENGTH_LONG).show();
+ }
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/app/src/main/res/drawable/camera.png b/app/src/main/res/drawable/camera.png
new file mode 100644
index 0000000..a070b0c
Binary files /dev/null and b/app/src/main/res/drawable/camera.png differ
diff --git a/app/src/main/res/drawable/camera20.png b/app/src/main/res/drawable/camera20.png
new file mode 100644
index 0000000..3d45f08
Binary files /dev/null and b/app/src/main/res/drawable/camera20.png differ
diff --git a/app/src/main/res/drawable/pointer.png b/app/src/main/res/drawable/pointer.png
new file mode 100644
index 0000000..9ae6f47
Binary files /dev/null and b/app/src/main/res/drawable/pointer.png differ
diff --git a/app/src/main/res/drawable/pointer20.png b/app/src/main/res/drawable/pointer20.png
new file mode 100644
index 0000000..5ffdd7c
Binary files /dev/null and b/app/src/main/res/drawable/pointer20.png differ
diff --git a/app/src/main/res/drawable/social.png b/app/src/main/res/drawable/social.png
new file mode 100644
index 0000000..2449057
Binary files /dev/null and b/app/src/main/res/drawable/social.png differ
diff --git a/app/src/main/res/drawable/social20.png b/app/src/main/res/drawable/social20.png
new file mode 100644
index 0000000..fb825e5
Binary files /dev/null and b/app/src/main/res/drawable/social20.png differ
diff --git a/app/src/main/res/layout-land/activity_map.xml b/app/src/main/res/layout-land/activity_map.xml
new file mode 100644
index 0000000..7fd11af
--- /dev/null
+++ b/app/src/main/res/layout-land/activity_map.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout-land/content_map.xml b/app/src/main/res/layout-land/content_map.xml
new file mode 100644
index 0000000..1e63700
--- /dev/null
+++ b/app/src/main/res/layout-land/content_map.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout-port/activity_map.xml b/app/src/main/res/layout-port/activity_map.xml
new file mode 100644
index 0000000..7fd11af
--- /dev/null
+++ b/app/src/main/res/layout-port/activity_map.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout-port/content_map.xml b/app/src/main/res/layout-port/content_map.xml
new file mode 100644
index 0000000..d018b77
--- /dev/null
+++ b/app/src/main/res/layout-port/content_map.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_map.xml b/app/src/main/res/layout/activity_map.xml
new file mode 100644
index 0000000..7fd11af
--- /dev/null
+++ b/app/src/main/res/layout/activity_map.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_submit.xml b/app/src/main/res/layout/activity_submit.xml
new file mode 100644
index 0000000..2402644
--- /dev/null
+++ b/app/src/main/res/layout/activity_submit.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/content_map.xml b/app/src/main/res/layout/content_map.xml
new file mode 100644
index 0000000..d018b77
--- /dev/null
+++ b/app/src/main/res/layout/content_map.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/content_submit.xml b/app/src/main/res/layout/content_submit.xml
new file mode 100644
index 0000000..57f5b15
--- /dev/null
+++ b/app/src/main/res/layout/content_submit.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/menu_map.xml b/app/src/main/res/menu/menu_map.xml
new file mode 100644
index 0000000..4a0c668
--- /dev/null
+++ b/app/src/main/res/menu/menu_map.xml
@@ -0,0 +1,10 @@
+
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..251fb9f
--- /dev/null
+++ b/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,9 @@
+>
+
+
+
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..812cb7b
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 16dp
+ 16dp
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..7e2d2d4
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,18 @@
+
+ Tubes 1 Android
+ Settings
+ Map
+ SubmitActivity
+
+ - GKU Barat
+ - GKU Timur
+ - Intel
+ - CC Barat
+ - CC Timur
+ - DPR
+ - Oktagon
+ - Perpustakaan
+ - PAU
+ - Kubus
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..545b9c6
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/release/res/values/google_maps_api.xml b/app/src/release/res/values/google_maps_api.xml
new file mode 100644
index 0000000..fa88c61
--- /dev/null
+++ b/app/src/release/res/values/google_maps_api.xml
@@ -0,0 +1,22 @@
+
+
+
+ YOUR_KEY_HERE
+
+
diff --git a/app/src/test/java/com/example/atia/tubes1android/ExampleUnitTest.java b/app/src/test/java/com/example/atia/tubes1android/ExampleUnitTest.java
new file mode 100644
index 0000000..5b8be7b
--- /dev/null
+++ b/app/src/test/java/com/example/atia/tubes1android/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.example.atia.tubes1android;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..e0b366a
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.5.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..05ef575
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..f23df6e
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Oct 21 11:34:03 PDT 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/screenshots/Screenshot_2016-03-27-23-35-15.png b/screenshots/Screenshot_2016-03-27-23-35-15.png
new file mode 100644
index 0000000..359ac0b
Binary files /dev/null and b/screenshots/Screenshot_2016-03-27-23-35-15.png differ
diff --git a/screenshots/map.png b/screenshots/map.png
new file mode 100644
index 0000000..0719c92
Binary files /dev/null and b/screenshots/map.png differ
diff --git a/screenshots/map_land.png b/screenshots/map_land.png
new file mode 100644
index 0000000..bfe7504
Binary files /dev/null and b/screenshots/map_land.png differ
diff --git a/screenshots/submit.png b/screenshots/submit.png
new file mode 100644
index 0000000..31ed77b
Binary files /dev/null and b/screenshots/submit.png differ
diff --git a/screenshots/toast.png b/screenshots/toast.png
new file mode 100644
index 0000000..359ac0b
Binary files /dev/null and b/screenshots/toast.png differ
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'