Commit d0891c19 by User

Stock Audit changes noted version 1.0

parent 042d3c1a
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "w.soulofpluto.posstock"
minSdkVersion 17
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
......@@ -21,13 +21,6 @@ android {
shrinkResources false
zipAlignEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
ndk {
abiFilters 'armeabi' //, 'x86', ' 'x86_64', 'arm64-v8a'
}
}
......@@ -51,10 +44,13 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
implementation platform('com.google.firebase:firebase-bom:28.4.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics:18.2.1'
implementation 'com.karumi:dexter:6.2.3'
implementation files('libs/ePOS2.jar')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
......
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="w.soulofpluto.posstock">
package="w.soulofpluto.posstockaudit">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<!--<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>-->
<application
android:allowBackup="true"
android:icon="@mipmap/ic_back"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_back_round"
android:icon="@drawable/icon"
android:supportsRtl="true"
android:hardwareAccelerated="true"
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true"
android:theme="@style/AppTheme.NoActionBar"
android:networkSecurityConfig="@xml/network_security_config">
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="true" />
<!--android:roundIcon="@drawable/adaptive_icon"
<uses-library
android:required="false"
android:name="com.sec.android.app.multiwindow">
</uses-library> -->
<activity
android:name=".SplashActivity"
android:name="w.soulofpluto.posstockaudit.SplashActivity"
android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait">
<intent-filter>
......@@ -42,64 +42,52 @@
</activity>
<activity
android:name=".Login"
android:name="w.soulofpluto.posstockaudit.Login"
android:windowSoftInputMode="adjustResize|stateHidden"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".HomeActivity"
android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".DiscoveryActivity"
android:windowSoftInputMode="adjustNothing"
android:name="w.soulofpluto.posstockaudit.HomeActivity"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".DashBoardActivity"
android:name="w.soulofpluto.posstockaudit.DashBoardActivity"
android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustNothing"
android:name="w.soulofpluto.posstockaudit.MainActivity"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".PlanDetails"
android:name="w.soulofpluto.posstockaudit.PlanDetails"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize"
android:windowSoftInputMode="adjustNothing">
</activity>
<activity
android:name=".RackWiseQty"
android:name="w.soulofpluto.posstockaudit.RackWiseQty"
android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".SearchByBarcode"
android:name="w.soulofpluto.posstockaudit.SearchByBarcode"
android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".CreateDeliverySlip"
android:windowSoftInputMode="adjustResize|stateHidden"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".CreateSaleBill"
android:windowSoftInputMode="adjustResize|stateHidden"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
</application>
</manifest>
\ No newline at end of file
package w.soulofpluto.posstock;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
/**
* Created by Ramesh on 05/09/20.
*/
public interface ApiService{
//String BASE_URL = "https://aeebe1.emporter.eu/pos_actions/";
//String Token = "41f34d7009db337f6213be52f7151108";
//String StoreId = "980";
/*@Headers({"Pos-Access-Token:" + Token,"Pos-User-Access-Store-Id:"+StoreId,
"Accept: application/json","Content-Type:multipart/form-data"})*/
/*@Multipart
@POST("uploadBarcodeImages")
Call<ResponseBody> uploadMultiple(@Part("Pos-Access-Token") RequestBody token,
@Part("Pos-User-Access-Store-Id") RequestBody storeId,
@Part("barcode") RequestBody barcode,
@Part List<MultipartBody.Part> files);*/
@Headers({"Content-type: application/json"})
@POST("/login/doLogin")
Call<Response> login(@Body RequestBody body);
@GET("/login/getStoresMappedToUser/{id}")
Call<Response> getStoreId(@Path("id") String id);
}
package w.soulofpluto.posstock;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Editable;
import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.epson.epos2.Epos2Exception;
import com.epson.epos2.discovery.DeviceInfo;
import com.epson.epos2.discovery.Discovery;
import com.epson.epos2.discovery.DiscoveryListener;
import com.epson.epos2.discovery.FilterOption;
import com.epson.epos2.printer.Printer;
import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener;
import com.google.android.material.snackbar.Snackbar;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.DeliveryslipAmt;
import static w.soulofpluto.posstock.Constants.DeliveryslipQty;
import static w.soulofpluto.posstock.Constants.JSON;
import static w.soulofpluto.posstock.Constants.Logout;
/*
Create by Ramesh Babu
*/
public class CreateDeliverySlip extends AppCompatActivity implements AdapterView.OnItemClickListener, ReceiveListener, TextView.OnEditorActionListener {
Toolbar createDeliverySlip_toolbar;
EditText barcode_enter, empId;
List<CreateResponse> arrayList;
LinearLayout header_items;
CheckBox checkBox;
PreferenceManager preferenceManager;
RecyclerView deliveryslip_list;
TextView totalItems, totalMrp, totalDis, totalNetMrp;
ArrayList<Barcode> list;
Button valid, valid_print;
Boolean print = false;
public static Printer mPrinter = null;
DeliverySlipAdapter deliverySlipAdapter;
List<CreateResponse.Datum> versionList;
ListView bluetooth_list;
private ArrayList<HashMap<String, String>> mPrinterList = null;
private SimpleAdapter mPrinterListAdapter = null;
private FilterOption mFilterOption = null;
private TextView store_location;
private Boolean initial = false;
Menu globalMenuItem;
Dialog dialog;
JSONObject responseobj;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_createdeliveryslip);
createDeliverySlip_toolbar = findViewById(R.id.createdeliveryslip_toolbar);
checkBox = findViewById(R.id.checked);
barcode_enter = findViewById(R.id.barcode_enter);
deliveryslip_list = findViewById(R.id.deliveryslip_list);
totalItems = findViewById(R.id.totalItems);
totalMrp = findViewById(R.id.totalMrp);
totalDis = findViewById(R.id.totalDis);
totalNetMrp = findViewById(R.id.totalNetMrp);
empId = findViewById(R.id.emp_id);
valid = findViewById(R.id.valid);
header_items = findViewById(R.id.header_items);
valid_print = findViewById(R.id.valid_print);
setSupportActionBar(createDeliverySlip_toolbar);
getSupportActionBar().setTitle(getResources().getString(R.string.create_title));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferenceManager = new PreferenceManager(this);
arrayList = new ArrayList<>();
list = new ArrayList<>();
versionList = new ArrayList<>();
empId.setText(preferenceManager.getUserId());
checkBox.setChecked(true);
barcode_enter.requestFocus();
barcode_enter.setOnEditorActionListener(this);
Log.e("Access Token ====> ", preferenceManager.getCustToken());
valid_print.setOnClickListener(view -> {
if(preferenceManager.getBLUETOOTH().length()>0) {
if (list.size() > 0) {
//print = true;
if (Constants.isNetworkAvailable(CreateDeliverySlip.this)) {
Constants.ProgressDialogShow(CreateDeliverySlip.this);
GenerateDeliverySlip("save", barcode_enter.getText().toString().trim(), "Y", false);
} else {
Constants.getToast(CreateDeliverySlip.this, getResources().getString(R.string.connection));
}
} else {
Constants.getToast(CreateDeliverySlip.this, "Please Scan Barcode Items");
}
}else{
Constants.getToast(CreateDeliverySlip.this,"Please Connect Bluetooth Printer");
}
});
valid.setOnClickListener(view -> {
if (list.size() > 0) {
if (Constants.isNetworkAvailable(CreateDeliverySlip.this)) {
Constants.ProgressDialogShow(CreateDeliverySlip.this);
GenerateDeliverySlip("scan", barcode_enter.getText().toString().trim(), "Y",true);
} else {
Constants.getToast(CreateDeliverySlip.this, getResources().getString(R.string.connection));
}
} else {
Constants.getToast(CreateDeliverySlip.this, "Please Scan Barcode Items");
}
});
barcode_enter.addTextChangedListener(new Checked());
new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) {
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
final CreateResponse.Datum deletedCourse = versionList.get(viewHolder.getAdapterPosition());
final int position = viewHolder.getAdapterPosition();
versionList.remove(viewHolder.getAdapterPosition());
deliverySlipAdapter.notifyItemRemoved(viewHolder.getAdapterPosition());
for (Barcode barcode : list) {
if (barcode.getBarcode().equalsIgnoreCase(deletedCourse.getBarcode())) {
list.remove(barcode);
break;
}
}
if(list.size()<1){
header_items.setVisibility(View.GONE);
if(checkBox.isChecked()){
barcode_enter.requestFocus();
}else{
empId.setText("");
empId.requestFocus();
}
}
if (Constants.isNetworkAvailable(CreateDeliverySlip.this)) {
Constants.ProgressDialogShow(CreateDeliverySlip.this);
GenerateDeliverySlip("scan", "", "N",false);
} else {
Constants.getToast(CreateDeliverySlip.this, getResources().getString(R.string.connection));
}
}
}).attachToRecyclerView(deliveryslip_list);
super.onCreate(savedInstanceState);
}
private boolean runPrintReceiptSequence() {
if (!initializeObject()) {
Log.e("initialize Object >>", "runPrintReceipt");
return false;
}
if (!createReceiptData()) {
System.out.println("runPrintReceipt1");
finalizeObject();
return false;
}
if (!printData()) {
finalizeObject();
Log.e("Print Data ====>", "runPrintReceipt2");
return false;
}
return true;
}
private boolean connectPrinter() {
boolean isBeginTransaction = false;
if (mPrinter == null) {
return false;
}
try {
//System.out.println("Checking Printer ======>"+com.epson.epos2.printer.Printer.PARAM_DEFAULT);
mPrinter.connect(preferenceManager.getBLUETOOTH(), 30000);
System.out.println("Shared Preferences Bluetooth ========>" + preferenceManager.getBLUETOOTH());
} catch (Exception e) {
ShowMsg.showException(e, "connect", CreateDeliverySlip.this);
return false;
}
try {
mPrinter.beginTransaction();
isBeginTransaction = true;
} catch (Exception e) {
ShowMsg.showException(e, "beginTransaction", CreateDeliverySlip.this);
}
if (isBeginTransaction == false) {
try {
mPrinter.disconnect();
} catch (Epos2Exception e) {
// Do nothing
return false;
}
}
return true;
}
public void Logout(String Url) {
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(240, TimeUnit.SECONDS);
client.setReadTimeout(240, TimeUnit.SECONDS);
client.setWriteTimeout(240, TimeUnit.SECONDS);
final Request request = new Request.Builder()
.url(Url)
.get()
.addHeader("Content-Type", "application/json")
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Request request, IOException e) {
Constants.ProgressDialogDismiss();
}
@Override
public void onResponse(Response response) throws IOException {
try {
Constants.ProgressDialogDismiss();
final String res = response.body().string();
if (response.code() == 200) {
Log.e("Dashboard Logout ", res);
JSONObject jsonObject = new JSONObject(res);
if (jsonObject.has("success")) {
if (jsonObject.getInt("success") == 1) {
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
preferenceManager.setBLUETOOTH("");
Login.logout(CreateDeliverySlip.this);
} else if(jsonObject.has("msg")) {
Constants.getToast(CreateDeliverySlip.this, jsonObject.getString("msg"));
}
}
} else {
runOnUiThread(() -> Constants.getToast(CreateDeliverySlip.this, res));
}
} catch (JSONException e) {
e.printStackTrace();
} catch (NullPointerException np) {
np.printStackTrace();
}
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
case R.id.dashboard_logout:
if (Constants.isNetworkAvailable(CreateDeliverySlip.this)) {
Logout(Logout + preferenceManager.getUserId());
Constants.ProgressDialogShow(CreateDeliverySlip.this);
} else {
Constants.getToast(CreateDeliverySlip.this, getResources().getString(R.string.connection));
}
try {
Discovery.stop();
break;
} catch (Epos2Exception e1) {
System.out.println("Output =====>" + e1.getMessage());
}
break;
case R.id.dashboard_connection:
bluetoothPair();
break;
case R.id.dashboard_reload:
startActivity(getIntent());
finish();
try {
Discovery.stop();
break;
} catch (Epos2Exception e1) {
System.out.println("Output =====>" + e1.getMessage());
}
break;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_create, menu);
globalMenuItem = menu;
if (preferenceManager.getBLUETOOTH().length() > 0) {
//System.out.println("connection ====>"+preferenceManager.getBLUETOOTH().length());
globalMenuItem.findItem(R.id.dashboard_connection).setIcon(R.drawable.ic_bluetooth_indicator);
} else {
//System.out.println("connection1 ====>"+preferenceManager.getBLUETOOTH());
globalMenuItem.findItem(R.id.dashboard_connection).setIcon(R.drawable.ic_bluetooth_signal_indicator);
}
return super.onCreateOptionsMenu(menu);
}
private boolean isPrintable(PrinterStatusInfo status) {
if (status == null) {
return false;
}
if (status.getConnection() == Printer.FALSE) {
return false;
} else if (status.getOnline() == Printer.FALSE) {
return false;
} else {
}
return true;
}
private boolean printData() {
if (mPrinter == null) {
return false;
}
if (!connectPrinter()) {
return false;
}
PrinterStatusInfo status = mPrinter.getStatus();
dispPrinterWarnings(status);
if (!isPrintable(status)) {
ShowMsg.showMsg(makeErrorMessage(status), CreateDeliverySlip.this);
try {
mPrinter.disconnect();
} catch (Exception ex) {
// Do nothing
}
return false;
}
try {
mPrinter.sendData(Printer.PARAM_DEFAULT);
} catch (Exception e) {
ShowMsg.showException(e, "sendData", CreateDeliverySlip.this);
try {
mPrinter.disconnect();
} catch (Exception ex) {
// Do nothing
}
return false;
}
return true;
}
private void finalizeObject() {
if (mPrinter == null) {
return;
}
mPrinter.clearCommandBuffer();
mPrinter.setReceiveEventListener(null);
mPrinter = null;
}
void getPrint() {
try {
if (responseobj.has("data")) {
System.out.println("Response Data =============>" + responseobj);
JSONObject dataobj = responseobj.getJSONObject("data");
mPrinter.addTextSize(2, 2);
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
mPrinter.addText(" * ESTIMATION SLIP * " + "\n");
mPrinter.addTextSize(1, 1);
mPrinter.addFeedLine(1);
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
mPrinter.addText("Date : " + dataobj.getString("dsdate") + "\n");
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
mPrinter.addText(Constants.dashed);
if (dataobj.has("ds_lines")) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
mPrinter.addText("SL Barcode Qty MRP Disc Amount " + "\n");
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
mPrinter.addText(Constants.dashed);
JSONObject da = dataobj.getJSONObject("ds_lines");
Iterator<String> keys = da.keys();
while (keys.hasNext()) {
String key = keys.next();
if (da.get(key) instanceof JSONArray) {
// do something with jsonObject here
System.out.println("Connection =====>" + da);
System.out.println("Connection =====>" + key);
JSONArray bill_data = new JSONArray(da.getString(key));
for (int i = 0; i < bill_data.length(); i++) {
JSONObject bill_object = bill_data.getJSONObject(i);
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
mPrinter.addText(Constants.SL(bill_object.getString("sno")) +
Constants.Barcode(bill_object.getString("barcode"))
+ Constants.Qty(bill_object.getString("qty")) + Constants.Mrp(bill_object.getString("item_rsp"))
+ Constants.Dis(bill_object.getString("qty_disc"))
+ Constants.Total(bill_object.getString("qty_amount_after_discount")));
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
mPrinter.addText(" SM : " + bill_object.getString("sm") + " " + bill_object.getString("section") + "\n");
mPrinter.addText(Constants.dashed);
}
}
}
}
}
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
mPrinter.addText("Gross Amount : " + Constants.Gross(dataobj.getString("total_grossamount")) + "\n");
mPrinter.addText("Total Discount : " + Constants.TotalSavings(dataobj.getString("total_promodisc")) + "\n\n");
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
mPrinter.addTextSize(2, 2);
mPrinter.addText("Total Qty : " + dataobj.getString("total_qty") + "\n");
mPrinter.addText("Net Payable : " + dataobj.getString("total_payable") + "\n");
mPrinter.addTextSize(1, 1);
mPrinter.addFeedLine(1);
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
mPrinter.addText(" Biller : " + dataobj.getString("biller") + "\n");
mPrinter.addFeedLine(1);
mPrinter.addBarcode(dataobj.getString("dsno"),
Printer.BARCODE_CODE39,
Printer.HRI_BELOW,
Printer.FONT_A,
2,
100);
mPrinter.addFeedLine(2);
mPrinter.addTextSize(4, 4);
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
mPrinter.addText(dataobj.getString("dsno_last_number") + "\n\n");
mPrinter.addCut(Printer.CUT_FEED);
mPrinter.addTextSize(1, 1);
mPrinter.addFeedLine(1);
}
} catch (JSONException jo) {
jo.printStackTrace();
} catch (Epos2Exception e) {
e.printStackTrace();
} catch (Exception e) {
System.out.println("Error Message ======>" + e.getMessage());
//ShowMsg.showException(e, method, CreateDeliverySlip.this);
}
}
private boolean createReceiptData() {
String method = "";
StringBuilder textData = new StringBuilder();
Constants.ProgressDialogDismiss();
if (print) {
print = false;
if (mPrinter == null) {
return false;
}
getPrint();
} else {
for (int k = 0; k < 2; k++) {
if (mPrinter == null) {
return false;
}
getPrint();
}
runOnUiThread(() -> {
valid.setVisibility(View.GONE);
valid_print.setVisibility(View.GONE);
arrayList.clear();
list.clear();
deliveryslip_list.setAdapter(null);
totalItems.setText("");
totalNetMrp.setText("");
totalMrp.setText("");
totalDis.setText("");
});
}
mPrinter = null;
return true;
}
private boolean initializeObject() {
try {
mPrinter = new Printer(1, 6, CreateDeliverySlip.this);
} catch (Exception e) {
ShowMsg.showException(e, "Printer", CreateDeliverySlip.this);
Constants.ProgressDialogDismiss();
return false;
}
mPrinter.setReceiveEventListener(this);
return true;
}
private void updateButtonState(boolean state) {
valid.setEnabled(state);
System.out.println("Data State Enables===>" + state);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
try {
Intent intent = new Intent();
HashMap<String, String> item = mPrinterList.get(position);
intent.putExtra(getString(R.string.title_target), item.get("Target"));
//System.out.println("Bluetooth Target =====>"+item.get("Target"));
dialog.dismiss();
preferenceManager.setBLUETOOTH(item.get("Target"));
invalidateOptionsMenu();
} catch (NullPointerException np) {
np.printStackTrace();
}
}
private String makeErrorMessage(PrinterStatusInfo status) {
String msg = "";
if (status.getOnline() == Printer.FALSE) {
msg += getString(R.string.handlingmsg_err_offline);
}
if (status.getConnection() == Printer.FALSE) {
msg += getString(R.string.handlingmsg_err_no_response);
}
if (status.getCoverOpen() == Printer.TRUE) {
msg += getString(R.string.handlingmsg_err_cover_open);
}
if (status.getPaper() == Printer.PAPER_EMPTY) {
msg += getString(R.string.handlingmsg_err_receipt_end);
}
if (status.getPaperFeed() == Printer.TRUE || status.getPanelSwitch() == Printer.SWITCH_ON) {
msg += getString(R.string.handlingmsg_err_paper_feed);
}
if (status.getErrorStatus() == Printer.MECHANICAL_ERR || status.getErrorStatus() == Printer.AUTOCUTTER_ERR) {
msg += getString(R.string.handlingmsg_err_autocutter);
msg += getString(R.string.handlingmsg_err_need_recover);
}
if (status.getErrorStatus() == Printer.UNRECOVER_ERR) {
msg += getString(R.string.handlingmsg_err_unrecover);
}
if (status.getErrorStatus() == Printer.AUTORECOVER_ERR) {
if (status.getAutoRecoverError() == Printer.HEAD_OVERHEAT) {
msg += getString(R.string.handlingmsg_err_overheat);
msg += getString(R.string.handlingmsg_err_head);
}
if (status.getAutoRecoverError() == Printer.MOTOR_OVERHEAT) {
msg += getString(R.string.handlingmsg_err_overheat);
msg += getString(R.string.handlingmsg_err_motor);
}
if (status.getAutoRecoverError() == Printer.BATTERY_OVERHEAT) {
msg += getString(R.string.handlingmsg_err_overheat);
msg += getString(R.string.handlingmsg_err_battery);
}
if (status.getAutoRecoverError() == Printer.WRONG_PAPER) {
msg += getString(R.string.handlingmsg_err_wrong_paper);
}
}
if (status.getBatteryLevel() == Printer.BATTERY_LEVEL_0) {
msg += getString(R.string.handlingmsg_err_battery_real_end);
}
return msg;
}
private void disconnectPrinter() {
if (mPrinter == null) {
return;
}
try {
mPrinter.endTransaction();
} catch (final Exception e) {
}
try {
mPrinter.disconnect();
} catch (final Exception e) {
}
finalizeObject();
}
@Override
public void onPtrReceive(Printer printer, final int code, final PrinterStatusInfo printerStatusInfo, String s) {
runOnUiThread(new Runnable() {
@Override
public synchronized void run() {
ShowMsg.showResult(code, makeErrorMessage(printerStatusInfo), CreateDeliverySlip.this);
dispPrinterWarnings(printerStatusInfo);
updateButtonState(true);
new Thread(new Runnable() {
@Override
public void run() {
disconnectPrinter();
}
}).start();
}
});
}
private void dispPrinterWarnings(PrinterStatusInfo status) {
//EditText edtWarnings = (EditText)findViewById(R.id.edtWarnings);
String warningsMsg = "";
if (status == null) {
return;
}
if (status.getPaper() == Printer.PAPER_NEAR_END) {
warningsMsg += getString(R.string.handlingmsg_warn_receipt_near_end);
}
if (status.getPaper() == Printer.PAPER_EMPTY) {
warningsMsg += "Paper Roll Is Empty";
}
if (status.getBatteryLevel() == Printer.BATTERY_LEVEL_1) {
warningsMsg += getString(R.string.handlingmsg_warn_battery_near_end);
}
if (warningsMsg.length() > 0) {
Constants.getToast(CreateDeliverySlip.this, warningsMsg);
}
// edtWarnings.setText(warningsMsg);
}
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(v.getId() == R.id.barcode_enter) {
if (TextUtils.isEmpty(barcode_enter.getText().toString())) {
Constants.getToast(CreateDeliverySlip.this, "Enter Barcode");
} else {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE) || (actionId == EditorInfo.IME_ACTION_NEXT) || (actionId == EditorInfo.IME_ACTION_GO)) {
Log.e("Event =============>","");
Constants.hideKeyboard(this);
if(Constants.isNetworkAvailable(this)){
GenerateDeliverySlip("scan", barcode_enter.getText().toString().trim(), "N", false);
Constants.ProgressDialogShow(CreateDeliverySlip.this);
}else {
Constants.getToast(CreateDeliverySlip.this,"Please check internet connection");
}
}
}
}
return false;
}
public class Checked implements TextWatcher {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence val, int i, int i1, int i2) {
try {
if (val.toString().length() > 0) {
if (val.toString().contains("\n")) {
if (Constants.isNetworkAvailable(CreateDeliverySlip.this)) {
Constants.ProgressDialogShow(CreateDeliverySlip.this);
GenerateDeliverySlip("scan", val.toString().trim(), "N",false);
} else {
Constants.getToast(CreateDeliverySlip.this, getResources().getString(R.string.connection));
}
}
}
} catch (NullPointerException np) {
np.printStackTrace();
}
}
@Override
public void afterTextChanged(Editable editable) {
}
}
public void GenerateDeliverySlip(final String scan, String trim, String app, final boolean var) {
JSONObject object = new JSONObject();
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
object.put(getResources().getString(R.string.action), scan);
object.put(getResources().getString(R.string.promotions), "N");
object.put(getResources().getString(R.string.apply_promotion),app);
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = null;
if (list.size() > 0) {
for (Barcode b : list) {
jsonObject = new JSONObject();
jsonObject.put(getResources().getString(R.string.barcode_name), b.barcode);
jsonObject.put(getResources().getString(R.string.qty_name), b.qty);
jsonObject.put(getResources().getString(R.string.empid), b.empId);
jsonArray.put(jsonObject);
}
}
Log.e("Test", trim);
if (trim.length() > 0) {
jsonObject = new JSONObject();
jsonObject.put(getResources().getString(R.string.barcode_name), trim);
jsonObject.put(getResources().getString(R.string.qty_name), 1);
jsonObject.put(getResources().getString(R.string.empid), empId.getText().toString());
jsonArray.put(jsonObject);
}
if (list.size() > 0 || trim.length() > 0) {
object.put(getResources().getString(R.string.items), jsonArray);
//object.put(getResources().getString(R.string.android_version),Constants.VERSION);
Log.e("Search", object.toString());
RequestBody body = RequestBody.create(JSON, object.toString());
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(250, TimeUnit.SECONDS);
client.setReadTimeout(250, TimeUnit.SECONDS);
client.setWriteTimeout(250, TimeUnit.SECONDS);
Request request = new Request.Builder()
.url(Constants.GenerateSlip)
.post(body)
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken), preferenceManager.getCustToken())
.addHeader(getResources().getString(R.string.storeidtoken), preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Request request, final IOException e) {
runOnUiThread(() -> {
Constants.getToast(CreateDeliverySlip.this, e.getMessage());
Constants.ProgressDialogDismiss();
});
}
@Override
public void onResponse(final com.squareup.okhttp.Response response) throws IOException {
try {
Constants.ProgressDialogDismiss();
final String Response = response.body().string();
Log.e("Barcode Search", Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> {
try {
if(response.code() == 200){
responseobj = new JSONObject(Response);
if(responseobj.getInt("success") == 1){
if(scan.equalsIgnoreCase("save")){
valid_print.setVisibility(View.GONE);
valid.setVisibility(View.VISIBLE);
header_items.setVisibility(View.GONE);
if(responseobj.has("data")){
updateButtonState(false);
if (!runPrintReceiptSequence()) {
updateButtonState(true);
}
}
}else if(var){
header_items.setVisibility(View.VISIBLE);
valid_print.setVisibility(View.VISIBLE);
valid.setVisibility(View.GONE);
if (responseobj.has("data")) {
if (barcode_enter.getText().toString().length() > 0)
list.add(new Barcode(barcode_enter.getText().toString().trim(), 1, empId.getText().toString()));
barcode_enter.setText("");
barcode_enter.requestFocus();
versionList = new Gson().fromJson(String.valueOf(responseobj.getJSONArray(getResources().getString(R.string.data))),
new TypeToken<List<CreateResponse.Datum>>() {
}.getType());
Log.e("Response =====>", String.valueOf(responseobj.getJSONArray(getResources().getString(R.string.data))));
deliveryslip_list.setLayoutManager(new LinearLayoutManager(CreateDeliverySlip.this));
deliverySlipAdapter = new DeliverySlipAdapter(CreateDeliverySlip.this, versionList);
deliveryslip_list.setAdapter(deliverySlipAdapter);
}
totalItems.setText(Html.fromHtml(Constants.getTotalItems(responseobj.getString(getResources().getString(R.string.totalqty)))));
totalMrp.setText(Html.fromHtml(Constants.getTotalMRP(Constants.IndianRupeesFormat(responseobj.getString(getResources().getString(R.string.netpayable))))));
if(checkBox.isChecked()){
barcode_enter.requestFocus();
}else{
empId.setText("");
empId.requestFocus();
}
Log.e("total Qty ========>", responseobj.getString(getResources().getString(R.string.totalqty)));
Log.e("total NetPayable ===>", responseobj.getString(getResources().getString(R.string.netpayable)));
} else {
valid_print.setVisibility(View.GONE);
valid.setVisibility(View.VISIBLE);
header_items.setVisibility(View.VISIBLE);
//List<CreateResponse> versionList = new Gson().fromJson(Response, new TypeToken<List<CreateResponse>>() {}.getType());
if (responseobj.has("data")) {
if (barcode_enter.getText().toString().length() > 0)
list.add(new Barcode(barcode_enter.getText().toString().trim(), 1, empId.getText().toString()));
barcode_enter.setText("");
barcode_enter.requestFocus();
versionList = new Gson().fromJson(String.valueOf(responseobj.getJSONArray(getResources().getString(R.string.data))),
new TypeToken<List<CreateResponse.Datum>>() {
}.getType());
Log.e("Response =====>", String.valueOf(responseobj.getJSONArray(getResources().getString(R.string.data))));
deliveryslip_list.setLayoutManager(new LinearLayoutManager(CreateDeliverySlip.this));
deliverySlipAdapter = new DeliverySlipAdapter(CreateDeliverySlip.this, versionList);
deliveryslip_list.setAdapter(deliverySlipAdapter);
}
totalItems.setText(Html.fromHtml(Constants.getTotalItems(responseobj.getString(getResources().getString(R.string.totalqty)))));
totalMrp.setText(Html.fromHtml(Constants.getTotalMRP(Constants.IndianRupeesFormat(responseobj.getString(getResources().getString(R.string.netpayable))))));
if(checkBox.isChecked()){
barcode_enter.requestFocus();
}else{
empId.setText("");
empId.requestFocus();
}
Log.e("total Qty ========>", responseobj.getString(getResources().getString(R.string.totalqty)));
Log.e("total NetPayable ===>", responseobj.getString(getResources().getString(R.string.netpayable)));
}
} else if (responseobj.getInt("success") == 3) {
runOnUiThread(() -> {
try {
Constants.getToast(CreateDeliverySlip.this, responseobj.getString(getResources().getString(R.string.msg)));
Login.logout(CreateDeliverySlip.this);
} catch (JSONException e) {
e.printStackTrace();
}
});
} else if (responseobj.has(getResources().getString(R.string.msg))) {
runOnUiThread(() -> {
try {
Constants.getToast(CreateDeliverySlip.this, responseobj.getString(getResources().getString(R.string.msg)));
//barcode_enter.setText("");
barcode_enter.requestFocus();
} catch (JSONException e) {
e.printStackTrace();
}
});
}
}else {
runOnUiThread(() -> Constants.getToast(CreateDeliverySlip.this,Response));
}
} catch (JSONException e) {
e.printStackTrace();
}
});
} catch (NullPointerException io) {
io.printStackTrace();
} finally {
response.body().close();
}
}
});
} else {
Constants.ProgressDialogDismiss();
Constants.getToast(CreateDeliverySlip.this, "No Barcode Scanned Items");
totalItems.setText("");
totalMrp.setText("");
valid.setVisibility(View.GONE);
}
}
} catch (JSONException e) {
e.printStackTrace();
}catch (NullPointerException npe){
npe.printStackTrace();
}
}
private void bluetoothPair() {
dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.print_dialog);
dialog.getWindow().setLayout(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT);
dialog.show();
bluetooth_list = dialog.findViewById(R.id.bluetooth_list);
ImageView refresh_bluetooth = dialog.findViewById(R.id.refresh_bluetooth);
mPrinterList = new ArrayList<HashMap<String, String>>();
mPrinterListAdapter = new SimpleAdapter(this, mPrinterList, R.layout.list_at,
new String[]{"PrinterName", "Target"},
new int[]{R.id.PrinterName, R.id.Target});
bluetooth_list.setAdapter(mPrinterListAdapter);
bluetooth_list.setOnItemClickListener(this);
mFilterOption = new FilterOption();
mFilterOption.setDeviceType(Discovery.TYPE_PRINTER);
mFilterOption.setEpsonFilter(Discovery.FILTER_NAME);
try{
if (initial) {
Discovery.stop();
initial = false;
Discovery.start(this, mFilterOption, mDiscoveryListener);
// Constants.ProgressDialogShow(this);
} else {
try {
Discovery.start(this, mFilterOption, mDiscoveryListener);
Constants.ProgressDialogShow(this);
} catch (Exception e) {
//Log.e("Exception =======>",e.getMessage());
}
}
} catch (Epos2Exception e) {
try {
Discovery.start(this, mFilterOption, mDiscoveryListener);
} catch (Epos2Exception e1) {
e1.getMessage();
}
if (e.getErrorStatus() != Epos2Exception.ERR_PROCESSING) {
ShowMsg.showException(e, "stop", CreateDeliverySlip.this);
return;
}
} finally {
}
refresh_bluetooth.setOnClickListener(v -> restartDiscovery());
}
private void restartDiscovery() {
while (true) {
try {
Discovery.stop();
break;
} catch (Epos2Exception e) {
if (e.getErrorStatus() != Epos2Exception.ERR_PROCESSING) {
ShowMsg.showException(e, "stop", CreateDeliverySlip.this);
return;
}
}
}
mPrinterList.clear();
mPrinterListAdapter.notifyDataSetChanged();
try {
Discovery.start(this, mFilterOption, mDiscoveryListener);
Constants.ProgressDialogShow(this);
} catch (Exception e) {
ShowMsg.showException(e, "stop", CreateDeliverySlip.this);
}
}
private DiscoveryListener mDiscoveryListener = deviceInfo -> runOnUiThread(new Runnable() {
@Override
public synchronized void run() {
initial = true;
HashMap<String, String> item = new HashMap<>();
item.put("PrinterName", deviceInfo.getDeviceName());
item.put("Target", deviceInfo.getTarget());
mPrinterList.add(item);
mPrinterListAdapter.notifyDataSetChanged();
Constants.ProgressDialogDismiss();
}
});
}
package w.soulofpluto.posstock;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/*
Create by Ramesh Babu
*/
public class CreateResponse {
@SerializedName("success")
@Expose
private Integer success;
@SerializedName("data")
@Expose
private List<Datum> data = null;
@SerializedName("promo_suggestions")
@Expose
private List<Object> promoSuggestions = null;
@SerializedName("total_qty")
@Expose
private Integer totalQty;
@SerializedName("net_payable")
@Expose
private Integer netPayable;
@SerializedName("last_scanned_barcode")
@Expose
private String lastScannedBarcode;
@SerializedName("barcode_images")
@Expose
private List<Object> barcodeImages = null;
@SerializedName("transaction_start_time")
@Expose
private String transactionStartTime;
@SerializedName("transaction_start_microtime")
@Expose
private Long transactionStartMicrotime;
public Integer getSuccess() {
return success;
}
public void setSuccess(Integer success) {
this.success = success;
}
public List<Datum> getData() {
return data;
}
public void setData(List<Datum> data) {
this.data = data;
}
public List<Object> getPromoSuggestions() {
return promoSuggestions;
}
public void setPromoSuggestions(List<Object> promoSuggestions) {
this.promoSuggestions = promoSuggestions;
}
public Integer getTotalQty() {
return totalQty;
}
public void setTotalQty(Integer totalQty) {
this.totalQty = totalQty;
}
public Integer getNetPayable() {
return netPayable;
}
public void setNetPayable(Integer netPayable) {
this.netPayable = netPayable;
}
public String getLastScannedBarcode() {
return lastScannedBarcode;
}
public void setLastScannedBarcode(String lastScannedBarcode) {
this.lastScannedBarcode = lastScannedBarcode;
}
public List<Object> getBarcodeImages() {
return barcodeImages;
}
public void setBarcodeImages(List<Object> barcodeImages) {
this.barcodeImages = barcodeImages;
}
public String getTransactionStartTime() {
return transactionStartTime;
}
public void setTransactionStartTime(String transactionStartTime) {
this.transactionStartTime = transactionStartTime;
}
public Long getTransactionStartMicrotime() {
return transactionStartMicrotime;
}
public void setTransactionStartMicrotime(Long transactionStartMicrotime) {
this.transactionStartMicrotime = transactionStartMicrotime;
}
public class Datum {
@SerializedName("barcode")
@Expose
private String barcode;
@SerializedName("emp_id")
@Expose
private String empId;
@SerializedName("quantity")
@Expose
private Integer quantity;
@SerializedName("promo_disc")
@Expose
private Integer promoDisc;
@SerializedName("item_rsp")
@Expose
private String itemRsp;
@SerializedName("net_payable")
@Expose
private Integer netPayable;
@SerializedName("issis")
@Expose
private Integer issis;
@SerializedName("uom")
@Expose
private String uom;
@SerializedName("emp_name")
@Expose
private String empName;
@SerializedName("item_level_promo_name")
@Expose
private String itemLevelPromoName;
@SerializedName("bill_level_promo_name")
@Expose
private String billLevelPromoName;
@SerializedName("discount_code")
@Expose
private String discountCode;
@SerializedName("promo_suggested")
@Expose
private String promoSuggested;
@SerializedName("suggested_promo_id")
@Expose
private Integer suggestedPromoId;
@SerializedName("color_code")
@Expose
private String colorCode;
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public String getEmpId() {
return empId;
}
public void setEmpId(String empId) {
this.empId = empId;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Integer getPromoDisc() {
return promoDisc;
}
public void setPromoDisc(Integer promoDisc) {
this.promoDisc = promoDisc;
}
public String getItemRsp() {
return itemRsp;
}
public void setItemRsp(String itemRsp) {
this.itemRsp = itemRsp;
}
public Integer getNetPayable() {
return netPayable;
}
public void setNetPayable(Integer netPayable) {
this.netPayable = netPayable;
}
public Integer getIssis() {
return issis;
}
public void setIssis(Integer issis) {
this.issis = issis;
}
public String getUom() {
return uom;
}
public void setUom(String uom) {
this.uom = uom;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public String getItemLevelPromoName() {
return itemLevelPromoName;
}
public void setItemLevelPromoName(String itemLevelPromoName) {
this.itemLevelPromoName = itemLevelPromoName;
}
public String getBillLevelPromoName() {
return billLevelPromoName;
}
public void setBillLevelPromoName(String billLevelPromoName) {
this.billLevelPromoName = billLevelPromoName;
}
public String getDiscountCode() {
return discountCode;
}
public void setDiscountCode(String discountCode) {
this.discountCode = discountCode;
}
public String getPromoSuggested() {
return promoSuggested;
}
public void setPromoSuggested(String promoSuggested) {
this.promoSuggested = promoSuggested;
}
public Integer getSuggestedPromoId() {
return suggestedPromoId;
}
public void setSuggestedPromoId(Integer suggestedPromoId) {
this.suggestedPromoId = suggestedPromoId;
}
public String getColorCode() {
return colorCode;
}
public void setColorCode(String colorCode) {
this.colorCode = colorCode;
}
}
}
\ No newline at end of file
package w.soulofpluto.posstock;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
/*
Create by Ramesh Babu
*/
public class CreateSaleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
private Context context;
private ArrayList<Model> List;
public CreateSaleAdapter(Context context, ArrayList<Model> list){
this.context = context;
this.List = list;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i){
LayoutInflater layoutInflater = LayoutInflater.from(viewGroup.getContext());
View listItem = layoutInflater.inflate(R.layout.custom_list_item, viewGroup, false);
CreateSaleAdapter.ViewHolder viewHolder = new CreateSaleAdapter.ViewHolder(listItem);
return viewHolder;
}
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder viewHolder, final int position){
final Model model = List.get(position);
((ViewHolder)viewHolder).Id.setText(model.getDelivery_slip_id());
((ViewHolder)viewHolder).remove.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
List.remove(position);
notifyDataSetChanged();
((CreateSaleBill)context).SetData(model.getDelivery_slip_id());
}
});
}
@Override
public int getItemCount(){
return List.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
private TextView Id;
private ImageView remove;
public ViewHolder(View itemView){
super(itemView);
this.Id = itemView.findViewById(R.id.Id);
this.remove = itemView.findViewById(R.id.remove);
}
}
}
package w.soulofpluto.posstock;
import android.Manifest;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.epson.epos2.Epos2Exception;
import com.epson.epos2.discovery.DeviceInfo;
import com.epson.epos2.discovery.Discovery;
import com.epson.epos2.discovery.DiscoveryListener;
import com.epson.epos2.discovery.FilterOption;
import com.epson.epos2.printer.Printer;
import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener;
import com.squareup.okhttp.RequestBody;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import static w.soulofpluto.posstock.Constants.DeliveryslipAmt;
import static w.soulofpluto.posstock.Constants.DeliveryslipQty;
import static w.soulofpluto.posstock.Constants.JSON;
/*
Create by Ramesh Babu
*/
public class CreateSaleBill extends AppCompatActivity implements View.OnClickListener,
ReceiveListener, AdapterView.OnItemClickListener,DataInterface, TextView.OnEditorActionListener {
private Button pluto_Print, send , generate_invoice;
private Toolbar main_toolbar;
private EditText cust_name, cust_number, ds_Number,last_four_digits;
public Menu globalMenuItem;
private TextView gross_amount,discount_amount,round_off,netamount;
private PreferenceManager preferenceManager;
private LinearLayout layout,data;
private StringBuilder builder;
private StringBuilder build;
private String NetAmount;
private ArrayList<Model> datalist;
private JSONObject responseobj;
private RecyclerView ds_list;
ArrayList<String> arrayList;
Dialog dialog;
private static final int REQUEST_PERMISSION = 100;
public static Printer mPrinter = null;
private Context mContext = null;
ListView bluetooth_list;
private ArrayList<HashMap<String, String>> mPrinterList = null;
private SimpleAdapter mPrinterListAdapter = null;
private FilterOption mFilterOption = null;
private TextView store_location;
private Boolean initial = false;
private String BankName;
private int BankId;
Dialog bankdialog;
private DataPresenter dataPresenter;
private Boolean print = false;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_salebill);
cust_name = findViewById(R.id.cust_name);
cust_number = findViewById(R.id.cust_number);
store_location = findViewById(R.id.store_location);
ds_Number = findViewById(R.id.ds_Number);
gross_amount = findViewById(R.id.gross_amount);
discount_amount = findViewById(R.id.discount_amount);
round_off = findViewById(R.id.round_off);
netamount = findViewById(R.id.netamount);
pluto_Print = findViewById(R.id.pluto_Print);
send = findViewById(R.id.send);
layout = findViewById(R.id.layout);
data = findViewById(R.id.data);
main_toolbar = findViewById(R.id.main_toolbar);
ds_list = findViewById(R.id.ds_list);
//last_four_digits = findViewById(R.id.last_four_digits);
generate_invoice = findViewById(R.id.generate_invoice);
//bank_details = findViewById(R.id.bank_details);
preferenceManager = new PreferenceManager(this);
store_location.setText(preferenceManager.getStoreName());
//pluto_pay.setOnClickListener(this);
pluto_Print.setOnClickListener(this);
generate_invoice.setOnClickListener(this);
send.setOnClickListener(this);
setSupportActionBar(main_toolbar);
getSupportActionBar().setTitle(" Create Sale Bill ");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
builder = new StringBuilder();
//build = new StringBuilder();
datalist = new ArrayList<>();
requestRuntimePermission();
mContext = this;
dataPresenter = new DataPresenter(this,(DataInterface)this);
ds_Number.setOnEditorActionListener(this);
cust_number.addTextChangedListener(new AutoChecked());
}
class AutoChecked implements TextWatcher {
public void afterTextChanged(Editable s){
try{
if(s.toString().length() == 10){
cust_name.requestFocus();
JSONObject object = new JSONObject();
try {
object.put("customer_phone",s.toString());
} catch (JSONException e) {
e.printStackTrace();
}
RequestBody body = RequestBody.create(JSON,object.toString());
dataPresenter.CustomerName(Constants.BASE_URL+"/Customers/getCustomerByPhoneNumber",body);
}
}catch(NumberFormatException nfe){
nfe.printStackTrace();
}
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
}
@Override
protected void onResume(){
super.onResume();
}
private void requestRuntimePermission() {
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M){
return;
}
int permissionStorage = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
int permissionLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);
List<String> requestPermissions = new ArrayList<>();
if(permissionStorage == PackageManager.PERMISSION_DENIED) {
requestPermissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
if(permissionLocation == PackageManager.PERMISSION_DENIED) {
requestPermissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);
}
if(!requestPermissions.isEmpty()) {
ActivityCompat.requestPermissions(this, requestPermissions.toArray(new String[requestPermissions.size()]), REQUEST_PERMISSION);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
if(requestCode != REQUEST_PERMISSION || grantResults.length == 0){
return;
}
List<String> requestPermissions = new ArrayList<>();
for(int i = 0; i < permissions.length; i++){
if(permissions[i].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)
&& grantResults[i] == PackageManager.PERMISSION_DENIED){
requestPermissions.add(permissions[i]);
}
if(permissions[i].equals(Manifest.permission.ACCESS_COARSE_LOCATION)
&& grantResults[i] == PackageManager.PERMISSION_DENIED){
requestPermissions.add(permissions[i]);
}
}
if(!requestPermissions.isEmpty()){
ActivityCompat.requestPermissions(this, requestPermissions.toArray(new String[requestPermissions.size()]), REQUEST_PERMISSION);
}
}
private void DsData(final String Id) {
arrayList = new ArrayList<>();
build = new StringBuilder();
if (datalist.size() > 0) {
for (int i = 0; i < datalist.size(); i++) {
Model data = datalist.get(i);
if (data.getDelivery_slip_id().equalsIgnoreCase(Id)) {
datalist.remove(i);
} else {
if (Id != "") {
if (build.toString().length() > 0) {
arrayList.add(data.getDelivery_slip_id());
build.append(Constants.PrintData(data.getDelivery_slip_id()));
} else {
arrayList.add(data.getDelivery_slip_id());
build.append(Constants.PrintData1(data.getDelivery_slip_id()));
}
}
}
}
if (Id != "") {
if (build.toString().length() > 0) {
build.append(Constants.PrintData(Id)).toString();
} else {
build.append(Constants.PrintData1(Id)).toString();
}
Log.e("Array List Data ====>" , Id);
Log.e("Array List Data1 ===>" , String.valueOf(arrayList));
}
} else {
if (Id != "") {
if (build.toString().length() > 0) {
build.append(Constants.PrintData(Id)).toString();
} else {
build.append(Constants.PrintData1(Id)).toString();
}
Log.e("Array List Data ====>" , Id);
Log.e("Array List Data1 ===>" , String.valueOf(arrayList));
//Collections.sort(arrayList);
} else {
layout.setVisibility(View.GONE);
Constants.getToast(this, "No data");
//Constants.ProgressDialogDismiss();
}
}
Log.e("Formation Data ===========>" , Constants.formdata(build.toString(), cust_name.getText().toString(), cust_number.getText().toString()));
RequestBody body = RequestBody.create(JSON, Constants.formdata(build.toString(), cust_name.getText().toString(), cust_number.getText().toString()));
if(Constants.isNetworkAvailable(this)) {
dataPresenter.SendDeliverySlipNumber(Constants.BASE_URL + "/Sales/pre_sale_check", body,Id);
Constants.ProgressDialogShow(CreateSaleBill.this);
}else{
Constants.getToast(CreateSaleBill.this,"Please check your internet connection");
}
}
private void SetData(ArrayList<Model> dList){
CreateSaleAdapter benifitsAdapter = new CreateSaleAdapter(CreateSaleBill.this, dList);
ds_list.setLayoutManager(new LinearLayoutManager(this));
ds_list.setAdapter(benifitsAdapter);
}
public void SetData(String Id){
//System.out.println("Data =====>" + Id);
//System.out.println("Before =====>" + datalist.size());
for(int i = 0; i < datalist.size(); i++)
Log.e("Before After =====>" , String.valueOf(datalist.size()));
Remove();
}
private void Remove(){
arrayList = new ArrayList<>();
build = new StringBuilder();
if (datalist.size() > 0){
for(int i = 0; i < datalist.size(); i++){
Model data = datalist.get(i);
if (build.toString().length() > 0) {
build.append(Constants.PrintData(data.getDelivery_slip_id())).toString();
} else {
build.append(Constants.PrintData1(data.getDelivery_slip_id())).toString();
}
}
RequestBody body = RequestBody.create(JSON, Constants.formdata(build.toString(), cust_name.getText().toString(), cust_number.getText().toString()));
if(Constants.isNetworkAvailable(CreateSaleBill.this)) {
dataPresenter.SendDeliverySlipNumberremove(Constants.BASE_URL + "/Sales/pre_sale_check", body);
Constants.ProgressDialogShow(CreateSaleBill.this);
}else{
Constants.getToast(CreateSaleBill.this,"Please check your internet connection");
}
} else {
//Constants.ProgressDialogDismiss();
layout.setVisibility(View.GONE);
Constants.getToast(this, "No data");
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.menu_create, menu);
globalMenuItem = menu;
if(preferenceManager.getBLUETOOTH().length()>0){
//System.out.println("connection ====>"+preferenceManager.getBLUETOOTH().length());
globalMenuItem.findItem(R.id.dashboard_connection).setIcon(R.drawable.ic_bluetooth_indicator);
}else{
//System.out.println("connection1 ====>"+preferenceManager.getBLUETOOTH());
globalMenuItem.findItem(R.id.dashboard_connection).setIcon(R.drawable.ic_bluetooth_signal_indicator);
}
return super.onCreateOptionsMenu(menu);
}
@Override
public void onBackPressed(){
super.onBackPressed();
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch(item.getItemId()){
case android.R.id.home:
finish();
break;
case R.id.dashboard_logout:
Logout(preferenceManager.getUserId());
try {
Discovery.stop();
break;
}catch (Epos2Exception e1){
Log.e("Output =====>",e1.getMessage());
}
break;
case R.id.dashboard_connection:
bluetoothpair();
break;
case R.id.dashboard_reload:
startActivity(getIntent());
finish();
try {
Discovery.stop();
break;
}catch (Epos2Exception e1){
//Log.e("Output =====>",e1.getMessage());
}
break;
}
return super.onOptionsItemSelected(item);
}
private void bluetoothpair(){
dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.print_dialog);
dialog.getWindow().setLayout(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT);
dialog.show();
bluetooth_list = dialog.findViewById(R.id.bluetooth_list);
ImageView refresh_bluetooth = dialog.findViewById(R.id.refresh_bluetooth);
mPrinterList = new ArrayList<HashMap<String,String>>();
mPrinterListAdapter = new SimpleAdapter(this, mPrinterList, R.layout.list_at,
new String[] { "PrinterName", "Target" },
new int[] { R.id.PrinterName, R.id.Target });
bluetooth_list.setAdapter(mPrinterListAdapter);
bluetooth_list.setOnItemClickListener(this);
mFilterOption = new FilterOption();
mFilterOption.setDeviceType(Discovery.TYPE_PRINTER);
mFilterOption.setEpsonFilter(Discovery.FILTER_NAME);
try{
//Constants.ProgressDialogDismiss();
//18072
if(initial) {
Discovery.stop();
initial = false;
Discovery.start(this, mFilterOption, mDiscoveryListener);
Constants.ProgressDialogShow(this);
}else{
Discovery.start(this, mFilterOption, mDiscoveryListener);
Constants.ProgressDialogShow(this);
}
}catch(Epos2Exception e){
try {
Discovery.start(this, mFilterOption, mDiscoveryListener);
Constants.ProgressDialogShow(this);
}catch (Epos2Exception e1){
e1.getMessage();
}
if (e.getErrorStatus() != Epos2Exception.ERR_PROCESSING){
ShowMsg.showException(e, "stop", mContext);
return;
}
}finally {
}
refresh_bluetooth.setOnClickListener(v -> restartDiscovery());
}
private void restartDiscovery(){
while (true) {
try {
//Constants.ProgressDialogDismiss();
Discovery.stop();
break;
}
catch (Epos2Exception e) {
if (e.getErrorStatus() != Epos2Exception.ERR_PROCESSING) {
ShowMsg.showException(e, "stop", mContext);
return;
}
}
}
mPrinterList.clear();
mPrinterListAdapter.notifyDataSetChanged();
try {
Discovery.start(this, mFilterOption, mDiscoveryListener);
Constants.ProgressDialogShow(this);
}
catch (Exception e) {
ShowMsg.showException(e, "stop", mContext);
}
}
private DiscoveryListener mDiscoveryListener = deviceInfo -> runOnUiThread(new Runnable(){
@Override
public synchronized void run(){
initial = true;
HashMap<String, String> item = new HashMap<String, String>();
item.put("PrinterName", deviceInfo.getDeviceName());
item.put("Target", deviceInfo.getTarget());
mPrinterList.add(item);
mPrinterListAdapter.notifyDataSetChanged();
Constants.ProgressDialogDismiss();
}
});
private void Logout(String Id){
if(Constants.isNetworkAvailable(CreateSaleBill.this)){
dataPresenter.Logout(Constants.BASE_URL + "/login/doLogout/" + Id);
Constants.ProgressDialogShow(CreateSaleBill.this);
}else{
Constants.getToast(CreateSaleBill.this,"Please check your internet connection");
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
try {
Intent intent = new Intent();
HashMap<String, String> item = mPrinterList.get(position);
intent.putExtra(getString(R.string.title_target), item.get("Target"));
dialog.dismiss();
preferenceManager.setBLUETOOTH(item.get("Target"));
invalidateOptionsMenu();
}catch (NullPointerException np){
np.printStackTrace();
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.pluto_Print:
print = true;
updateButtonState(false);
if(!runPrintReceiptSequence()){
updateButtonState(true);
}
break;
case R.id.generate_invoice:
if(preferenceManager.getBLUETOOTH().length()>0) {
bankdialog = new Dialog(this);
bankdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
bankdialog.setCancelable(false);
bankdialog.setContentView(R.layout.dialog);
final Spinner bank_names = bankdialog.findViewById(R.id.bank_names);
last_four_digits = bankdialog.findViewById(R.id.last_four_digits);
last_four_digits.setOnEditorActionListener(this);
Button bank_submit = bankdialog.findViewById(R.id.bank_submit);
ImageView dialog_close = bankdialog.findViewById(R.id.dialog_close);
final ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("Select Bank");
arrayList.add("Canara Bank");
arrayList.add("State Bank of India");
arrayList.add("Lakshmi Vilas Bank");
final ArrayList<Integer> arrayList1 = new ArrayList<>();
arrayList1.add(0);
arrayList1.add(6);
arrayList1.add(3);
arrayList1.add(4);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, arrayList);
bank_names.setAdapter(adapter);
bank_names.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
BankName = arrayList.get(position);
BankId = arrayList1.get(position);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
dialog_close.setOnClickListener(v1 -> bankdialog.dismiss());
bank_submit.setOnClickListener(v12 -> {
if (BankName.equalsIgnoreCase("Select Bank") && last_four_digits.getText().toString().length() == 0) {
Constants.getToast(CreateSaleBill.this, "Please Select Bank and Enter last four digits");
} else if (BankName.equalsIgnoreCase("Select Bank")) {
Constants.getToast(CreateSaleBill.this, "Please Select Bank ");
} else if (last_four_digits.getText().toString().length() == 0) {
Constants.getToast(CreateSaleBill.this, "Enter last four digits");
} else if (last_four_digits.getText().toString().length() == 4) {
//dialog.dismiss();
if (Constants.isNetworkAvailable(CreateSaleBill.this)) {
Constants.hideSoftKeyBoardOnTabClicked(v12, CreateSaleBill.this);
PrintData(last_four_digits.getText().toString(), BankId);
//Constants.ProgreesDialogShow(CreateSaleBill.this);
}else{
Constants.getToast(CreateSaleBill.this,"Please check your internet connection");
}
}
});
bankdialog.show();
}else{
Constants.getToast(this,"Please Pair Bluetooth Printer");
}
break;
case R.id.send:
if (TextUtils.isEmpty(ds_Number.getText().toString())) {
Constants.getToast(CreateSaleBill.this, "Enter Delivery Slip Id");
} else {
if(preferenceManager.getBLUETOOTH().length()>0){
DsData(preferenceManager.getPrefix() + ds_Number.getText().toString());
Constants.hideKeyboard(this);
}else{
Constants.getToast(CreateSaleBill.this,"Please Connect Bluetooth Printer");
}
}
break;
}
}
private boolean runPrintReceiptSequence(){
if (!initializeObject()) {
Log.e("runPrintReceipt","");
return false;
}
if (!createReceiptData()) {
Log.e("runPrintReceipt1","");
finalizeObject();
return false;
}
if (!printData()) {
finalizeObject();
Log.e("runPrintReceipt2","");
return false;
}
return true;
}
private void finalizeObject(){
if (mPrinter == null) {
return;
}
mPrinter.clearCommandBuffer();
mPrinter.setReceiveEventListener(null);
mPrinter = null;
}
@Override
public void onPtrReceive(final Printer printerObj, final int code, final PrinterStatusInfo status, final String printJobId) {
runOnUiThread(new Runnable() {
@Override
public synchronized void run() {
ShowMsg.showResult(code, makeErrorMessage(status), mContext);
dispPrinterWarnings(status);
updateButtonState(true);
new Thread(new Runnable() {
@Override
public void run() {
disconnectPrinter();
}
}).start();
}
});
}
private String makeErrorMessage(PrinterStatusInfo status){
String msg = "";
if (status.getOnline() == Printer.FALSE){
msg += getString(R.string.handlingmsg_err_offline);
}
if (status.getConnection() == Printer.FALSE){
msg += getString(R.string.handlingmsg_err_no_response);
}
if (status.getCoverOpen() == Printer.TRUE){
msg += getString(R.string.handlingmsg_err_cover_open);
}
if (status.getPaper() == Printer.PAPER_EMPTY){
msg += getString(R.string.handlingmsg_err_receipt_end);
}
if (status.getPaperFeed() == Printer.TRUE || status.getPanelSwitch() == Printer.SWITCH_ON){
msg += getString(R.string.handlingmsg_err_paper_feed);
}
if (status.getErrorStatus() == Printer.MECHANICAL_ERR || status.getErrorStatus() == Printer.AUTOCUTTER_ERR){
msg += getString(R.string.handlingmsg_err_autocutter);
msg += getString(R.string.handlingmsg_err_need_recover);
}
if (status.getErrorStatus() == Printer.UNRECOVER_ERR){
msg += getString(R.string.handlingmsg_err_unrecover);
}
if (status.getErrorStatus() == Printer.AUTORECOVER_ERR){
if (status.getAutoRecoverError() == Printer.HEAD_OVERHEAT) {
msg += getString(R.string.handlingmsg_err_overheat);
msg += getString(R.string.handlingmsg_err_head);
}
if (status.getAutoRecoverError() == Printer.MOTOR_OVERHEAT){
msg += getString(R.string.handlingmsg_err_overheat);
msg += getString(R.string.handlingmsg_err_motor);
}
if (status.getAutoRecoverError() == Printer.BATTERY_OVERHEAT){
msg += getString(R.string.handlingmsg_err_overheat);
msg += getString(R.string.handlingmsg_err_battery);
}
if (status.getAutoRecoverError() == Printer.WRONG_PAPER){
msg += getString(R.string.handlingmsg_err_wrong_paper);
}
}
if (status.getBatteryLevel() == Printer.BATTERY_LEVEL_0){
msg += getString(R.string.handlingmsg_err_battery_real_end);
}
return msg;
}
private boolean printData(){
if(mPrinter == null){
return false;
}
if (!connectPrinter()) {
return false;
}
PrinterStatusInfo status = mPrinter.getStatus();
dispPrinterWarnings(status);
if (!isPrintable(status)) {
ShowMsg.showMsg(makeErrorMessage(status), mContext);
try {
mPrinter.disconnect();
}
catch (Exception ex) {
// Do nothing
}
return false;
}
try {
mPrinter.sendData(Printer.PARAM_DEFAULT);
}
catch (Exception e) {
ShowMsg.showException(e, "sendData", mContext);
try {
mPrinter.disconnect();
}
catch (Exception ex) {
// Do nothing
}
return false;
}
return true;
}
private void dispPrinterWarnings(PrinterStatusInfo status) {
//EditText edtWarnings = (EditText)findViewById(R.id.edtWarnings);
String warningsMsg = "";
if (status == null) {
return;
}
if (status.getPaper() == Printer.PAPER_NEAR_END) {
warningsMsg += getString(R.string.handlingmsg_warn_receipt_near_end);
}
if (status.getPaper() == Printer.PAPER_EMPTY) {
warningsMsg += "Paper Roll Is Empty";
}
if (status.getBatteryLevel() == Printer.BATTERY_LEVEL_1) {
warningsMsg += getString(R.string.handlingmsg_warn_battery_near_end);
}
if(warningsMsg.length()>0){
Constants.getToast(CreateSaleBill.this,warningsMsg);
}
Log.e("Print ======>", String.valueOf(status.getPaper()));
// edtWarnings.setText(warningsMsg);
}
private boolean isPrintable(PrinterStatusInfo status) {
if (status == null) {
return false;
}
if (status.getConnection() == Printer.FALSE) {
return false;
}
else if (status.getOnline() == Printer.FALSE) {
return false;
}
else {
}
return true;
}
private void disconnectPrinter() {
if (mPrinter == null) {
return;
}
try {
mPrinter.endTransaction();
}
catch (final Exception e) {
}
try {
mPrinter.disconnect();
}
catch (final Exception e) {
}
finalizeObject();
}
private boolean connectPrinter() {
boolean isBeginTransaction = false;
if (mPrinter == null) {
return false;
}
try {
//System.out.println("Checking Printer ======>"+com.epson.epos2.printer.Printer.PARAM_DEFAULT);
mPrinter.connect(preferenceManager.getBLUETOOTH(), 30000);
//Log.e("Shared Preferences Bluetooth ========>",preferenceManager.getBLUETOOTH());
}
catch (Exception e) {
ShowMsg.showException(e, "connect", mContext);
return false;
}
try {
mPrinter.beginTransaction();
isBeginTransaction = true;
}
catch (Exception e) {
ShowMsg.showException(e, "beginTransaction", mContext);
}
if (isBeginTransaction == false) {
try {
mPrinter.disconnect();
}
catch (Epos2Exception e) {
// Do nothing
return false;
}
}
return true;
}
private boolean initializeObject(){
try{
mPrinter = new Printer(1,6,mContext);
}
catch (Exception e) {
ShowMsg.showException(e, "Printer", mContext);
Constants.ProgressDialogDismiss();
return false;
}
mPrinter.setReceiveEventListener(this);
return true;
}
private void updateButtonState(boolean state) {
pluto_Print.setEnabled(state);
Log.e("Data State Enables===>", String.valueOf(state));
}
private boolean createReceiptData(){
String method = "";
StringBuilder textData = new StringBuilder();
Constants.ProgressDialogDismiss();
if(print){
print = false;
try {
if (mPrinter == null) {
return false;
}
if (responseobj.has("data")) {
Log.e("Response Data =============>" , String.valueOf(responseobj));
JSONObject dataobj = responseobj.getJSONObject("data");
JSONObject dataobject = dataobj.getJSONObject("invoice_data");
if (dataobject.has("website")) {
if (dataobject.getString("website").equalsIgnoreCase("www.kanchivml.com")) {
try {
Bitmap vml = BitmapFactory.decodeResource(getResources(), R.drawable.vara);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(vml, 0, 0,
vml.getWidth(),
vml.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
} else if (dataobject.getString("website").equalsIgnoreCase("www.themandir.com")) {
try {
Bitmap vml = BitmapFactory.decodeResource(getResources(), R.drawable.mandir);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(vml, 0, 0,
vml.getWidth(),
vml.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
} else if (dataobject.getString("website").equalsIgnoreCase("www.klmfashionmall.com")) {
try {
Bitmap vml = BitmapFactory.decodeResource(getResources(), R.drawable.klm);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(vml, 0, 0,
vml.getWidth(),
vml.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
} else if (dataobject.getString("website").equalsIgnoreCase("www.kalamandir.com")) {
try {
Bitmap vml = BitmapFactory.decodeResource(getResources(), R.drawable.kala);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(vml, 0, 0,
vml.getWidth(),
vml.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
}
}
if (dataobject.has("company_name")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
mPrinter.addFeedLine(1);
textData.append(dataobject.getString("company_name") + "\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("store_name")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append(dataobject.getString("store_name") + "\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("addr2")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append(dataobject.getString("addr1") + "\n" + dataobject.getString("addr2") + "\n");
Log.e("Data ======>" , dataobject.getString("addr3"));
if (dataobject.getString("addr3").equalsIgnoreCase("null")) {
} else {
textData.append(dataobject.getString("addr3") + "\n");
}
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("showroom_phone_no")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append(dataobject.getString("showroom_phone_no") + "\n \n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("website")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append(dataobject.getString("website") + "\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("gstno")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append("GSTIN : " + dataobject.getString("gstno") + "\n\n");
textData.append("\n");
textData.append("Retail Invoice \n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(Constants.dashed);
textData.append(" Memo No : " + dataobject.getString("memono") + "\n");
textData.append(" Date : " + dataobject.getString("BillDate") + "\n");
Log.e("name ===================>" , dataobject.getString("customer"));
if (dataobject.getString("customer") != "NA")
textData.append(" Customer : " + dataobject.getString("customer") + "\n");
Log.e("name ===================>" , dataobject.getString("mobile"));
if (dataobject.getString("mobile") != "NA")
textData.append(" Ph No : " + dataobject.getString("mobile") + "\n");
textData.append(Constants.dashed);
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("memono")) {
}
if (dataobject.has("BillDate")) {
}
if (dataobject.has("customer")) {
}
if (dataobject.has("mobile")) {
}
if (dataobject.has("bill_lines")) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" SL Barcode Qty MRP Disc Amount " + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
JSONObject da = dataobject.getJSONObject("bill_lines");
Iterator<String> keys = da.keys();
while (keys.hasNext()) {
String key = keys.next();
if (da.get(key) instanceof JSONArray) {
// do something with jsonObject here
Log.e("Connection =====>" , String.valueOf(da));
Log.e("Connection =====>" , key);
JSONArray bill_data = new JSONArray(da.getString(key));
for (int i = 0; i < bill_data.length(); i++) {
JSONObject bill_object = bill_data.getJSONObject(i);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" " + Constants.SL(bill_object.getString("sno")) +
Constants.Barcode(bill_object.getString("barcode"))
+ Constants.Qty(bill_object.getString("qty")) + Constants.Mrp(bill_object.getString("item_rsp"))
+ Constants.Dis(bill_object.getString("item_qty_disc"))
+ Constants.Total(bill_object.getString("item_qty_payable_amount")));
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" HSN " + bill_object.getString("hsn") + " " + "Gst %" + bill_object.getString("gst_per") + " "
+ " Gst Amt " + bill_object.getString("gst_amount") + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" SM " + bill_object.getString("sm") + " " + bill_object.getString("perticulars") + "\n");
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
}
}
}
}
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" Gross Amount : " + Constants.Gross(dataobject.getString("total_mrp")) + "\n");
textData.append(" Total Savings : " + Constants.TotalSavings(dataobject.getString("total_saving")) + "\n\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addTextSize";
mPrinter.addTextSize(2, 1);
method = "addText";
mPrinter.addText("Total Qty : " + dataobject.getString("total_qty") + "\n");
mPrinter.addText("Net Amount : " + dataobject.getString("total_payable") + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextSize";
mPrinter.addTextSize(1, 1);
method = "addFeedLine";
mPrinter.addFeedLine(1);
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
if (dataobject.has("mop")) {
JSONArray mop = dataobject.getJSONArray("mop");
Log.e("Mop =====>" , String.valueOf(mop));
textData.delete(0, textData.length());
for (int L = 0; L < mop.length(); L++) {
JSONObject object = mop.getJSONObject(L);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
method = "addText";
mPrinter.addText(" " + Constants.RecievedCashText(object.getString("paidtype")) + Constants.RecievedCash(object.getString("paidamount")) + "\n");
}
}
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append("\n" + " Tax Details " + "\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" GST% Taxable CGST SGST IGST " + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
if (dataobject.has("gst_lines")) {
JSONArray TaxArray = new JSONArray(dataobject.getString("gst_lines"));
for (int j = 0; j < TaxArray.length(); j++) {
JSONObject taxoObject = TaxArray.getJSONObject(j);
JSONObject taxdata = new JSONObject();
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" " + Constants.GST(taxoObject.getString("gst_per").trim()) + Constants.Taxable(taxoObject.getString("taxable"))
+ Constants.CGST(taxoObject.getString("cgst")) + Constants.CGST(taxoObject.getString("sgst"))
+ Constants.CGST(taxoObject.getString("igst")) + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("gst_total")) {
JSONObject jsonObject = new JSONObject(dataobject.getString("gst_total"));
method = "addText";
textData.append(" Total " + Constants.Taxable(jsonObject.getString("t_taxable")) + Constants.CGST(jsonObject.getString("t_cgst"))
+ Constants.CGST(jsonObject.getString("t_sgst")) + Constants.CGST(jsonObject.getString("t_igst")) + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
}
method = "addText";
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" Biller : " + dataobject.getString("biller") + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append("\n Delivery Slip Summary\n\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
if (dataobject.has("ds_numbers")) {
JSONArray dslipArray = dataobject.getJSONArray("ds_numbers");
Log.e("DS NUMBERS =====>" , String.valueOf(dslipArray));
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" DS Number Qty Amount ");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
for (int m = 0; m < dslipArray.length(); m++) {
JSONObject object = dslipArray.getJSONObject(m);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
method = "addText";
mPrinter.addText(" " + Constants.Deliveryslipnumber(object.getString("ds_no")) + DeliveryslipQty(object.getString("qty")) + DeliveryslipAmt(object.getString("ds_amount")));
textData.delete(0, textData.length());
}
}
method = "addText";
textData.append("\n" + Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextSize";
mPrinter.addTextSize(2, 2);
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
mPrinter.addText(dataobject.getString("memono") + "\n\n");
method = "addTextSize";
mPrinter.addTextSize(1, 1);
Bitmap logoData1 = BitmapFactory.decodeResource(getResources(), R.drawable.cash_paid);
final int barcodeWidth = 2;
final int barcodeHeight = 100;
if (mPrinter == null) {
return false;
}
try {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(logoData1, 0, 0,
logoData1.getWidth(),
logoData1.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
if (dataobject.has("ds_number_last_numbers")) {
JSONArray dsArray = dataobject.getJSONArray("ds_number_last_numbers");
Log.e("DS NUMBERS =====>" , String.valueOf(dsArray));
for (int n = 0; n < dsArray.length(); n++) {
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addTextSize";
mPrinter.addTextSize(5, 5);
method = "addText";
mPrinter.addText("\n" + dsArray.get(n) + "\n");
}
}
method = "addCut";
mPrinter.addCut(Printer.CUT_FEED);
textData.delete(0, textData.length());
method = "addTextSize";
mPrinter.addTextSize(1, 1);
method = "addFeedLine";
mPrinter.addFeedLine(1);
}
} catch (JSONException jo) {
jo.printStackTrace();
} catch (Epos2Exception e) {
e.printStackTrace();
} catch (Exception e) {
Log.e("Error Message ======>" , e.getMessage());
ShowMsg.showException(e, method, mContext);
return false;
}
}else {
for (int k = 0; k < 2; k++) {
try {
if (mPrinter == null) {
return false;
}
if (responseobj.has("data")) {
Log.e("Response Data =============>" , String.valueOf(responseobj));
JSONObject dataobj = responseobj.getJSONObject("data");
JSONObject dataobject = dataobj.getJSONObject("invoice_data");
if (dataobject.has("website")) {
if (dataobject.getString("website").equalsIgnoreCase("www.kanchivml.com")) {
try {
Bitmap vml = BitmapFactory.decodeResource(getResources(), R.drawable.vara);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(vml, 0, 0,
vml.getWidth(),
vml.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
} else if (dataobject.getString("website").equalsIgnoreCase("www.themandir.com")) {
try {
Bitmap vml = BitmapFactory.decodeResource(getResources(), R.drawable.mandir);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(vml, 0, 0,
vml.getWidth(),
vml.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
} else if (dataobject.getString("website").equalsIgnoreCase("www.klmfashionmall.com")) {
try {
Bitmap vml = BitmapFactory.decodeResource(getResources(), R.drawable.klm);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(vml, 0, 0,
vml.getWidth(),
vml.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
} else if (dataobject.getString("website").equalsIgnoreCase("www.kalamandir.com")) {
try {
Bitmap vml = BitmapFactory.decodeResource(getResources(), R.drawable.kala);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(vml, 0, 0,
vml.getWidth(),
vml.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
}
}
if (dataobject.has("company_name")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
mPrinter.addFeedLine(1);
textData.append(dataobject.getString("company_name") + "\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("store_name")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append(dataobject.getString("store_name") + "\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("addr2")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append(dataobject.getString("addr1") + "\n" + dataobject.getString("addr2") + "\n");
Log.e("Data ======>" , dataobject.getString("addr3"));
if (dataobject.getString("addr3").equalsIgnoreCase("null")) {
} else {
textData.append(dataobject.getString("addr3") + "\n");
}
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("showroom_phone_no")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append(dataobject.getString("showroom_phone_no") + "\n \n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("website")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append(dataobject.getString("website") + "\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("gstno")) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append("GSTIN : " + dataobject.getString("gstno") + "\n\n");
textData.append("\n");
textData.append("Retail Invoice \n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(Constants.dashed);
textData.append(" Memo No : " + dataobject.getString("memono") + "\n");
textData.append(" Date : " + dataobject.getString("BillDate") + "\n");
Log.e("name ===================>" , dataobject.getString("customer"));
if (dataobject.getString("customer") != "NA")
textData.append(" Customer : " + dataobject.getString("customer") + "\n");
Log.e("name ===================>" , dataobject.getString("mobile"));
if (dataobject.getString("mobile") != "NA")
textData.append(" Ph No : " + dataobject.getString("mobile") + "\n");
textData.append(Constants.dashed);
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("memono")) {
}
if (dataobject.has("BillDate")) {
}
if (dataobject.has("customer")) {
}
if (dataobject.has("mobile")) {
}
if (dataobject.has("bill_lines")) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" SL Barcode Qty MRP Disc Amount " + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
JSONObject da = dataobject.getJSONObject("bill_lines");
Iterator<String> keys = da.keys();
while (keys.hasNext()) {
String key = keys.next();
if (da.get(key) instanceof JSONArray) {
// do something with jsonObject here
Log.e("Connection =====>" , String.valueOf(da));
Log.e("Connection =====>" , key);
JSONArray bill_data = new JSONArray(da.getString(key));
for (int i = 0; i < bill_data.length(); i++) {
JSONObject bill_object = bill_data.getJSONObject(i);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" " + Constants.SL(bill_object.getString("sno")) +
Constants.Barcode(bill_object.getString("barcode"))
+ Constants.Qty(bill_object.getString("qty")) + Constants.Mrp(bill_object.getString("item_rsp"))
+ Constants.Dis(bill_object.getString("item_qty_disc"))
+ Constants.Total(bill_object.getString("item_qty_payable_amount")));
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" HSN " + bill_object.getString("hsn") + " " + "Gst %" + bill_object.getString("gst_per") + " "
+ " Gst Amt " + bill_object.getString("gst_amount") + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" SM " + bill_object.getString("sm") + " " + bill_object.getString("perticulars") + "\n");
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
}
}
}
}
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" Gross Amount : " + Constants.Gross(dataobject.getString("total_mrp")) + "\n");
textData.append(" Total Savings : " + Constants.TotalSavings(dataobject.getString("total_saving")) + "\n\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addTextSize";
mPrinter.addTextSize(2, 1);
method = "addText";
mPrinter.addText("Total Qty : " + dataobject.getString("total_qty") + "\n");
mPrinter.addText("Net Amount : " + dataobject.getString("total_payable") + "\n");
/*textData.append("Total Qty : " + dataobject.getString("total_qty")+"\n");
textData.append("Net Amount : " + dataobject.getString("total_payable")+"\n");*/
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextSize";
mPrinter.addTextSize(1, 1);
method = "addFeedLine";
mPrinter.addFeedLine(1);
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
if (dataobject.has("mop")) {
JSONArray mop = dataobject.getJSONArray("mop");
Log.e("Mop =====>" , String.valueOf(mop));
textData.delete(0, textData.length());
for (int L = 0; L < mop.length(); L++) {
JSONObject object = mop.getJSONObject(L);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
method = "addText";
mPrinter.addText(" " + Constants.RecievedCashText(object.getString("paidtype")) + Constants.RecievedCash(object.getString("paidamount")) + "\n");
}
}
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append("\n" + " Tax Details " + "\n");
method = "addText";
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" GST% Taxable CGST SGST IGST " + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
if (dataobject.has("gst_lines")) {
JSONArray TaxArray = new JSONArray(dataobject.getString("gst_lines"));
for (int j = 0; j < TaxArray.length(); j++) {
JSONObject taxoObject = TaxArray.getJSONObject(j);
JSONObject taxdata = new JSONObject();
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" " + Constants.GST(taxoObject.getString("gst_per").trim()) + Constants.Taxable(taxoObject.getString("taxable"))
+ Constants.CGST(taxoObject.getString("cgst")) + Constants.CGST(taxoObject.getString("sgst"))
+ Constants.CGST(taxoObject.getString("igst")) + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
if (dataobject.has("gst_total")) {
JSONObject jsonObject = new JSONObject(dataobject.getString("gst_total"));
method = "addText";
textData.append(" Total " + Constants.Taxable(jsonObject.getString("t_taxable")) + Constants.CGST(jsonObject.getString("t_cgst"))
+ Constants.CGST(jsonObject.getString("t_sgst")) + Constants.CGST(jsonObject.getString("t_igst")) + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
}
}
method = "addText";
textData.append(Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" Biller : " + dataobject.getString("biller") + "\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
textData.append("\n Delivery Slip Summary\n\n");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
if (dataobject.has("ds_numbers")) {
JSONArray dslipArray = dataobject.getJSONArray("ds_numbers");
Log.e("DS NUMBERS =====>" , String.valueOf(dslipArray));
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
textData.append(" DS Number Qty Amount ");
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
for (int m = 0; m < dslipArray.length(); m++) {
JSONObject object = dslipArray.getJSONObject(m);
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_LEFT);
method = "addText";
mPrinter.addText(" " + Constants.Deliveryslipnumber(object.getString("ds_no")) + DeliveryslipQty(object.getString("qty")) + DeliveryslipAmt(object.getString("ds_amount")));
textData.delete(0, textData.length());
}
}
method = "addText";
textData.append("\n" + Constants.dashed);
mPrinter.addText(textData.toString());
textData.delete(0, textData.length());
method = "addTextSize";
mPrinter.addTextSize(2, 2);
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
mPrinter.addText(dataobject.getString("memono") + "\n\n");
method = "addTextSize";
mPrinter.addTextSize(1, 1);
Bitmap logoData1 = BitmapFactory.decodeResource(getResources(), R.drawable.cash_paid);
final int barcodeWidth = 2;
final int barcodeHeight = 100;
if (mPrinter == null) {
return false;
}
try {
method = "addTextAlign";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addImage";
mPrinter.addImage(logoData1, 0, 0,
logoData1.getWidth(),
logoData1.getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO,
Printer.HALFTONE_DITHER,
Printer.PARAM_DEFAULT,
Printer.COMPRESS_AUTO);
method = "addFeedLine";
mPrinter.addFeedLine(1);
} catch (Epos2Exception eps) {
eps.getMessage();
}
if (dataobject.has("ds_number_last_numbers")) {
JSONArray dsArray = dataobject.getJSONArray("ds_number_last_numbers");
Log.e("DS NUMBERS =====>" , String.valueOf(dsArray));
for (int n = 0; n < dsArray.length(); n++) {
method = "addText";
mPrinter.addTextAlign(Printer.ALIGN_CENTER);
method = "addTextSize";
mPrinter.addTextSize(5, 5);
method = "addText";
mPrinter.addText("\n" + dsArray.get(n) + "\n");
}
}
method = "addCut";
mPrinter.addCut(Printer.CUT_FEED);
textData.delete(0, textData.length());
method = "addTextSize";
mPrinter.addTextSize(1, 1);
method = "addFeedLine";
mPrinter.addFeedLine(1);
}
} catch (JSONException jo) {
jo.printStackTrace();
} catch (Epos2Exception e) {
e.printStackTrace();
} catch (Exception e) {
Log.e("Error Message ======>" , e.getMessage());
ShowMsg.showException(e, method, mContext);
return false;
}
}
}
textData = null;
return true;
}
@Override
protected void onDestroy() {
/* if(connection1!= null)
unbindService(connection1);*/
super.onDestroy();
}
@Override
protected void onPause() {
super.onPause();
}
private void PrintData(String cardNo, final int batchId){
build = new StringBuilder();
for (Model data : datalist) {
if (build.toString().length() > 0) {
build.append(Constants.PrintData(data.getDelivery_slip_id()));
} else {
build.append(Constants.PrintData1(data.getDelivery_slip_id()));
}
}
JSONObject object = new JSONObject();
try {
object.put("bank_mapping_id", batchId);
object.put("card_number", cardNo);
object.put("amount", Float.parseFloat(NetAmount));
} catch (JSONException e) {
e.printStackTrace();
}
if(Constants.isNetworkAvailable(CreateSaleBill.this)){
RequestBody body = RequestBody.create(JSON, Constants.formdata1(build.toString(), cust_name.getText().toString(), cust_number.getText().toString(), object));
dataPresenter.FinalData(Constants.BASE_URL + "/Sales/pre_sale_check",body);
Constants.ProgressDialogShow(CreateSaleBill.this);
}else{
Constants.getToast(CreateSaleBill.this,"Please check your internet connection");
}
}
@Override
public void onDeliveryData(int code, final String res, String Id) {
try {
Constants.ProgressDialogDismiss();
if (code == 200) {
final JSONObject object = new JSONObject(res);
if (object.has("success")) {
if (object.getInt("success") == 1) {
layout.setVisibility(View.VISIBLE);
data.setVisibility(View.VISIBLE);
generate_invoice.setVisibility(View.VISIBLE);
ds_Number.setText("");
JSONObject data = object.getJSONObject("data");
gross_amount.setText(Constants.IndianRupeesformat(data.getString("total_gross")));
discount_amount.setText(Constants.IndianRupeesformat(data.getString("total_promo_discount")));
round_off.setText(Constants.IndianRupeesformat(data.getString("round_off_amount")));
netamount.setText(Constants.IndianRupeesformat(data.getString("total_payable")));
NetAmount = data.getString("total_payable");
//build.append("{"+'"'+"delivery_slip_id"+'"'+":"+'"'+preferenceManager.getPrefix()+Id+'"'+","+'"'+"manual_discount"+'"'+":"+0+"}");
//var = true;
datalist.add(new Model(Id, 0));
//setArraylist.add(new Model(Id,0));
if (datalist.size() > 0) {
SetData(datalist);
}
//pluto_pay.setVisibility(View.VISIBLE);
//pluto_Print.setVisibility(View.VISIBLE);
} else {
layout.setVisibility(View.GONE);
generate_invoice.setVisibility(View.GONE);
runOnUiThread(() -> {
try {
Constants.getToast(CreateSaleBill.this, object.getString("msg"));
//Login.logout(CreateSaleBill.this);
} catch (JSONException e) {
e.printStackTrace();
}
});
}
}
} else {
runOnUiThread(() -> Constants.getToast(CreateSaleBill.this, res));
}
} catch (JSONException e) {
e.printStackTrace();
} catch (NullPointerException io) {
io.printStackTrace();
}
}
@Override
public void onDeliveryFail(final String fail) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Constants.ProgressDialogDismiss();
Constants.getToast(CreateSaleBill.this, fail);
}
});
}
@Override
public void onDeliveryDataRemove(int code, final String res) {
try {
Constants.ProgressDialogDismiss();
if (code == 200) {
final JSONObject obj = new JSONObject(res);
if (obj.has("success")) {
if (obj.getInt("success") == 1) {
layout.setVisibility(View.VISIBLE);
ds_Number.setText("");
JSONObject data = obj.getJSONObject("data");
gross_amount.setText(Constants.IndianRupeesformat(data.getString("total_gross")));
discount_amount.setText(Constants.IndianRupeesformat(data.getString("total_promo_discount")));
round_off.setText(Constants.IndianRupeesformat(data.getString("round_off_amount")));
netamount.setText(Constants.IndianRupeesformat(data.getString("total_payable")));
NetAmount = data.getString("total_payable");
if (datalist.size() > 0) {
SetData(datalist);
}
} else {
layout.setVisibility(View.GONE);
//bank_details.setVisibility(View.GONE);
runOnUiThread(() -> {
try {
Constants.getToast(CreateSaleBill.this, obj.getString("msg"));
Login.logout(CreateSaleBill.this);
} catch (JSONException e) {
e.printStackTrace();
}
});
}
}
} else {
runOnUiThread(new Runnable() {
@Override
public void run() {
Constants.getToast(CreateSaleBill.this, res);
}
});
}
} catch (JSONException e) {
e.printStackTrace();
} catch (NullPointerException io) {
io.printStackTrace();
}
}
@Override
public void onDeliveryFailRemove(final String fail) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Constants.ProgressDialogDismiss();
Constants.getToast(CreateSaleBill.this,fail);
}
});
}
@Override
public void onLogoutData(int code, final String remove) {
try {
Constants.ProgressDialogDismiss();
if (code == 200) {
final JSONObject object = new JSONObject(remove);
//stores = new ArrayList<>();
if (object.has("success")) {
if (object.getInt("success") == 1) {
//JSONObject data = object.getJSONObject("data");
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Constants.getToast(CreateSaleBill.this, object.getString("msg"));
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setBLUETOOTH("");
Login.logout(CreateSaleBill.this);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
} else {
runOnUiThread(() -> {
try {
Constants.getToast(CreateSaleBill.this, object.getString("msg"));
Login.logout(CreateSaleBill.this);
} catch (JSONException e) {
e.printStackTrace();
}
});
}
}
}else{
runOnUiThread(() -> Constants.getToast(CreateSaleBill.this,remove));
}
} catch (JSONException e) {
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
}
@Override
public void onLogoutFail(final String fail) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Constants.ProgressDialogDismiss();
Constants.getToast(CreateSaleBill.this,fail);
}
});
}
@Override
public void onFinalData(int code, String finalData) {
try{
Constants.ProgressDialogDismiss();
bankdialog.dismiss();
if (code == 200) {
pluto_Print.setVisibility(View.VISIBLE);
generate_invoice.setVisibility(View.GONE);
data.setVisibility(View.INVISIBLE);
ds_list.setAdapter(null);
datalist.clear();
cust_name.setText("");
cust_number.setText("");
responseobj = new JSONObject(finalData);
if(responseobj.has("success")) {
if (responseobj.getInt("success") == 1) {
updateButtonState(false);
if (!runPrintReceiptSequence()) {
updateButtonState(true);
}
} else {
runOnUiThread(() -> {
try {
Constants.getToast(CreateSaleBill.this, responseobj.getString("msg"));
Login.logout(CreateSaleBill.this);
} catch (JSONException e) {
e.printStackTrace();
}
});
}
}
} else {
Constants.getToast(CreateSaleBill.this, finalData);
}
} catch (JSONException e) {
e.printStackTrace();
} catch (NullPointerException np) {
np.printStackTrace();
}
}
@Override
public void onFinalFail(final String finalFail) {
runOnUiThread(() -> {
Constants.ProgressDialogDismiss();
Constants.getToast(CreateSaleBill.this,finalFail);
bankdialog.dismiss();
pluto_Print.setVisibility(View.GONE);
generate_invoice.setVisibility(View.VISIBLE);
data.setVisibility(View.VISIBLE);
});
}
@Override
public void onCustomerName(int code, final String name) {
if(code == 200){
runOnUiThread(() -> {
try{
final JSONObject object = new JSONObject(name);
if(object.has("success")){
if(object.getInt("success") == 1){
JSONObject jsonObject = object.getJSONObject("data");
//if(jsonObject.getString("customer_name"))
if(jsonObject.getString("customer_name").isEmpty()){
cust_name.setText("");
}else {
cust_name.setText(jsonObject.getString("customer_name"));
ds_Number.requestFocus();
}
}else{
}
}
}catch(JSONException e){
e.printStackTrace();
}
});
}else{
runOnUiThread(() -> Constants.getToast(CreateSaleBill.this,name));
}
}
@Override
public void onCustomerNameFail(String fail) {
runOnUiThread(() -> {
//cust_name.setText(name);
});
}
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event){
if(v.getId() == R.id.ds_Number) {
if (TextUtils.isEmpty(ds_Number.getText().toString())) {
Constants.getToast(CreateSaleBill.this, "Enter Delivery Slip Id");
} else {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE) || (actionId == EditorInfo.IME_ACTION_NEXT) || (actionId == EditorInfo.IME_ACTION_GO)) {
Log.e("Event =============>","");
DsData(preferenceManager.getPrefix() + ds_Number.getText().toString());
Constants.hideKeyboard(this);
}
}
}else if(v.getId() == R.id.last_four_digits){
if (BankName.equalsIgnoreCase("Select Bank") && last_four_digits.getText().toString().length() == 0) {
Constants.getToast(CreateSaleBill.this, "Please Select Bank and Enter last four digits");
} else if (BankName.equalsIgnoreCase("Select Bank")) {
Constants.getToast(CreateSaleBill.this, "Please Select Bank ");
} else if (last_four_digits.getText().toString().length() == 0) {
Constants.getToast(CreateSaleBill.this, "Enter last four digits");
} else if (last_four_digits.getText().toString().length() == 4) {
if (Constants.isNetworkAvailable(CreateSaleBill.this)) {
Constants.hideSoftKeyBoardOnTabClicked(v, CreateSaleBill.this);
PrintData(last_four_digits.getText().toString(), BankId);
}else{
Constants.getToast(CreateSaleBill.this,"Please check your internet connection");
}
}
}
return false;
}
}
package w.soulofpluto.posstock;
/*
Create by Ramesh Babu
*/
import android.content.Context;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
public class DeliverySlipAdapter extends RecyclerView.Adapter<DeliverySlipAdapter.ViewHolder> {
public List<CreateResponse.Datum> arrayList;
public Context context;
public DeliverySlipAdapter(Context context, List<CreateResponse.Datum> list){
this.context = context;
this.arrayList = list;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem = layoutInflater.inflate(R.layout.delivery_list_item, parent, false);
DeliverySlipAdapter.ViewHolder viewHolder = new DeliverySlipAdapter.ViewHolder(listItem);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
CreateResponse.Datum datum = arrayList.get(position);
if(TextUtils.isEmpty(datum.getItemLevelPromoName())){
holder.item_level_promotion.setVisibility(View.GONE);
}else{
holder.item_level_promotion.setVisibility(View.VISIBLE);
holder.item_level_promotion.setText(datum.getItemLevelPromoName());
}
holder.create_barcode.setText(Html.fromHtml(Constants.getBarcode(datum.getBarcode())));
holder.create_empid.setText(Html.fromHtml(Constants.getEmpId(datum.getEmpId())));
holder.create_dis.setText(Html.fromHtml(Constants.getCode(Constants.IndianRupeesFormat(String.valueOf(datum.getPromoDisc())))));
holder.create_mrp.setText(Html.fromHtml(Constants.getMRP(Constants.IndianRupeesFormat(datum.getItemRsp()))));
holder.create_netpay.setText(Html.fromHtml(Constants.getNetPayable(Constants.IndianRupeesFormat(datum.getNetPayable().toString()))));
}
@Override
public int getItemCount() {
return arrayList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
public TextView create_barcode,create_empid,create_mrp,create_dis,create_netpay,item_level_promotion;
public ViewHolder(View itemView){
super(itemView);
create_barcode = itemView.findViewById(R.id.create_barcode);
create_empid = itemView.findViewById(R.id.create_empid);
create_mrp = itemView.findViewById(R.id.create_mrp);
create_dis = itemView.findViewById(R.id.create_dis);
create_netpay = itemView.findViewById(R.id.create_netpay);
item_level_promotion = itemView.findViewById(R.id.item_level_promotion);
}
}
}
package w.soulofpluto.posstock;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import com.epson.epos2.Epos2Exception;
import com.epson.epos2.discovery.DeviceInfo;
import com.epson.epos2.discovery.Discovery;
import com.epson.epos2.discovery.DiscoveryListener;
import com.epson.epos2.discovery.FilterOption;
import java.util.ArrayList;
import java.util.HashMap;
public class DiscoveryActivity extends Activity implements View.OnClickListener, AdapterView.OnItemClickListener {
private Context mContext = null;
private ArrayList<HashMap<String, String>> mPrinterList = null;
private SimpleAdapter mPrinterListAdapter = null;
private FilterOption mFilterOption = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_discovery);
mContext = this;
Button button = (Button)findViewById(R.id.btnRestart);
button.setOnClickListener(this);
mPrinterList = new ArrayList<HashMap<String, String>>();
mPrinterListAdapter = new SimpleAdapter(this, mPrinterList, R.layout.list_at,
new String[] { "PrinterName", "Target" },
new int[] { R.id.PrinterName, R.id.Target });
ListView list = (ListView)findViewById(R.id.lstReceiveData);
list.setAdapter(mPrinterListAdapter);
list.setOnItemClickListener(this);
mFilterOption = new FilterOption();
mFilterOption.setDeviceType(Discovery.TYPE_PRINTER);
mFilterOption.setEpsonFilter(Discovery.FILTER_NAME);
try {
Discovery.start(this, mFilterOption, mDiscoveryListener);
}
catch (Exception e) {
ShowMsg.showException(e, "start", mContext);
}
}
@Override
public void onDestroy() {
super.onDestroy();
while (true) {
try {
Discovery.stop();
break;
}
catch (Epos2Exception e) {
if (e.getErrorStatus() != Epos2Exception.ERR_PROCESSING) {
break;
}
}
}
mFilterOption = null;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnRestart:
restartDiscovery();
break;
default:
// Do nothing
break;
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent();
HashMap<String, String> item = mPrinterList.get(position);
intent.putExtra(getString(R.string.title_target), item.get("Target"));
setResult(RESULT_OK, intent);
finish();
}
private void restartDiscovery() {
while (true) {
try {
Discovery.stop();
break;
}
catch (Epos2Exception e) {
if (e.getErrorStatus() != Epos2Exception.ERR_PROCESSING) {
ShowMsg.showException(e, "stop", mContext);
return;
}
}
}
mPrinterList.clear();
mPrinterListAdapter.notifyDataSetChanged();
try {
Discovery.start(this, mFilterOption, mDiscoveryListener);
}
catch (Exception e) {
ShowMsg.showException(e, "stop", mContext);
}
}
private DiscoveryListener mDiscoveryListener = new DiscoveryListener() {
@Override
public void onDiscovery(final DeviceInfo deviceInfo) {
runOnUiThread(new Runnable() {
@Override
public synchronized void run() {
HashMap<String, String> item = new HashMap<String, String>();
item.put("PrinterName", deviceInfo.getDeviceName());
item.put("Target", deviceInfo.getTarget());
mPrinterList.add(item);
mPrinterListAdapter.notifyDataSetChanged();
}
});
}
};
}
package w.soulofpluto.posstock;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import static w.soulofpluto.posstock.Constants.BASE_URL;
/*
Create by Ramesh Babu
*/
public class Getretrofit {
static String URL = BASE_URL;
static OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(5, TimeUnit.MINUTES)
.writeTimeout(5, TimeUnit.MINUTES)
.readTimeout(5, TimeUnit.MINUTES)
.build();
static Retrofit retrofit = new Retrofit.Builder()
.baseUrl(URL)
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
public static Retrofit getClient() {
return retrofit;
}
}
package w.soulofpluto.posstock;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import com.epson.epos2.Epos2CallbackCode;
import com.epson.epos2.Epos2Exception;
public class ShowMsg {
public static void showException(Exception e, String method, Context context) {
String msg = "";
if (e instanceof Epos2Exception) {
msg = String.format(
"%s\n\t%s\n%s\n\t%s",
context.getString(R.string.title_err_code),
getEposExceptionText(((Epos2Exception) e).getErrorStatus()),
context.getString(R.string.title_err_method),
method);
}
else {
msg = e.toString();
}
show(msg, context);
}
public static void showResult(int code, String errMsg, Context context) {
String msg = "";
if (errMsg.isEmpty()) {
msg = String.format(
"\t%s\n\t%s\n",
context.getString(R.string.title_msg_result),
getCodeText(code));
}
else {
msg = String.format(
"\t%s\n\t%s\n\n\t%s\n\t%s\n",
context.getString(R.string.title_msg_result),
getCodeText(code),
context.getString(R.string.title_msg_description),
errMsg);
}
show(msg, context);
}
public static void showMsg(String msg, Context context) {
show(msg, context);
}
private static void show(String msg, Context context) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);
alertDialog.setMessage(msg);
alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
return ;
}
});
alertDialog.create();
alertDialog.show();
}
private static String getEposExceptionText(int state) {
String return_text = "";
switch (state) {
case Epos2Exception.ERR_PARAM:
return_text = "ERR_PARAM";
break;
case Epos2Exception.ERR_CONNECT:
return_text = "ERR_CONNECT";
break;
case Epos2Exception.ERR_TIMEOUT:
return_text = "ERR_TIMEOUT";
break;
case Epos2Exception.ERR_MEMORY:
return_text = "ERR_MEMORY";
break;
case Epos2Exception.ERR_ILLEGAL:
return_text = "ERR_ILLEGAL";
break;
case Epos2Exception.ERR_PROCESSING:
return_text = "ERR_PROCESSING";
break;
case Epos2Exception.ERR_NOT_FOUND:
return_text = "ERR_NOT_FOUND";
break;
case Epos2Exception.ERR_IN_USE:
return_text = "ERR_IN_USE";
break;
case Epos2Exception.ERR_TYPE_INVALID:
return_text = "ERR_TYPE_INVALID";
break;
case Epos2Exception.ERR_DISCONNECT:
return_text = "ERR_DISCONNECT";
break;
case Epos2Exception.ERR_ALREADY_OPENED:
return_text = "ERR_ALREADY_OPENED";
break;
case Epos2Exception.ERR_ALREADY_USED:
return_text = "ERR_ALREADY_USED";
break;
case Epos2Exception.ERR_BOX_COUNT_OVER:
return_text = "ERR_BOX_COUNT_OVER";
break;
case Epos2Exception.ERR_BOX_CLIENT_OVER:
return_text = "ERR_BOX_CLIENT_OVER";
break;
case Epos2Exception.ERR_UNSUPPORTED:
return_text = "ERR_UNSUPPORTED";
break;
case Epos2Exception.ERR_FAILURE:
return_text = "ERR_FAILURE";
break;
default:
return_text = String.format("%d", state);
break;
}
return return_text;
}
private static String getCodeText(int state) {
String return_text = "";
switch (state) {
case Epos2CallbackCode.CODE_SUCCESS:
return_text = "PRINT_SUCCESS";
break;
case Epos2CallbackCode.CODE_PRINTING:
return_text = "PRINTING";
break;
case Epos2CallbackCode.CODE_ERR_AUTORECOVER:
return_text = "ERR_AUTORECOVER";
break;
case Epos2CallbackCode.CODE_ERR_COVER_OPEN:
return_text = "ERR_COVER_OPEN";
break;
case Epos2CallbackCode.CODE_ERR_CUTTER:
return_text = "ERR_CUTTER";
break;
case Epos2CallbackCode.CODE_ERR_MECHANICAL:
return_text = "ERR_MECHANICAL";
break;
case Epos2CallbackCode.CODE_ERR_EMPTY:
return_text = "ERR_EMPTY";
break;
case Epos2CallbackCode.CODE_ERR_UNRECOVERABLE:
return_text = "ERR_UNRECOVERABLE";
break;
case Epos2CallbackCode.CODE_ERR_FAILURE:
return_text = "ERR_FAILURE";
break;
case Epos2CallbackCode.CODE_ERR_NOT_FOUND:
return_text = "ERR_NOT_FOUND";
break;
case Epos2CallbackCode.CODE_ERR_SYSTEM:
return_text = "ERR_SYSTEM";
break;
case Epos2CallbackCode.CODE_ERR_PORT:
return_text = "ERR_PORT";
break;
case Epos2CallbackCode.CODE_ERR_TIMEOUT:
return_text = "ERR_TIMEOUT";
break;
case Epos2CallbackCode.CODE_ERR_JOB_NOT_FOUND:
return_text = "ERR_JOB_NOT_FOUND";
break;
case Epos2CallbackCode.CODE_ERR_SPOOLER:
return_text = "ERR_SPOOLER";
break;
case Epos2CallbackCode.CODE_ERR_BATTERY_LOW:
return_text = "ERR_BATTERY_LOW";
break;
case Epos2CallbackCode.CODE_ERR_TOO_MANY_REQUESTS:
return_text = "ERR_TOO_MANY_REQUESTS";
break;
case Epos2CallbackCode.CODE_ERR_REQUEST_ENTITY_TOO_LARGE:
return_text = "ERR_REQUEST_ENTITY_TOO_LARGE";
break;
case Epos2CallbackCode.CODE_CANCELED:
return_text = "CODE_CANCELED";
break;
case Epos2CallbackCode.CODE_ERR_NO_MICR_DATA:
return_text = "ERR_NO_MICR_DATA";
break;
case Epos2CallbackCode.CODE_ERR_ILLEGAL_LENGTH:
return_text = "ERR_ILLEGAL_LENGTH";
break;
case Epos2CallbackCode.CODE_ERR_NO_MAGNETIC_DATA:
return_text = "ERR_NO_MAGNETIC_DATA";
break;
case Epos2CallbackCode.CODE_ERR_RECOGNITION:
return_text = "ERR_RECOGNITION";
break;
case Epos2CallbackCode.CODE_ERR_READ:
return_text = "ERR_READ";
break;
case Epos2CallbackCode.CODE_ERR_NOISE_DETECTED:
return_text = "ERR_NOISE_DETECTED";
break;
case Epos2CallbackCode.CODE_ERR_PAPER_JAM:
return_text = "ERR_PAPER_JAM";
break;
case Epos2CallbackCode.CODE_ERR_PAPER_PULLED_OUT:
return_text = "ERR_PAPER_PULLED_OUT";
break;
case Epos2CallbackCode.CODE_ERR_CANCEL_FAILED:
return_text = "ERR_CANCEL_FAILED";
break;
case Epos2CallbackCode.CODE_ERR_PAPER_TYPE:
return_text = "ERR_PAPER_TYPE";
break;
case Epos2CallbackCode.CODE_ERR_WAIT_INSERTION:
return_text = "ERR_WAIT_INSERTION";
break;
case Epos2CallbackCode.CODE_ERR_ILLEGAL:
return_text = "ERR_ILLEGAL";
break;
case Epos2CallbackCode.CODE_ERR_INSERTED:
return_text = "ERR_INSERTED";
break;
case Epos2CallbackCode.CODE_ERR_WAIT_REMOVAL:
return_text = "ERR_WAIT_REMOVAL";
break;
case Epos2CallbackCode.CODE_ERR_DEVICE_BUSY:
return_text = "ERR_DEVICE_BUSY";
break;
case Epos2CallbackCode.CODE_ERR_IN_USE:
return_text = "ERR_IN_USE";
break;
case Epos2CallbackCode.CODE_ERR_CONNECT:
return_text = "ERR_CONNECT";
break;
case Epos2CallbackCode.CODE_ERR_DISCONNECT:
return_text = "ERR_DISCONNECT";
break;
case Epos2CallbackCode.CODE_ERR_MEMORY:
return_text = "ERR_MEMORY";
break;
case Epos2CallbackCode.CODE_ERR_PROCESSING:
return_text = "ERR_PROCESSING";
break;
case Epos2CallbackCode.CODE_ERR_PARAM:
return_text = "ERR_PARAM";
break;
default:
return_text = String.format("%d", state);
break;
}
return return_text;
}
}
package w.soulofpluto.posstock;
import android.app.AlertDialog;
import android.bluetooth.BluetoothAdapter;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.google.firebase.FirebaseApp;
/*
Create by Ramesh Babu
*/
public class SplashActivity extends AppCompatActivity{
PreferenceManager preferenceManager;
BluetoothAdapter bluetoothAdapter;
private int REQUEST_ENABLE_BT = 1;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState){
setContentView(R.layout.activity_splash);
preferenceManager = new PreferenceManager(this);
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
FirebaseApp.initializeApp(this);
//FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
//FirebaseApp.getInstance().setAutomaticResourceManagementEnabled(true);
//FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
//FirebaseApp.getInstance().
if(bluetoothAdapter!=null && bluetoothAdapter.isEnabled()){
runOnUiThread(() -> splashMethod());
//throw new RuntimeException("Test Crash");
}else{
//Constants.getToast(this,"Please Enable your bluetooth device");
try {
showDialog("Please Enable your bluetooth device");
} catch (Exception e) {
e.printStackTrace();
}
}
super.onCreate(savedInstanceState);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_ENABLE_BT) {
if (resultCode == RESULT_OK) {
Constants.getToast(this,"BlueTooth Turned On");
runOnUiThread(new Runnable(){
@Override
public void run(){
splashMethod();
}
});
//Toast.makeText(MainActivity.this, "BlueTooth Turned On", Toast.LENGTH_LONG).show();
} else {
//Toast.makeText(MainActivity.this, "Cancelled", Toast.LENGTH_LONG).show();
Constants.getToast(this,"Cancelled");
}
}
}
public void showDialog(final String phone) throws Exception
{
AlertDialog.Builder builder = new AlertDialog.Builder(SplashActivity.this);
builder.setMessage(phone);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
dialog.dismiss();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
dialog.dismiss();
}
});
builder.show();
}
public void splashMethod(){
Handler handler = new Handler();
Runnable runnable = new Runnable(){
@Override
public void run(){
//TODO Auto-generated method stub
/*startActivity(new Intent(SplashActivity.this, MainActivity.class));
finish();*/
if(preferenceManager.isLogged()){
startActivity(new Intent(SplashActivity.this, HomeActivity.class));
finish();
}else{
startActivity(new Intent(SplashActivity.this, Login.class));
finish();
}
}
};
handler.postDelayed(runnable, 2500);
}
}
package w.soulofpluto.posstockaudit;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Build;
import android.util.Log;
import java.io.File;
import static android.content.Context.ACTIVITY_SERVICE;
/*
Create by Ramesh Babu
*/
public class AppUtils {
public static void deleteCache(Context context) {
Log.e("AppUtils ====<","Calling deleteCache");
try {
File dir = context.getCacheDir();
deleteDir(dir);
} catch (Exception e) {
}
}
public static boolean deleteDir(File dir) {
if (dir != null && dir.isDirectory()) {
Log.e("AppUtils ====<","Calling 1 deleteCache");
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
boolean success = deleteDir(new File(dir, children[i]));
if (!success) {
return false;
}
}
return dir.delete();
} else if (dir != null && dir.isFile()) {
return dir.delete();
} else {
return false;
}
}
public static void clearAppData(Context context) {
try {
if (Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT) {
((ActivityManager)context.getSystemService(ACTIVITY_SERVICE)).clearApplicationUserData();
} else {
String packageName = context.getApplicationContext().getPackageName();
Runtime runtime = Runtime.getRuntime();
runtime.exec("pm clear "+packageName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
/*
Create by Ramesh Babu
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
......@@ -15,8 +14,6 @@ import com.squareup.okhttp.MediaType;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.security.MessageDigest;
import java.text.NumberFormat;
import java.util.ArrayList;
......@@ -27,14 +24,13 @@ import java.util.Locale;
/*
Create by Ramesh Babu
*/
public class Constants{
//public static String BASE_URL = "http://182.18.167.139/";
//public static String BASE_URL = "https://2bc746.emporter.eu/";
//public static String BASE_URL = "https://68c783.emporter.eu/";
//public static String BASE_URL = "https://e0ca19.emporter.eu/";
public static String BASE_URL = "https://6d70e4.emporter.eu/";
//public static String BASE_URL = "https://49588a.emporter.eu/";
//public static String BASE_URL = "https://30ad04.emporter.eu/";
//public static String BASE_URL = "http://182.18.167.139/";
public static String BASE_URL = "http://192.168.34.16/";
//public static String BASE_URL = "http://posapi.plutokm.com/";
//public static String BASE_URL = "https://7fad42.emporter.eu/";
public static String MenuBar = Constants.BASE_URL + "/Users/generateUserMenuBarLinksForAndroidApp";
public static String Logout = Constants.BASE_URL + "/login/doLogout/";
public static String Login = Constants.BASE_URL + "/login/doLogin";
......@@ -48,6 +44,8 @@ public class Constants{
public static String GenerateSlip = Constants.BASE_URL + "/Sales/generateDeliverySlip";
public static String Type = "Content-Type";
public static String App_json = "application/json";
public static String Access_Token = "Pos-Access-Token";
public static String Access_StoreId = "Pos-User-Access-Store-Id";
public static MediaType JSON = MediaType.parse("application/json; charset=utf-8");
public static String Sec = "<font color=#3700B3><b>SECTION : </b></font>";
public static String div = "<font color=#3700B3><b>DIVISION : </b></font>";
......@@ -58,14 +56,13 @@ public class Constants{
public static String To = "<font color=#3700B3><b>End time : </b></font>";
public static String Count = "<font color=#3700B3><b>TOTAL SCANNED ITEMS : </b></font>";
public static String Barcode = "<font color=#3700B3><b>Barcode : </b></font>";
public static String Ver_Text = "<font color=#3700B3><b>Version : </b></font>";
public static String Ver_Text = "<font color=#ee4d35><b>Version : </b></font>";
public static String Plan_Id = "<font color=#3700B3><b>PLAN ID : </b></font>";
public static String Name = "<font color=#3700B3><b>NAME : </b></font>";
public static String VERSION = "1.1";
public static int Value = 7 ;
public static final String dashed = "------------------------------------------------"+"\n";
public static int Value = 30;
public static ProgressDialog progressDialog;
public static StringBuilder stringBuilder;
public static StringBuilder stringBuilder;
public static void getToast(Context context, String data){
Toast toast = Toast.makeText(context, data, Toast.LENGTH_SHORT);
......@@ -78,32 +75,41 @@ public class Constants{
}
public static String getTotalItems(String count){
return "<font color=#F31505><b>Total Items : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
return "<font color=#ee4d35><b>Items : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
}
public static String getTotalMRP(String count){
return "<font color=#F31505><b>Total MRP : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
return "<font color=#ee4d35><b>Total MRP &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
}
public static String getTotalDisc(String count){
return "<font color=#ee4d35><b> Disc &nbsp;&nbsp;&nbsp; : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
}
public static String getTotalNetPayable(String count){
return "<font color=#ee4d35><b>NetPayable : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
}
public static String getBarcode(String count){
return "<font color=#6A95A5A6><b>Barcode : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
return "<font color=#797979><b>Barcode : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
}
public static String getCode(String count){
return "<font color=#6A95A5A6><b>Disc Amt : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
return "<font color=#797979><b>Disc : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
}
public static String getMRP(String count){
return "<font color=#6A95A5A6><b>MRP &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
return "<font color=#797979><b>MRP &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
}
public static String getEmpId(String count){
return "<font color=#6A95A5A6><b>SM &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
return "<font color=#797979><b>SM &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : </b></font>"+"<font color=#000000><b>"+count+"</b></font>";
}
public static String getNetPayable(String count){
return "<font color=#6A95A5A6><b>NetPayable : </b></font>"+"<font color=#FE3004><b>"+count+"</b></font>";
return "<font color=#797979><b>NetPayable : </b></font>"+"<font color=#4caa4c><b>"+count+"</b></font>";
}
public static boolean isNetworkAvailable(Context context){
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
......@@ -137,6 +143,7 @@ public class Constants{
public static String PrintData1(String Id){
return "{" + '"' + "delivery_slip_id" + '"' + ":" + '"' + Id + '"' + "," + '"' + "manual_discount" + '"' + ":" + 0 + "}";
}
public static String getSHA256(String data){
StringBuffer sb = new StringBuffer();
try{
......@@ -175,32 +182,17 @@ public class Constants{
}
public static Date getDateWithOffset(int offset, Date date){
Calendar calendar = calendar = Calendar.getInstance();;
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, offset);
return calendar.getTime();
}
public static boolean isNetworkOnline(){
boolean isOnline = false;
try{
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("ping -c 1 8.8.8.8");
int waitFor = p.waitFor();
isOnline = waitFor == 0;
Log.e("Constants",String.valueOf(isOnline));
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return isOnline;
}
protected static void hideSoftKeyboard(EditText input,Context context){
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(input.getWindowToken(), 0);
}
public static String SL(String len){
if(len.length() == 3){
return len;
......@@ -211,6 +203,7 @@ public class Constants{
}
return null;
}
public static String Qty(String len){
if(len.length() == 3){
return len+" ";
......@@ -221,6 +214,7 @@ public class Constants{
}
return null;
}
public static String Barcode(String mrp){
if(mrp.length() == 11){
return mrp;
......@@ -247,6 +241,7 @@ public class Constants{
}
return null;
}
public static String Mrp(String mrp){
if(mrp.length() == 9){
return mrp;
......@@ -271,6 +266,7 @@ public class Constants{
}
return null;
}
public static String Dis(String dis){
if(dis.length() == 9){
return dis;
......@@ -293,6 +289,7 @@ public class Constants{
}
return null;
}
public static String Total(String mrp){
if(mrp.length() == 11){
return mrp;
......@@ -319,6 +316,7 @@ public class Constants{
}
return null;
}
public static String Taxable(String tax){
if(tax.length() == 13){
return tax;
......@@ -349,6 +347,7 @@ public class Constants{
}
return null;
}
public static String CGST(String dis){
if(dis.length() == 9){
return dis;
......@@ -371,6 +370,7 @@ public class Constants{
}
return null;
}
public static String SGST(String dis){
if(dis.length() == 7){
return dis+" ";
......@@ -389,6 +389,7 @@ public class Constants{
}
return null;
}
public static String IGST(String dis){
if(dis.length()== 8){
return dis;
......@@ -409,6 +410,7 @@ public class Constants{
}
return null;
}
public static String GST(String dis){
if(dis.length() == 7){
return dis;
......@@ -427,6 +429,7 @@ public class Constants{
}
return null;
}
public static String Gross(String dis){
if(dis.length() == 10){
return " "+dis;
......@@ -451,7 +454,8 @@ public class Constants{
}
return null;
}
public static String RecievedCashText(String dis){
public static String ReceivedCashText(String dis){
if(dis.length() == 13){
return dis+" ";
}else if(dis.length() == 14){
......@@ -467,7 +471,8 @@ public class Constants{
}
return null;
}
public static String Deliveryslipnumber(String dev){
public static String DeliverySlipNumber(String dev){
if(dev.length() == 16){
return dev+" ";
}else if(dev.length() == 15){
......@@ -483,7 +488,8 @@ public class Constants{
}
return null;
}
public static String DeliveryslipQty(String dev){
public static String DeliverySlipQty(String dev){
if(dev.length() == 7){
return dev+" ";
}else if(dev.length() == 6){
......@@ -501,7 +507,8 @@ public class Constants{
}
return null;
}
public static String DeliveryslipAmt(String dev){
public static String DeliverySlipAmt(String dev){
if(dev.length() == 11){
return dev+" ";
}else if(dev.length() == 10){
......@@ -527,7 +534,8 @@ public class Constants{
}
return null;
}
public static String RecievedCash(String dis){
public static String ReceivedCash(String dis){
if(dis.length() == 10){
return " "+dis;
}else if(dis.length() == 9){
......@@ -551,6 +559,7 @@ public class Constants{
}
return null;
}
public static String TotalSavings(String dis){
if(dis.length() == 10){
return " "+dis;
......@@ -575,12 +584,14 @@ public class Constants{
}
return null;
}
public static String IndianRupeesformat(String amount){
NumberFormat formatter = NumberFormat.getCurrencyInstance(new Locale("en", "in"));
String moneyString = formatter.format(Double.valueOf(amount));
return moneyString;
//return formatter.format(amount);
}
public static void hideKeyboard(Activity activity){
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
//Find the currently focused view, so we can grab the correct window token from it.
......@@ -598,7 +609,8 @@ public class Constants{
imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
public static String formdata(String builder, String name, String phone){
public static String formData(String builder, String name, String phone){
stringBuilder = new StringBuilder();
stringBuilder.append("{"+'"'+"approval_emp_id"+'"'+":"+'"'+"1"+'"'+",");
stringBuilder.append('"'+"from_mobile"+'"'+":"+'"'+"yes"+'"'+",");
......@@ -625,7 +637,8 @@ public class Constants{
stringBuilder.append('"'+"otp"+'"'+":"+'"'+'"'+"}");
return stringBuilder.toString();
}
public static String formdata1(String builder, String name, String phone, JSONObject obj){
public static String formData1(String builder, String name, String phone, JSONObject obj){
stringBuilder = new StringBuilder();
stringBuilder.append("{"+'"'+"approval_emp_id"+'"'+":"+'"'+"1"+'"'+",");
stringBuilder.append('"'+"from_mobile"+'"'+":"+'"'+"yes"+'"'+",");
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
/*
Create by Ramesh Babu
......@@ -7,12 +7,13 @@ package w.soulofpluto.posstock;
import android.app.Dialog;
import android.content.Context;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
......@@ -23,6 +24,7 @@ import java.util.ArrayList;
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
private Context context;
private ArrayList<Plans> arrayList;
public boolean status = false;
public CustomAdapter(Context context, ArrayList<Plans> storesArrayList){
this.context = context;
this.arrayList = storesArrayList;
......@@ -40,37 +42,36 @@ public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder
final Plans items = arrayList.get(position);
holder.plan_id.setText("PLAN ID : "+items.getPlanId());
holder.plan_name.setText("NAME : "+items.getName());
holder.view_section.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View view){
final Dialog dialog = new Dialog(context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.adapter_dialog);
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
dialog.show();
TextView section = dialog.findViewById(R.id.plan_section);
TextView division = dialog.findViewById(R.id.plan_division);
ImageView close = dialog.findViewById(R.id.close);
section.setText(Html.fromHtml(Constants.Sec +items.getSection()));
division.setText(Html.fromHtml(Constants.div+items.getDivision()));
close.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View view){
dialog.dismiss();
}
});
}
holder.view_section.setOnClickListener(view -> {
final Dialog dialog = new Dialog(context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.adapter_dialog);
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
dialog.show();
TextView section = dialog.findViewById(R.id.plan_section);
TextView division = dialog.findViewById(R.id.plan_division);
ImageView close = dialog.findViewById(R.id.close);
section.setText(Html.fromHtml(Constants.Sec +items.getSection()));
division.setText(Html.fromHtml(Constants.div+items.getDivision()));
close.setOnClickListener(view1 -> dialog.dismiss());
});
holder.start_scan.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View view){
PlanDetails.start(context,items);
holder.start_scan.setOnClickListener(view -> {
if(TextUtils.isEmpty(holder.rack_no.getText().toString())){
Constants.getToast(context,"Please Enter Rack No");
}else{
if(holder.rack_no.getText().toString().length()<= 3) {
PlanDetails.start(context, items, holder.rack_no.getText().toString());
}else{
Constants.getToast(context,"Enter Valid Rack No");
holder.rack_no.setText("");
holder.rack_no.requestFocus();
}
}
});
}
@Override
public int getItemCount(){
return arrayList.size();
......@@ -78,12 +79,14 @@ public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder
public class ViewHolder extends RecyclerView.ViewHolder{
public TextView plan_id,plan_name;
Button start_scan,view_section;
EditText rack_no;
public ViewHolder(View itemView){
super(itemView);
plan_id = itemView.findViewById(R.id.plan_id);
plan_name = itemView.findViewById(R.id.plan_name);
start_scan = itemView.findViewById(R.id.start_scan);
view_section = itemView.findViewById(R.id.view_section);
plan_id = itemView.findViewById(R.id.plan_id);
plan_name = itemView.findViewById(R.id.plan_name);
start_scan = itemView.findViewById(R.id.start_scan);
view_section = itemView.findViewById(R.id.view_section);
rack_no = itemView.findViewById(R.id.rack_no);
}
}
}
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
......@@ -11,7 +10,6 @@ import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.squareup.okhttp.Callback;
......@@ -29,7 +27,7 @@ import java.util.concurrent.TimeUnit;
public class DashBoardActivity extends AppCompatActivity implements View.OnClickListener {
Toolbar dashboard_toolbar;
Button stock_audit,rack_qty,searchby_barcode, transfer;
Button stock_audit,rack_qty,searchBy_Barcode, transfer;
TextView version;
PreferenceManager preferenceManager;
@Override
......@@ -38,7 +36,7 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
setContentView(R.layout.activity_dashboard);
stock_audit = findViewById(R.id.stock_audit);
rack_qty = findViewById(R.id.rack_qty);
searchby_barcode = findViewById(R.id.searchby_barcode);
searchBy_Barcode = findViewById(R.id.searchby_barcode);
dashboard_toolbar = findViewById(R.id.dashboard_toolbar);
version = findViewById(R.id.version);
transfer = findViewById(R.id.transfer);
......@@ -46,29 +44,30 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
setSupportActionBar(dashboard_toolbar);
getSupportActionBar().setTitle(getResources().getString(R.string.dashboard));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
stock_audit.setOnClickListener(this);
rack_qty.setOnClickListener(this);
searchby_barcode.setOnClickListener(this);
transfer.setOnClickListener(this);
version.setText(Html.fromHtml(Constants.Ver_Text +Constants.VERSION));
stock_audit .setOnClickListener(this);
rack_qty .setOnClickListener(this);
searchBy_Barcode.setOnClickListener(this);
transfer .setOnClickListener(this);
version .setText(Html.fromHtml(Constants.Ver_Text +Constants.VERSION));
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item){
switch(item.getItemId()){
case R.id.dashboard_logout:
if(Constants.isNetworkAvailable(DashBoardActivity.this)){
Logout(Constants.Logout+preferenceManager.getUserId());
Constants.ProgressDialogShow(DashBoardActivity.this);
Logout(Constants.Logout+preferenceManager.getUserId());
Constants.ProgressDialogShow(DashBoardActivity.this);
}else{
Constants.getToast(DashBoardActivity.this,getResources().getString(R.string.connection));
Constants.getToast(DashBoardActivity.this,getResources().getString(R.string.connection));
}
break;
case android.R.id.home:
finish();
break;
......@@ -93,29 +92,29 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
}
@Override
public void onResponse(Response response) throws IOException{
Constants.ProgressDialogDismiss();
if(response.isSuccessful()){
String res = response.body().string();
Log.e("Dashboard Logout ", res);
try{
JSONObject jsonObject = new JSONObject(res);
if(jsonObject.has("success")){
if(jsonObject.getInt("success") == 1){
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(DashBoardActivity.this);
}else{
Constants.getToast(DashBoardActivity.this,jsonObject.getString("msg"));
}
}
}catch(JSONException e){
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
}
Constants.ProgressDialogDismiss();
if(response.isSuccessful()){
String res = response.body().string();
Log.e("Dashboard Logout ", res);
try{
JSONObject jsonObject = new JSONObject(res);
if(jsonObject.has("success")){
if(jsonObject.getInt("success") == 1){
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(DashBoardActivity.this);
}else{
Constants.getToast(DashBoardActivity.this,jsonObject.getString("msg"));
}
}
}catch(JSONException e){
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
}
}
});
}
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
/*
Create by Ramesh Babu
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
......@@ -18,7 +17,6 @@ import java.util.concurrent.TimeUnit;
*/
public class DataPresenter{
public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
private Context context;
private DataInterface dataInterface;
private String Response;
......@@ -41,15 +39,14 @@ public class DataPresenter{
Request request = new Request.Builder()
.url(Url)
.post(object)
.addHeader("Content-Type", "application/json")
.addHeader("Pos-Access-Token",preferenceManager.getCustToken())
.addHeader("Pos-User-Access-Store-Id", preferenceManager.getStoreId())
.addHeader(Constants.Type, Constants.App_json)
.addHeader(Constants.Access_Token,preferenceManager.getCustToken())
.addHeader(Constants.Access_StoreId, preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback(){
@Override
public void onFailure(Request request, IOException e){
//featureDataInterface.FeatureFailure(request.toString());
dataInterface.onDeliveryFail(request.toString());
System.out.println("Delivery Slip error" +e.getMessage());
}
......@@ -75,10 +72,9 @@ public class DataPresenter{
}
public void SendDeliverySlipNumberremove(String Url, RequestBody object){
public void SendDeliverySlipNumberRemove(String Url, RequestBody object){
System.out.println("Url ====>"+Url);
System.out.println("Object ====>"+object);
//RequestBody body = RequestBody.create(JSON, object);
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(240, TimeUnit.SECONDS);
client.setReadTimeout(240,TimeUnit.SECONDS);
......@@ -86,9 +82,9 @@ public class DataPresenter{
Request request = new Request.Builder()
.url(Url)
.post(object)
.addHeader("Content-Type", "application/json")
.addHeader("Pos-Access-Token",preferenceManager.getCustToken())
.addHeader("Pos-User-Access-Store-Id", preferenceManager.getStoreId())
.addHeader(Constants.Type, Constants.App_json)
.addHeader(Constants.Access_Token,preferenceManager.getCustToken())
.addHeader(Constants.Access_StoreId, preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback(){
@Override
......@@ -130,9 +126,9 @@ public class DataPresenter{
Request request = new Request.Builder()
.url(Url)
.post(object)
.addHeader("Content-Type", "application/json")
.addHeader(context.getResources().getString(R.string.accesstoken),preferenceManager.getCustToken())
.addHeader(context.getResources().getString(R.string.storeidtoken),preferenceManager.getStoreId())
.addHeader(Constants.Type, Constants.App_json)
.addHeader(Constants.Access_Token,preferenceManager.getCustToken())
.addHeader(Constants.Access_StoreId, preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback(){
@Override
......@@ -165,9 +161,9 @@ public class DataPresenter{
Request request = new Request.Builder()
.url(Url)
.get()
.addHeader("Content-Type", "application/json")
.addHeader(context.getResources().getString(R.string.accesstoken),preferenceManager.getCustToken())
.addHeader(context.getResources().getString(R.string.storeidtoken),preferenceManager.getStoreId())
.addHeader(Constants.Type, Constants.App_json)
.addHeader(Constants.Access_Token,preferenceManager.getCustToken())
.addHeader(Constants.Access_StoreId, preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback(){
@Override
......@@ -194,15 +190,12 @@ public class DataPresenter{
client.setConnectTimeout(2000, TimeUnit.SECONDS);
client.setReadTimeout(2000,TimeUnit.SECONDS);
client.setWriteTimeout(2000,TimeUnit.SECONDS);
System.out.println("Url ====>"+Url);
System.out.println("Object ====>"+object);
System.out.println("Token ====>"+preferenceManager.getCustToken());
final Request request = new Request.Builder()
.url(Url)
.post(object)
.addHeader("Content-Type", "application/json")
.addHeader("Pos-Access-Token", preferenceManager.getCustToken())
.addHeader("Pos-User-Access-Store-Id", preferenceManager.getStoreId())
.addHeader(Constants.Type, Constants.App_json)
.addHeader(Constants.Access_Token,preferenceManager.getCustToken())
.addHeader(Constants.Access_StoreId, preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback(){
@Override
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
......@@ -12,11 +10,7 @@ import android.text.Html;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
......@@ -25,32 +19,25 @@ import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.nio.channels.InterruptedByTimeoutException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.JSON;
import static w.soulofpluto.posstock.Constants.Logout;
import static w.soulofpluto.posstockaudit.Constants.Logout;
/*
Create by Ramesh Babu
*/
public class HomeActivity extends AppCompatActivity implements View.OnClickListener {
public class HomeActivity extends AppCompatActivity {
Toolbar home_toolbar;
static PreferenceManager preferenceManager;
TextView version;
......@@ -60,46 +47,39 @@ import static w.soulofpluto.posstock.Constants.Logout;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState){
setContentView(R.layout.activity_home);
requestRuntimePermission();
//requestRuntimePermission();
home_toolbar = findViewById(R.id.home_toolbar);
version = findViewById(R.id.version);
recyclerView = findViewById(R.id.menu_list);
preferenceManager = new PreferenceManager(this);
setSupportActionBar(home_toolbar);
getSupportActionBar().setTitle(getResources().getString(R.string.home));
version.setText(Html.fromHtml(Constants.Ver_Text +Constants.VERSION));
getSupportActionBar().setTitle(Html.fromHtml("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+getResources().getString(R.string.home)));
version.setText(Html.fromHtml(Constants.Ver_Text + Constants.VERSION));
if(Constants.isNetworkAvailable(HomeActivity.this)) {
setUI();
Constants.ProgressDialogShow(HomeActivity.this);
} else {
Constants.getToast(HomeActivity.this,"Please check internet connection");
}
super.onCreate(savedInstanceState);
}
private void requestRuntimePermission() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return;
}
int permissionStorage = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
int permissionLocation = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION);
List<String> requestPermissions = new ArrayList<>();
if (permissionStorage == PackageManager.PERMISSION_DENIED) {
requestPermissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
if (permissionLocation == PackageManager.PERMISSION_DENIED) {
requestPermissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);
}
if (!requestPermissions.isEmpty()) {
ActivityCompat.requestPermissions(this, requestPermissions.toArray(new String[requestPermissions.size()]), REQUEST_PERMISSION);
}
//ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.ACCESS_BACKGROUND_LOCATION}, REQUEST_PERMISSION);
}
@Override
......@@ -107,22 +87,7 @@ import static w.soulofpluto.posstock.Constants.Logout;
if (requestCode != REQUEST_PERMISSION || grantResults.length == 0) {
return;
}
List<String> requestPermissions = new ArrayList<>();
for(int i = 0; i < permissions.length; i++){
if(permissions[i].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)
&& grantResults[i] == PackageManager.PERMISSION_DENIED) {
requestPermissions.add(permissions[i]);
}
if (permissions[i].equals(Manifest.permission.ACCESS_COARSE_LOCATION)
&& grantResults[i] == PackageManager.PERMISSION_DENIED) {
requestPermissions.add(permissions[i]);
}
}
if (!requestPermissions.isEmpty()) {
ActivityCompat.requestPermissions(this, requestPermissions.toArray(new String[requestPermissions.size()]), REQUEST_PERMISSION);
}
}
private void setUI(){
final OkHttpClient client = new OkHttpClient();
......@@ -139,12 +104,9 @@ import static w.soulofpluto.posstock.Constants.Logout;
client.newCall(request).enqueue(new Callback(){
@Override
public void onFailure(Request request, final IOException e){
runOnUiThread(new Runnable(){
@Override
public void run(){
Constants.getToast(HomeActivity.this,e.getMessage());
Constants.ProgressDialogDismiss();
}
runOnUiThread(() -> {
Constants.getToast(HomeActivity.this,e.getMessage());
Constants.ProgressDialogDismiss();
});
}
@Override
......@@ -159,37 +121,31 @@ import static w.soulofpluto.posstock.Constants.Logout;
if (object.getInt("success") == 1) {
JSONArray jsonArray = object.getJSONArray("data");
for (int i = 0; i < jsonArray.length(); i++) {
arrayList.add(jsonArray.get(i).toString());
if(jsonArray.get(i).equals("Stock Audit")) {
arrayList.add(jsonArray.get(i).toString());
}
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
recyclerView.setLayoutManager(new GridLayoutManager(HomeActivity.this, 2));
MenuAdapter menuAdapter = new MenuAdapter(HomeActivity.this, arrayList);
recyclerView.setAdapter(menuAdapter);
}
handler.post(() -> {
recyclerView.setLayoutManager(new GridLayoutManager(HomeActivity.this, 2));
MenuAdapter menuAdapter = new MenuAdapter(HomeActivity.this, arrayList);
recyclerView.setAdapter(menuAdapter);
});
Log.e("Size", String.valueOf(arrayList.size()));
} else if (object.getInt("success") == 3) {
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Log.e("session", object.getString("msg"));
Constants.getToast(HomeActivity.this, object.getString("msg"));
Login.logout(HomeActivity.this);
} catch (JSONException e) {
e.printStackTrace();
}
runOnUiThread(() -> {
try{
Log.e("session", object.getString("msg"));
Constants.getToast(HomeActivity.this, object.getString("msg"));
Login.logout(HomeActivity.this);
}catch(JSONException e) {
e.printStackTrace();
}
});
}
}else{
runOnUiThread(() -> Constants.getToast(HomeActivity.this,Response));
}
}catch(NullPointerException | JSONException io){
io.printStackTrace();
}finally{
......@@ -226,7 +182,7 @@ import static w.soulofpluto.posstock.Constants.Logout;
final Request request = new Request.Builder()
.url(Url)
.get()
.addHeader("Content-Type", "application/json")
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken),preferenceManager.getCustToken())
.addHeader(getResources().getString(R.string.storeidtoken),preferenceManager.getStoreId())
.build();
......@@ -266,7 +222,6 @@ import static w.soulofpluto.posstock.Constants.Logout;
}
});
}
@Override
public void onBackPressed(){
int count = 0;
......@@ -275,29 +230,11 @@ import static w.soulofpluto.posstock.Constants.Logout;
}else{
AlertDialog alert = new AlertDialog.Builder(this)
.setTitle("Are you sure you want to close this app")
//.setMessage("Are you sure to Exit")
.setPositiveButton("Yes", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialogInterface, int i){
finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialogInterface, int i){
}
.setPositiveButton("Yes", (dialogInterface, i) -> finish())
.setNegativeButton("No", (dialogInterface, i) -> {
})
.show();
}
}
@Override
public void onClick(View view) {
switch (view.getId()){
/* case R.id.layout1:
Intent intent = new Intent(HomeActivity.this,DashBoardActivity.class);
startActivity(intent);
break;*/
}
}
}
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.app.Activity;
import android.content.Context;
......@@ -7,7 +7,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
......@@ -19,7 +18,7 @@ import android.widget.Spinner;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
......@@ -32,24 +31,25 @@ import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.JSON;
import static w.soulofpluto.posstockaudit.Constants.JSON;
/*
Create by Ramesh Babu
*/
public class Login extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener{
private EditText userId, password;
private Spinner storeId;
private Button submit;
private ArrayList<Store> stores;
private String Response;
private int Store_Id;
private Toolbar login_toolbar;
private PreferenceManager preferenceManager;
private String Store_Name;
public static void logout(Context context){
AppUtils.clearAppData(context);
Activity activity = (Activity) context;
Intent in_logout = new Intent(context, Login.class);
in_logout.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
......@@ -65,26 +65,20 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
password = findViewById(R.id.password);
storeId = findViewById(R.id.storeId);
submit = findViewById(R.id.submit);
login_toolbar = findViewById(R.id.login_toolbar);
setSupportActionBar(login_toolbar);
getSupportActionBar().setTitle(getResources().getString(R.string.login));
preferenceManager = new PreferenceManager(this);
submit.setOnClickListener(this);
storeId.setOnItemSelectedListener(this);
password.setOnFocusChangeListener(new View.OnFocusChangeListener(){
@Override
public void onFocusChange(View view, boolean hasFocus){
if(!hasFocus){
}else{
if(Constants.isNetworkAvailable(Login.this)){
if(userId.getText().toString().length() > 3){
StoreId(userId.getText().toString());
Constants.ProgressDialogShow(Login.this);
}
}else{
Constants.getToast(Login.this, getResources().getString(R.string.connection));
}
}
password.setOnFocusChangeListener((view, hasFocus) -> {
if(!hasFocus){
}else{
if(Constants.isNetworkAvailable(Login.this)){
if(userId.getText().toString().length() > 3){
StoreId(userId.getText().toString());
Constants.ProgressDialogShow(Login.this);
}
}else{
Constants.getToast(Login.this, getResources().getString(R.string.connection));
}
}
});
}
......@@ -99,12 +93,9 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
client.newCall(request).enqueue(new Callback(){
@Override
public void onFailure(Request request, final IOException e){
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(Login.this, e.getMessage(), Toast.LENGTH_SHORT).show();
Constants.ProgressDialogDismiss();
}
runOnUiThread(() -> {
Toast.makeText(Login.this, e.getMessage(), Toast.LENGTH_SHORT).show();
Constants.ProgressDialogDismiss();
});
}
@Override
......@@ -112,47 +103,39 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
try{
Constants.ProgressDialogDismiss();
final String Response = response.body().string();
Log.e("Store Response ", Response);
Log.e("Login Response ", Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
@Override
public void run(){
try{
if(response.code() == 200){
JSONObject object = new JSONObject(Response);
stores = new ArrayList<>();
if(object.has(getResources().getString(R.string.success))){
if(object.getInt(getResources().getString(R.string.success)) == 1){
if(object.has(getResources().getString(R.string.data))){
JSONArray jsonArray = object.getJSONArray(getResources().getString(R.string.data));
if(jsonArray.length() > 0){
for(int i = 0; i < jsonArray.length(); i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
Store store = new Store();
store.setStoreId(jsonObject.getInt(getResources().getString(R.string.id)));
store.setStoreName(jsonObject.getString(getResources().getString(R.string.store_name)));
stores.add(store);
}
ArrayAdapter<Store> adapter = new ArrayAdapter<Store>(Login.this, android.R.layout.simple_dropdown_item_1line, stores);
storeId.setAdapter(adapter);
handler.post(() -> {
try{
if(response.code() == 200){
JSONObject object = new JSONObject(Response);
stores = new ArrayList<>();
if(object.has(getResources().getString(R.string.success))){
if(object.getInt(getResources().getString(R.string.success)) == 1){
if(object.has(getResources().getString(R.string.data))){
JSONArray jsonArray = object.getJSONArray(getResources().getString(R.string.data));
if(jsonArray.length() > 0){
for(int i = 0; i < jsonArray.length(); i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
Store store = new Store();
store.setStoreId(jsonObject.getInt(getResources().getString(R.string.id)));
store.setStoreName(jsonObject.getString(getResources().getString(R.string.store_name)));
stores.add(store);
}
ArrayAdapter<Store> adapter = new ArrayAdapter<Store>(Login.this, R.layout.spinner_item, stores);
storeId.setAdapter(adapter);
}
}else{
Toast.makeText(Login.this, getResources().getString(R.string.no_stores), Toast.LENGTH_SHORT).show();
storeId.setAdapter(null);
}
}else{
Constants.getToast(Login.this,getResources().getString(R.string.no_stores));
storeId.setAdapter(null);
}
}else{
runOnUiThread(new Runnable() {
@Override
public void run() {
Constants.getToast(Login.this,Response);
}
});
}
}catch(JSONException e){
e.printStackTrace();
}else{
runOnUiThread(() -> Constants.getToast(Login.this,Response));
}
}catch(JSONException e){
e.printStackTrace();
}
});
}catch (NullPointerException io) {
......@@ -178,36 +161,6 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
if(Constants.isNetworkAvailable(Login.this)){
doLogin(userId.getText().toString(), password.getText().toString());
Constants.ProgressDialogShow(Login.this);
/*JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
object.put(getResources().getString(R.string.empid), userId.getText().toString());
object.put(getResources().getString(R.string.password), Constants.getSHA256(password.getText().toString()));
object.put(getResources().getString(R.string.storeid), Store_Id);
object.put(getResources().getString(R.string.dongle), false);
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
Log.e("post object ",object.toString());
}
}catch(JSONException e){
e.printStackTrace();
}
ApiService service = Getretrofit.getClient().create(ApiService.class);
//service.login(object);
RequestBody body = RequestBody.create(JSON, object.toString());
Call<Response> call = service.login(body);
call.enqueue(new retrofit2.Callback<com.squareup.okhttp.Response>(){
@Override
public void onResponse(Call<com.squareup.okhttp.Response> call, retrofit2.Response<com.squareup.okhttp.Response> response){
Log.e("Login",response.toString());
Log.e("Login",String.valueOf(response.isSuccessful()));
}
@Override
public void onFailure(Call<com.squareup.okhttp.Response> call, Throwable t){
Log.e("Fail",String.valueOf(t.getCause()));
Log.e("Fail",String.valueOf(t.getMessage()));
Log.e("Fail",String.valueOf(t.getLocalizedMessage()));
}
});*/
}else{
Constants.getToast(Login.this, getResources().getString(R.string.connection));
}
......@@ -243,12 +196,12 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
client.newCall(request).enqueue(new Callback(){
@Override
public void onFailure(Request request, IOException e){
Constants.ProgressDialogDismiss();
if(e.getCause() != null && e.getCause() instanceof UnknownHostException){
}else{
Log.e("error ====>", e.getMessage());
runOnUiThread(() -> Constants.getToast(Login.this,e.getMessage()));
}
Constants.ProgressDialogDismiss();
}
}//7842734567
@Override
public void onResponse(final Response response) throws IOException{
Constants.ProgressDialogDismiss();
......@@ -256,35 +209,33 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
Log.e("Login",Response);
try{
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
@Override
public void run(){
if(response.code() == 200){
try{
JSONObject obj = new JSONObject(Response);
if(obj.has(getResources().getString(R.string.success))){
if(obj.getInt(getResources().getString(R.string.success)) == 1){
JSONObject data = obj.getJSONObject(getResources().getString(R.string.data));
preferenceManager.setUserId(data.getString(getResources().getString(R.string.empid)));
preferenceManager.setCustToken(data.getString(getResources().getString(R.string.usertoken)));
preferenceManager.setStoreId(data.getString(getResources().getString(R.string.storeid)));
preferenceManager.setPrefix(data.getString(getResources().getString(R.string.prefix)));
preferenceManager.setPassword(Constants.getSHA256(pass));
if (Store_Name != null)
preferenceManager.setStoreName(Store_Name);
preferenceManager.setLogged(true);
Intent in = new Intent(Login.this, HomeActivity.class);
startActivity(in);
finish();
} else {
Toast.makeText(Login.this, obj.getString(getResources().getString(R.string.msg)), Toast.LENGTH_SHORT).show();
}
handler.post(() -> {
if(response.code() == 200){
try{
JSONObject obj = new JSONObject(Response);
if(obj.has(getResources().getString(R.string.success))){
if(obj.getInt(getResources().getString(R.string.success)) == 1){
JSONObject data = obj.getJSONObject(getResources().getString(R.string.data));
preferenceManager.setUserId(data.getString(getResources().getString(R.string.empid)));
preferenceManager.setCustToken(data.getString(getResources().getString(R.string.usertoken)));
preferenceManager.setStoreId(data.getString(getResources().getString(R.string.storeid)));
preferenceManager.setPrefix(data.getString(getResources().getString(R.string.prefix)));
preferenceManager.setPassword(Constants.getSHA256(pass));
if (Store_Name != null)
preferenceManager.setStoreName(Store_Name);
preferenceManager.setLogged(true);
Intent in = new Intent(Login.this, HomeActivity.class);
startActivity(in);
finish();
} else {
Toast.makeText(Login.this, obj.getString(getResources().getString(R.string.msg)), Toast.LENGTH_SHORT).show();
}
}catch(JSONException e){
e.printStackTrace();
}
} else {
}catch(JSONException e){
e.printStackTrace();
}
} else {
runOnUiThread(() -> Constants.getToast(Login.this,Response));
}
});
}catch(NullPointerException io){
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.app.ActivityManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
......@@ -11,21 +13,25 @@ import android.os.Looper;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.JSON;
import static w.soulofpluto.posstock.Constants.getDateWithOffset;
import static w.soulofpluto.posstockaudit.Constants.JSON;
import static w.soulofpluto.posstockaudit.Constants.getDateWithOffset;
public class MainActivity extends AppCompatActivity {
Toolbar main_toolbar;
......@@ -34,115 +40,116 @@ public class MainActivity extends AppCompatActivity {
ArrayList<Plans> plansArrayList;
@Override
protected void onCreate(Bundle savedInstanceState){
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
main_toolbar = findViewById(R.id.main_toolbar);
plans_list = findViewById(R.id.plans_List);
plans_list = findViewById(R.id.plans_List);
plansArrayList = new ArrayList<>();
preferenceManager = new PreferenceManager(this);
setSupportActionBar(main_toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(getResources().getString(R.string.test)+ " UserId : " +preferenceManager.getUserId());
getSupportActionBar().setTitle(getResources().getString(R.string.test) + " UserId : " + preferenceManager.getUserId());
}
@Override
protected void onStart(){
if(Constants.isNetworkAvailable(MainActivity.this)){
FetchData(Constants.Dashboard);
Constants.ProgressDialogShow(MainActivity.this);
}else{
Constants.getToast(MainActivity.this,getResources().getString(R.string.connection));
protected void onStart() {
if (Constants.isNetworkAvailable(MainActivity.this)) {
AppUtils.deleteCache(MainActivity.this);
FetchData(Constants.Dashboard);
Constants.ProgressDialogShow(MainActivity.this);
} else {
Constants.getToast(MainActivity.this, getResources().getString(R.string.connection));
}
super.onStart();
}
public void Logout(String Url){
public void Logout(String Url) {
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(250, TimeUnit.SECONDS);
client.setReadTimeout(250,TimeUnit.SECONDS);
client.setWriteTimeout(250,TimeUnit.SECONDS);
client.setReadTimeout(250, TimeUnit.SECONDS);
client.setWriteTimeout(250, TimeUnit.SECONDS);
final Request request = new Request.Builder()
.url(Url)
.get()
.addHeader(Constants.Type, Constants.App_json)
.build();
client.newCall(request).enqueue(new Callback(){
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Request request, IOException e){
public void onFailure(Request request, IOException e) {
Constants.ProgressDialogDismiss();
}
@Override
public void onResponse(Response response) throws IOException{
public void onResponse(Response response) throws IOException {
Constants.ProgressDialogDismiss();
if(response.isSuccessful()){
if (response.isSuccessful()) {
String res = response.body().string();
try{
try {
JSONObject jsonObject = new JSONObject(res);
if(jsonObject.has(getResources().getString(R.string.success))){
if(jsonObject.getInt(getResources().getString(R.string.success)) == 1){
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(MainActivity.this);
}else{
Constants.getToast(MainActivity.this,jsonObject.getString(getResources().getString(R.string.msg)));
}
if (jsonObject.has(getResources().getString(R.string.success))) {
if (jsonObject.getInt(getResources().getString(R.string.success)) == 1) {
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(MainActivity.this);
} else {
Constants.getToast(MainActivity.this, jsonObject.getString(getResources().getString(R.string.msg)));
}
}
}catch(JSONException e) {
e.printStackTrace();
}catch(NullPointerException np){
np.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
} catch (NullPointerException np) {
np.printStackTrace();
}
}
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.menu,menu);
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch(item.getItemId()){
case android.R.id.home:
finish();
break;
case R.id.dashboard_logout:
if(Constants.isNetworkAvailable(MainActivity.this)){
Logout(Constants.Logout+preferenceManager.getUserId());
Constants.ProgressDialogShow(MainActivity.this);
}else{
Constants.getToast(MainActivity.this,getResources().getString(R.string.connection));
}
break;
}
return super.onOptionsItemSelected(item);
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
case R.id.dashboard_logout:
if (Constants.isNetworkAvailable(MainActivity.this)) {
Logout(Constants.Logout + preferenceManager.getUserId());
Constants.ProgressDialogShow(MainActivity.this);
} else {
Constants.getToast(MainActivity.this, getResources().getString(R.string.connection));
}
break;
}
return super.onOptionsItemSelected(item);
}
private void FetchData(String Url){
private void FetchData(String Url) {
JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd");
Date todayDate = new Date();
Date from = getDateWithOffset(-Constants.Value, new Date());
String fromDate = currentDate.format(from);
String thisDate = currentDate.format(todayDate);
Log.e("Last date",fromDate);
object.put(getResources().getString(R.string.auditstatus),"In Progress");
object.put(getResources().getString(R.string.fromdate),fromDate);
object.put(getResources().getString(R.string.todate),thisDate);
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
Date todayDate = new Date();
Date from = getDateWithOffset(-Constants.Value, new Date());
String fromDate = currentDate.format(from);
String thisDate = currentDate.format(todayDate);
object.put(getResources().getString(R.string.auditstatus), "In Progress");
object.put(getResources().getString(R.string.fromdate), fromDate);
object.put(getResources().getString(R.string.todate), thisDate);
object.put(getResources().getString(R.string.android_version), Constants.VERSION);
}
}catch(JSONException e){
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
RequestBody body = RequestBody.create(JSON,object.toString());
RequestBody body = RequestBody.create(JSON, object.toString());
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(250, TimeUnit.SECONDS);
client.setReadTimeout(250, TimeUnit.SECONDS);
......@@ -150,90 +157,78 @@ public class MainActivity extends AppCompatActivity {
Request request = new Request.Builder()
.url(Url)
.post(body)
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken),preferenceManager.getCustToken())
.addHeader(getResources().getString(R.string.storeidtoken),preferenceManager.getStoreId())
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken), preferenceManager.getCustToken())
.addHeader(getResources().getString(R.string.storeidtoken), preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback(){
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Request request, final IOException e){
runOnUiThread(new Runnable(){
@Override
public void run(){
Constants.getToast(MainActivity.this,e.getMessage());
Constants.ProgressDialogDismiss();
}
public void onFailure(Request request, final IOException e) {
runOnUiThread(() -> {
Constants.getToast(MainActivity.this, e.getMessage());
Constants.ProgressDialogDismiss();
});
}
@Override
public void onResponse(final com.squareup.okhttp.Response response) throws IOException{
try{
public void onResponse(final com.squareup.okhttp.Response response) throws IOException {
try {
Constants.ProgressDialogDismiss();
final String Response = response.body().string();
Log.e("Store Response " , Response);
Log.e("Store Response ", Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
@Override
public void run(){
try{
if(response.code() == 200){
final JSONObject object = new JSONObject(Response);
if(object.has(getResources().getString(R.string.success))){
if(object.getInt(getResources().getString(R.string.success)) == 1){
if(object.has(getResources().getString(R.string.data))){
plansArrayList.clear();
JSONArray jsonArray = object.getJSONArray(getResources().getString(R.string.data));
for(int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
Plans plans = new Plans();
plans.setPlanId(String.valueOf(jsonObject.getInt("id")));
plans.setName(jsonObject.getString("stock_audit_name"));
plans.setDivision(Constants.convertString(jsonObject.getString("item_divisions")));
plans.setSection(Constants.convertString(jsonObject.getString("item_sections")));
plansArrayList.add(plans);
}
CustomAdapter customAdapter = new CustomAdapter(MainActivity.this, plansArrayList);
plans_list.setLayoutManager(new LinearLayoutManager(MainActivity.this,LinearLayoutManager.VERTICAL,false));
plans_list.setAdapter(customAdapter);
}else if (object.has(getResources().getString(R.string.msg))){
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Constants.getToast(MainActivity.this, object.getString(getResources().getString(R.string.msg)));
} catch (JSONException e) {
e.printStackTrace();
}
}
});
handler.post(() -> {
try {
if (response.code() == 200) {
final JSONObject object1 = new JSONObject(Response);
if (object1.has(getResources().getString(R.string.success))) {
if (object1.getInt(getResources().getString(R.string.success)) == 1) {
if (object1.has(getResources().getString(R.string.data))) {
plansArrayList.clear();
JSONArray jsonArray = object1.getJSONArray(getResources().getString(R.string.data));
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
Plans plans = new Plans();
plans.setPlanId(String.valueOf(jsonObject.getInt("id")));
plans.setName(jsonObject.getString("stock_audit_name"));
plans.setDivision(Constants.convertString(jsonObject.getString("item_divisions")));
plans.setSection(Constants.convertString(jsonObject.getString("item_sections")));
plansArrayList.add(plans);
}
}else if(object.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(MainActivity.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e) {
e.printStackTrace();
}
CustomAdapter customAdapter = new CustomAdapter(MainActivity.this, plansArrayList);
plans_list.setLayoutManager(new LinearLayoutManager(MainActivity.this, LinearLayoutManager.VERTICAL, false));
plans_list.setAdapter(customAdapter);
} else if (object1.has(getResources().getString(R.string.msg))) {
runOnUiThread(() -> {
try {
Constants.getToast(MainActivity.this, object1.getString(getResources().getString(R.string.msg)));
} catch (JSONException e) {
e.printStackTrace();
}
});
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(MainActivity.this);
}
} else if (object1.getInt(getResources().getString(R.string.success)) == 3) {
runOnUiThread(() -> {
try {
Constants.getToast(MainActivity.this, object1.getString(getResources().getString(R.string.msg)));
} catch (JSONException e) {
e.printStackTrace();
}
});
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(MainActivity.this);
}
}
}catch(JSONException e){
e.printStackTrace();
}
} catch (JSONException e) {
e.printStackTrace();
}
});
}catch(NullPointerException io){
} catch (NullPointerException io) {
io.printStackTrace();
}finally{
} finally {
response.body().close();
}
}
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -36,20 +35,18 @@ import java.util.ArrayList;
public void onBindViewHolder(@NonNull MenuAdapter.ViewHolder holder, final int position) {
final String data = arrayList.get(position);
holder.menu_name.setText(data);
holder.layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(data.equalsIgnoreCase("Stock Audit")){
Intent intent = new Intent(context,DashBoardActivity.class);
context.startActivity(intent);
}else if(data.equalsIgnoreCase("Create Delivery Slip")){
Intent intent = new Intent(context,CreateDeliverySlip.class);
context.startActivity(intent);
}else{
Intent intent = new Intent(context,CreateSaleBill.class);
context.startActivity(intent);
}
}
if(data.equalsIgnoreCase("Create Delivery Slip")){
holder.menu_image.setImageResource(R.drawable.ic_create_delivery_slip);
}else if(data.equalsIgnoreCase("Stock Audit")){
holder.menu_image.setImageResource(R.drawable.ic_stock_audit);
}else if(data.equalsIgnoreCase("Create Sale Bill")){
holder.menu_image.setImageResource(R.drawable.ic_create_sale_bill);
}else{
holder.menu_image.setImageResource(R.drawable.ic_stock_transfer);
}
holder.layout.setOnClickListener(view -> {
Intent intent = new Intent(context,DashBoardActivity.class);
context.startActivity(intent);
});
}
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
/*
Create by Ramesh Babu
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Build;
......@@ -26,7 +25,7 @@ import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
......@@ -43,7 +42,7 @@ import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.JSON;
import static w.soulofpluto.posstockaudit.Constants.JSON;
/*
Create by Ramesh Babu
......@@ -65,10 +64,13 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
PlanDetailsAdapter planDetailsAdapter;
private String Response;
Dialog dialog;
MediaPlayer mp;
String Rack_No;
public static void start(Context context, Plans plans){
public static void start(Context context, Plans plans, String rackno){
Intent in = new Intent(context, PlanDetails.class);
in.putExtra("key", plans);
in.putExtra("rack",rackno);
context.startActivity(in);
}
......@@ -99,26 +101,27 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
setSupportActionBar(plandetails_toolbar);
getSupportActionBar().setTitle(getResources().getString(R.string.plan_details));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
plans = getIntent().getParcelableExtra(getResources().getString(R.string.key));
plans = getIntent().getParcelableExtra(getResources().getString(R.string.key));
Rack_No = getIntent().getStringExtra(getResources().getString(R.string.Rack));
barcode.requestFocus();
plandetails_id.setText(Html.fromHtml(Constants.Plan_Id + plans.getPlanId()));
plandetails_name.setText(Html.fromHtml(Constants.Name+ plans.getName()));
plandetails_name.setText(Html.fromHtml(Constants.Name + plans.getName()));
ScanComplete.setOnClickListener(this);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
barcode.setShowSoftInputOnFocus(false);
}
barcode.addTextChangedListener(new AutoChecked());
rack_number.setText(Rack_No);
rack_number.setEnabled(false);
pieces.setChecked(true);
barcode.setOnFocusChangeListener(new View.OnFocusChangeListener(){
@Override
public void onFocusChange(View view, boolean hasFocus){
if(!hasFocus){
}else{
Constants.hideSoftKeyboard(barcode,PlanDetails.this);
}
}
});
barcode.setOnFocusChangeListener((view, hasFocus) -> {
if(!hasFocus){
}else{
Constants.hideSoftKeyboard(barcode,PlanDetails.this);
}
});
}
public void PiecesClicked(View view){
boolean checked = ((RadioButton) view).isChecked();
switch(view.getId()){
......@@ -136,6 +139,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
break;
}
}
public void MetersClicked(View view){
boolean checked = ((RadioButton) view).isChecked();
switch (view.getId()){
......@@ -153,6 +157,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
break;
}
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item){
switch (item.getItemId()) {
......@@ -162,10 +167,12 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
}
return super.onOptionsItemSelected(item);
}
public class AutoChecked implements TextWatcher{
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onTextChanged(CharSequence val, int i, int i1, int i2){
try{
......@@ -174,94 +181,47 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
if(status){
if(Constants.isNetworkAvailable(PlanDetails.this)){
if(arrayList.size() > 0){
boolean itemExistsBasedOnProp = arrayList.stream().map(Plans::getBarcode).anyMatch(barcode.getText().toString().replace("\n", "")::equals);
Log.e("Barcode Status ====>" , String.valueOf(itemExistsBasedOnProp));
if(Constants.Existing(arrayList, barcode.getText().toString().replace("\n", ""))){
//Constants.getToast(PlanDetails.this, "Already scanned this item");
//barcode.setText("");
runOnUiThread(new Runnable() {
@Override
public void run() {
MediaPlayer mp;
mp = MediaPlayer.create(PlanDetails.this, R.raw.beep);
mp.start();
final Dialog dialog1 = new Dialog(PlanDetails.this);
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog1.setContentView(R.layout.activity_dialog);
dialog1.setCancelable(false);
dialog1.setCanceledOnTouchOutside(false);
dialog1.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
dialog1.show();
TextView message = dialog1.findViewById(R.id.message);
Button ok = dialog1.findViewById(R.id.ok);
message.setText("Already scanned this item");
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog1.dismiss();
barcode.setFocusable(true);
barcode.requestFocus();
barcode.setText("");
}
});
}
});
return;
getNotification("Already scanned this item");
return;
}
}
UploadBarcode(barcode.getText().toString().replace("\n", ""), "1", plans.getPlanId());
Constants.ProgressDialogShow(PlanDetails.this);
barcode.setText("");
try{
UploadBarcode(barcode.getText().toString().replace("\n", ""), "1", plans.getPlanId());
Constants.ProgressDialogShow(PlanDetails.this);
barcode.setText("");
}catch(NullPointerException np){
np.printStackTrace();
}
}else{
Constants.getToast(PlanDetails.this, getResources().getString(R.string.connection));
Constants.getToast(PlanDetails.this, getResources().getString(R.string.connection));
}
}else{
if(TextUtils.isEmpty(qty.getText().toString())){
runOnUiThread(new Runnable() {
@Override
public void run() {
barcode.setText("");
Constants.getToast(PlanDetails.this, "Enter Qty");
}
runOnUiThread(() -> {
barcode.setText("");
Constants.getToast(PlanDetails.this, "Enter Qty");
});
}else{
float value = Float.parseFloat(qty.getText().toString());
if(value > 0){
if(Constants.isNetworkAvailable(PlanDetails.this)){
//barcode.setFocusable(false);
if(arrayList.size() > 0){
if(arrayList.size() > 0) {
if (Constants.Existing(arrayList, barcode.getText().toString().replace("\n", ""))) {
runOnUiThread(new Runnable() {
@Override
public void run() {
MediaPlayer mp;
mp = MediaPlayer.create(PlanDetails.this, R.raw.beep);
mp.start();
final Dialog dialog1 = new Dialog(PlanDetails.this);
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog1.setContentView(R.layout.activity_dialog);
dialog1.setCancelable(false);
dialog1.setCanceledOnTouchOutside(false);
dialog1.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
dialog1.show();
TextView message = dialog1.findViewById(R.id.message);
Button ok = dialog1.findViewById(R.id.ok);
message.setText("Already scanned this item");
ok.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
dialog1.dismiss();
barcode.setFocusable(true);
barcode.requestFocus();
barcode.setText("");
}
});
}
});
getNotification("Already scanned this item");
return;
}
}
UploadBarcode(barcode.getText().toString().replace("\n", ""), qty.getText().toString(), plans.getPlanId());
Constants.ProgressDialogShow(PlanDetails.this);
barcode.setText("");
try {
UploadBarcode(barcode.getText().toString().replace("\n", ""), qty.getText().toString(), plans.getPlanId());
Constants.ProgressDialogShow(PlanDetails.this);
barcode.setText("");
}catch (NullPointerException np){
np.printStackTrace();
}
}else{
Constants.getToast(PlanDetails.this, getResources().getString(R.string.connection));
}
......@@ -270,7 +230,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
}
}
}else{
Constants.getToast(PlanDetails.this, getResources().getString(R.string.connection));
getNotification(getResources().getString(R.string.connection));
}
}catch(NullPointerException np){
np.printStackTrace();
......@@ -289,7 +249,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
if(Constants.isNetworkAvailable(PlanDetails.this)){
if(rack_number.getText().toString().length()>0){
Constants.ProgressDialogShow(PlanDetails.this);
UploadAllBarcodes(Constants.BarcodeComplete,rack_number.getText().toString());
UploadAllBarCodes(Constants.BarcodeComplete,rack_number.getText().toString());
}else{
Constants.getToast(PlanDetails.this,"Enter Rack Id");
}
......@@ -305,7 +265,40 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
break;
}
}
public void UploadAllBarcodes(String barcodeall,String rack){
public void getNotification(String text){
runOnUiThread(() -> {
mp = MediaPlayer.create(PlanDetails.this, R.raw.beep);
if(mp.isPlaying()) {
mp.stop();
try {
mp.prepare();
} catch (IOException e) {
e.printStackTrace();
}
}
mp.start();
final Dialog dialog1 = new Dialog(PlanDetails.this);
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog1.setContentView(R.layout.activity_dialog);
dialog1.setCancelable(false);
dialog1.setCanceledOnTouchOutside(false);
dialog1.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
dialog1.show();
TextView message = dialog1.findViewById(R.id.message);
Button ok = dialog1.findViewById(R.id.ok);
message.setText(text);
ok.setOnClickListener(view -> {
dialog1.dismiss();
barcode.setFocusable(true);
barcode.requestFocus();
barcode.setText("");
mp.stop();
mp.release();
});
});
}
public void UploadAllBarCodes(String barcodeAll,String rack){
JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
......@@ -322,21 +315,18 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
client.setReadTimeout(250, TimeUnit.SECONDS);
client.setWriteTimeout(250, TimeUnit.SECONDS);
Request request = new Request.Builder()
.url(barcodeall)
.url(barcodeAll)
.post(body)
.addHeader(Constants.Type, Constants.App_json)
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken), preferenceManager.getCustToken())
.addHeader(getResources().getString(R.string.storeidtoken), preferenceManager.getStoreId())
.addHeader(getResources().getString(R.string.storeidtoken),preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Request request, final IOException e){
runOnUiThread(new Runnable() {
@Override
public void run(){
Toast.makeText(PlanDetails.this, e.getMessage(), Toast.LENGTH_SHORT).show();
Constants.ProgressDialogDismiss();
}
runOnUiThread(() -> {
Toast.makeText(PlanDetails.this, e.getMessage(), Toast.LENGTH_SHORT).show();
Constants.ProgressDialogDismiss();
});
}
@Override
......@@ -346,48 +336,34 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
final String Response = response.body().string();
Log.e("upload all Response ", Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
try{
final JSONObject object = new JSONObject(Response);
if(response.code() == 200) {
if (object.getInt(getResources().getString(R.string.success)) == 1) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Constants.getToast(PlanDetails.this, "Uploaded Successfully");
}
});
finish();
}else if(object.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(new Runnable(){
@Override
public void run(){
try{
Constants.getToast(PlanDetails.this, object.getString(getResources().getString(R.string.msg)));
DoLogin();
}catch(JSONException e){
e.printStackTrace();
}
}
});
}else{
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(PlanDetails.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
}
});
}
handler.post(() -> {
try{
final JSONObject object1 = new JSONObject(Response);
if(response.code() == 200) {
if (object1.getInt(getResources().getString(R.string.success)) == 1) {
runOnUiThread(() -> Constants.getToast(PlanDetails.this, "Uploaded Successfully"));
finish();
}else if(object1.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(() -> {
try{
Constants.getToast(PlanDetails.this, object1.getString(getResources().getString(R.string.msg)));
DoLogin();
}catch(JSONException e){
e.printStackTrace();
}
});
}else{
runOnUiThread(() -> {
try{
Constants.getToast(PlanDetails.this, object1.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
});
}
}catch(JSONException e){
e.printStackTrace();
}
}catch(JSONException e){
e.printStackTrace();
}
});
}catch(NullPointerException io){
......@@ -401,10 +377,10 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
public void UploadBarcode(final String Barcode, final String qty, final String Id){
JSONObject object = new JSONObject();
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
object.put(getResources().getString(R.string.barcode_upload), Barcode);
object.put(getResources().getString(R.string.rule_id), Id);
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
object.put(getResources().getString(R.string.barcode_upload), Barcode);
object.put(getResources().getString(R.string.rule_id), Id);
object.put(getResources().getString(R.string.quantity_upload), qty);
object.put(getResources().getString(R.string.android_version), Constants.VERSION);
}
......@@ -420,19 +396,16 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
Request request = new Request.Builder()
.url(Constants.BarcodeUpload)
.post(body)
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken), preferenceManager.getCustToken())
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken), preferenceManager.getCustToken())
.addHeader(getResources().getString(R.string.storeidtoken), preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Request request, final IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Constants.getToast(PlanDetails.this, e.getMessage());
Constants.ProgressDialogDismiss();
}
runOnUiThread(() -> {
Constants.getToast(PlanDetails.this, e.getMessage());
Constants.ProgressDialogDismiss();
});
}
@Override
......@@ -442,77 +415,48 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
final String Response = response.body().string();
Log.e("Upload Barcode", Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
try{
final JSONObject object = new JSONObject(Response);
if (response.code() == 200) {
if(object.has(getResources().getString(R.string.success))) {
if(object.getInt(getResources().getString(R.string.success)) == 1){
barcode.requestFocus();
Plans plans = new Plans();
plans.setQty(qty);
plans.setPlanId(Id);
plans.setBarcode(Barcode);
arrayList.add(plans);
Collections.reverse(arrayList);
if(arrayList.size() > 0){
handler.post(() -> {
try{
final JSONObject object1 = new JSONObject(Response);
if (response.code() == 200) {
if(object1.has(getResources().getString(R.string.success))) {
if(object1.getInt(getResources().getString(R.string.success)) == 1){
barcode.requestFocus();
Plans plans = new Plans();
plans.setQty(qty);
plans.setPlanId(Id);
plans.setBarcode(Barcode);
if(arrayList.size()>0) {
plans.setColumnId(arrayList.size() + 1);
}else{
plans.setColumnId(1);
}
arrayList.add(plans);
Collections.sort(arrayList,Plans.sortByName);
setUI(arrayList);
if(arrayList.size() > 0){
runOnUiThread(() -> {
planDetailsAdapter = new PlanDetailsAdapter(PlanDetails.this, arrayList);
barcode_recylerview.setLayoutManager(new LinearLayoutManager(PlanDetails.this));
barcode_recylerview.setAdapter(planDetailsAdapter);
}
setUI(arrayList);
}else if(object.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(PlanDetails.this, object.getString(getResources().getString(R.string.msg)));
DoLogin();
}catch(JSONException e){
e.printStackTrace();
}
}
});
}else{
runOnUiThread(new Runnable() {
@Override
public void run() {
MediaPlayer mp;
mp = MediaPlayer.create(PlanDetails.this, R.raw.beep);
mp.start();
final Dialog dialog1 = new Dialog(PlanDetails.this);
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog1.setContentView(R.layout.activity_dialog);
dialog1.setCancelable(false);
dialog1.setCanceledOnTouchOutside(false);
dialog1.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
dialog1.show();
TextView message = dialog1.findViewById(R.id.message);
Button ok = dialog1.findViewById(R.id.ok);
try{
message.setText(object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog1.dismiss();
barcode.setFocusable(true);
barcode.requestFocus();
barcode.setText("");
}
});
}
});
}
}else if(object1.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(() -> {
try{
Constants.getToast(PlanDetails.this, object1.getString(getResources().getString(R.string.msg)));
DoLogin();
}catch(JSONException e){
e.printStackTrace();
}
});
}else{
getNotification(object1.getString(getResources().getString(R.string.msg)));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
} catch (JSONException e) {
e.printStackTrace();
}
});
} catch (NullPointerException io) {
......@@ -537,7 +481,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
}catch(JSONException e){
e.printStackTrace();
}
Log.e("delele Barcode ", object.toString());
Log.e("delete Barcode ", object.toString());
RequestBody body = RequestBody.create(JSON, object.toString());
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(250, TimeUnit.SECONDS);
......@@ -553,12 +497,9 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Request request, final IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Constants.ProgressDialogDismiss();
Constants.getToast(PlanDetails.this, e.getMessage());
}
runOnUiThread(() -> {
Constants.ProgressDialogDismiss();
Constants.getToast(PlanDetails.this, e.getMessage());
});
}
@Override
......@@ -571,41 +512,32 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
final JSONObject jsonObject = new JSONObject(res);
if (jsonObject.has(getResources().getString(R.string.success))) {
if(jsonObject.getInt(getResources().getString(R.string.success)) == 1){
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Constants.getToast(PlanDetails.this, jsonObject.getString(getResources().getString(R.string.data)));
} catch (JSONException e) {
e.printStackTrace();
}
arrayList.remove(position);
planDetailsAdapter.notifyDataSetChanged();
setUI(arrayList);
runOnUiThread(() -> {
try{
Constants.getToast(PlanDetails.this, jsonObject.getString(getResources().getString(R.string.data)));
}catch(JSONException e) {
e.printStackTrace();
}
arrayList.remove(position);
planDetailsAdapter.notifyDataSetChanged();
setUI(arrayList);
});
}else if (jsonObject.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(PlanDetails.this, jsonObject.getString(getResources().getString(R.string.msg)));
DoLogin();
}catch(JSONException e){
e.printStackTrace();
}
} else if (jsonObject.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(() -> {
try{
Constants.getToast(PlanDetails.this, jsonObject.getString(getResources().getString(R.string.msg)));
DoLogin();
}catch(JSONException e){
e.printStackTrace();
}
});
} else{
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(PlanDetails.this, jsonObject.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
runOnUiThread(() -> {
try{
Constants.getToast(PlanDetails.this, jsonObject.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
});
}
......@@ -621,14 +553,11 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
}
public void setUI(final ArrayList<Plans> list){
runOnUiThread(new Runnable() {
@Override
public void run() {
if(list.size() > 0) {
count.setText("Scanned Items : " + list.size());
}else {
count.setText("Scanned Items : 0 ");
}
runOnUiThread(() -> {
if(list.size() > 0) {
count.setText("Scanned Items : " + list.size());
}else {
count.setText("Scanned Items : 0 ");
}
});
}
......@@ -645,20 +574,16 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
final TextView pass = dialog.findViewById(R.id.relogin_pass);
final Button reLogin = dialog.findViewById(R.id.relogin_submit);
userId.setText(preferenceManager.getUserId());
//pass.setText(preferenceManager.getPassword());
reLogin.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
if(Constants.isNetworkAvailable(PlanDetails.this)){
if(TextUtils.isEmpty(pass.getText().toString())){
Constants.getToast(PlanDetails.this,getResources().getString(R.string.enterPassword));
}else{
doLogin(preferenceManager.getUserId(), Constants.getSHA256(pass.getText().toString()));
Constants.ProgressDialogShow(PlanDetails.this);
}
}else{
Constants.getToast(PlanDetails.this,getResources().getString(R.string.connection));
}
reLogin.setOnClickListener(view -> {
if(Constants.isNetworkAvailable(PlanDetails.this)){
if(TextUtils.isEmpty(pass.getText().toString())){
Constants.getToast(PlanDetails.this,getResources().getString(R.string.enterPassword));
}else{
doLogin(preferenceManager.getUserId(), Constants.getSHA256(pass.getText().toString()));
Constants.ProgressDialogShow(PlanDetails.this);
}
}else{
Constants.getToast(PlanDetails.this,getResources().getString(R.string.connection));
}
});
}
......@@ -667,10 +592,10 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
object.put(getResources().getString(R.string.empid), userId);
object.put(getResources().getString(R.string.password),pass);
object.put(getResources().getString(R.string.storeid), preferenceManager.getStoreId());
object.put(getResources().getString(R.string.dongle),false);
object.put(getResources().getString(R.string.empid), userId);
object.put(getResources().getString(R.string.password), pass);
object.put(getResources().getString(R.string.storeid), preferenceManager.getStoreId());
object.put(getResources().getString(R.string.dongle), false);
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
}
}catch(JSONException e){
......@@ -679,8 +604,8 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
RequestBody body = RequestBody.create(JSON,object.toString());
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(100, TimeUnit.SECONDS);
client.setReadTimeout(100, TimeUnit.SECONDS);
client.setWriteTimeout(100, TimeUnit.SECONDS);
client.setReadTimeout(100, TimeUnit.SECONDS);
client.setWriteTimeout(100, TimeUnit.SECONDS);
Request request = new Request.Builder()
.url(Constants.Login)
.post(body)
......@@ -701,32 +626,29 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
Response = response.body().string();
try{
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
@Override
public void run(){
if(response.code() == 200){
try{
JSONObject obj = new JSONObject(Response);
if(obj.has(getResources().getString(R.string.success))){
if(obj.getInt(getResources().getString(R.string.success)) == 1 ){
JSONObject data = obj.getJSONObject(getResources().getString(R.string.data));
preferenceManager.setUserId(data.getString(getResources().getString(R.string.empid)));
preferenceManager.setCustToken(data.getString(getResources().getString(R.string.usertoken)));
preferenceManager.setStoreId(data.getString(getResources().getString(R.string.storeid)));
preferenceManager.setPrefix(data.getString(getResources().getString(R.string.prefix)));
preferenceManager.setLogged(true);
dialog.dismiss();
}else{
Toast.makeText(PlanDetails.this,obj.getString(getResources().getString(R.string.msg)), Toast.LENGTH_SHORT).show();
}
handler.post(() -> {
if(response.code() == 200){
try{
JSONObject obj = new JSONObject(Response);
if(obj.has(getResources().getString(R.string.success))){
if(obj.getInt(getResources().getString(R.string.success)) == 1 ){
JSONObject data = obj.getJSONObject(getResources().getString(R.string.data));
preferenceManager.setUserId(data.getString(getResources().getString(R.string.empid)));
preferenceManager.setCustToken(data.getString(getResources().getString(R.string.usertoken)));
preferenceManager.setStoreId(data.getString(getResources().getString(R.string.storeid)));
preferenceManager.setPrefix(data.getString(getResources().getString(R.string.prefix)));
preferenceManager.setLogged(true);
dialog.dismiss();
}else{
Toast.makeText(PlanDetails.this,obj.getString(getResources().getString(R.string.msg)), Toast.LENGTH_SHORT).show();
}
}catch(JSONException e){
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
}else{
}catch(JSONException e){
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
}else{
}
});
}catch(NullPointerException io){
......@@ -740,24 +662,16 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
@Override
public void onBackPressed(){
int count = 0;
/*int count = 0;
if(count>0) {
super.onBackPressed();
}else{
AlertDialog alert = new AlertDialog.Builder(this)
.setTitle("Are you sure you want to close this app")
.setPositiveButton("Yes", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialogInterface, int i){
finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialogInterface, int i){
}
.setPositiveButton("Yes", (dialogInterface, i) -> finish())
.setNegativeButton("No", (dialogInterface, i) -> {
})
.show();
}
}*/
}
}
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.content.Context;
import android.util.Log;
......@@ -32,22 +32,19 @@ public class PlanDetailsAdapter extends RecyclerView.Adapter<PlanDetailsAdapter.
}
@Override
public void onBindViewHolder(@NonNull PlanDetailsAdapter.ViewHolder holder, final int position){
final Plans items = arrayList.get(position);
final Plans items = arrayList.get(position);
holder.plandetails_barcode.setText(items.getBarcode());
holder.plandetails_qty.setText(items.getQty());
Log.e("PlanDetails",items.getPlanId());
holder.plandetails_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try{
if(Constants.isNetworkAvailable(context)){
((PlanDetails) context).DeleteBarcode(items,position);
}else{
Constants.getToast(context,context.getResources().getString(R.string.connection));
}
}catch(NullPointerException np){
np.printStackTrace();
holder.plandetails_qty .setText(items.getQty());
Log.e("PlanDetails", items.getPlanId());
holder.plandetails_delete .setOnClickListener(view -> {
try{
if(Constants.isNetworkAvailable(context)){
((PlanDetails) context).DeleteBarcode(items,position);
}else{
Constants.getToast(context,context.getResources().getString(R.string.connection));
}
}catch(NullPointerException np){
np.printStackTrace();
}
});
}
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.Comparator;
/*
Create by Ramesh Babu
......@@ -14,6 +17,17 @@ public class Plans implements Parcelable {
String division;
String Barcode;
String Qty;
int ColumnId;
public int getColumnId() {
return ColumnId;
}
public void setColumnId(int columnId) {
ColumnId = columnId;
}
protected Plans(Parcel in) {
PlanId = in.readString();
......@@ -22,6 +36,7 @@ public class Plans implements Parcelable {
division = in.readString();
Barcode = in.readString();
Qty = in.readString();
ColumnId = in.readInt();
}
public static final Creator<Plans> CREATOR = new Creator<Plans>() {
......@@ -100,9 +115,12 @@ public class Plans implements Parcelable {
parcel.writeString(division);
parcel.writeString(Barcode);
parcel.writeString(Qty);
parcel.writeInt(ColumnId);
}
public String toString() {
return Name;
}
public static Comparator<Plans> sortByName = (t1, t2) -> t2.getColumnId()- t1.getColumnId();
}
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.app.Activity;
import android.content.Context;
......@@ -47,8 +47,6 @@ public class PreferenceManager {
public String getKeyUserLogin(){
return _sharedPrefs.getString(KEY_USER_LOGIN,"");
}
public void setFirstName(String firstName){
_prefsEditor.putString(FIRST_NAME,firstName);
_prefsEditor.apply();
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
/*
Create by Ramesh Babu
*/
import java.util.Comparator;
public class RackWise {
String id;
int id;
int Qty;
String scanned_by;
String scanning_start_at;
......@@ -36,11 +38,11 @@ public class RackWise {
this.scanning_end_at = scanning_end_at;
}
public String getId() {
public int getId() {
return id;
}
public void setId(String id) {
public void setId(int id) {
this.id = id;
}
......@@ -52,6 +54,6 @@ public class RackWise {
Qty = qty;
}
public static Comparator<RackWise> sortByName = (t1, t2) -> t1.getId()- t2.getId();
}
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.content.Context;
import android.text.Html;
......@@ -35,8 +35,8 @@ public class RackWiseAdapter extends RecyclerView.Adapter<RackWiseAdapter.ViewHo
@Override
public void onBindViewHolder(@NonNull RackWiseAdapter.ViewHolder holder, final int position){
final RackWise items = arrayList.get(position);
if(items.getId().equalsIgnoreCase("null")){
holder.rack_id.setText("");
if(items.getId() == 0){
// holder.rack_id.setText(Html.fromHtml(Constants.Id + "0"));
}else{
holder.rack_id.setText(Html.fromHtml(Constants.Id + items.getId()));
}
......
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
......@@ -30,13 +29,14 @@ import org.json.JSONObject;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.JSON;
import static w.soulofpluto.posstock.Constants.getDateWithOffset;
import static w.soulofpluto.posstockaudit.Constants.JSON;
import static w.soulofpluto.posstockaudit.Constants.getDateWithOffset;
/*
Create by Ramesh Babu
Create by Ramesh Babu P
*/
public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
......@@ -91,6 +91,7 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem
String fromDate = currentDate.format(from);
String thisDate = currentDate.format(todayDate);
Log.e("Last date",fromDate);
Log.e("Today date",thisDate);
object.put(getResources().getString(R.string.auditstatus),"In Progress");
object.put(getResources().getString(R.string.fromdate),fromDate);
object.put(getResources().getString(R.string.todate),thisDate);
......@@ -107,19 +108,16 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem
Request request = new Request.Builder()
.url(Url)
.post(body)
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken),preferenceManager.getCustToken())
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken), preferenceManager.getCustToken())
.addHeader(getResources().getString(R.string.storeidtoken),preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback(){
@Override
public void onFailure(Request request, final IOException e){
runOnUiThread(new Runnable(){
@Override
public void run(){
Constants.getToast(RackWiseQty.this,e.getMessage());
Constants.ProgressDialogDismiss();
}
runOnUiThread(() -> {
Constants.getToast(RackWiseQty.this,e.getMessage());
Constants.ProgressDialogDismiss();
});
}
@Override
......@@ -129,65 +127,56 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem
final String Response = response.body().string();
Log.e("Store Response " , Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
@Override
public void run(){
try{
if(response.code() == 200){
final JSONObject object = new JSONObject(Response);
if(object.has(getResources().getString(R.string.success))){
arrayList = new ArrayList<>();
if(object.getInt(getResources().getString(R.string.success)) == 1){
if(object.has(getResources().getString(R.string.data))){
arrayList.clear();
Plans plan = new Plans();
plan.setPlanId("0");
plan.setName("Select PlanId");
arrayList.add(plan);
JSONArray jsonArray = object.getJSONArray(getResources().getString(R.string.data));
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
Plans plans = new Plans();
plans.setPlanId(String.valueOf(jsonObject.getInt("id")));
plans.setName(jsonObject.getString("stock_audit_name"));
arrayList.add(plans);
}
ArrayAdapter<Plans> adapter = new ArrayAdapter<Plans>(RackWiseQty.this, android.R.layout.simple_dropdown_item_1line, arrayList);
rack_spinner.setAdapter(adapter);
}else if (object.has(getResources().getString(R.string.msg))){
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(RackWiseQty.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
}
});
handler.post(() -> {
try{
if(response.code() == 200){
final JSONObject object1 = new JSONObject(Response);
if(object1.has(getResources().getString(R.string.success))){
arrayList = new ArrayList<>();
if(object1.getInt(getResources().getString(R.string.success)) == 1){
if(object1.has(getResources().getString(R.string.data))){
arrayList.clear();
Plans plan = new Plans();
plan.setPlanId("0");
plan.setName("Select PlanId");
arrayList.add(plan);
JSONArray jsonArray = object1.getJSONArray(getResources().getString(R.string.data));
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
Plans plans = new Plans();
plans.setPlanId(String.valueOf(jsonObject.getInt("id")));
plans.setName(jsonObject.getString("stock_audit_name"));
arrayList.add(plans);
}
}else if(object.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(RackWiseQty.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e) {
e.printStackTrace();
}
ArrayAdapter<Plans> adapter = new ArrayAdapter<>(RackWiseQty.this, android.R.layout.simple_dropdown_item_1line, arrayList);
rack_spinner.setAdapter(adapter);
}else if (object1.has(getResources().getString(R.string.msg))){
runOnUiThread(() -> {
try{
Constants.getToast(RackWiseQty.this, object1.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
});
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(RackWiseQty.this);
}
}else if(object1.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(() -> {
try{
Constants.getToast(RackWiseQty.this, object1.getString(getResources().getString(R.string.msg)));
}catch(JSONException e) {
e.printStackTrace();
}
});
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(RackWiseQty.this);
}
}
}catch(JSONException e){
e.printStackTrace();
}
}catch(JSONException e){
e.printStackTrace();
}
});
}catch(NullPointerException io){
......@@ -205,12 +194,9 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem
Plans plan = arrayList.get(i);
rackid = plan.PlanId;
if(rackid.equalsIgnoreCase("0")){
runOnUiThread(new Runnable(){
@Override
public void run(){
total_scanned.setText(Html.fromHtml(Constants.getVal(0)));
rack_recylerview.setAdapter(null);
}
runOnUiThread(() -> {
total_scanned.setText(Html.fromHtml(Constants.getVal(0)));
rack_recylerview.setAdapter(null);
});
}else{
if(Constants.isNetworkAvailable(this)){
......@@ -251,19 +237,16 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem
Request request = new Request.Builder()
.url(Constants.RackWiseQty)
.post(body)
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken),preferenceManager.getCustToken())
.addHeader(Constants.Type, Constants.App_json)
.addHeader(getResources().getString(R.string.accesstoken), preferenceManager.getCustToken())
.addHeader(getResources().getString(R.string.storeidtoken),preferenceManager.getStoreId())
.build();
client.newCall(request).enqueue(new Callback(){
@Override
public void onFailure(Request request, final IOException e){
runOnUiThread(new Runnable(){
@Override
public void run(){
Constants.getToast(RackWiseQty.this,e.getMessage());
Constants.ProgressDialogDismiss();
}
runOnUiThread(() -> {
Constants.getToast(RackWiseQty.this,e.getMessage());
Constants.ProgressDialogDismiss();
});
}
@Override
......@@ -273,74 +256,65 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem
final String Response = response.body().string();
Log.e("Rackwise Response " , Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
@Override
public void run(){
try{
if(response.code() == 200){
final JSONObject object = new JSONObject(Response);
if(object.has(getResources().getString(R.string.success))){
if(object.getInt(getResources().getString(R.string.success)) == 1){
if(object.has(getResources().getString(R.string.data))){
rackWiseArrayList.clear();
JSONObject headerobject = object.getJSONObject(getResources().getString(R.string.data));
final int count = headerobject.getInt("total_scanned_items");
Log.e("TOTAL SCANNED ITEMS : ",String.valueOf(count));
runOnUiThread(new Runnable(){
@Override
public void run(){
total_scanned.setText(Html.fromHtml(Constants.getVal(count)));
}
});
JSONArray jsonArray = headerobject.getJSONArray("rack_info");
//JSONArray jsonArray = object.getJSONArray(getResources().getString(R.string.data));
for(int i = 0; i < jsonArray.length(); i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
RackWise rackWise = new RackWise();
rackWise.setId(jsonObject.getString("rack_id"));
rackWise.setScanned_by(String.valueOf(jsonObject.getInt("scanned_by")));
rackWise.setScanning_start_at(jsonObject.getString("scanning_start_at"));
rackWise.setScanning_end_at(jsonObject.getString("scanning_end_at"));
rackWise.setQty(Integer.parseInt(jsonObject.getString("scanned_items_count")));
rackWiseArrayList.add(rackWise);
handler.post(() -> {
try{
if(response.code() == 200){
final JSONObject object1 = new JSONObject(Response);
if(object1.has(getResources().getString(R.string.success))){
if(object1.getInt(getResources().getString(R.string.success)) == 1){
if(object1.has(getResources().getString(R.string.data))){
rackWiseArrayList.clear();
JSONObject headerObject = object1.getJSONObject(getResources().getString(R.string.data));
final int count = headerObject.getInt("total_scanned_items");
Log.e("TOTAL SCANNED ITEMS : ",String.valueOf(count));
runOnUiThread(() -> total_scanned.setText(Html.fromHtml(Constants.getVal(count))));
JSONArray jsonArray = headerObject.getJSONArray("rack_info");
//JSONArray jsonArray = object.getJSONArray(getResources().getString(R.string.data));
for(int i = 0; i < jsonArray.length(); i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
RackWise rackWise = new RackWise();
if(jsonObject.getString("rack_id").equalsIgnoreCase("null")){
rackWise.setId(0);
}else {
rackWise.setId(Integer.parseInt(jsonObject.getString("rack_id")));
}
rackWiseAdapter = new RackWiseAdapter(RackWiseQty.this, rackWiseArrayList);
rack_recylerview.setLayoutManager(new LinearLayoutManager(RackWiseQty.this,LinearLayoutManager.VERTICAL,false));
rack_recylerview.setAdapter(rackWiseAdapter);
}else if (object.has(getResources().getString(R.string.msg))){
runOnUiThread(new Runnable(){
@Override
public void run(){
try{
Constants.getToast(RackWiseQty.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
}
});
rackWise.setScanned_by(String.valueOf(jsonObject.getInt("scanned_by")));
rackWise.setScanning_start_at(jsonObject.getString("scanning_start_at"));
rackWise.setScanning_end_at(jsonObject.getString("scanning_end_at"));
rackWise.setQty(Integer.parseInt(jsonObject.getString("scanned_items_count")));
rackWiseArrayList.add(rackWise);
}
}else if(object.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(new Runnable(){
@Override
public void run(){
try{
Constants.getToast(RackWiseQty.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e) {
e.printStackTrace();
}
}
});
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(RackWiseQty.this);
Collections.sort(rackWiseArrayList,RackWise.sortByName);
rackWiseAdapter = new RackWiseAdapter(RackWiseQty.this, rackWiseArrayList);
rack_recylerview.setLayoutManager(new LinearLayoutManager(RackWiseQty.this,LinearLayoutManager.VERTICAL,false));
rack_recylerview.setAdapter(rackWiseAdapter);
}else if (object1.has(getResources().getString(R.string.msg))){
runOnUiThread(() -> {
try{
Constants.getToast(RackWiseQty.this, object1.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
});
}
}else if(object1.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(() -> {
try{
Constants.getToast(RackWiseQty.this, object1.getString(getResources().getString(R.string.msg)));
}catch(JSONException e) {
e.printStackTrace();
}
});
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(RackWiseQty.this);
}
}
}catch(JSONException e){
e.printStackTrace();
}
}catch(JSONException e){
e.printStackTrace();
}
});
}catch(NullPointerException io){
......@@ -351,5 +325,4 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem
}
});
}
}
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
import android.os.Build;
import android.os.Bundle;
......@@ -32,8 +32,8 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.JSON;
import static w.soulofpluto.posstock.Constants.getDateWithOffset;
import static w.soulofpluto.posstockaudit.Constants.JSON;
import static w.soulofpluto.posstockaudit.Constants.getDateWithOffset;
/*
Create by Ramesh Babu
......@@ -86,7 +86,7 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
object.put(getResources().getString(R.string.plan_id),planId);
object.put(getResources().getString(R.string.plan_id), planId);
object.put(getResources().getString(R.string.barcode_upload), Barcode);
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
}
......
package w.soulofpluto.posstockaudit;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.google.firebase.FirebaseApp;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
/*
Create by Ramesh Babu
*/
public class SplashActivity extends AppCompatActivity{
PreferenceManager preferenceManager;
//BluetoothAdapter bluetoothAdapter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState){
setContentView(R.layout.activity_splash);
preferenceManager = new PreferenceManager(this);
//bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
FirebaseApp.initializeApp(this);
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
runOnUiThread(() -> splashMethod());
super.onCreate(savedInstanceState);
}
public void splashMethod(){
Handler handler = new Handler();
Runnable runnable = () -> {
if(preferenceManager.isLogged()){
startActivity(new Intent(SplashActivity.this, HomeActivity.class));
finish();
}else{
startActivity(new Intent(SplashActivity.this, Login.class));
finish();
}
};
handler.postDelayed(runnable, 2500);
}
}
package w.soulofpluto.posstock;
package w.soulofpluto.posstockaudit;
/*
Create by Ramesh Babu
......
......@@ -3,8 +3,8 @@
<item>
<shape android:shape="rectangle">
<gradient android:angle="180"
android:endColor="#0000FF"
android:startColor="#87ceeb" />
android:endColor="#07c4a0"
android:startColor="#007cde" />
</shape>
</item>
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="180"
android:endColor="#07c4a0"
android:startColor="#007cde"/>
<corners
android:bottomLeftRadius="7dp"
android:bottomRightRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
</shape>
\ No newline at end of file
<vector android:height="24dp" android:viewportHeight="510"
android:viewportWidth="510" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ffffff" android:pathData="M311.1,255l58.65,58.65c7.65,-17.851 10.2,-38.25 10.2,-58.65c0,-20.4 -5.101,-40.8 -10.2,-58.65L311.1,255zM446.25,119.85L415.65,153c15.3,30.6 25.5,66.3 25.5,102s-10.2,71.4 -25.5,102l30.6,30.6c25.5,-38.25 38.25,-86.699 38.25,-135.149S471.75,158.1 446.25,119.85zM349.35,145.35L204,0h-25.5v193.8L61.2,76.5l-35.7,35.7L168.3,255L25.5,397.8l35.7,35.7l117.3,-117.3V510H204l145.35,-145.35L239.7,255L349.35,145.35zM229.5,96.9l48.45,48.45L229.5,193.8V96.9zM277.95,364.65L229.5,413.1V316.2L277.95,364.65z"/>
<path android:fillColor="#FFFFFF" android:pathData="M311.1,255l58.65,58.65c7.65,-17.851 10.2,-38.25 10.2,-58.65c0,-20.4 -5.101,-40.8 -10.2,-58.65L311.1,255zM446.25,119.85L415.65,153c15.3,30.6 25.5,66.3 25.5,102s-10.2,71.4 -25.5,102l30.6,30.6c25.5,-38.25 38.25,-86.699 38.25,-135.149S471.75,158.1 446.25,119.85zM349.35,145.35L204,0h-25.5v193.8L61.2,76.5l-35.7,35.7L168.3,255L25.5,397.8l35.7,35.7l117.3,-117.3V510H204l145.35,-145.35L239.7,255L349.35,145.35zM229.5,96.9l48.45,48.45L229.5,193.8V96.9zM277.95,364.65L229.5,413.1V316.2L277.95,364.65z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="80dp"
android:height="80dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M237.5,2.1c-60.6,4.3 -118.1,30.7 -161.4,74 -99.4,99.4 -99.4,260.4 0,359.8 99.4,99.4 260.4,99.4 359.8,-0 99.4,-99.4 99.4,-260.4 0,-359.8 -44.1,-44.1 -100.7,-69.7 -163.9,-74.1 -16,-1.1 -17.3,-1.1 -34.5,0.1zM166.6,115.5c1.9,2.9 1.1,6 -2,8l-2.3,1.5 2.6,5.3 2.6,5.2 0.5,124.2c0.5,123.4 0.5,124.2 2.6,126.9 4,5.4 7,6.9 13.9,6.9 6.9,-0 9.9,-1.5 13.9,-6.9 1.7,-2.2 2.2,-4.7 2.6,-13.2 0.4,-8.9 0.8,-10.8 2.4,-12 1.6,-1.2 9.8,-1.4 47.5,-1.4 40.9,-0 45.6,0.2 47.3,1.7 2.2,2 2.3,6.1 0.1,8.5 -1.5,1.7 -4.2,1.8 -43.5,1.8l-41.8,-0 0,6.3c0,4.7 -0.6,7.6 -2.4,11l-2.3,4.7 86.2,-0.2 86.2,-0.3 3.7,-2.9c4.5,-3.4 6.6,-7.9 6.6,-14.1l0,-4.5 -26.5,-0c-25.2,-0 -26.6,-0.1 -28.5,-2 -4.2,-4.2 -1.2,-10 5.1,-10l3.9,-0 0,-111.9 0,-111.8 -2.2,-3.3c-1.3,-1.8 -3.6,-4.3 -5.1,-5.4 -2.8,-2.1 -3.7,-2.1 -67.5,-2.4 -64.6,-0.2 -64.6,-0.2 -66.9,-2.4 -2.7,-2.5 -2.9,-4.5 -0.7,-7.6l1.5,-2.2 65.7,-0 65.7,-0 5,2.4c6.2,2.9 11.7,8.6 14.7,15.1l2.3,5 0.3,112.2 0.2,112.3 20.7,-0c25.7,-0 24.3,-0.8 24.3,13.9 0,8.2 -0.5,11.5 -1.9,14.7 -2.8,6.1 -8.9,12.4 -14.6,15l-5,2.4 -102,-0 -102,-0 -5,-2.4c-6.2,-2.9 -11.7,-8.6 -14.7,-15.1l-2.3,-5 -0.3,-112.3 -0.2,-112.2 -20.7,-0c-25.7,-0 -24.3,0.8 -24.3,-13.9 0,-8.2 0.5,-11.5 1.9,-14.7 2.8,-6.1 8.9,-12.4 14.6,-15 4.6,-2.2 6.3,-2.4 21.7,-2.4 16.7,-0 16.8,-0 18.4,2.5zM189.6,115.9c1.6,3.1 0.4,6.2 -2.9,8.1 -3.1,1.8 -5.3,0.8 -7.6,-3.2 -1.3,-2.3 -1.3,-2.9 0.3,-5.2 1.4,-2.3 2.3,-2.7 5.4,-2.4 2.7,0.2 4,0.9 4.8,2.7zM280.8,153.2c0.7,0.7 1.2,2.5 1.2,4l0,2.8 9.3,-0c6.8,-0 9.8,0.4 11.5,1.6 1.3,0.8 5.2,7.5 8.9,14.7 3.6,7.3 8.5,15.7 10.9,18.9l4.4,5.6 0,16.4c0,11.4 -0.4,16.8 -1.2,17.6 -0.7,0.7 -4.1,1.2 -8.3,1.2 -7.1,-0 -7.1,-0 -8.8,3.4 -6.4,13.5 -27.9,12.4 -33,-1.7 -0.6,-1.5 -2.1,-1.7 -13.1,-1.7l-12.4,-0 -2.5,4.3c-3.3,5.6 -8.9,8.7 -15.6,8.7 -2.9,-0 -6.5,-0.7 -8,-1.5 -3.3,-1.6 -7.7,-6.5 -8.6,-9.5 -0.6,-1.7 -1.5,-2 -7.4,-2 -7.1,-0 -9.1,-1 -9.1,-4.5 0,-3.5 2,-4.5 9.2,-4.5 5.4,-0 6.8,-0.3 6.8,-1.5 0,-2.6 7,-9.3 11.5,-11.1 8,-3 17.5,0.8 21.5,8.6l2,4 12.6,-0c11,-0 12.5,-0.2 13.1,-1.8 2,-5.6 7.5,-10.3 14,-11.6 6.8,-1.5 16.5,3.7 19.3,10.4 1.1,2.6 1.8,3 5.1,3l3.9,-0 0,-11.1c0,-10.9 -0.1,-11.2 -3.1,-15l-3.1,-3.9 -17.9,-0c-23.4,-0 -21.9,1.4 -21.9,-20l0,-16 -35.3,-0c-37.1,-0 -37.7,-0.1 -37.7,-4.5 0,-1.2 0.5,-2.6 1.2,-3.3 1.7,-1.7 78.9,-1.7 80.6,-0zM239.4,171.6c1.9,1.9 2,3.5 0.4,5.7 -1.1,1.4 -3.9,1.7 -21.8,1.7 -11.3,0.1 -21.3,-0.2 -22.2,-0.5 -2.6,-1 -3.2,-4.4 -1.2,-6.6 1.6,-1.8 3.2,-1.9 22.5,-1.9 17.5,-0 21,0.2 22.3,1.6zM232.4,189.2c2,2.9 2,3.4 -0.4,5.8 -1.9,1.9 -3.3,2 -21.8,2 -16.3,-0 -20.1,-0.3 -22,-1.6 -2.6,-1.8 -2.8,-4.1 -0.5,-6.6 1.5,-1.6 3.5,-1.8 22.4,-1.8 20.3,-0 20.8,-0 22.3,2.2zM221.1,205c2.2,1.2 2.6,5.9 0.7,7.8 -0.8,0.8 -5.3,1.2 -13.4,1.2 -11.6,-0 -12.4,-0.1 -13.8,-2.2 -2,-2.9 -2,-3.4 0.4,-5.8 1.8,-1.8 3.3,-2 13.1,-2 6.1,-0 11.9,0.5 13,1zM312.7,281.2c2.7,2.5 2.9,4.5 0.7,7.6l-1.5,2.2 -55.4,-0 -55.4,-0 -1.5,-2.2c-2.1,-3 -2,-4.7 0.6,-7.5l2.1,-2.3 54.1,-0 54,-0 2.3,2.2zM313,304c2.4,2.4 2.5,4.8 0.4,7.8l-1.5,2.2 -55.4,-0 -55.4,-0 -1.5,-2.2c-2.1,-3 -2,-5.4 0.4,-7.8 2,-2 3.3,-2 56.5,-2 53.2,-0 54.5,-0 56.5,2zM272.7,328.2c2.7,2.5 2.9,4.5 0.7,7.6l-1.5,2.2 -35.4,-0 -35.4,-0 -1.5,-2.2c-2.1,-3 -2,-5 0.4,-7.6 2.1,-2.2 2.4,-2.2 36.2,-2.2 33.7,-0 34.2,-0 36.5,2.2zM313,328.2c2.4,2.6 2.5,4.6 0.4,7.6 -1.4,2 -2.3,2.2 -12.1,2.2 -8.5,-0 -11,-0.3 -12.5,-1.7 -2.4,-2.1 -2.3,-5.8 0.2,-8.3 1.7,-1.7 3.3,-2 12,-2 8.9,-0 10.1,0.2 12,2.2zM321.2,361.7c3.7,3.3 1.1,10.3 -3.9,10.3 -2.8,-0 -6.3,-3.3 -6.3,-6 0,-2.6 3.4,-6 6.2,-6 1.2,-0 3,0.7 4,1.7z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M131.5,126.4c-6.1,2.7 -9.5,8.5 -9.5,16.2l0,4.4 16.8,-0 16.8,-0 -0.6,-6c-0.6,-6.6 -2.7,-10.2 -8,-13.8 -3.8,-2.5 -10.7,-2.9 -15.5,-0.8z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M282,178.5l0,8.5 12,-0 12,-0 -4.2,-8.5 -4.2,-8.5 -7.8,-0 -7.8,-0 0,8.5z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M226.5,225.5c-4.1,4 -3.3,10.5 1.7,13.1 5.9,3.1 12,-0.6 12,-7.3 0,-7.3 -8.6,-11 -13.7,-5.8z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M286.9,225.9c-3.5,3.6 -3.7,7 -0.5,10.7 6.1,7.2 17.4,-0.2 14,-9.1 -0.8,-1.9 -5.5,-4.5 -8.4,-4.5 -1.2,-0 -3.5,1.3 -5.1,2.9z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="80dp"
android:height="80dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M237.5,2.1c-60.6,4.3 -118.1,30.7 -161.4,74 -99.4,99.4 -99.4,260.4 0,359.8 99.4,99.4 260.4,99.4 359.8,-0 99.4,-99.4 99.4,-260.4 0,-359.8 -44.1,-44.1 -100.7,-69.7 -163.9,-74.1 -16,-1.1 -17.3,-1.1 -34.5,0.1zM318.3,109.6c5.6,1.9 12.9,8.1 16.1,13.7 4.4,7.6 4.6,11.4 4.6,78.7l0,64 -6.5,-0 -6.5,-0 0,-63.3c-0.1,-34.7 -0.5,-65.2 -0.9,-67.6 -1,-4.8 -3.3,-8.4 -7.5,-11.5 -2.7,-2 -4,-2.1 -54.7,-2.4l-51.9,-0.3 0,26.1c0,23.6 -0.2,26.4 -1.9,29.8 -4.2,8.2 -8.8,10.2 -23.6,10.2l-11.5,-0 0,-6.5 0,-6.5 10.4,-0c8.2,-0 10.8,-0.3 12,-1.6 1.4,-1.3 1.6,-4.7 1.6,-21.8l0,-20.2 -26.5,26.6 -26.5,26.5 0,94.8c0,104.8 -0.4,99 6.6,104.3l3.7,2.9 77.1,0.3c42.4,0.2 78.5,-0 80.3,-0.3 1.8,-0.3 4.6,-1.7 6.3,-3.2 5.5,-4.6 6.3,-7.4 6.8,-23.6l0.5,-14.8 6.1,0.3 6.1,0.3 0.3,11.5c0.5,19.3 -2.2,27.8 -11.3,35.8 -8.5,7.5 -4.5,7.2 -92.5,7.2 -90.4,-0 -84.6,0.5 -94.1,-8.9 -9.6,-9.6 -8.9,-1.2 -8.9,-114l0,-98.5 34.7,-34.8 34.8,-34.8 56.1,-0c48.4,-0 56.7,0.2 60.7,1.6zM272,138.5l0,6.5 -6.5,-0 -6.5,-0 0,-6.5 0,-6.5 6.5,-0 6.5,-0 0,6.5zM302.7,133.5c8.4,3.5 11.3,9 11.3,21l0,8.5 -6.5,-0 -6.5,-0 0,-7.4c0,-5.4 -0.4,-7.9 -1.6,-9 -1.1,-1.2 -3.6,-1.6 -9,-1.6l-7.4,-0 0,-6.5 0,-6.5 8,-0c5,-0 9.5,0.6 11.7,1.5zM247.8,210.8l0.3,6.2 8.3,-0c7.3,-0 8.7,0.3 12.8,2.9 4.6,3 8.8,9.5 8.8,13.9 0,2 -0.5,2.2 -6.5,2.2 -4.3,-0 -6.5,-0.4 -6.5,-1.2 0,-0.6 -0.7,-2 -1.7,-3 -1.5,-1.6 -3.5,-1.8 -22.4,-1.8 -20.8,-0 -20.9,-0 -22.4,2.4 -2,3 -0.5,7.3 2.7,8.1 1.3,0.3 11.8,0.6 23.5,0.7 23.6,0.3 23.3,0.2 29.7,8.2 2.7,3.3 3.1,4.5 3.1,9.9 -0.1,5.1 -0.6,6.9 -2.9,10.4 -4,6 -9.3,8.3 -18.9,8.3l-7.7,-0 0,6 0,6 -6.5,-0 -6.5,-0 0,-5.9 0,-5.9 -9.4,-0.4c-8.8,-0.3 -9.7,-0.5 -13.3,-3.4 -4.3,-3.5 -6.8,-7.4 -7.8,-12.2l-0.7,-3.2 6.6,-0c6.1,-0 6.6,0.2 7.8,2.7l1.3,2.8 20.9,0.3c18.4,0.2 21.1,-0 22.7,-1.4 2.3,-2.1 2.4,-5.2 0.2,-7.6 -1.5,-1.6 -3.5,-1.8 -22.5,-1.8 -16.6,-0 -21.6,-0.3 -24.6,-1.5 -12.2,-5.2 -15.6,-19.3 -6.9,-29.2 4.3,-4.9 8.2,-6.3 17.7,-6.3l8,-0 0,-5.8c0,-3.2 0.2,-6.1 0.4,-6.3 0.2,-0.2 3.1,-0.4 6.3,-0.3l5.8,-0 0.3,6.2zM412.3,218.4c10.2,4.3 14,17.4 7.7,26.7 -1.6,2.4 -21.7,23.1 -44.7,46.1l-41.8,41.6 -18.2,9.1 -18.3,9.1 -61.5,-0 -61.5,-0 0,-6.5 0,-6.5 58.8,-0 58.8,-0 7.4,-15 7.4,-14.9 44.1,-44c24.2,-24.1 45.4,-44.6 47,-45.5 3.7,-1.9 10.6,-2 14.8,-0.2zM290,314.5l0,6.5 -58,-0 -58,-0 0,-6.5 0,-6.5 58,-0 58,-0 0,6.5z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M400,232.5l-2.4,2.6 3.7,3.6 3.6,3.7 2.6,-2.4c2.7,-2.5 3.3,-6.8 1.3,-8.8 -2,-2 -6.3,-1.4 -8.8,1.3z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M354.9,277.6l-33.4,33.4 3.8,3.7 3.7,3.8 33.3,-33.5 33.4,-33.5 -3.7,-3.7 -3.7,-3.6 -33.4,33.4z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M312,326l-2.1,4.1 4.2,-2.1c3.9,-2.1 4,-2.2 2.3,-4.1 -0.9,-1 -1.9,-1.9 -2,-1.9 -0.2,-0 -1.3,1.8 -2.4,4z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M246,3.1c-63.9,8.5 -103.8,44.2 -117.1,104.4 -1.9,8.9 -2.2,13.8 -2.6,44.2l-0.5,34.3 -31.8,-0c-31.3,-0 -31.7,-0 -35.1,2.3 -1.8,1.2 -4.4,3.8 -5.6,5.6l-2.3,3.4 0,149.4c0,146.6 0,149.5 2,153.2 1.1,2.2 3.6,5 5.7,6.2l3.8,2.4 193,-0 193,-0 3.8,-2.4c2.1,-1.2 4.6,-4 5.7,-6.2 2,-3.7 2,-6.6 2,-153.2l0,-149.4 -2.3,-3.4c-1.2,-1.8 -3.8,-4.4 -5.6,-5.6 -3.4,-2.3 -3.8,-2.3 -35.2,-2.3l-31.9,-0 0,-30.3c0,-32.6 -0.9,-42.2 -5.6,-59.7 -2.9,-10.9 -10.2,-26.9 -17.1,-37.3 -10.1,-15.3 -28.6,-30.9 -48.1,-40.7 -21.6,-10.7 -51.2,-17.2 -68.2,-14.9zM269.5,25.5c44.2,7.2 75,32.1 88.1,71.1 4.9,14.6 5.4,20.1 5.4,56l0,33.4 -107.5,-0 -107.5,-0 0,-29.9c0,-25.9 0.3,-31.4 2,-40.4 7.1,-36.8 26.3,-64.4 55,-79.1 21.8,-11.2 42.4,-14.7 64.5,-11.1zM435.2,209.9l3.3,2.9 0.3,132.9c0.2,98.5 -0.1,133.5 -0.9,135.6 -2.6,6.1 11.1,5.7 -182.4,5.7 -193.5,-0 -179.8,0.4 -182.4,-5.7 -0.8,-2.1 -1.1,-37.1 -0.9,-135.6l0.3,-132.9 3.3,-2.9 3.2,-2.9 176.5,-0 176.5,-0 3.2,2.9z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
<path
android:pathData="M248.7,294.1c-23.7,5.6 -33.5,34.3 -17.8,52.1l3.1,3.6 0,17.3c0,14.8 0.3,18 1.9,21.4 7.7,16.6 31.5,16.6 39.2,-0 1.6,-3.4 1.9,-6.6 1.9,-21.4l0,-17.3 3.1,-3.6c5.3,-6 7.3,-11.7 7.3,-20.7 0,-6.8 -0.4,-8.8 -2.8,-13.5 -4.8,-9.6 -11.3,-14.9 -21.3,-17.5 -6.3,-1.7 -9,-1.7 -14.6,-0.4z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
</vector>
<vector android:height="26dp" android:viewportHeight="489.888"
android:viewportWidth="489.888" android:width="26dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M25.383,290.5c-7.2,-77.5 25.9,-147.7 80.8,-192.3c21.4,-17.4 53.4,-2.5 53.4,25l0,0c0,10.1 -4.8,19.4 -12.6,25.7c-38.9,31.7 -62.3,81.7 -56.6,136.9c7.4,71.9 65,130.1 136.8,138.1c93.7,10.5 173.3,-62.9 173.3,-154.5c0,-48.6 -22.5,-92.1 -57.6,-120.6c-7.8,-6.3 -12.5,-15.6 -12.5,-25.6l0,0c0,-27.2 31.5,-42.6 52.7,-25.6c50.2,40.5 82.4,102.4 82.4,171.8c0,126.9 -107.8,229.2 -236.7,219.9C122.183,481.8 35.283,396.9 25.383,290.5zM244.883,0c-18,0 -32.5,14.6 -32.5,32.5v149.7c0,18 14.6,32.5 32.5,32.5s32.5,-14.6 32.5,-32.5V32.5C277.383,14.6 262.883,0 244.883,0z"/>
<!--<vector
android:viewportHeight="489.888"
android:viewportWidth="489.888"
android:height="26dp"
android:width="26dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF"
android:pathData="M25.383,290.5c-7.2,-77.5 25.9,-147.7 80.8,-192.3c21.4,-17.4 53.4,-2.5 53.4,25l0,0c0,10.1 -4.8,19.4 -12.6,25.7c-38.9,31.7 -62.3,81.7 -56.6,136.9c7.4,71.9 65,130.1 136.8,138.1c93.7,10.5 173.3,-62.9 173.3,-154.5c0,-48.6 -22.5,-92.1 -57.6,-120.6c-7.8,-6.3 -12.5,-15.6 -12.5,-25.6l0,0c0,-27.2 31.5,-42.6 52.7,-25.6c50.2,40.5 82.4,102.4 82.4,171.8c0,126.9 -107.8,229.2 -236.7,219.9C122.183,481.8 35.283,396.9 25.383,290.5zM244.883,0c-18,0 -32.5,14.6 -32.5,32.5v149.7c0,18 14.6,32.5 32.5,32.5s32.5,-14.6 32.5,-32.5V32.5C277.383,14.6 262.883,0 244.883,0z"/>
</vector>-->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:height="26dp"
android:width="26dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M249.5,2.7c-4.6,2.4 -6.6,4.5 -8.6,8.8 -1.8,3.8 -1.9,9.1 -1.9,103.4 0,99.3 0,99.5 2.1,103.9 5.8,11.8 22.4,12.9 29.7,1.9l2.7,-4.1 0.3,-99.5c0.2,-67.4 0,-100.8 -0.7,-103.2 -3,-10.1 -15,-15.8 -23.6,-11.2z"
android:fillColor="#ffffff"
android:strokeColor="#ffffff"/>
<path
android:pathData="M158,61.5c-20.9,8.7 -45.6,25.4 -65.4,44.5 -33.3,32 -58.1,76.8 -67,121 -7.3,36.1 -7.3,61.2 0,97 5.6,27.2 18.5,58.2 34.2,81.5 37.9,56.6 95.7,93.2 162.7,103.1 16.6,2.5 50.4,2.5 67,-0 77.8,-11.5 143.7,-59.7 178.1,-130.1 12.1,-24.9 19.2,-49.5 22.9,-79.7 2.7,-22.7 1.5,-43.9 -4.1,-71.8 -7.2,-35.8 -25.7,-73.8 -50.2,-103.1 -21.3,-25.4 -52.1,-49.1 -79.6,-61.2 -11.5,-5.1 -16,-5.7 -22.2,-2.7 -8.3,4 -10.8,14.8 -5.5,23.4 1.8,2.8 4.9,4.9 15.9,10.5 23.7,12 39.5,23.4 56.3,40.8 46.3,47.8 65.5,113.4 52.4,178.9 -12.3,61.2 -53,113.2 -109.6,140.3 -55.2,26.4 -120.6,26.4 -175.8,-0 -113.3,-54.2 -149.2,-198.6 -74.3,-299.2 19.3,-25.9 42.4,-45.1 73.4,-60.8 11,-5.6 14.1,-7.7 15.9,-10.5 5.2,-8.5 2.7,-19.4 -5.3,-23.3 -6.1,-2.9 -9.9,-2.6 -19.8,1.4z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"/>
</vector>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:height="26dp"
android:width="26dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M249.5,2.7c-4.6,2.4 -6.6,4.5 -8.6,8.8 -1.8,3.8 -1.9,9.1 -1.9,103.4 0,99.3 0,99.5 2.1,103.9 5.8,11.8 22.4,12.9 29.7,1.9l2.7,-4.1 0.3,-99.5c0.2,-67.4 0,-100.8 -0.7,-103.2 -3,-10.1 -15,-15.8 -23.6,-11.2z"
android:fillColor="#ffffff"
android:strokeColor="#ffffff"/>
<path
android:pathData="M158,61.5c-20.9,8.7 -45.6,25.4 -65.4,44.5 -33.3,32 -58.1,76.8 -67,121 -7.3,36.1 -7.3,61.2 0,97 5.6,27.2 18.5,58.2 34.2,81.5 37.9,56.6 95.7,93.2 162.7,103.1 16.6,2.5 50.4,2.5 67,-0 77.8,-11.5 143.7,-59.7 178.1,-130.1 12.1,-24.9 19.2,-49.5 22.9,-79.7 2.7,-22.7 1.5,-43.9 -4.1,-71.8 -7.2,-35.8 -25.7,-73.8 -50.2,-103.1 -21.3,-25.4 -52.1,-49.1 -79.6,-61.2 -11.5,-5.1 -16,-5.7 -22.2,-2.7 -8.3,4 -10.8,14.8 -5.5,23.4 1.8,2.8 4.9,4.9 15.9,10.5 23.7,12 39.5,23.4 56.3,40.8 46.3,47.8 65.5,113.4 52.4,178.9 -12.3,61.2 -53,113.2 -109.6,140.3 -55.2,26.4 -120.6,26.4 -175.8,-0 -113.3,-54.2 -149.2,-198.6 -74.3,-299.2 19.3,-25.9 42.4,-45.1 73.4,-60.8 11,-5.6 14.1,-7.7 15.9,-10.5 5.2,-8.5 2.7,-19.4 -5.3,-23.3 -6.1,-2.9 -9.9,-2.6 -19.8,1.4z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="80dp"
android:height="80dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M237.5,2.1c-60.6,4.3 -118.1,30.7 -161.4,74 -99.4,99.4 -99.4,260.4 0,359.8 99.4,99.4 260.4,99.4 359.8,-0 99.4,-99.4 99.4,-260.4 0,-359.8 -44.1,-44.1 -100.7,-69.7 -163.9,-74.1 -16,-1.1 -17.3,-1.1 -34.5,0.1zM318.7,146.2l36.3,36.3 0,27.5 0,27.5 4.8,2.5c7,3.7 17.1,14.3 21.4,22.6 4.9,9.3 6.8,16.9 6.8,27.2 0,10.4 -2.1,18.9 -6.9,27.8l-3.8,6.9 23,23.8 23,23.8 -3.8,3.9c-2.2,2.2 -4.4,4 -5,4 -0.5,-0 -11.3,-10.3 -23.8,-22.9l-22.8,-22.8 -6.4,4.1 -6.4,4.1 0,29.2 -0.1,29.3 -111.5,-0 -111.5,-0 0,-145.5 0,-145.5 75.2,-0 75.3,-0 36.2,36.2z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M146.8,256l-0.3,131 97.3,-0 97.2,-0 0,-19.8 0,-19.7 -8.7,0.3c-17.3,0.7 -31.6,-5 -43.9,-17.3 -8.3,-8.3 -13.6,-18 -15.9,-29 -1.8,-8.8 -1.8,-14.2 0,-23 4.3,-20.6 20,-37.8 40,-44.1 7,-2.2 9.7,-2.5 18.3,-2.2l10.2,0.3 0,-20.3 0,-20.2 -34,-0 -34,-0 0,-33.5 0,-33.5 -63,-0 -63,-0 -0.2,131zM287,222.5l0,7.5 -60.5,-0 -60.5,-0 0,-7.5 0,-7.5 60.5,-0 60.5,-0 0,7.5zM253,256.5l0,7.5 -43.5,-0 -43.5,-0 0,-7.5 0,-7.5 43.5,-0 43.5,-0 0,7.5zM252.5,291l0,7.5 -43.2,0.3 -43.3,0.2 0,-7.3c0,-4.1 0.3,-7.7 0.7,-8 0.3,-0.4 19.8,-0.6 43.2,-0.5l42.6,0.3 0,7.5zM253,325.5l0,7.5 -43.5,-0 -43.5,-0 0,-7.5 0,-7.5 43.5,-0 43.5,-0 0,7.5z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M285,155.4l0,25.6 25,-0c13.8,-0 25,-0.3 25,-0.6 0,-0.4 -11.2,-11.9 -25,-25.7l-25,-25 0,25.7z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
<path
android:pathData="M318.7,247.1c-10.9,2.6 -23.7,13 -28.7,23.4 -13,27.2 3.6,58.9 33.3,63.5 19.4,3 38.3,-7.4 47,-25.8 3,-6.3 3.2,-7.4 3.2,-17.7 0,-9.2 -0.4,-12 -2.4,-16.8 -4.7,-11.8 -15.8,-22 -27.9,-25.7 -6.8,-2.1 -17.7,-2.5 -24.5,-0.9zM357.4,272.1c1.8,1.4 2.6,3 2.6,5 0,3.4 -1.3,4.8 -19.2,21.8 -15.2,14.3 -15.2,14.3 -26.5,2.8 -4.5,-4.5 -8.7,-9.4 -9.2,-11 -1.9,-4.9 1.5,-9.7 6.9,-9.7 1.2,-0 4.7,2.4 8.1,5.7l6,5.7 4.2,-4c2.3,-2.2 7.6,-7.2 11.8,-11.2 8.4,-7.9 10.8,-8.7 15.3,-5.1z"
android:fillColor="#1c81ce"
android:strokeColor="#1c81ce"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="80dp"
android:height="80dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M237.5,2.1c-60.6,4.3 -118.1,30.7 -161.4,74 -99.4,99.4 -99.4,260.4 0,359.8 99.4,99.4 260.4,99.4 359.8,-0 99.4,-99.4 99.4,-260.4 0,-359.8 -44.1,-44.1 -100.7,-69.7 -163.9,-74.1 -16,-1.1 -17.3,-1.1 -34.5,0.1zM404.2,114.7c11.8,11.8 15.8,16.4 15.8,18.2 0,1.8 -4,6.4 -15.2,17.8 -8.4,8.5 -16.3,15.6 -17.6,16 -2.8,0.7 -9.2,-4.9 -9.2,-8.1 0,-1.2 3.3,-5.4 8.2,-10.3l8.3,-8.3 -39,-0 -38.9,-0 5.9,3.7c52.9,32.5 76,95.3 56.5,153.2 -13.6,40.5 -49.2,73.5 -90.6,84 -15.6,4 -23.1,4.3 -97.8,4.2l-71.9,-0.1 8.1,8.4c4.9,4.9 8.2,9.2 8.2,10.4 0,3.2 -4.8,8.2 -7.8,8.2 -3.8,-0 -34.2,-30.3 -34.2,-34 0,-3.4 30.4,-34 33.8,-34 3,-0 8.2,5.1 8.2,8 0,1.4 -3,5.3 -8.2,10.6l-8.2,8.4 39.5,-0 39.4,-0.1 -5.4,-3.2c-42.4,-25.2 -67.2,-70.9 -64.7,-119.2 2.9,-56.7 42.3,-104.7 97.4,-119 15.3,-4 29.3,-4.6 102,-4.3 36.9,0.2 67.2,0.1 67.2,-0.2 0,-0.3 -3.6,-4.1 -8,-8.5 -4.4,-4.4 -8,-8.7 -8,-9.6 0,-1 1.2,-3.1 2.6,-4.8 4.7,-5.6 6.1,-4.8 23.6,12.6z"
android:fillColor="#1c81ce"
android:strokeColor="#00000000"/>
<path
android:pathData="M249.5,140.6c-27.9,2.4 -51.5,12.6 -71.3,30.9 -36.5,33.9 -46.5,89.5 -24.1,134.8 5.5,11.1 11.1,19 20.7,28.9 44.4,46.1 119,46.1 163.4,-0 20.1,-20.8 30.7,-44.8 32.4,-73.3 3.2,-52.4 -30.1,-100.7 -80.1,-116.2 -12.1,-3.7 -30.1,-6 -41,-5.1zM325.5,193.4c1.4,2 1.5,9.6 1.3,62.8 -0.3,49.5 -0.5,60.8 -1.7,62.1 -1.2,1.6 -7.3,1.7 -68.6,1.7 -61.3,-0 -67.4,-0.1 -68.6,-1.7 -1.2,-1.3 -1.4,-12.6 -1.7,-62.1 -0.2,-53.2 -0.1,-60.8 1.3,-62.8l1.5,-2.4 67.5,-0 67.5,-0 1.5,2.4z"
android:fillColor="#1c81ce"
android:strokeColor="#00000000"/>
<path
android:pathData="M198,255.5l0,53.5 58.5,-0 58.5,-0 0,-53.5 0,-53.5 -17.5,-0 -17.5,-0 0,23.3c0,19.4 -0.3,23.6 -1.6,25.5 -2.3,3.4 -5.8,2.7 -13.9,-2.8 -4.1,-2.8 -7.7,-5 -8,-5 -0.3,-0 -3.9,2.2 -8,5 -8.1,5.5 -11.6,6.2 -13.9,2.8 -1.3,-1.9 -1.6,-6.1 -1.6,-25.5l0,-23.3 -17.5,-0 -17.5,-0 0,53.5zM245,272c2.4,2.4 2.5,4.8 0.4,7.8 -1.5,2.1 -2.1,2.2 -18,2.2 -9.5,-0 -17.4,-0.4 -18.5,-1 -2.4,-1.3 -2.6,-6.6 -0.2,-9.2 1.4,-1.6 3.4,-1.8 18,-1.8 15,-0 16.5,0.2 18.3,2zM228.2,289.7c2.2,2 2.4,6.6 0.2,8.7 -1.1,1.2 -3.6,1.6 -9.9,1.6 -9.2,-0 -11.5,-1.1 -11.5,-5.7 0,-4.9 2.4,-6.3 11.3,-6.3 6.1,-0 8.5,0.4 9.9,1.7z"
android:fillColor="#1c81ce"
android:strokeColor="#00000000"/>
<path
android:pathData="M244.8,219.4l-0.3,17.5 3,-2c1.7,-1.1 4.4,-2.7 6.2,-3.6 3.3,-1.7 4,-1.5 12.4,4l2.4,1.6 -0.3,-17.4 -0.3,-17.5 -11.4,-0 -11.4,-0 -0.3,17.4z"
android:fillColor="#1c81ce"
android:strokeColor="#00000000"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M246,3c-11.4,1.4 -26.3,4.8 -35.9,8.2 -35.1,12.4 -59.8,37.6 -71.5,72.9 -6.4,19.1 -6.8,24.4 -6.4,79.4l0.4,49 2.7,9.7c3.4,12.3 9.1,25.6 15.3,35.4 5,8.1 16.5,22.4 22.8,28.3l3.6,3.5 0,23.2 0,23.3 -19.2,9.7c-10.6,5.3 -31,15.2 -45.3,21.9 -31.1,14.5 -40.9,20.7 -55.6,35.4 -28,27.9 -40.8,62 -37.2,99.4l0.6,6.7 235.2,-0 235.2,-0 0.6,-6.8c4.5,-46.7 -17,-88.7 -59.8,-117.3 -4.5,-3 -10.3,-6.4 -13,-7.6 -2.8,-1.2 -12.2,-5.4 -21,-9.3 -16.1,-7.2 -33.9,-16.2 -53.7,-27.2l-10.8,-6 0,-25.1 0.1,-25.2 6,-4.5c16.4,-12.1 29.1,-35.7 36.2,-67 2,-8.8 2.1,-12.8 2.5,-55.4 0.4,-51.1 0.3,-51.4 -6.5,-71 -13.5,-38.8 -39.4,-65.6 -75,-77.7 -16.1,-5.4 -35.4,-7.7 -50.3,-5.9zM277.6,24.9c32.1,6.6 57.9,28.3 71.2,59.7 1.6,3.8 4.2,11.3 5.8,16.5l2.9,9.4 0,44.5c0,42.2 -0.1,45 -2.2,54.2 -7.1,31.4 -19.4,51.3 -37,60.2l-5.3,2.6 0,37.5 0,37.4 14.3,8.1c17.8,10.2 57.5,30.1 72.7,36.4 19.6,8.3 36.3,20.7 49,36.5 13.6,17 19.9,32.5 22.5,55.3l0.6,5.8 -216.6,-0 -216.6,-0 0.6,-5.8c2.3,-20.8 6.6,-32.4 18.1,-49.7 2.9,-4.5 8.4,-11.3 12.2,-15.1 14.3,-14.5 18.5,-17 72.9,-42.7 27.5,-13 45.3,-22.4 50.6,-26.8l3.7,-3 0,-33.7 0,-33.7 -3.5,-2.4c-5,-3.4 -15.5,-14.8 -21.5,-23.3 -9.7,-13.7 -15.8,-28.1 -18.5,-43.7 -1.8,-10 -2.1,-86 -0.5,-97.6 2.4,-16.3 9,-34.4 17,-46 4.9,-7.1 14.8,-17.2 21.5,-22 23.2,-16.4 59,-24.2 86.1,-18.6z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#000000">
<group android:scaleX="0.08477816"
android:scaleY="0.08477816"
android:translateX="29.16"
android:translateY="46.99587">
<group android:translateY="134.71875">
<path android:pathData="M9,-0L9,-103L40.609375,-103Q51.78125,-103,57.09375,-101.03125Q64.34375,-98.375,68.671875,-91.140625Q73,-83.921875,73,-73.40625Q73,-59.53125,65.9375,-50.765625Q58.875,-42,41.53125,-42L20,-42L20,-0L9,-0ZM20,-54L41.984375,-54Q52.390625,-54,57.1875,-58.6875Q62,-63.390625,62,-72.859375Q62,-79,59.625,-83.375Q57.265625,-87.75,53.90625,-89.375Q50.546875,-91,41.78125,-91L20,-91L20,-54Z"
android:fillColor="#000000"/>
<path android:pathData="M85,-50.125Q85,-76.578125,96.625,-90.78125Q108.25,-105,125.578125,-105Q136.76562,-105,145.98438,-98.640625Q155.21875,-92.296875,160.60938,-80.203125Q166,-68.109375,166,-51.390625Q166,-28.40625,155.57812,-13.9375Q144.09375,2,125.5,2Q106.765625,2,95.359375,-14.359375Q85,-29.171875,85,-50.125ZM96,-49.953125Q96,-30.953125,104.578125,-20.46875Q113.15625,-10,125.421875,-10Q137.98438,-10,146.48438,-20.578125Q155,-31.171875,155,-51.703125Q155,-64.953125,150.625,-75.40625Q147.25,-83.390625,140.46875,-88.1875Q133.6875,-93,125.640625,-93Q112.71875,-93,104.359375,-82.484375Q96,-71.96875,96,-49.953125Z"
android:fillColor="#000000"/>
<path android:pathData="M177,-33L187,-34Q187.84375,-25.40625,190.82812,-20.609375Q193.82812,-15.828125,199.39062,-12.90625Q204.96875,-10,211.9375,-10Q221.9375,-10,227.46875,-14.984375Q233,-19.96875,233,-27.9375Q233,-32.59375,231.01562,-36.0625Q229.03125,-39.546875,225.03125,-41.765625Q221.04688,-44,207.76562,-47.75Q195.9375,-51.109375,190.8125,-54.71875Q185.6875,-58.328125,182.84375,-63.875Q180,-69.421875,180,-76.421875Q180,-89.015625,188.01562,-97Q196.03125,-105,209.625,-105Q218.96875,-105,225.96875,-101.25Q232.98438,-97.5,236.84375,-90.484375Q240.71875,-83.484375,241,-74L231,-73Q230.15625,-83.171875,224.98438,-88.078125Q219.82812,-93,210.46875,-93Q200.98438,-93,195.98438,-88.359375Q191,-83.71875,191,-76.359375Q191,-69.546875,194.29688,-65.78125Q197.57812,-62.03125,210.29688,-58.671875Q222.75,-55.390625,227.78125,-52.96875Q235.46875,-49.21875,239.73438,-42.96875Q244,-36.734375,244,-28.078125Q244,-19.484375,239.85938,-12.421875Q235.73438,-5.359375,228.625,-1.671875Q221.53125,2,211.51562,2Q195.90625,2,186.625,-7.4375Q177.34375,-16.875,177,-33Z"
android:fillColor="#000000"/>
<path android:pathData="M289,-33L299,-34Q299.84375,-25.40625,302.82812,-20.609375Q305.82812,-15.828125,311.39062,-12.90625Q316.96875,-10,323.9375,-10Q333.9375,-10,339.46875,-14.984375Q345,-19.96875,345,-27.9375Q345,-32.59375,343.01562,-36.0625Q341.03125,-39.546875,337.03125,-41.765625Q333.04688,-44,319.76562,-47.75Q307.9375,-51.109375,302.8125,-54.71875Q297.6875,-58.328125,294.84375,-63.875Q292,-69.421875,292,-76.421875Q292,-89.015625,300.01562,-97Q308.03125,-105,321.625,-105Q330.96875,-105,337.96875,-101.25Q344.98438,-97.5,348.84375,-90.484375Q352.71875,-83.484375,353,-74L343,-73Q342.15625,-83.171875,336.98438,-88.078125Q331.82812,-93,322.46875,-93Q312.98438,-93,307.98438,-88.359375Q303,-83.71875,303,-76.359375Q303,-69.546875,306.29688,-65.78125Q309.57812,-62.03125,322.29688,-58.671875Q334.75,-55.390625,339.78125,-52.96875Q347.46875,-49.21875,351.73438,-42.96875Q356,-36.734375,356,-28.078125Q356,-19.484375,351.85938,-12.421875Q347.73438,-5.359375,340.625,-1.671875Q333.53125,2,323.51562,2Q307.90625,2,298.625,-7.4375Q289.34375,-16.875,289,-33Z"
android:fillColor="#000000"/>
<path android:pathData="M362,0L394.26562,-103L405.67188,-103L439,0L427.51562,0L418.71875,-30L382.29688,-30L373.5,0L362,0ZM385.8125,-42L415.20312,-42L406.45312,-70.65625Q402.39062,-83.859375,400.5,-92.125Q398.78125,-82.171875,395.65625,-72.359375L385.8125,-42Z"
android:fillColor="#000000"/>
<path android:pathData="M450,0L450,-103L461,-103L461,-12L503,-12L503,0L450,0Z"
android:fillColor="#000000"/>
<path android:pathData="M516,0L516,-103L578,-103L578,-91L527,-91L527,-59L575,-59L575,-47L527,-47L527,-12L579,-12L579,0L516,0Z"
android:fillColor="#000000"/>
</group>
</group>
</vector>
\ No newline at end of file
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="#FFFFFF" >
</solid>
<padding
android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp">
</padding>
<corners
android:radius="3dp" >
</corners>
</shape>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/bg">
<androidx.appcompat.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/background_all"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat"
app:elevation="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:titleTextColor="@android:color/white"
app:titleTextAppearance="@style/Toolbartitleheader">
</androidx.appcompat.widget.Toolbar>
<TextView
android:layout_below="@+id/main_toolbar"
android:id="@+id/store_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="15dp"
android:text="KLM"
android:textSize="18dp"
style="@style/textfont"
android:textColor="@android:color/black"/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/cust_num"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/store_location"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp">
<EditText
android:id="@+id/cust_number"
android:layout_below="@+id/cust_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile Number"
android:inputType="number"
android:textSize="16dp"
style="@style/textfont"
android:maxLength="10"
android:singleLine="true"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/cust_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cust_num"
android:layout_marginTop="10dp">
<EditText
android:id="@+id/cust_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Customer Name"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
style="@style/textfont"
android:textSize="16dp"
android:singleLine="true"/>
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:id="@+id/layout_ds"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cust_layout"
android:weightSum="1"
android:gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="15dp">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/ds"
android:layout_below="@+id/cust_num"
android:layout_weight="0.8">
<EditText
android:id="@+id/ds_Number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:layout_marginRight="15dp"
android:singleLine="true"
android:paddingLeft="8dp"
android:textSize="16dp"
style="@style/textfont"
android:hint="Delivery Slip Number"
android:layout_gravity="center"/>
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/send"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Add"
android:layout_weight="0.2"
android:minHeight="45dp"
android:layout_gravity="center"
style="@style/textfont"
android:background="@drawable/background_all"
android:textColor="@android:color/white"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/layout"
android:layout_below="@+id/layout_ds"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="20dp"
android:visibility="gone">
<LinearLayout
android:id="@+id/data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="invisible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_marginTop="10dp"
>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Gross Amount"
android:layout_weight="0.4"
style="@style/textfont"
android:textColor="@android:color/black"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
style="@style/textfont"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/gross_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Gross Amount"
android:layout_weight="0.6"
style="@style/textfont"
android:textColor="@android:color/black"
android:layout_marginLeft="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_marginTop="10dp"
>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Discount Amount"
style="@style/textfont"
android:layout_weight="0.4"
android:textColor="@android:color/black"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
style="@style/textfont"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/discount_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Discount Amount"
style="@style/textfont"
android:layout_weight="0.6"
android:textColor="@android:color/black"
android:layout_marginLeft="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_marginTop="10dp"
>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Round Off"
style="@style/textfont"
android:layout_weight="0.4"
android:textColor="@android:color/black"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
style="@style/textfont"
android:textColor="@android:color/black"/>
<TextView
android:id="@+id/round_off"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="RoundOff"
style="@style/textfont"
android:layout_weight="0.6"
android:textColor="@android:color/black"
android:layout_marginLeft="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_marginTop="10dp"
>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Net Amount"
android:layout_weight="0.4"
android:textColor="@android:color/black"
style="@style/textfont"
android:textSize="18dp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
android:textColor="@android:color/black"
style="@style/textfont"
android:textSize="18dp"
android:textStyle="bold"/>
<TextView
android:id="@+id/netamount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Net Amount"
android:layout_weight="0.6"
android:textColor="@android:color/black"
style="@style/textfont"
android:layout_marginLeft="10dp"
android:textSize="18dp"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/generate_invoice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Generate Invoice "
android:textAllCaps="false"
android:background="@drawable/background_all"
android:textColor="@android:color/white"
android:textSize="16dp"
style="@style/textfont"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"/>
<Button
android:id="@+id/pluto_Print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/holo_blue_dark"
android:layout_marginTop="15dp"
android:layout_alignParentBottom="true"
android:text="PRINT"
style="@style/textfont"
android:visibility="gone"
android:minHeight="40dp"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_marginTop="15dp"
android:id="@+id/ds_list"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
<!-- <ListView
android:layout_marginTop="15dp"
android:id="@+id/ds_list"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>-->
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_above="@+id/layout"
android:layout_alignParentTop="true">
<androidx.appcompat.widget.Toolbar
android:id="@+id/createdeliveryslip_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/background_all"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:elevation="0dp"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat"
app:titleTextAppearance="@style/Toolbartitleheader"
app:titleTextColor="@android:color/white"></androidx.appcompat.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:cardCornerRadius="3dp">
<LinearLayout
android:id="@+id/header_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/totalItems"
style="@style/textfont"
android:layout_width="0dp"
android:textStyle="bold"
android:layout_height="wrap_content"
android:layout_weight="0.50" />
<TextView
android:id="@+id/totalMrp"
style="@style/textfont"
android:layout_width="0dp"
android:textStyle="bold"
android:layout_height="wrap_content"
android:layout_weight="0.50" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/totalDis"
style="@style/textfont"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:text="Total Disc"
android:visibility="invisible" />
<TextView
android:id="@+id/totalNetMrp"
style="@style/textfont"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:text="Net MRP"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal"
android:weightSum="1">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checked"/>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.30">
<EditText
android:id="@+id/emp_id"
style="@style/textfont"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:hint="Sales Person"
android:singleLine="true"
android:textColor="@android:color/black" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.70">
<EditText
android:id="@+id/barcode_enter"
style="@style/textfont"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:hint="Barcode"
android:singleLine="true"
android:textColor="@android:color/black" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
<!-- <androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg">
</androidx.cardview.widget.CardView> -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/deliveryslip_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_above="@+id/layout">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/valid"
style="@style/textfont"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="3dp"
android:background="@drawable/background_all"
android:text="@string/resolve_promotions"
android:textColor="@android:color/white"
android:visibility="gone" />
<Button
android:id="@+id/valid_print"
style="@style/textfont"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="3dp"
android:background="@drawable/background_all"
android:text="@string/print"
android:textColor="@android:color/white"
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -34,7 +34,7 @@
android:layout_margin="10dp"
style="@style/headerfont"
android:textColor="@android:color/white"
android:background="@drawable/background_all"
android:background="@drawable/button_background"
android:padding="10dp"/>
<Button
......@@ -45,7 +45,7 @@
android:layout_margin="10dp"
style="@style/headerfont"
android:textColor="@android:color/white"
android:background="@drawable/background_all"
android:background="@drawable/button_background"
android:padding="10dp"/>
<Button
......@@ -56,7 +56,7 @@
android:layout_margin="10dp"
style="@style/headerfont"
android:textColor="@android:color/white"
android:background="@drawable/background_all"
android:background="@drawable/button_background"
android:padding="10dp"/>
......
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" android:background="#FFFFFF">
android:orientation="vertical"
android:background="#FFFFFF">
<Button
android:layout_width="match_parent"
......
......@@ -22,7 +22,7 @@
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:titleTextColor="@android:color/white"
app:titleTextAppearance="@style/Toolbartitleheader">
app:titleTextAppearance="@style/headerfont">
</androidx.appcompat.widget.Toolbar>
......@@ -146,6 +146,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/menu_list"
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
android:background="@drawable/background_all"
android:orientation="vertical"
android:weightSum="1">
<androidx.appcompat.widget.Toolbar
<!--<androidx.appcompat.widget.Toolbar
android:id="@+id/login_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/background_all"
app:elevation="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:elevation="0dp"
app:titleTextAppearance="@style/Toolbartitleheader"
app:titleTextColor="@android:color/white">
</androidx.appcompat.widget.Toolbar>-->
</androidx.appcompat.widget.Toolbar>
<!-- <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/smart_login"
android:layout_gravity="center"
android:layout_marginTop="50dp"/>-->
<!-- <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/smart_login"
android:layout_gravity="center"
android:layout_marginTop="50dp"/>-->
<!-- <LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.40"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/pos_logo"
android:layout_gravity="center"/>&ndash;&gt;
</LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<com.google.android.material.textfield.TextInputLayout
android:layout_weight="0.60"
android:gravity="center"
>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/userId">
app:cardCornerRadius="10dp"
android:layout_margin="20dp">
<EditText
android:id="@+id/userId"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:inputType="number"
android:textAllCaps="false" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/userIdPassword" >
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:layout_margin="10dp">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:inputType="textPassword"/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="LOGIN"
android:gravity="center"
style="@style/headerfont"
android:layout_marginTop="30dp"/>
<Spinner
android:id="@+id/storeId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp">
</Spinner>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/userId">
<EditText
android:id="@+id/userId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:drawableRight="@drawable/ic_user"
android:inputType="number"
style="@style/textfont"
android:textAllCaps="false" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/background_all"
android:textColor="@android:color/white"
android:text="Submit"
style="@style/textfont"/>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/userIdPassword">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:drawableRight="@drawable/ic_password"
style="@style/textfont"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<Spinner
android:id="@+id/storeId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp">
</Spinner>
<Button
android:id="@+id/submit"
style="@style/textfont"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/button_background"
android:text="LOGIN"
android:textColor="@android:color/white"
app:cornerRadius="5dp"
android:layout_marginBottom="30dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
......@@ -32,6 +33,7 @@
android:textColor="@android:color/black"
style="@style/textfont"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/plandetails_name"
android:layout_width="wrap_content"
......@@ -40,6 +42,7 @@
android:textColor="@android:color/black"
style="@style/textfont"
/>
<!--<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/plandetails_division"
android:layout_width="wrap_content"
......@@ -48,6 +51,7 @@
android:textColor="@android:color/black"
style="@style/textfont"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/plandetails_section"
android:layout_width="wrap_content"
......@@ -61,12 +65,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/pieces"
android:layout_width="0dp"
......@@ -76,6 +82,7 @@
android:checked="true"
android:onClick="PiecesClicked"
style="@style/textfont"/>
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/meters"
android:layout_width="0dp"
......@@ -84,6 +91,7 @@
android:text="@string/meters"
android:onClick="MetersClicked"
style="@style/textfont"/>
</RadioGroup>
</LinearLayout>
......@@ -138,17 +146,17 @@
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/rack_number"
style="@style/headerfont"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="1dp"
android:hint="@string/rack"
style="@style/headerfont"
android:inputType="number"
android:singleLine="true"/>
android:maxLines="2"
android:inputType="number|text"/>
</RelativeLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatEditText
......@@ -168,30 +176,31 @@
android:orientation="horizontal"
android:weightSum="1"
android:layout_margin="3dp">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/barcode"
android:layout_weight="0.33"
android:textColor="@android:color/black"
style="@style/headerfont"
/>
style="@style/headerfont"/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/qty"
android:layout_weight="0.33"
android:textColor="@android:color/black"
style="@style/headerfont"
/>
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/qty"
android:layout_weight="0.33"
android:textColor="@android:color/black"
style="@style/headerfont"/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:textColor="@android:color/black"
/>
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:textColor="@android:color/black"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -202,8 +211,7 @@
android:id="@+id/barcode_recylerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/ScanComplete"
/>
android:layout_above="@+id/ScanComplete"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/ScanComplete"
......@@ -214,6 +222,7 @@
android:textColor="@android:color/white"
android:layout_alignParentBottom="true"
style="@style/textfont"/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/background_all"
android:gravity="center">
android:background="@drawable/splashscreen">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_back_foreground"/>
<ProgressBar
android:id="@+id/progress_circular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"/>
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="150dp"
/>
<!-- <androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
......@@ -27,4 +27,4 @@
android:textColor="@android:color/white"
android:textAppearance="@style/textfont"/>-->
</LinearLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
......@@ -6,7 +6,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="5dp"
android:background="@color/bg"
app:cardCornerRadius="3dp">
app:cardCornerRadius="5dp">
<LinearLayout
android:layout_width="match_parent"
......@@ -20,20 +20,21 @@
android:layout_height="wrap_content"
style="@style/textfont"
android:textStyle="bold"
android:layout_margin="5dp"/>
android:layout_marginTop="14dp"
android:layout_marginLeft="14dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_margin="5dp">
android:layout_margin="14dp">
<TextView
android:id="@+id/create_barcode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:layout_weight="0.60"
android:layout_marginRight="5dp"
style="@style/textfont"/>
......@@ -41,7 +42,7 @@
android:id="@+id/create_empid"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:layout_weight="0.40"
android:layout_marginLeft="5dp"
style="@style/textfont"/>
......@@ -57,13 +58,13 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_margin="5dp">
android:layout_margin="14dp">
<TextView
android:id="@+id/create_mrp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:layout_weight="0.60"
android:layout_marginRight="5dp"
style="@style/textfont"/>
......@@ -71,7 +72,7 @@
android:id="@+id/create_dis"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:layout_weight="0.40"
android:layout_marginLeft="5dp"
style="@style/textfont"/>
</LinearLayout>
......@@ -88,7 +89,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
style="@style/textfont"
android:layout_margin="5dp"/>
android:layout_margin="10dp"/>
</LinearLayout>
......
......@@ -6,21 +6,22 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@android:color/white"
app:cardCornerRadius="3dp"
android:layout_margin="3dp">
android:layout_margin="10dp">
<LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_margin="15dp">
android:layout_margin="5dp">
<ImageView
android:id="@+id/menu_image"
android:src="@mipmap/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="15dp"/>
<TextView
android:id="@+id/menu_name"
......@@ -28,6 +29,8 @@
android:layout_height="wrap_content"
style="@style/textfont"
android:textColor="@android:color/black"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:text="name"/>
</LinearLayout>
......
......@@ -5,7 +5,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardCornerRadius="3dp"
android:layout_margin="5dp">
<LinearLayout
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -17,26 +18,39 @@
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:textColor="@android:color/black"
style="@style/textfont"
/>
style="@style/textfont"/>
<TextView
android:id="@+id/plan_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:textColor="@android:color/black"
style="@style/textfont"
/>
style="@style/textfont"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
android:layout_marginTop="10dp"
android:layout_gravity="center">
<EditText
android:id="@+id/rack_no"
style="@style/textfont"
android:layout_width="80dp"
android:layout_height="50dp"
android:layout_marginRight="15dp"
android:layout_toLeftOf="@+id/view_section"
android:hint="Rack No"
android:inputType="number"
android:textColor="@android:color/black" />
<Button
android:id="@+id/view_section"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_height="wrap_content"
android:text="@string/view"
android:textAllCaps="false"
android:layout_toLeftOf="@+id/start_scan"
......@@ -49,20 +63,15 @@
<Button
android:id="@+id/start_scan"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_height="wrap_content"
android:text="@string/startscan"
android:textAllCaps="false"
android:layout_gravity="right"
style="@style/textfont"
android:background="@drawable/background_all"
android:textColor="@android:color/white"
android:layout_alignParentRight="true"
></Button>
android:layout_alignParentRight="true">
</Button>
</RelativeLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
......@@ -9,13 +9,14 @@
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:background="@color/colorAccent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bluetooth Devices List"
android:layout_margin="10dp"
style="@style/headerfont"
android:textColor="@android:color/white"/>
<ImageView
......
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="@style/textfont"
android:textAppearance="?android:attr/textAppearanceLargePopupMenu"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:text="Spinner"
android:paddingLeft="10dp"
android:paddingTop="22dp"
android:ellipsize="marquee" />
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/icon_background"/>
<foreground android:drawable="@drawable/icon_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/icon_background"/>
<foreground android:drawable="@drawable/icon_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#2C0465</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#2C0465</color>
<color name="colorPrimaryDark">#007cde</color>
<color name="colorAccent">#07c4a0</color>
<color name="bg">#6A95A5A6</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="icon_background">#35DCD8</color>
</resources>
\ No newline at end of file
......@@ -18,7 +18,7 @@
<string name="no_stores">No Stores Available</string>
<string name="login">Login</string>
<string name="dashboard">DashBoard</string>
<string name="home">Home</string>
<string name="home">HOME</string>
<string name="test">Plans List</string>
<string name="spalsh">Splash Screen</string>
......@@ -56,6 +56,7 @@
<string name="android_version">android_version</string>
<string name="plan_details">Plan Details</string>
<string name="key">key</string>
<string name="Rack">rack</string>
<string name="action">action</string>
......@@ -72,6 +73,11 @@
<string name="totalqty">total_qty</string>
<string name="netpayable">net_payable</string>
<string name="totalDisc">total_items_promo_disc</string>
<string name="totalMrp">total_items_mrp</string>
<string name="printerName">PrinterName</string>
<string name="target">Target</string>
<!--<string name="section"><font color=#cc0029>SECTION :</font></string>-->
......
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
......@@ -10,8 +9,9 @@
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDisablePreview">true</item>
</style>
<style name="Toolbartitleheader">
<item name="android:fontFamily">@font/whitneyhtf_book</item>
<item name="android:textSize">18sp</item>
......
......@@ -7,6 +7,7 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment