Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions PrinterApp/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "android.app.printerapp"
minSdkVersion 14
targetSdkVersion 20
targetSdkVersion 23
versionName 1.0 + ";" + computeVersionName()
versionCode System.getenv("BUILD_NUMBER") as Integer ?: 0

// useLibrary 'org.apache.http.legacy'
}

buildTypes {
Expand Down Expand Up @@ -52,27 +53,31 @@ def computeVersionName() {
repositories {
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}

dependencies {
compile 'com.android.support:support-v4:21.+'
compile 'com.android.support:support-v4:23.1.1'
compile files('libs/autobahn-0.5.0.jar')
compile files('libs/devsmartlib.jar')
compile files('libs/jmdns.jar')
// compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/core-1.51.0.0.jar')
compile "cz.msebera.android:httpclient:4.4.1.1"
//UI libraries
compile project(':horizontallistlibrary')
compile 'uk.co.androidalliance:edgeeffectoverride:1.0.2' //Scroll mode effect
//Material design libraries
compile "com.android.support:appcompat-v7:21.0.+"
compile 'com.android.support:cardview-v7:21.+'
compile 'com.github.navasmdc:MaterialDesign:1.+@aar'
compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.1'
compile "com.android.support:appcompat-v7:23.1.1"
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.6'
compile project(':materialdesignlibrary')
compile 'com.afollestad:material-dialogs:0.6.1.6' //Material design dialogs
compile('com.github.afollestad.material-dialogs:core:0.8.5.6@aar') {
transitive = true
}
compile 'com.pnikosis:materialish-progress:1.4'
compile 'com.rengwuxian.materialedittext:library:1.8.2'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/android-async-http-1.4.9.jar')
}
Binary file removed PrinterApp/app/libs/android-async-http-1.4.6.jar
Binary file not shown.
Binary file added PrinterApp/app/libs/android-async-http-1.4.9.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import android.widget.CheckBox;
import android.widget.EditText;

import com.afollestad.materialdialogs.MaterialDialogCompat;
import com.afollestad.materialdialogs.AlertDialogWrapper;

import java.io.File;

Expand All @@ -41,7 +41,7 @@ public FinishDialog(Context context, ModelPrinter p){
public void createDialog(){

//Constructor
MaterialDialogCompat.Builder adb = new MaterialDialogCompat.Builder(mContext);
AlertDialogWrapper.Builder adb = new AlertDialogWrapper.Builder(mContext);
adb.setTitle(mContext.getString(R.string.finish_dialog_title) + " " + mPrinter.getJob().getFilename());

//Inflate the view
Expand Down Expand Up @@ -107,7 +107,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
public void createFinishDialogSave(final ModelPrinter m, final File file) {

//Constructor
MaterialDialogCompat.Builder adb = new MaterialDialogCompat.Builder(mContext);
AlertDialogWrapper.Builder adb = new AlertDialogWrapper.Builder(mContext);
adb.setTitle(m.getDisplayName() + " (100%) - " +file.getName());

//Inflate the view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import android.view.View.OnClickListener;
import android.widget.FrameLayout;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.HttpHostConnectException;
import org.apache.http.impl.client.DefaultHttpClient;

import java.io.IOException;
import java.net.URI;

import cz.msebera.android.httpclient.HttpResponse;
import cz.msebera.android.httpclient.client.methods.HttpGet;
import cz.msebera.android.httpclient.impl.client.DefaultHttpClient;

/**
* This class will handle the Camera connection.
* The device camera will stream on MJPEG.
Expand Down Expand Up @@ -103,7 +101,7 @@ protected MjpegInputStream doInBackground(String... url) {


HttpResponse res = null;
DefaultHttpClient httpclient = new DefaultHttpClient();
DefaultHttpClient httpclient = new DefaultHttpClient();

try {
res = httpclient.execute(new HttpGet(URI.create(url[0])));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import android.widget.RadioGroup;
import android.widget.TextView;

import com.afollestad.materialdialogs.AlertDialogWrapper;
import com.afollestad.materialdialogs.MaterialDialog;
import com.afollestad.materialdialogs.MaterialDialogCompat;
import com.rengwuxian.materialedittext.MaterialEditText;

import java.io.File;
Expand Down Expand Up @@ -359,7 +359,7 @@ public void optionSearchLibrary() {

final EditText et = new EditText(getActivity());

MaterialDialogCompat.Builder adb = new MaterialDialogCompat.Builder(getActivity());
AlertDialogWrapper.Builder adb = new AlertDialogWrapper.Builder(getActivity());
adb.setTitle(R.string.library_search_dialog_title);
adb.setView(et);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package android.app.printerapp.library;

import android.app.AlertDialog;
import android.app.printerapp.Log;
import android.app.printerapp.R;
import android.app.printerapp.viewer.DataStorage;
Expand All @@ -14,6 +13,7 @@
import android.graphics.Bitmap;
import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
Expand All @@ -40,7 +40,7 @@
*/
public class LibraryModelCreation {

static AlertDialog mAlert;
static MaterialDialog mAlert;
static String mName;
public static ViewerSurfaceView mSnapshotSurface;
public static FrameLayout mSnapshotLayout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
import com.loopj.android.http.ResponseHandlerInterface;
import com.loopj.android.http.SyncHttpClient;

import org.apache.http.HttpEntity;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPatch;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContexts;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import javax.net.ssl.SSLContext;

import cz.msebera.android.httpclient.HttpEntity;
import cz.msebera.android.httpclient.client.ClientProtocolException;
import cz.msebera.android.httpclient.client.methods.CloseableHttpResponse;
import cz.msebera.android.httpclient.client.methods.HttpPatch;
import cz.msebera.android.httpclient.conn.ssl.SSLConnectionSocketFactory;
import cz.msebera.android.httpclient.impl.client.CloseableHttpClient;
import cz.msebera.android.httpclient.impl.client.HttpClientBuilder;
import cz.msebera.android.httpclient.ssl.SSLContexts;

/**
* Static class to handle Http requests with the old API or the new one (with API_KEY)
* @author alberto-baeza
Expand Down Expand Up @@ -87,7 +87,7 @@ public static void patch(Context context, String url, HttpEntity entity, String
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslContext,
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
CloseableHttpClient httpClient= HttpClientBuilder.create()
CloseableHttpClient httpClient= HttpClientBuilder.create()
.setSSLSocketFactory(sslsf)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

import com.loopj.android.http.JsonHttpResponseHandler;

import org.apache.http.Header;
import org.apache.http.entity.StringEntity;
import org.json.JSONException;
import org.json.JSONObject;

Expand All @@ -26,6 +24,9 @@
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;

import cz.msebera.android.httpclient.Header;
import cz.msebera.android.httpclient.entity.StringEntity;

/**
* Created by alberto-baeza on 11/21/14.
*/
Expand All @@ -46,7 +47,9 @@ public static void getAuth(final Context context, final ModelPrinter p, final bo
HttpClientHandler.get(p.getAddress() + HttpUtils.URL_AUTHENTICATION, null, new JsonHttpResponseHandler(){

@Override
public void onProgress(int bytesWritten, int totalSize) {
public void onFailure(int statusCode, cz.msebera.android.httpclient.Header[] headers, String responseString, Throwable throwable) {
super.onFailure(statusCode, headers, responseString, throwable);
Log.i("Connection", "Failure! " + responseString);
}

@Override
Expand All @@ -61,13 +64,6 @@ public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
e.printStackTrace();
}
}

@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
super.onFailure(statusCode, headers, responseString, throwable);

Log.i("Connection", "Failure! " + responseString);
}
});

}
Expand Down Expand Up @@ -118,11 +114,6 @@ public static void postAuth(final Context context, String key, final ModelPrinte
HttpClientHandler.post(context, p.getAddress() + HttpUtils.URL_AUTHENTICATION,
entity, "application/json", new JsonHttpResponseHandler() {

//Override onProgress because it's faulty
@Override
public void onProgress(int bytesWritten, int totalSize) {
}

@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
super.onSuccess(statusCode, headers, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@
import com.afollestad.materialdialogs.MaterialDialog;
import com.loopj.android.http.JsonHttpResponseHandler;

import org.apache.http.Header;
import org.apache.http.entity.StringEntity;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

import cz.msebera.android.httpclient.Header;
import cz.msebera.android.httpclient.entity.StringEntity;
import de.tavendo.autobahn.WebSocketConnection;
import de.tavendo.autobahn.WebSocketException;
import de.tavendo.autobahn.WebSocketHandler;
Expand Down Expand Up @@ -76,20 +75,12 @@ public static void startConnection(String url, final Context context, String por
entity = new StringEntity(object.toString(), "UTF-8");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

Log.i("Profile", "Start connection on " + profile);

HttpClientHandler.post(context,url + HttpUtils.URL_CONNECTION,
entity, "application/json", new JsonHttpResponseHandler(){

//Override onProgress because it's faulty
@Override
public void onProgress(int bytesWritten, int totalSize) {
}

@Override
public void onFailure(int statusCode, Header[] headers,
String responseString, Throwable throwable) {
Expand All @@ -100,9 +91,7 @@ public void onFailure(int statusCode, Header[] headers,
super.onFailure(statusCode, headers, responseString, throwable);
}

});


});

}
public static void disconnect(Context context, String url){
Expand All @@ -114,29 +103,15 @@ public static void disconnect(Context context, String url){
entity = new StringEntity(object.toString(), "UTF-8");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

HttpClientHandler.post(context,url + HttpUtils.URL_CONNECTION,
entity, "application/json", new JsonHttpResponseHandler(){

//Override onProgress because it's faulty
@Override
public void onProgress(int bytesWritten, int totalSize) {
}
});
entity, "application/json", new JsonHttpResponseHandler());
}

public static void getLinkedConnection(final Context context, final ModelPrinter p){

HttpClientHandler.get(p.getAddress() + HttpUtils.URL_CONNECTION, null, new JsonHttpResponseHandler(){

@Override
public void onProgress(int bytesWritten, int totalSize) {

}

@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
super.onSuccess(statusCode, headers, response);
Expand Down Expand Up @@ -375,17 +350,10 @@ public static void getUpdatedSettings(final ModelPrinter p, String profile){

HttpClientHandler.get(p.getAddress() + HttpUtils.URL_PROFILES + "/" + profile, null, new JsonHttpResponseHandler(){


@Override
public void onProgress(int bytesWritten, int totalSize) {

}

@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
super.onSuccess(statusCode, headers, response);


Log.i("Connection", response.toString());

try {
Expand Down Expand Up @@ -470,14 +438,6 @@ public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
} catch (JSONException e) {
e.printStackTrace();
}



}

@Override
public void onProgress(int bytesWritten, int totalSize) {

}

@Override
Expand Down Expand Up @@ -507,18 +467,11 @@ public static void setSettings(final ModelPrinter p, String newName, final Strin
entity = new StringEntity(object.toString(), "UTF-8");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

HttpClientHandler.post(context, p.getAddress() + HttpUtils.URL_SETTINGS,
entity, "application/json", new JsonHttpResponseHandler() {

//Override onProgress because it's faulty
@Override
public void onProgress(int bytesWritten, int totalSize) {
}

@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
super.onSuccess(statusCode, headers, response);
Expand Down
Loading