initial commit

parent 988f2930
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>
\ No newline at end of file
......@@ -4,17 +4,16 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="JDK" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
......
......@@ -5,7 +5,7 @@
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
......@@ -3,12 +3,17 @@
xmlns:android="http://schemas.android.com/apk/res/android"
package="w.soulofpluto.posstock">
<uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<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_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"/>
......
......@@ -15,10 +15,10 @@ import retrofit2.http.Path;
* Created by Ramesh on 05/09/20.
*/
public interface ApiService{
public interface ApiService {
/*String BASE_URL = "https://aeebe1.emporter.eu/pos_actions/";
String Token = "41f34d7009db337f6213be52f7151108";
String StoreId = "980";
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")
......@@ -27,11 +27,11 @@ import retrofit2.http.Path;
@Headers({"Content-type: application/json"})
@POST("/login/doLogin")
Call<String> Login(@Body RequestBody body);
Call<String> Login(@Body RequestBody body);
@POST("/Tfs/getInfoWithTfsNumber")
Call<Response> getInfoTfsNumber(@HeaderMap Map<String, String> headers, @Body RequestBody responseBody);
@GET("/login/getStoresMappedToUser/{id}")
Call<Response> getStoreId(@Path("id") String id);
}
}
......@@ -4,15 +4,17 @@ package w.soulofpluto.posstock;
Create by Ramesh Babu
*/
public class
Barcode {
String barcode, empId;
int qty;
public class Barcode {
private String barcode;
private String empId;
private int qty;
public Barcode(String Barcode, int Qty, String empId){
this.barcode = Barcode;
this.qty = Qty;
this.empId = empId;
}
public String getBarcode() {
return barcode;
}
......
......@@ -35,7 +35,7 @@ public class CreateResponse {
private String transactionStartTime;
@SerializedName("transaction_start_microtime")
@Expose
private Long transactionStartMicrotime;
private Long transactionStartMicroTime;
public Integer getSuccess() {
return success;
......@@ -101,16 +101,14 @@ public class CreateResponse {
this.transactionStartTime = transactionStartTime;
}
public Long getTransactionStartMicrotime() {
return transactionStartMicrotime;
public Long getTransactionStartMicroTime() {
return transactionStartMicroTime;
}
public void setTransactionStartMicrotime(Long transactionStartMicrotime) {
this.transactionStartMicrotime = transactionStartMicrotime;
public void setTransactionStartMicroTime(Long transactionStartMicroTime) {
this.transactionStartMicroTime = transactionStartMicroTime;
}
public class Datum {
@SerializedName("barcode")
@Expose
......@@ -283,7 +281,5 @@ public class CreateResponse {
public void setColorCode(String colorCode) {
this.colorCode = colorCode;
}
}
}
\ No newline at end of file
package w.soulofpluto.posstock;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
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;
......@@ -23,121 +20,124 @@ import org.json.JSONObject;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/*
Create by Ramesh Babu
/*
Create by Ramesh Babu
*/
//9985099555
public class DashBoardActivity extends AppCompatActivity implements View.OnClickListener {
Toolbar dashboard_toolbar;
Button stock_audit,rack_qty,searchBy_Barcode, transfer;
TextView version;
Toolbar dashboard_toolbar;
Button stock_audit, rack_qty, searchBy_Barcode, transfer;
TextView version;
PreferenceManager preferenceManager;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
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);
dashboard_toolbar = findViewById(R.id.dashboard_toolbar);
version = findViewById(R.id.version);
transfer = findViewById(R.id.transfer);
preferenceManager = new PreferenceManager(this);
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));
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
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);
dashboard_toolbar = findViewById(R.id.dashboard_toolbar);
version = findViewById(R.id.version);
transfer = findViewById(R.id.transfer);
preferenceManager = new PreferenceManager(this);
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));
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.menu, menu);
return super.onCreateOptionsMenu(menu);
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()){
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.dashboard_logout:
if(Constants.isNetworkAvailable(DashBoardActivity.this)){
Logout(Constants.Logout+preferenceManager.getUserId());
if (Constants.isNetworkAvailable(DashBoardActivity.this)) {
Logout(Constants.Logout + preferenceManager.getUserId());
Constants.ProgressDialogShow(DashBoardActivity.this);
}else{
Constants.getToast(DashBoardActivity.this,getResources().getString(R.string.connection));
} else {
Constants.getToast(DashBoardActivity.this, getResources().getString(R.string.connection));
}
break;
break;
case android.R.id.home:
finish();
break;
break;
}
return super.onOptionsItemSelected(item);
}
public void Logout(String Url){
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(){
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();
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{
JSONObject jsonObject = new JSONObject(res);
if(jsonObject.has("success")){
if(jsonObject.getInt("success") == 1){
}else if(jsonObject.getInt("success") == 3){
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(DashBoardActivity.this);
Constants.getToast(DashBoardActivity.this,jsonObject.getString("msg"));
}else{
Constants.getToast(DashBoardActivity.this,jsonObject.getString("msg"));
try {
JSONObject jsonObject = new JSONObject(res);
if (jsonObject.has("success")) {
if (jsonObject.getInt("success") == 1) {
} else if (jsonObject.getInt("success") == 3) {
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(DashBoardActivity.this);
Constants.getToast(DashBoardActivity.this, jsonObject.getString("msg"));
} else {
Constants.getToast(DashBoardActivity.this, jsonObject.getString("msg"));
}
}
}catch(JSONException e){
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
}
}
} catch (JSONException e) {
e.printStackTrace();
} catch (NullPointerException np) {
np.printStackTrace();
}
}
}
});
}
@Override
public void onClick(View view){
switch(view.getId()){
public void onClick(View view) {
switch (view.getId()) {
case R.id.stock_audit:
Intent in_main = new Intent(this, MainActivity.class);
this.startActivity(in_main);
break;
Intent in_main = new Intent(this, MainActivity.class);
this.startActivity(in_main);
break;
case R.id.rack_qty:
Intent in_rack = new Intent(this, RackWiseQty.class);
this.startActivity(in_rack);
break;
Intent in_rack = new Intent(this, RackWiseQty.class);
this.startActivity(in_rack);
break;
case R.id.searchby_barcode:
Intent in_search = new Intent(this, SearchByBarcode.class);
this.startActivity(in_search);
break;
}
Intent in_search = new Intent(this, SearchByBarcode.class);
this.startActivity(in_search);
break;
}
}
}
package w.soulofpluto.posstock;
/*
/*
Create by Ramesh Babu
*/
public interface DataInterface {
void onDeliveryData(int code, String data, String Id);
void onDeliveryFail(String fail);
void onDeliveryDataRemove(int code, String data);
void onDeliveryFailRemove(String fail);
void onLogoutData(int code, String data);
void onLogoutFail(String fail);
void onFinalData(int code, String finalData);
void onFinalFail(String finalFail);
void onLogoutData (int code, String data);
void onLogoutFail (String fail);
void onFinalData (int code, String finalData);
void onFinalFail (String finalFail);
void onCustomerName(int code,String name);
void onCustomerNameFail(String fail);
void onCustomerNameFail (String fail);
}
......@@ -3,15 +3,12 @@ package w.soulofpluto.posstock;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
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;
import java.io.IOException;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
/*
......@@ -19,59 +16,59 @@ import java.util.concurrent.TimeUnit;
*/
public class DataPresenter{
private Context context;
private DataInterface dataInterface;
private String Response;
private Context context;
private DataInterface dataInterface;
private String Response;
private PreferenceManager preferenceManager;
public DataPresenter(Context context,DataInterface dataInterface){
this.context = context;
this.dataInterface = dataInterface;
preferenceManager = new PreferenceManager(context);
this .context = context;
this .dataInterface = dataInterface;
preferenceManager = new PreferenceManager(context);
}
public void SendDeliverySlipNumber(String Url, RequestBody object, final String Id){
System.out.println("Url ====>"+Url);
System.out.println("Object ====>"+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);
client.setWriteTimeout(240,TimeUnit.SECONDS);
client .setConnectTimeout(240, TimeUnit.SECONDS);
client .setReadTimeout(240, TimeUnit.SECONDS);
client .setWriteTimeout(240, TimeUnit.SECONDS);
Request request = new Request.Builder()
.url(Url)
.post(object)
.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(){
.url(Url)
.post(object)
.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());
dataInterface.onDeliveryFail(request.toString());
System.out.println("Delivery Slip error" +e.getMessage());
}
@Override
public void onResponse(final com.squareup.okhttp.Response response) throws IOException{
try {
Response = response.body().string();
System.out.println("Delivery Slip" + Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> dataInterface.onDeliveryData(response.code(),Response,Id));
}catch (NullPointerException np){
np.printStackTrace();
}finally {
response.body().close();
}
try {
Response = response.body().string();
System.out.println("Delivery Slip" + Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> dataInterface.onDeliveryData(response.code(),Response,Id));
}catch (NullPointerException np){
np.printStackTrace();
}finally {
response.body().close();
}
}
});
}
public void SendDeliverySlipNumberRemove(String Url, RequestBody object){
System.out.println("Url ====>"+Url);
System.out.println("Object ====>"+object);
//System.out.println("Url ====>"+Url);
//System.out.println("Object ====>"+object);
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(240, TimeUnit.SECONDS);
client.setReadTimeout(240,TimeUnit.SECONDS);
......@@ -171,6 +168,7 @@ public class DataPresenter{
}
});
}
public void CustomerName(String Url,RequestBody object){
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(2000, TimeUnit.SECONDS);
......@@ -192,7 +190,7 @@ public class DataPresenter{
@Override
public void onResponse(final com.squareup.okhttp.Response response) throws IOException{
Response = response.body().string();
System.out.println("Customer Response ====>" + Response);
Log.e("Customer Response ====>" , Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> dataInterface.onCustomerName(response.code(), Response));
}
......
......@@ -20,30 +20,25 @@ import java.util.ArrayList;
import java.util.HashMap;
public class DiscoveryActivity extends Activity implements View.OnClickListener, AdapterView.OnItemClickListener {
private Context mContext = null;
private Context mContext = null;
private ArrayList<HashMap<String, String>> mPrinterList = null;
private SimpleAdapter mPrinterListAdapter = null;
private FilterOption mFilterOption = 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);
mContext = this;
Button button = findViewById(R.id.btnRestart);
mPrinterList = new ArrayList<>();
button.setOnClickListener(this);
mPrinterList = new ArrayList<>();
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);
ListView list = findViewById(R.id.lstReceiveData);
list.setAdapter(mPrinterListAdapter);
list.setOnItemClickListener(this);
mFilterOption = new FilterOption();
mFilterOption.setDeviceType(Discovery.TYPE_PRINTER);
mFilterOption.setEpsonFilter(Discovery.FILTER_NAME);
......@@ -58,7 +53,6 @@ public class DiscoveryActivity extends Activity implements View.OnClickListener,
@Override
public void onDestroy() {
super.onDestroy();
while (true) {
try {
Discovery.stop();
......@@ -70,7 +64,6 @@ public class DiscoveryActivity extends Activity implements View.OnClickListener,
}
}
}
mFilterOption = null;
}
......@@ -81,11 +74,9 @@ public class DiscoveryActivity extends Activity implements View.OnClickListener,
restartDiscovery();
break;
default:
// Do nothing
break;
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent();
......
......@@ -18,7 +18,6 @@ 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;
......@@ -39,13 +38,13 @@ import static w.soulofpluto.posstock.Constants.JSON;
public class Login extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener{
private EditText userId, password;
private Spinner storeId;
private Button submit;
private Spinner storeId;
private Button submit;
private ArrayList<Store> stores;
private String Response;
private int Store_Id;
private String Response;
private int Store_Id;
private PreferenceManager preferenceManager;
private String Store_Name;
private String Store_Name;
public static void logout(Context context){
Activity activity = (Activity) context;
......@@ -180,12 +179,12 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
}catch(JSONException je){
je.printStackTrace();
}
RequestBody body = RequestBody.create(JSON, object.toString());
RequestBody body = RequestBody.create(JSON, object.toString());
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(240, TimeUnit.SECONDS);
client.setReadTimeout(240, TimeUnit.SECONDS);
client.setReadTimeout(240, TimeUnit.SECONDS);
client.setWriteTimeout(240, TimeUnit.SECONDS);
Request request = new Request.Builder()
Request request = new Request.Builder()
.url(Constants.Login)
.post(body)
.addHeader(Constants.Type, Constants.App_json)
......@@ -243,6 +242,7 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
}
});
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id){
switch (parent.getId()){
......@@ -253,9 +253,11 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
@Override
public void onBackPressed() {
super.onBackPressed();
......
......@@ -44,18 +44,17 @@ public class MainActivity extends AppCompatActivity {
setSupportActionBar(main_toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
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));
}
super.onStart();
if(Constants.isNetworkAvailable(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){
......@@ -103,23 +102,23 @@ public class MainActivity extends AppCompatActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.menu,menu);
return super.onCreateOptionsMenu(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));
}
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);
......@@ -130,15 +129,15 @@ public class MainActivity extends AppCompatActivity {
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());
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);
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();
......@@ -148,12 +147,12 @@ public class MainActivity extends AppCompatActivity {
client.setConnectTimeout(250, TimeUnit.SECONDS);
client.setReadTimeout(250, TimeUnit.SECONDS);
client.setWriteTimeout(250, TimeUnit.SECONDS);
Request request = new Request.Builder()
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(){
@Override
......
......@@ -13,71 +13,70 @@ import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
/*
Create by Ramesh Babu
Create by Ramesh Babu
*/
public class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.ViewHolder> {
public class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.ViewHolder> {
ArrayList<String> arrayList;
Context context;
public MenuAdapter(Context context,ArrayList<String> arrayList) {
this.context = context;
this.arrayList = arrayList;
public MenuAdapter(Context context, ArrayList<String> arrayList){
this.context = context;
this.arrayList = arrayList;
}
@NonNull
@Override
public MenuAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem = layoutInflater.inflate(R.layout.menulist_item, parent, false);
MenuAdapter.ViewHolder viewHolder = new MenuAdapter.ViewHolder(listItem);
return viewHolder;
public MenuAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem = layoutInflater.inflate(R.layout.menulist_item, parent, false);
MenuAdapter.ViewHolder viewHolder = new MenuAdapter.ViewHolder(listItem);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull MenuAdapter.ViewHolder holder, final int position) {
final String data = arrayList.get(position);
holder.menu_name.setText(data);
if(data.equalsIgnoreCase("Create Delivery Slip")){
public void onBindViewHolder(@NonNull MenuAdapter.ViewHolder holder, final int position){
final String data = arrayList.get(position);
holder.menu_name.setText(data);
if (data.equalsIgnoreCase("Create Delivery Slip")) {
holder.menu_image.setImageResource(R.drawable.ic_create_delivery_slip);
}else if(data.equalsIgnoreCase("Stock Audit")){
} else if (data.equalsIgnoreCase("Stock Audit")) {
holder.menu_image.setImageResource(R.drawable.ic_stock_audit);
}else if(data.equalsIgnoreCase("Create Sale Bill")){
} else if (data.equalsIgnoreCase("Create Sale Bill")) {
holder.menu_image.setImageResource(R.drawable.ic_create_sale_bill);
}else if(data.equalsIgnoreCase("Stock OutWord")){
} else if (data.equalsIgnoreCase("Stock OutWord")) {
holder.menu_image.setImageResource(R.drawable.ic_stock_out_word);
}else if(data.equalsIgnoreCase("Stock Transfer")){
holder.menu_image.setImageResource(R.drawable.ic_stock_out_word);
}else{
} else if (data.equalsIgnoreCase("Stock Transfer")) {
holder.menu_image.setImageResource(R.drawable.ic_stock_out_word);
} else {
holder.menu_image.setImageResource(R.drawable.ic_stock_transfer);
}
//45724.48
holder.layout.setOnClickListener(view -> {
if (data.equalsIgnoreCase("Stock Audit")) {
/*Intent intent = new Intent(context,DashBoardActivity.class);
context.startActivity(intent);*/
return;
} else if(data.equalsIgnoreCase("Create Delivery Slip")) {
/*Intent intent = new Intent(context,CreateDeliverySlip.class);
context.startActivity(intent);*/
return;
} else if(data.equalsIgnoreCase("Create Sale Bill")) {
/*Intent intent = new Intent(context,CreateSaleBill.class);
context.startActivity(intent);*/
return;
} else if(data.equalsIgnoreCase("Stock OutWord")) {
Intent intent = new Intent(context, StockOutWordActivity.class);
context.startActivity(intent);
return;
} else if(data.equalsIgnoreCase("Stock Transfer")){
Intent intent = new Intent(context, StockOutWordActivity.class);
context.startActivity(intent);
return;
} else {
Intent intent = new Intent(context, StockTransferActivity.class);
context.startActivity(intent);
return;
}
}
holder.layout.setOnClickListener(view -> {
if (data.equalsIgnoreCase("Stock Audit")) {
/*Intent intent = new Intent(context,DashBoardActivity.class);
context.startActivity(intent);*/
return;
} else if (data.equalsIgnoreCase("Create Delivery Slip")) {
/* Intent intent = new Intent(context, CreateDeliverySlip.class);
context.startActivity(intent);*/
return;
} else if (data.equalsIgnoreCase("Create Sale Bill")) {
/*Intent intent = new Intent(context, CreateSaleBill.class);
context.startActivity(intent);*/
return;
} else if (data.equalsIgnoreCase("Stock OutWord")) {
Intent intent = new Intent(context, StockOutWordActivity.class);
context.startActivity(intent);
return;
} else if (data.equalsIgnoreCase("Stock Transfer")) {
Intent intent = new Intent(context, StockOutWordActivity.class);
context.startActivity(intent);
return;
} else {
Intent intent = new Intent(context, StockTransferActivity.class);
context.startActivity(intent);
return;
}
});
}
......@@ -87,14 +86,14 @@ import java.util.ArrayList;
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView menu_name;
public ImageView menu_image;
public TextView menu_name;
public ImageView menu_image;
public LinearLayout layout;
public ViewHolder(View itemView) {
super(itemView);
menu_name = itemView.findViewById(R.id.menu_name);
menu_image = itemView.findViewById(R.id.menu_image);
layout = itemView.findViewById(R.id.layout);
menu_name = itemView.findViewById(R.id.menu_name);
menu_image = itemView.findViewById(R.id.menu_image);
layout = itemView.findViewById(R.id.layout);
}
}
}
......@@ -4,7 +4,7 @@ package w.soulofpluto.posstock;
Create by Ramesh Babu
*/
public class Model {
public class Model {
private String delivery_slip_id;
private int manual_discount;
......@@ -12,16 +12,19 @@ public class Model {
this.delivery_slip_id = Id;
this.manual_discount = discount;
}
public String getDelivery_slip_id() {
return delivery_slip_id;
}
public void setDelivery_slip_id(String delivery_slip_id) {
this.delivery_slip_id = delivery_slip_id;
}
public int getManual_discount() {
return manual_discount;
}
public void setManual_discount(int manual_discount) {
this.manual_discount = manual_discount;
}
}
}
......@@ -119,20 +119,20 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
}
public void PiecesClicked(View view){
boolean checked = ((RadioButton) view).isChecked();
switch(view.getId()){
case R.id.pieces:
if(checked){
status = true;
qty.setVisibility(View.INVISIBLE);
dummy_qty.setVisibility(View.INVISIBLE);
barcode.setText("");
}else{
status = false;
qty.setVisibility(View.VISIBLE);
dummy_qty.setVisibility(View.VISIBLE);
}
break;
boolean checked = ((RadioButton) view).isChecked();
switch(view.getId()){
case R.id.pieces:
if(checked){
status = true;
qty.setVisibility(View.INVISIBLE);
dummy_qty.setVisibility(View.INVISIBLE);
barcode.setText("");
}else{
status = false;
qty.setVisibility(View.VISIBLE);
dummy_qty.setVisibility(View.VISIBLE);
}
break;
}
}
......@@ -141,14 +141,14 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
switch (view.getId()){
case R.id.meters:
if(checked){
status = false;
qty.setVisibility(View.VISIBLE);
dummy_qty.setVisibility(View.VISIBLE);
barcode.setText("");
status = false;
qty.setVisibility(View.VISIBLE);
dummy_qty.setVisibility(View.VISIBLE);
barcode.setText("");
}else{
status = true;
qty.setVisibility(View.INVISIBLE);
dummy_qty.setVisibility(View.INVISIBLE);
status = true;
qty.setVisibility(View.INVISIBLE);
dummy_qty.setVisibility(View.INVISIBLE);
}
break;
}
......@@ -643,11 +643,11 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
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.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);
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();
......
......@@ -15,7 +15,6 @@ import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
......@@ -35,9 +34,10 @@ import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.JSON;
import static w.soulofpluto.posstock.Constants.getDateWithOffset;
/*
Create by Ramesh Babu
*/
/*
Create by Ramesh Babu
*/
public class SearchByBarcode extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
Toolbar searchbybarcode_toolbar;
Spinner searchbybarcode_spinner;
......@@ -87,7 +87,7 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
}
}catch(JSONException e){
e.printStackTrace();
e.printStackTrace();
}
Log.e("Search", object.toString());
RequestBody body = RequestBody.create(JSON, object.toString());
......
......@@ -27,7 +27,10 @@ public class SplashActivity extends AppCompatActivity{
FirebaseApp.initializeApp(this);
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
if(bluetoothAdapter!=null && bluetoothAdapter.isEnabled()){
runOnUiThread(() -> splashMethod());
/* if(bluetoothAdapter!=null && bluetoothAdapter.isEnabled()){
runOnUiThread(() -> splashMethod());
}else{
try{
......@@ -35,7 +38,7 @@ public class SplashActivity extends AppCompatActivity{
}catch(Exception e){
e.printStackTrace();
}
}
}*/
super.onCreate(savedInstanceState);
}
......
......@@ -19,7 +19,8 @@ import static w.soulofpluto.posstock.StockReceived.startData;
public class StockTransferActivity extends AppCompatActivity {
EditText tfs_number;
Toolbar StockTransfer_toolbar;
Toolbar StockTransfer_toolbar;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_stock_transfer);
......@@ -63,6 +64,8 @@ public class StockTransferActivity extends AppCompatActivity {
if (Constants.isNetworkAvailable(StockTransferActivity.this)) {
startData(StockTransferActivity.this,val.toString().replace("\n",""));
tfs_number.setText("");
//tfs_number.requestFocus();
//return;
}
}
} else {
......
......@@ -67,8 +67,8 @@
<string name="apply_promotion">apply_promotion_on_scan</string>
<string name="qty_name">quantity</string>
<string name="items">delivery_slip_items</string>
<string name="stock_transfer">Stock Transfer</string>
<string name="stock_out">Stock Out</string>
<string name="stock_transfer">Stock Recieved</string>
<string name="stock_out">Stock Transfer</string>
<string name="stock_received">Stock Received</string>
<string name="create_title">Create Delivery Slip</string>
<string name="resolve_promotions">Resolve Promotions</string>
......
......@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath "com.android.tools.build:gradle:7.2.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
......
#Wed Jan 27 12:34:28 IST 2021
#Tue Oct 03 13:32:00 IST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
......@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
......@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
......@@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
......
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