Новые ассеты, диалог выглядит в стиле приложения
This commit is contained in:
@@ -61,6 +61,7 @@ import android.app.DialogFragment;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import com.dinect.checker.R;
|
import com.dinect.checker.R;
|
||||||
|
|
||||||
public class CameraActivity extends AppCompatActivity implements SurfaceHolder.Callback {
|
public class CameraActivity extends AppCompatActivity implements SurfaceHolder.Callback {
|
||||||
@@ -75,6 +76,7 @@ public class CameraActivity extends AppCompatActivity implements SurfaceHolder.C
|
|||||||
private Handler autoFocusHandler;
|
private Handler autoFocusHandler;
|
||||||
private int mOffset;
|
private int mOffset;
|
||||||
private String mToken;
|
private String mToken;
|
||||||
|
private LogoutDialogFragment mDialog;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("iconv");
|
System.loadLibrary("iconv");
|
||||||
@@ -221,12 +223,14 @@ public class CameraActivity extends AppCompatActivity implements SurfaceHolder.C
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
|
||||||
if (item.getItemId() == R.id.logout) {
|
if (item.getItemId() == R.id.logout) {
|
||||||
LogoutDialogFragment newFragment = new LogoutDialogFragment();
|
mDialog = new LogoutDialogFragment();
|
||||||
newFragment.show(getFragmentManager(), "logout");
|
mDialog.show(getFragmentManager(), "logout");
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.faq) {
|
} else if (item.getItemId() == R.id.faq) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
@@ -329,7 +333,6 @@ public class CameraActivity extends AppCompatActivity implements SurfaceHolder.C
|
|||||||
|
|
||||||
AutoFocusCallback autoFocusCallback = new AutoFocusCallback() {
|
AutoFocusCallback autoFocusCallback = new AutoFocusCallback() {
|
||||||
public void onAutoFocus(boolean success, Camera camera) {
|
public void onAutoFocus(boolean success, Camera camera) {
|
||||||
Log.d("kifio", String.valueOf(success));
|
|
||||||
autoFocusHandler.postDelayed(doAutoFocus, 1000);
|
autoFocusHandler.postDelayed(doAutoFocus, 1000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -338,7 +341,7 @@ public class CameraActivity extends AppCompatActivity implements SurfaceHolder.C
|
|||||||
|
|
||||||
private CameraActivity mActivity;
|
private CameraActivity mActivity;
|
||||||
private String mCode = "";
|
private String mCode = "";
|
||||||
private String mUrl = "http://pos-api-autoclub.dinect.com/20130701/?auto=";
|
private String mUrl = "https://pos-api-int.dinect.com/20130701/?auto=";
|
||||||
private String mCard = "";
|
private String mCard = "";
|
||||||
private String mToken = "";
|
private String mToken = "";
|
||||||
|
|
||||||
@@ -361,7 +364,7 @@ public class CameraActivity extends AppCompatActivity implements SurfaceHolder.C
|
|||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.addHeader("DM-Authorization", "dmapptoken bdea0f3ba9034b688019a7cac753d1209e2b227f")
|
.addHeader("DM-Authorization", "dmapptoken 9fec83cdca38c357e6b65dbb17514cdd36bf2a08")
|
||||||
.addHeader("Authorization", "dmtoken " + mToken)
|
.addHeader("Authorization", "dmtoken " + mToken)
|
||||||
.url(mUrl)
|
.url(mUrl)
|
||||||
.build();
|
.build();
|
||||||
@@ -384,28 +387,48 @@ public class CameraActivity extends AppCompatActivity implements SurfaceHolder.C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LogoutDialogFragment extends DialogFragment {
|
void dismissDialog() {
|
||||||
@Override
|
if (mDialog != null) {
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
mDialog.dismiss();
|
||||||
// Use the Builder class for convenient dialog construction
|
mDialog = null;
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
}
|
||||||
builder.setTitle("Подтверждение");
|
}
|
||||||
builder.setMessage("Вы действительно хотите выйти и ввести другой номер магазина?")
|
|
||||||
.setPositiveButton("Да", new DialogInterface.OnClickListener() {
|
void logout() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
dismissDialog();
|
||||||
dialog.dismiss();
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra("item", "logout");
|
intent.putExtra("item", "logout");
|
||||||
getActivity().setResult(RESULT_OK, intent);
|
setResult(RESULT_OK, intent);
|
||||||
getActivity().finish();
|
finish();
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.setNegativeButton("Нет", new DialogInterface.OnClickListener() {
|
public static class LogoutDialogFragment extends DialogFragment {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
dialog.dismiss();
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
|
View content = inflater.inflate(R.layout.f_logout_dialog, null);
|
||||||
|
builder.setView(content);
|
||||||
|
View positiveButton = content.findViewById(R.id.positiveButton);
|
||||||
|
View negativeButton = content.findViewById(R.id.negativeButton);
|
||||||
|
|
||||||
|
negativeButton.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Log.d("kifio", "Negative click!");
|
||||||
|
((CameraActivity) getActivity()).dismissDialog();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Create the AlertDialog object and return it
|
|
||||||
|
positiveButton.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Log.d("kifio", "Positive click!");
|
||||||
|
((CameraActivity) getActivity()).logout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
60
android/app/src/main/res/layout/f_logout_dialog.xml
Normal file
60
android/app/src/main/res/layout/f_logout_dialog.xml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<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">
|
||||||
|
|
||||||
|
<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:fontFamily="sans-serif-medium"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="@string/logout_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginLeft="24dp"
|
||||||
|
android:layout_marginRight="24dp"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:text="@string/logout_text" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="24dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
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:textColor="#eb0004"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/logout_yes" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/negativeButton"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="42dp"
|
||||||
|
android:layout_marginRight="64dp"
|
||||||
|
android:layout_gravity="right|end"
|
||||||
|
android:fontFamily="sans-serif-medium"
|
||||||
|
android:textColor="#eb0004"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/logout_no" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -4,4 +4,8 @@
|
|||||||
<string name="scan">Сканировать</string>
|
<string name="scan">Сканировать</string>
|
||||||
<string name="faq">FAQ</string>
|
<string name="faq">FAQ</string>
|
||||||
<string name="logout">Выход</string>
|
<string name="logout">Выход</string>
|
||||||
|
<string name="logout_title">Подтверждение</string>
|
||||||
|
<string name="logout_text">Вы действительно хотите выйти и ввести другой номер магазина?</string>
|
||||||
|
<string name="logout_yes">Да</string>
|
||||||
|
<string name="logout_no">Нет</string>
|
||||||
</resources>
|
</resources>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 147 KiB |
BIN
assets/splash_text.png
Normal file
BIN
assets/splash_text.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
@@ -11,8 +11,6 @@ abstract class BaseState<T> extends State<T> {
|
|||||||
String error = null;
|
String error = null;
|
||||||
String textFieldValue = '';
|
String textFieldValue = '';
|
||||||
|
|
||||||
TextEditingController controller = new TextEditingController();
|
|
||||||
|
|
||||||
@override Widget build(BuildContext context) {
|
@override Widget build(BuildContext context) {
|
||||||
return new Scaffold(appBar: getAppBar(context), body: getBody(context));
|
return new Scaffold(appBar: getAppBar(context), body: getBody(context));
|
||||||
}
|
}
|
||||||
@@ -108,7 +106,6 @@ abstract class BaseState<T> extends State<T> {
|
|||||||
return new TextField(keyboardType: TextInputType.number,
|
return new TextField(keyboardType: TextInputType.number,
|
||||||
decoration: new InputDecoration.collapsed(hintText: getHint(),
|
decoration: new InputDecoration.collapsed(hintText: getHint(),
|
||||||
hintStyle: new TextStyle(color: greyTextColor, fontSize: 16.0)),
|
hintStyle: new TextStyle(color: greyTextColor, fontSize: 16.0)),
|
||||||
controller: controller,
|
|
||||||
onChanged: (text) => handleUserInput(text));
|
onChanged: (text) => handleUserInput(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
// Serious constants
|
// Serious constants
|
||||||
const String url = 'http://pos-api-autoclub.dinect.com/20130701/';
|
const String url = 'https://pos-api-int.dinect.com/20130701/';
|
||||||
const String appToken = 'bdea0f3ba9034b688019a7cac753d1209e2b227f';
|
const String appToken = '9fec83cdca38c357e6b65dbb17514cdd36bf2a08';
|
||||||
|
|
||||||
// Hints
|
// Hints
|
||||||
const String merchantIDHint = 'ID магазина';
|
const String merchantIDHint = 'ID магазина';
|
||||||
@@ -17,7 +17,7 @@ const String active_token_bg_png = 'assets/active_token_message_background.png';
|
|||||||
const String expansion_icon_png = 'assets/expansion_icon.png';
|
const String expansion_icon_png = 'assets/expansion_icon.png';
|
||||||
const String powered_by_dinect_splash_png = 'assets/powered_by_dinect_splash.png';
|
const String powered_by_dinect_splash_png = 'assets/powered_by_dinect_splash.png';
|
||||||
const String powered_by_dinect_png = 'assets/powered_by_dinect.png';
|
const String powered_by_dinect_png = 'assets/powered_by_dinect.png';
|
||||||
const String splash_logo_png = 'assets/splash_logo_png';
|
const String splash_text_png = 'assets/splash_text.png';
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
const Color primaryColor = const Color(0xffeb0004);
|
const Color primaryColor = const Color(0xffeb0004);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
/// Смена состояния экрана при изменении текста в поле ввода.
|
/// Смена состояния экрана при изменении текста в поле ввода.
|
||||||
@override handleUserInput(String tmpString) {
|
@override handleUserInput(String tmpString) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
double.parse(tmpString);
|
||||||
tmpString = tmpString.replaceAll('-', '');
|
tmpString = tmpString.replaceAll('-', '');
|
||||||
tmpString = tmpString.replaceAll(',', '');
|
tmpString = tmpString.replaceAll(',', '');
|
||||||
print(tmpString);
|
print(tmpString);
|
||||||
@@ -85,6 +86,12 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override getTextWidget() {
|
||||||
|
return new TextField(decoration: new InputDecoration.collapsed(hintText: getHint(),
|
||||||
|
hintStyle: new TextStyle(color: greyTextColor, fontSize: 16.0)),
|
||||||
|
onChanged: (text) => handleUserInput(text));
|
||||||
|
}
|
||||||
|
|
||||||
getLoyality(String url) {
|
getLoyality(String url) {
|
||||||
|
|
||||||
print(url);
|
print(url);
|
||||||
|
|||||||
@@ -18,10 +18,15 @@ class SplashScreen extends StatelessWidget {
|
|||||||
showNextScreen(context);
|
showNextScreen(context);
|
||||||
});
|
});
|
||||||
|
|
||||||
return new Stack(children: <Widget>[getBackgroundContainer(),
|
return new Stack(children: <Widget>[getBackgroundContainer(), getLogo(),
|
||||||
new Align(alignment: FractionalOffset.bottomRight, child:
|
new Align(alignment: FractionalOffset.bottomRight, child:
|
||||||
new Container(margin: new EdgeInsets.only(right: 11.0, bottom: 5.0), child: new Image.asset(powered_by_dinect_splash_png, height: 16.0, width: 122.0))),
|
new Container(margin: new EdgeInsets.only(right: 11.0, bottom: 5.0), child: new Image.asset(powered_by_dinect_splash_png, height: 16.0, width: 122.0)))]);
|
||||||
new Center(child: new Image.asset(splash_logo_png, height: 198.0, width: 252.0))]);
|
}
|
||||||
|
|
||||||
|
getLogo() {
|
||||||
|
return new Center(child: new Column(mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[new Image.asset(logo_png, height: 112.0, width: 252.0),
|
||||||
|
new Image.asset(splash_text_png, height: 40.0, width: 240.0)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
getBackgroundContainer() {
|
getBackgroundContainer() {
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ flutter:
|
|||||||
- assets/expansion_icon.png
|
- assets/expansion_icon.png
|
||||||
- assets/powered_by_dinect_splash.png
|
- assets/powered_by_dinect_splash.png
|
||||||
- assets/powered_by_dinect.png
|
- assets/powered_by_dinect.png
|
||||||
- assets/splash_logo.png
|
- assets/registration_logo.png
|
||||||
|
- assets/splash_text.png
|
||||||
|
|
||||||
# To add assets from package dependencies, first ensure the asset
|
# To add assets from package dependencies, first ensure the asset
|
||||||
# is in the lib/ directory of the dependency. Then,
|
# is in the lib/ directory of the dependency. Then,
|
||||||
|
|||||||
Reference in New Issue
Block a user