Merge branch 'master' of https://git.dirt.kz/igor/ASDC
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package kz.istt.locust;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Bundle;
|
||||
@ -9,6 +11,7 @@ import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.webkit.URLUtil;
|
||||
|
||||
/*import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpVersion;
|
||||
@ -121,6 +124,7 @@ public class MySynchronizationOld
|
||||
MySynchronizationOld(Context context)
|
||||
{
|
||||
_context = context;
|
||||
loadURL();
|
||||
|
||||
String appPath = _context.getApplicationContext().getFilesDir().getAbsolutePath();
|
||||
//Thread for downloading from Internet
|
||||
@ -128,6 +132,16 @@ public class MySynchronizationOld
|
||||
myThread.start(); //Стартуем поток
|
||||
}
|
||||
|
||||
//Download setup from local storage
|
||||
public void loadURL()
|
||||
{
|
||||
String URL = MySynchronizationOld.URL;
|
||||
SharedPreferences prefs = _context.getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE);
|
||||
URL = prefs.getString("URL", "");
|
||||
if(URLUtil.isValidUrl(URL))
|
||||
MySynchronizationOld.URL = URL;
|
||||
}
|
||||
|
||||
/*public static HttpClient getTestHttpClient() {
|
||||
try {
|
||||
SSLContextBuilder builder = new SSLContextBuilder();
|
||||
|
||||
@ -12,13 +12,18 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.webkit.URLUtil;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.text.TextWatcher;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.vision.Frame;
|
||||
import com.google.android.gms.vision.barcode.Barcode;
|
||||
@ -54,6 +59,7 @@ public class SetupActivity extends Activity {
|
||||
public Button btnAr = null;
|
||||
public Button btnQR = null;
|
||||
public Button btnDeleteAllData = null;
|
||||
public EditText edtURL = null;
|
||||
public CheckBox cbIdentifyCountryRegion = null;
|
||||
public CheckBox cbShowAdvancedSettings = null;
|
||||
|
||||
@ -310,6 +316,27 @@ public class SetupActivity extends Activity {
|
||||
cbShowAdvancedSettings = (CheckBox) findViewById(R.id.cbShowAdvancedSettings);
|
||||
cbShowAdvancedSettings.setOnClickListener(oclShowAdvancedSettings);
|
||||
|
||||
edtURL = (EditText) findViewById(R.id.edtURL);
|
||||
edtURL.setText(MySynchronizationOld.URL);
|
||||
|
||||
edtURL.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if (URLUtil.isValidUrl(editable.toString())) {
|
||||
SharedPreferences prefs = SetupActivity.this.getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putString("URL", editable.toString());
|
||||
editor.apply(); // or editor.commit(); if you want to save synchronously
|
||||
MySynchronizationOld.URL = editable.toString();
|
||||
} else {
|
||||
Toast.makeText(SetupActivity.this, "Invalid URL", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Button delete all data
|
||||
OnClickListener oclDeleteAllData = new OnClickListener()
|
||||
|
||||
@ -244,7 +244,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/edtCalibrWidthCard0"
|
||||
android:id="@+id/edtURL"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
Reference in New Issue
Block a user