-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
399 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/build | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
app/src/main/java/com/example/user/pointie/AddImageActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.example.user.pointie; | ||
|
||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.os.Environment; | ||
import android.provider.MediaStore; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.design.widget.Snackbar; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.Button; | ||
|
||
import java.io.File; | ||
|
||
public class AddImageActivity extends AppCompatActivity { | ||
private File imageFile; | ||
private String filePath; | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_add_image); | ||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
|
||
} | ||
|
||
public void process(View view) | ||
{ | ||
|
||
filePath = Environment.getExternalStorageDirectory() + "/" + System.currentTimeMillis() + ".jpeg"; | ||
|
||
File file = new File(filePath); | ||
|
||
Uri output = Uri.fromFile(file); | ||
|
||
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); | ||
|
||
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, output); | ||
|
||
startActivityForResult(cameraIntent, 0); | ||
|
||
} | ||
|
||
@Override | ||
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
|
||
switch (requestCode) { | ||
case RESULT_OK: | ||
|
||
Log.i( "MakeMachine", "resultCode: " + resultCode ); | ||
switch( resultCode ) | ||
{ | ||
case 0: | ||
Log.i( "MakeMachine", "User cancelled" ); | ||
break; | ||
case -1: | ||
//Bitmap bm = BitmapFactory.decodeFile(filePath); | ||
break; | ||
} | ||
break; | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package com.example.user.pointie; | ||
|
||
import android.os.AsyncTask; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
|
||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
import com.fasterxml.jackson.databind.JavaType; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
import org.apache.http.HttpResponse; | ||
import org.apache.http.client.methods.HttpGet; | ||
import org.apache.http.impl.client.DefaultHttpClient; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by user on 7/5/2017. | ||
*/ | ||
|
||
public class AsyncHttp extends AsyncTask<Void, Void, ArrayList<String> > | ||
{ | ||
String url; | ||
ArrayList<String> arraylistitem; | ||
public AsyncHttp() | ||
{ | ||
arraylistitem = new ArrayList<String>(); | ||
if(url=="") this.url= new String(); | ||
else this.url = url; | ||
} | ||
|
||
|
||
@Override | ||
protected ArrayList<String> doInBackground(Void ...params) | ||
{ | ||
String[] images = {" ", " "};; | ||
DefaultHttpClient client = new DefaultHttpClient(); | ||
HttpGet request = new HttpGet("https://gitlab.com/snippets/1661382/raw"); | ||
HttpResponse response = null; | ||
try { | ||
response = client.execute(request); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
BufferedReader rd = null; | ||
try { | ||
rd = new BufferedReader | ||
(new InputStreamReader( | ||
response.getEntity().getContent())); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
String lines = new String(); | ||
String line = ""; | ||
StringBuilder stringBuilder = new StringBuilder(); | ||
try { | ||
while ((line = rd.readLine()) != null) { | ||
stringBuilder.append(line); | ||
// textView.append(line); | ||
} | ||
lines = stringBuilder.toString(); | ||
Log.v("Json", lines); | ||
|
||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
ObjectMapper mapper = new ObjectMapper(); | ||
try { | ||
JavaType type = mapper.getTypeFactory().constructCollectionType(ArrayList.class, ImagePojo.class); | ||
|
||
images= mapper.readValue(lines, String[].class); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
if (images==null) | ||
arraylistitem = new ArrayList<String>( Arrays.asList(images)); | ||
ArrayList<String> s = new ArrayList<String>(); | ||
s.add(lines); | ||
return s; | ||
// return arraylistitem; | ||
|
||
} | ||
@Override | ||
protected void onPostExecute( ArrayList<String> array) { | ||
super.onPostExecute(array); | ||
onResponse(array); | ||
} | ||
public void onResponse(ArrayList<String> array) { | ||
|
||
} | ||
|
||
|
||
} |
80 changes: 80 additions & 0 deletions
80
app/src/main/java/com/example/user/pointie/ImageAdapter.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context="com.example.user.pointie.AddImageActivity"> | ||
|
||
<android.support.design.widget.AppBarLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:theme="@style/AppTheme.AppBarOverlay"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="?attr/colorPrimary" | ||
app:popupTheme="@style/AppTheme.PopupOverlay" /> | ||
|
||
</android.support.design.widget.AppBarLayout> | ||
|
||
<include layout="@layout/content_add_image" | ||
android:id="@+id/include" /> | ||
|
||
<Button | ||
android:id="@+id/button3" | ||
android:layout_width="145dp" | ||
android:layout_height="107dp" | ||
android:layout_marginBottom="25dp" | ||
android:layout_gravity="center_vertical|center_horizontal" | ||
android:text="Upload it!" | ||
app:layout_anchor="@+id/include" | ||
app:layout_anchorGravity="bottom|center_horizontal" /> | ||
|
||
<Button | ||
android:id="@+id/button4" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom|center_horizontal" | ||
android:text="Camera" | ||
android:onClick="process" | ||
app:layout_anchor="@+id/include" | ||
app:layout_anchorGravity="center_vertical|center_horizontal" /> | ||
|
||
<EditText | ||
android:id="@+id/editText" | ||
android:layout_marginTop="205dp" | ||
android:layout_marginLeft="70dp" | ||
android:layout_width="wrap_content" | ||
android:layout_height="57dp" | ||
android:ems="10" | ||
android:inputType="textPersonName" | ||
android:text="City" /> | ||
|
||
|
||
</android.support.design.widget.CoordinatorLayout> |
Oops, something went wrong.