reformat code (auto ident), optimize imports, refs #9991
This commit is contained in:
@@ -4,14 +4,16 @@
|
||||
android:versionCode="1"
|
||||
android:versionName="0.4">
|
||||
|
||||
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="21" />
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
android:targetSdkVersion="21" />
|
||||
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
||||
@@ -19,23 +21,28 @@
|
||||
In most cases you can leave this as-is, but you if you want to provide
|
||||
additional functionality it is fine to subclass or reimplement
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<application android:name="io.flutter.app.FlutterApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher">
|
||||
<activity android:name="com.dinect.checker.MainActivity"
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name">
|
||||
<activity
|
||||
android:name="com.dinect.checker.MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
|
||||
android:hardwareAccelerated="true"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="com.dinect.checker.CameraActivity"
|
||||
<activity
|
||||
android:name="com.dinect.checker.CameraActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme"/>
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".zxing.ScannerActivity"
|
||||
|
||||
@@ -1,71 +1,41 @@
|
||||
package com.dinect.checker;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.Camera;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.graphics.*;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.content.res.Resources;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.View;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.Window;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Button;
|
||||
import android.graphics.Rect;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.CameraInfo;
|
||||
import android.hardware.Camera.PreviewCallback;
|
||||
import android.hardware.Camera.AutoFocusCallback;
|
||||
import android.hardware.Camera.Parameters;
|
||||
import android.hardware.Camera.Size;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.graphics.ImageFormat;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.HashMap;
|
||||
import net.sourceforge.zbar.ImageScanner;
|
||||
|
||||
import net.sourceforge.zbar.Config;
|
||||
import net.sourceforge.zbar.Image;
|
||||
import net.sourceforge.zbar.ImageScanner;
|
||||
import net.sourceforge.zbar.Symbol;
|
||||
import net.sourceforge.zbar.SymbolSet;
|
||||
import net.sourceforge.zbar.Config;
|
||||
import android.graphics.YuvImage;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Display;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.Exception;
|
||||
import java.lang.Thread;
|
||||
import java.util.List;
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
|
||||
import io.flutter.plugin.common.MethodChannel.Result;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.*;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.LayoutInflater;
|
||||
import com.dinect.checker.Utils;
|
||||
import com.dinect.checker.R;
|
||||
|
||||
public class CameraActivity extends AppCompatActivity implements Camera.PreviewCallback {
|
||||
|
||||
@@ -95,7 +65,7 @@ public class CameraActivity extends AppCompatActivity implements Camera.PreviewC
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if(!isCameraAvailable()) {
|
||||
if (!isCameraAvailable()) {
|
||||
// Cancel request if there is no rear-facing camera.
|
||||
cancelRequest();
|
||||
return;
|
||||
@@ -154,7 +124,7 @@ public class CameraActivity extends AppCompatActivity implements Camera.PreviewC
|
||||
|
||||
// Open the default i.e. the first rear facing camera.
|
||||
mCamera = Camera.open();
|
||||
if(mCamera == null) {
|
||||
if (mCamera == null) {
|
||||
// Cancel request if mCamera is null.
|
||||
cancelRequest();
|
||||
return;
|
||||
@@ -231,7 +201,7 @@ public class CameraActivity extends AppCompatActivity implements Camera.PreviewC
|
||||
|
||||
private Runnable doAutoFocus = new Runnable() {
|
||||
public void run() {
|
||||
if(mCamera != null && mPreviewing) {
|
||||
if (mCamera != null && mPreviewing) {
|
||||
mCamera.autoFocus(autoFocusCB);
|
||||
}
|
||||
}
|
||||
@@ -303,7 +273,7 @@ public class CameraActivity extends AppCompatActivity implements Camera.PreviewC
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if(code == 204) {
|
||||
} else if (code == 204) {
|
||||
mPreviewing = true;
|
||||
Toast.makeText(this, "Пользователь с таким id не найден", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.dinect.checker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.hardware.Camera;
|
||||
import android.hardware.Camera.CameraInfo;
|
||||
import android.hardware.Camera.AutoFocusCallback;
|
||||
import android.hardware.Camera.CameraInfo;
|
||||
import android.hardware.Camera.PreviewCallback;
|
||||
import android.hardware.Camera.Size;
|
||||
import android.util.Log;
|
||||
@@ -13,6 +13,7 @@ import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -79,7 +80,7 @@ class CameraPreview extends ViewGroup implements SurfaceHolder.Callback {
|
||||
previewHeight = mPreviewSize.height;
|
||||
}
|
||||
|
||||
child.layout(0, 0,width, height);
|
||||
child.layout(0, 0, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +147,7 @@ class CameraPreview extends ViewGroup implements SurfaceHolder.Callback {
|
||||
}
|
||||
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
|
||||
if (holder.getSurface() == null){
|
||||
if (holder.getSurface() == null) {
|
||||
// preview surface does not exist
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.dinect.checker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
||||
public class Utils {
|
||||
|
||||
private Utils() {}
|
||||
private Utils() {
|
||||
}
|
||||
|
||||
public static boolean isOnline(Context context) {
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
@@ -2,51 +2,57 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/rootLayout"
|
||||
android:background="@android:color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View android:layout_height="0dp"
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="56dp"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_width="match_parent"
|
||||
android:background="#с0000000"
|
||||
android:layout_marginBottom="56dp"/>
|
||||
android:background="#с0000000" />
|
||||
|
||||
<View android:layout_height="0dp"
|
||||
android:layout_weight="0.5"
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:background="#с0000000"
|
||||
android:layout_marginTop="56dp"/>
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="56dp"
|
||||
android:layout_weight="0.5"
|
||||
android:background="#с0000000" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View android:layout_width="match_parent"
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="#00ff00"
|
||||
android:layout_marginBottom="56dp"/>
|
||||
android:layout_marginBottom="56dp"
|
||||
android:background="#00ff00" />
|
||||
|
||||
<View android:layout_width="match_parent"
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="#00ff00"
|
||||
android:layout_marginTop="56dp"/>
|
||||
android:layout_marginTop="56dp"
|
||||
android:background="#00ff00" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="#eb0004"
|
||||
app:titleTextColor="@android:color/white"/>
|
||||
app:titleTextColor="@android:color/white" />
|
||||
|
||||
<View android:id="@+id/toolbarShadow"
|
||||
<View
|
||||
android:id="@+id/toolbarShadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dp"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:background="@drawable/shadow_bottom"/>
|
||||
android:background="@drawable/shadow_bottom" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/white">
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|left"
|
||||
android:textColor="@android:color/black"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/logout_title" />
|
||||
android:gravity="center_vertical|left"
|
||||
android:text="@string/logout_title"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:scaleType="center"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/logout_text"
|
||||
android:textColor="@android:color/black"
|
||||
android:text="@string/logout_text" />
|
||||
android:textSize="18sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -37,23 +37,23 @@
|
||||
android:id="@+id/positiveButton"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="42dp"
|
||||
android:scaleType="center"
|
||||
android:layout_gravity="right|end"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:scaleType="center"
|
||||
android:text="@string/logout_yes"
|
||||
android:textColor="#eb0004"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/logout_yes" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/negativeButton"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginRight="64dp"
|
||||
android:layout_gravity="right|end"
|
||||
android:layout_marginRight="64dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/logout_no"
|
||||
android:textColor="#eb0004"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/logout_no" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user