Merge branch 'RG-3434' into sqflite
This commit is contained in:
@@ -37,6 +37,7 @@ import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.dinect.checker.net.ApiClient;
|
||||
|
||||
@@ -59,7 +60,9 @@ public abstract class AbstractScannerActivity extends AppCompatActivity {
|
||||
"Перестань!",
|
||||
"Ну и зачем?..",
|
||||
};
|
||||
|
||||
private final AtomicInteger counter = new AtomicInteger(0);
|
||||
private int mColor;
|
||||
|
||||
public static final String SCAN_MODES = "SCAN_MODES";
|
||||
public static final String ERROR_INFO = "ERROR_INFO";
|
||||
@@ -115,6 +118,8 @@ public abstract class AbstractScannerActivity extends AppCompatActivity {
|
||||
protected final void initToolbar(final int toolbarId, final @NonNull String title) {
|
||||
Log.d(TAG, "initToolbar");
|
||||
final Toolbar toolbar = (Toolbar) findViewById(toolbarId);
|
||||
mColor = (int) getIntent().getLongExtra(MainActivity.PREF_APP_BAR_COLOR, 0xffffff);
|
||||
toolbar.setBackgroundColor(mColor);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
@@ -295,7 +300,7 @@ public abstract class AbstractScannerActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.logout) {
|
||||
logoutDialog = new AbstractScannerActivity.LogoutDialogFragment();
|
||||
logoutDialog = LogoutDialogFragment.newInstance(mColor);
|
||||
logoutDialog.show(getFragmentManager(), "logout");
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.faq) {
|
||||
@@ -324,14 +329,25 @@ public abstract class AbstractScannerActivity extends AppCompatActivity {
|
||||
|
||||
public static class LogoutDialogFragment extends DialogFragment {
|
||||
|
||||
static LogoutDialogFragment newInstance(int color) {
|
||||
LogoutDialogFragment f = new LogoutDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(MainActivity.PREF_APP_BAR_COLOR, color);
|
||||
f.setArguments(bundle);
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
final LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
final View content = inflater.inflate(R.layout.f_logout_dialog, null);
|
||||
builder.setView(content);
|
||||
final View positiveButton = content.findViewById(R.id.positiveButton);
|
||||
final View negativeButton = content.findViewById(R.id.negativeButton);
|
||||
final TextView positiveButton = (TextView) content.findViewById(R.id.positiveButton);
|
||||
final TextView negativeButton = (TextView) content.findViewById(R.id.negativeButton);
|
||||
// Можно делать через стили, но я не уверен, что необходимо в нашем случае
|
||||
positiveButton.setTextColor(getArguments().getInt(MainActivity.PREF_APP_BAR_COLOR));
|
||||
negativeButton.setTextColor(getArguments().getInt(MainActivity.PREF_APP_BAR_COLOR));
|
||||
|
||||
negativeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -29,9 +29,11 @@ public class MainActivity extends FlutterActivity {
|
||||
static final String TAG = "Checker.MainActivity";
|
||||
|
||||
private static final int START_SCANNER_REQUEST_CODE = 2017;
|
||||
|
||||
static final String PREF_API_URL = "prefs_api_token";
|
||||
static final String PREF_APP_TOKEN = "pres_app_token";
|
||||
static final String PREF_POS_TOKEN = "pref_pos_token";
|
||||
static final String PREF_APP_BAR_COLOR = "pref_app_bar_color";
|
||||
|
||||
static final Class[] SCANNER_BACKEND = {
|
||||
ScannerActivity.class,
|
||||
@@ -60,6 +62,10 @@ public class MainActivity extends FlutterActivity {
|
||||
result.success(BuildConfig.locale);
|
||||
break;
|
||||
|
||||
case "getFlavor":
|
||||
result.success(BuildConfig.flavor);
|
||||
break;
|
||||
|
||||
case "startScanner":
|
||||
final Map arguments = call.arguments();
|
||||
final int idx = mPreferences.getInt(SCANNER_BACKEND_KEY, 0);
|
||||
@@ -68,6 +74,7 @@ public class MainActivity extends FlutterActivity {
|
||||
cameraIntent.putExtra(PREF_API_URL, (String) arguments.get("url"));
|
||||
cameraIntent.putExtra(PREF_APP_TOKEN, (String) arguments.get("appToken"));
|
||||
cameraIntent.putExtra(PREF_POS_TOKEN, (String) arguments.get("token"));
|
||||
cameraIntent.putExtra(PREF_APP_BAR_COLOR, (Long) arguments.get("color"));
|
||||
startActivityForResult(cameraIntent, START_SCANNER_REQUEST_CODE);
|
||||
break;
|
||||
|
||||
@@ -133,6 +140,10 @@ public class MainActivity extends FlutterActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void getFlavor() {
|
||||
|
||||
}
|
||||
|
||||
public void getLocale() {
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="#eb0004"
|
||||
app:titleTextColor="@android:color/white" />
|
||||
|
||||
<View
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
android:id="@+id/zxingToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="#eb0004"
|
||||
app:titleTextColor="@android:color/white" />
|
||||
|
||||
<View
|
||||
|
||||
51
android/app/src/pip/AndroidManifest.xml
Normal file
51
android/app/src/pip/AndroidManifest.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.dinect.checker"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0.1">
|
||||
|
||||
<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.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
||||
calls FlutterMain.startInitialization(this); in its onCreate method.
|
||||
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:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name">
|
||||
<activity
|
||||
android:name=".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:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".zbar.CameraActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme"/>
|
||||
|
||||
<activity
|
||||
android:name=".zxing.ScannerActivity"
|
||||
android:theme="@style/AppTheme"/>
|
||||
</application>
|
||||
</manifest>
|
||||
BIN
android/app/src/pip/ic_launcher-web.png
Normal file
BIN
android/app/src/pip/ic_launcher-web.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
android/app/src/pip/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
android/app/src/pip/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
android/app/src/pip/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
android/app/src/pip/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
android/app/src/pip/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
android/app/src/pip/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
BIN
android/app/src/pip/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
android/app/src/pip/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
BIN
android/app/src/pip/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
android/app/src/pip/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
3
android/app/src/pip/res/values-ru/strings.xml
Normal file
3
android/app/src/pip/res/values-ru/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">PIP</string>
|
||||
</resources>
|
||||
3
android/app/src/pip/res/values-ua/strings.xml
Normal file
3
android/app/src/pip/res/values-ua/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">PIP</string>
|
||||
</resources>
|
||||
3
android/app/src/pip/res/values/strings.xml
Normal file
3
android/app/src/pip/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">PIP</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user