diff --git a/android/app/build.gradle b/android/app/build.gradle
index 5a6fbe1..abc5234 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -74,6 +74,9 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index e6f7a9e..db4b2b5 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,46 +1,59 @@
+
-
+ FlutterApplication and put your custom class here.
+ -->
-
-
+
+
+
-
-
+
+ />
+ -->
-
-
+
+
+
-
+
-
+
+
\ No newline at end of file
diff --git a/android/app/src/main/java/com/example/aman_kassa_flutter/bank/BankActivity.kt b/android/app/src/main/java/com/example/aman_kassa_flutter/bank/BankActivity.kt
new file mode 100644
index 0000000..d1bf682
--- /dev/null
+++ b/android/app/src/main/java/com/example/aman_kassa_flutter/bank/BankActivity.kt
@@ -0,0 +1,33 @@
+package com.example.aman_kassa_flutter.bank
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import android.util.Log
+import android.view.View
+import com.example.aman_kassa_flutter.R
+import io.flutter.app.FlutterActivity
+
+
+class BankActivity : FlutterActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ Log.i("BankActivity","onCreate")
+ setContentView(R.layout.activity_bank)
+ }
+
+ fun myClickHandler(view: View) {
+ Log.i("BankActivity","closed")
+ val returnIntent = Intent()
+ returnIntent.putExtra("result", "abrakadabra")
+ setResult(Activity.RESULT_OK, returnIntent)
+ finish()
+ }
+
+ override fun onDestroy() {
+ val returnIntent = Intent()
+ returnIntent.putExtra("result", "abrakadabra")
+ setResult(Activity.RESULT_CANCELED, returnIntent)
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/main/kotlin/com/example/aman_kassa_flutter/MainActivity.kt b/android/app/src/main/kotlin/com/example/aman_kassa_flutter/MainActivity.kt
index 95c47d6..4dbc05f 100644
--- a/android/app/src/main/kotlin/com/example/aman_kassa_flutter/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/example/aman_kassa_flutter/MainActivity.kt
@@ -1,15 +1,10 @@
package com.example.aman_kassa_flutter
-import android.content.Context
-import android.content.ContextWrapper
+import android.app.Activity
import android.content.Intent
-import android.content.IntentFilter
-import android.content.pm.PackageManager
-import android.net.Uri
-import android.os.BatteryManager
-import android.os.Build.VERSION
-import android.os.Build.VERSION_CODES
import androidx.annotation.NonNull
+import com.example.aman_kassa_flutter.bank.BankActivity
+import com.example.aman_kassa_flutter.bank.MusicPlugin
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
@@ -17,67 +12,44 @@ import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
- private val CHANNEL = "samples.flutter.dev/battery"
+ private val BANK_CHANNEL = "channel:com.amanKassa/bank"
+ private val ACTIVITY_CHANNEL = "channel:com.amanKassa/activity"
+
+ private lateinit var _result: MethodChannel.Result
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
- MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
+ MethodChannel(flutterEngine.dartExecutor.binaryMessenger, BANK_CHANNEL).setMethodCallHandler(MusicPlugin());
+ MethodChannel(flutterEngine.dartExecutor.binaryMessenger, ACTIVITY_CHANNEL).setMethodCallHandler {
// Note: this method is invoked on the main thread.
call, result ->
- if (call.method == "getBatteryLevel") {
- val batteryLevel = getBatteryLevel()
-
- if (batteryLevel != -1) {
- result.success(batteryLevel)
- } else {
- result.error("UNAVAILABLE", "Battery level not available.", null)
- }
- } else if (call.method == "sendMessage") {
- val batteryLevel = sendMessage()
-
- if (batteryLevel != -1) {
- result.success(batteryLevel)
- } else {
- result.error("UNAVAILABLE", "Battery level not available.", null)
- }
+ if (call.method == "start") {
+ _result = result
+ val intent= Intent(this, BankActivity::class.java)
+ startActivityForResult(intent, 8989)
+ //result.success("ActivityStarted")
} else {
result.notImplemented()
}
}
}
- private fun getBatteryLevel(): Int {
- val batteryLevel: Int
- if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
- val batteryManager = getSystemService(Context.BATTERY_SERVICE) as BatteryManager
- batteryLevel = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
- } else {
- val intent = ContextWrapper(applicationContext).registerReceiver(null, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
- batteryLevel = intent!!.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) * 100 / intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1)
+
+
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+ super.onActivityResult(requestCode, resultCode, data)
+ if(requestCode == 8989) {
+ if (resultCode == Activity.RESULT_OK) {
+ _result.success(data?.getStringExtra("result"))
+ } else if (resultCode == Activity.RESULT_CANCELED) {
+ _result.error("008", "123","aaa")
+ } else
+ _result.success(null)
}
- println("batteryLevel");
- println(batteryLevel);
- return batteryLevel
+
}
- private fun sendMessage(): Int {
- val packageManager: PackageManager = context.packageManager
- val i = Intent(Intent.ACTION_VIEW)
- try {
- val mobileNo: String = "77774904900" //call.argument("mobileNo")
- val message: String = "Hello world" //call.argument("message")
- //https://wa.me/919167370647?text=Yes%20We'll%20do%20this%20in%20frag4%20inOCW
- println("mobileNo: $mobileNo message: $message")
- val url = "https://wa.me/" + mobileNo.trim { it <= ' ' } + "?text=" + message.trim { it <= ' ' }
- i.setPackage("com.whatsapp")
- i.data = Uri.parse(url)
- if (i.resolveActivity(packageManager) != null) {
- context.startActivity(i)
- }
- println("finish method - 2")
- } catch (e: Exception) {
- e.printStackTrace()
- }
- return 25
- }
+
+
+
}
diff --git a/android/app/src/main/res/layout/activity_bank.xml b/android/app/src/main/res/layout/activity_bank.xml
new file mode 100644
index 0000000..a4dac4f
--- /dev/null
+++ b/android/app/src/main/res/layout/activity_bank.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..73862c4
--- /dev/null
+++ b/android/app/src/main/res/values/strings.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/lib/core/route_names.dart b/lib/core/route_names.dart
index f880aa9..36abba1 100644
--- a/lib/core/route_names.dart
+++ b/lib/core/route_names.dart
@@ -5,4 +5,5 @@ const String PaymentViewRoute = "PaymentView";
const String HistoryViewRoute = "HistoryView";
const String InfoKkmViewRoute = "InfoKkmViewRoute";
const String QrViewRoute = "QrViewRoute";
+const String BankViewRoute = "BankViewRoute";
// Generate the views here
diff --git a/lib/core/router.dart b/lib/core/router.dart
index 574f5de..4258764 100644
--- a/lib/core/router.dart
+++ b/lib/core/router.dart
@@ -1,3 +1,4 @@
+import 'package:aman_kassa_flutter/views/bank_view/bank_view.dart';
import 'package:aman_kassa_flutter/views/check/image_show_container.dart';
import 'package:aman_kassa_flutter/views/history/history_view.dart';
import 'package:aman_kassa_flutter/views/info_kkm/info_kkm_view.dart';
@@ -15,7 +16,9 @@ Route generateRoute(RouteSettings settings) {
LoginModel model = settings.arguments as LoginModel;
return _getPageRoute(
routeName: settings.name,
- viewToShow: LoginView(loginModel: model,),
+ viewToShow: LoginView(
+ loginModel: model,
+ ),
);
case HomeViewRoute:
return _getPageRoute(
@@ -38,6 +41,11 @@ Route generateRoute(RouteSettings settings) {
routeName: settings.name,
viewToShow: InfoKkmView(),
);
+ case BankViewRoute:
+ return _getPageRoute(
+ routeName: settings.name,
+ viewToShow: BankView(),
+ );
case QrViewRoute:
ImageShowModel data = settings.arguments as ImageShowModel;
return _getPageRoute(
diff --git a/lib/views/home/components/popup_menu.dart b/lib/views/home/components/popup_menu.dart
index a2b0d8b..b9c7f8c 100644
--- a/lib/views/home/components/popup_menu.dart
+++ b/lib/views/home/components/popup_menu.dart
@@ -5,13 +5,13 @@ import 'package:flutter/material.dart';
const List choices = const [
//const Choice(title: 'Обновить номенклатуру', icon: Icons.update, command: 'update'),
//const Choice(title: 'Помощь', icon: Icons.help, command: 'help'),
- const Choice(title: 'Информацио о ККМ', icon: Icons.info_outline, command: 'infokkm'),
- //const Choice(title: 'Язык', icon: Icons.language, command: 'language'),
+ const Choice(
+ title: 'Информацио о ККМ', icon: Icons.info_outline, command: 'infokkm'),
+ const Choice(title: 'Bank', icon: Icons.text_fields, command: 'bank'),
const Choice(title: 'Выйти', icon: Icons.exit_to_app, command: 'exit')
];
class PopupMenu extends StatelessWidget {
-
final void Function(Choice value) onSelectChoice;
PopupMenu({this.onSelectChoice});
@@ -28,11 +28,18 @@ class PopupMenu extends StatelessWidget {
return choices.map((Choice choice) {
return PopupMenuItem(
value: choice,
- child: Row(children: [
- Icon(choice.icon, color: primaryColor,),
- SizedBox(width: 5,),
- Text(choice.title)
- ], ),
+ child: Row(
+ children: [
+ Icon(
+ choice.icon,
+ color: primaryColor,
+ ),
+ SizedBox(
+ width: 5,
+ ),
+ Text(choice.title)
+ ],
+ ),
);
}).toList();
},
diff --git a/lib/views/home/home_view.dart b/lib/views/home/home_view.dart
index 46c3459..f288906 100644
--- a/lib/views/home/home_view.dart
+++ b/lib/views/home/home_view.dart
@@ -57,13 +57,16 @@ class _HomeViewState extends State {
void _onSelectChoice(Choice choice) async {
if (choice.command == 'exit') {
Dialogs.showLoadingDialog(context, _keyLoader);
- Response result = await _api.logout(Redux.store.state.userState.user.token);
- if(result.operation && result.status == 200) {
+ Response result =
+ await _api.logout(Redux.store.state.userState.user.token);
+ if (result.operation && result.status == 200) {
Redux.store.dispatch(logoutAction);
}
Navigator.of(_keyLoader.currentContext, rootNavigator: true).pop();
} else if (choice.command == 'infokkm') {
_navigatorService.push(InfoKkmViewRoute);
+ } else if (choice.command == 'bank') {
+ _navigatorService.push(BankViewRoute);
}
}
@@ -81,26 +84,25 @@ class _HomeViewState extends State {
],
backgroundColor: fillColor,
),
- body:StoreConnector(
- converter: (store) => store.state.settingState,
- builder: (context, vm) {
- return PageView(
- onPageChanged: (index) {
- setState(() {
- selectedTabIndex = index;
- });
- },
- controller: pageController,
- children: [
- vm.mode == SettingModeKassa ? KassaTab(0) : CalculatorTab(0),
- AdditionalTab(1),
- ],
- );
- }
- ),
+ body: StoreConnector(
+ converter: (store) => store.state.settingState,
+ builder: (context, vm) {
+ return PageView(
+ onPageChanged: (index) {
+ setState(() {
+ selectedTabIndex = index;
+ });
+ },
+ controller: pageController,
+ children: [
+ vm.mode == SettingModeKassa ? KassaTab(0) : CalculatorTab(0),
+ AdditionalTab(1),
+ ],
+ );
+ }),
bottomNavigationBar: BottomBar(
- pageController: pageController,
- selectedTabIndex: selectedTabIndex,
+ pageController: pageController,
+ selectedTabIndex: selectedTabIndex,
),
);
}