Commit 40384fd7 by User

initial commit

parents
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<component name="ProjectDictionaryState">
<dictionary name="SOP001">
<words>
<w>setupdate</w>
</words>
</dictionary>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="JDK" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="IfStatementWithIdenticalBranches" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="myHighlightWhenLastStatementIsCall" value="false" />
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?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
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "w.soulofpluto.posstock"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.1.0-alpha09'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package w.soulofpluto.posstock;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("w.soulofpluto.posstock", appContext.getPackageName());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="w.soulofpluto.posstock">
<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" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_back"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_back_round"
android:supportsRtl="true"
android:requestLegacyExternalStorage="true"
android:theme="@style/AppTheme.NoActionBar"
android:networkSecurityConfig="@xml/network_security_config">
<activity
android:name=".SplashActivity"
android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Login"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".DashBoardActivity"
android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".PlanDetails"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize"
android:windowSoftInputMode="adjustNothing">
</activity>
<activity
android:name=".RackWiseQty"
android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|screenSize">
</activity>
<activity
android:name=".SearchByBarcode"
android:windowSoftInputMode="adjustNothing"
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 org.json.JSONObject;
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.ProgressDialog;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import android.view.Gravity;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Toast;
import com.squareup.okhttp.MediaType;
import org.json.JSONArray;
import org.json.JSONException;
import java.io.IOException;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.StringTokenizer;
/*
Create by Ramesh Babu
*/
public class Constants{
//public static String BASE_URL = "http://182.18.167.139/";
public static String BASE_URL = "http://posapi.plutokm.com/";
//public static String BASE_URL = "https://7fad42.emporter.eu/";
public static String Logout = Constants.BASE_URL + "/login/doLogout/";
public static String Login = Constants.BASE_URL + "/login/doLogin";
public static String StoreId = Constants.BASE_URL + "login/getStoresMappedToUser/";
public static String Dashboard = Constants.BASE_URL + "/stockaudit/listOfStockAuditsOfLoginStore";
public static String BarcodeUpload = Constants.BASE_URL + "/stockaudit/validateStockAuditBarcode";
public static String BarcodeDelete = Constants.BASE_URL + "/stockaudit/deleteBarcodeAndQuantityFromStockAudit";
public static String BarcodeComplete = Constants.BASE_URL + "/stockaudit/batchScanningCompleted";
public static String RackWiseQty = Constants.BASE_URL + "/stockaudit/stockAuditPlanBarcodesScannedInformation";
public static String BarcodeSearch = Constants.BASE_URL + "/stockaudit/stockAuditBarcodeRackInformation";
public static String Type = "Content-Type";
public static String App_json = "application/json";
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>";
public static String Id = "<font color=#3700B3><b>RACK ID : </b></font>";
public static String Qty = "<font color=#3700B3><b>QTY : </b></font>";
public static String User = "<font color=#3700B3><b>UserId : </b></font>";
public static String From = "<font color=#3700B3><b>Start time : </b></font>";
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 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 ProgressDialog progressDialog;
public static void getToast(Context context, String data){
Toast toast = Toast.makeText(context, data, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
public static String getVal(int count){
return "<font color=#3700B3><b>TOTAL SCANNED ITEMS : </b></font>"+"<font color=#3700B3><b>"+count+"</b></font>";
}
public static boolean isNetworkAvailable(Context context){
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null;
}
public static void ProgressDialogShow(Context context){
progressDialog = new ProgressDialog(context);
progressDialog.setMessage("Loading Please wait ...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.show();
}
public static void ProgressDialogDismiss(){
if(progressDialog != null){
progressDialog.dismiss();
}
}
public static String getSHA256(String data){
StringBuffer sb = new StringBuffer();
try{
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(data.getBytes());
byte byteData[] = md.digest();
for(int i = 0; i < byteData.length; i++){
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
}catch (Exception e) {
e.printStackTrace();
}
return sb.toString();
}
public static String convertString(String data){
StringBuilder stringBuilder = new StringBuilder();
try{
JSONArray jsonArray = new JSONArray(data);
for(int i = 0; i < jsonArray.length(); i++){
stringBuilder.append(jsonArray.get(i) + ",");
}
}catch(JSONException e){
e.printStackTrace();
}
return stringBuilder.toString().substring(0, stringBuilder.toString().length() - 1);
}
public static Boolean Existing(ArrayList<Plans> plans, String barcode){
for(Plans plan : plans){
if(plan.getBarcode().contains(barcode)){
return true;
}
}
return false;
}
public static Date getDateWithOffset(int offset, Date date){
Calendar 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);
}
}
package w.soulofpluto.posstock;
/*
Create by Ramesh Babu
*/
import android.app.Dialog;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
private Context context;
private ArrayList<Plans> arrayList;
public CustomAdapter(Context context, ArrayList<Plans> storesArrayList){
this.context = context;
this.arrayList = storesArrayList;
}
@NonNull
@Override
public CustomAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem = layoutInflater.inflate(R.layout.planslist_item, parent, false);
CustomAdapter.ViewHolder viewHolder = new CustomAdapter.ViewHolder(listItem);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull CustomAdapter.ViewHolder holder, final int position){
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 View.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 View.OnClickListener(){
@Override
public void onClick(View view){
dialog.dismiss();
}
});
}
});
holder.start_scan.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
PlanDetails.start(context,items);
}
});
}
@Override
public int getItemCount(){
return arrayList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
public TextView plan_id,plan_name;
Button start_scan,view_section;
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);
}
}
}
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 android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
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;
import com.squareup.okhttp.Response;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/*
Create by Ramesh Babu
*/
public class DashBoardActivity extends AppCompatActivity implements View.OnClickListener {
Toolbar dashboad_toolbar;
Button stock_audit,rack_qty,searchby_barcode;
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);
dashboad_toolbar = findViewById(R.id.dashboard_toolbar);
version = findViewById(R.id.version);
preferenceManager= new PreferenceManager(this);
setSupportActionBar(dashboad_toolbar);
getSupportActionBar().setTitle(getResources().getString(R.string.dashboard));
stock_audit.setOnClickListener(this);
rack_qty.setOnClickListener(this);
searchby_barcode.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 android.R.id.home:
finish();
break;*/
case R.id.dashboard_logout:
if(Constants.isNetworkAvailable(DashBoardActivity.this)){
Logout(Constants.Logout+preferenceManager.getUserId());
Constants.ProgressDialogShow(DashBoardActivity.this);
}else{
Constants.getToast(DashBoardActivity.this,getResources().getString(R.string.connection));
}
break;
}
return super.onOptionsItemSelected(item);
}
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{
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,preferenceManager.getStoreId());
}else{
Constants.getToast(DashBoardActivity.this,jsonObject.getString("msg"));
}
}
} catch (JSONException e) {
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
}
}
});
}
@Override
public void onClick(View view){
switch (view.getId()){
case R.id.stock_audit:
Intent in_main = new Intent(this,MainActivity.class);
startActivity(in_main);
break;
case R.id.rack_qty:
Intent in_rack = new Intent(this,RackWiseQty.class);
startActivity(in_rack);
break;
case R.id.searchby_barcode:
Intent in_search = new Intent(this, SearchByBarcode.class);
startActivity(in_search);
break;
}
}
@Override
public void onBackPressed(){
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")
//.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) {
}
})
.show();
}
}
}
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.Activity;
import android.content.Context;
import android.content.Intent;
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;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
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;
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.net.UnknownHostException;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.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, String id){
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);
context.startActivity(in_logout);
activity.finish();
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
userId = findViewById(R.id.userId);
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));
}
}
}
});
}
private void StoreId(String Id){
final OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(Constants.StoreId + Id)
.get()
.addHeader(Constants.Type, Constants.App_json)
.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(Login.this, e.getMessage(), Toast.LENGTH_SHORT).show();
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("Store Response ", Response);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable(){
@Override
public void run(){
try{
JSONObject object = new JSONObject(Response);
if(response.code() == 200){
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);
}
}
}else{
Toast.makeText(Login.this, getResources().getString(R.string.no_stores), Toast.LENGTH_SHORT).show();
storeId.setAdapter(null);
}
}
}
}catch(JSONException e){
e.printStackTrace();
}
}
});
}catch (NullPointerException io) {
io.printStackTrace();
} finally {
response.body().close();
}
}
});
}
@Override
public void onClick(View v){
switch (v.getId()){
case R.id.submit:
if(TextUtils.isEmpty(userId.getText().toString()) && TextUtils.isEmpty(password.getText().toString())){
Toast.makeText(Login.this, getResources().getString(R.string.val_empandpass), Toast.LENGTH_SHORT).show();
}else if(TextUtils.isEmpty(userId.getText().toString())){
Toast.makeText(Login.this, getResources().getString(R.string.val_empid), Toast.LENGTH_SHORT).show();
}else if(TextUtils.isEmpty(password.getText().toString())){
Toast.makeText(Login.this, getResources().getString(R.string.val_pass), Toast.LENGTH_SHORT).show();
}else{
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));
}
}
break;
}
}
private void doLogin(String userId, final String pass){
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), Constants.getSHA256(pass));
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();
}
RequestBody body = RequestBody.create(JSON, object.toString());
final OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(240, TimeUnit.SECONDS);
client.setReadTimeout(240, TimeUnit.SECONDS);
client.setWriteTimeout(240, TimeUnit.SECONDS);
Request request = new Request.Builder()
.url(Constants.Login)
.post(body)
.addHeader(Constants.Type, Constants.App_json)
.build();
client.newCall(request).enqueue(new Callback(){
@Override
public void onFailure(Request request, IOException e){
if(e.getCause() != null && e.getCause() instanceof UnknownHostException){
}else{
Log.e("error ====>", e.getMessage());
}
Constants.ProgressDialogDismiss();
}
@Override
public void onResponse(final Response response) throws IOException{
Constants.ProgressDialogDismiss();
Response = response.body().string();
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, DashBoardActivity.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(NullPointerException io){
io.printStackTrace();
}finally{
response.body().close();
}
}
});
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id){
switch (parent.getId()){
case R.id.storeId:
Store store = stores.get(position);
Store_Id = store.StoreId;
Store_Name = store.StoreName;
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
}
package w.soulofpluto.posstock;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
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;
public class MainActivity extends AppCompatActivity {
Toolbar main_toolbar;
RecyclerView plans_list;
PreferenceManager preferenceManager;
ArrayList<Plans> plansArrayList;
@Override
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);
plansArrayList = new ArrayList<>();
preferenceManager = new PreferenceManager(this);
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();
}
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);
final Request request = new Request.Builder()
.url(Url)
.get()
.addHeader(Constants.Type, Constants.App_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{
Constants.ProgressDialogDismiss();
if(response.isSuccessful()){
String res = response.body().string();
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,preferenceManager.getStoreId());
}else{
Constants.getToast(MainActivity.this,jsonObject.getString(getResources().getString(R.string.msg)));
}
}
}catch(JSONException e) {
e.printStackTrace();
}catch(NullPointerException np){
np.printStackTrace();
}
}
}
});
}
@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 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){
JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd");
Date todayDate = new Date();
Date from = getDateWithOffset(-7, 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);
}
}catch(JSONException e){
e.printStackTrace();
}
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(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())
.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(MainActivity.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("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();
}
}
});
}
}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();
}
}
});
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(MainActivity.this,preferenceManager.getStoreId());
}
}
}
}catch(JSONException e){
e.printStackTrace();
}
}
});
}catch(NullPointerException io){
io.printStackTrace();
}finally{
response.body().close();
}
}
});
}
}
\ No newline at end of file
package w.soulofpluto.posstock;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.MediaPlayer;
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.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
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.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import static w.soulofpluto.posstock.Constants.JSON;
/*
Create by Ramesh Babu
*/
public class PlanDetails extends AppCompatActivity implements View.OnClickListener {
Toolbar plandetails_toolbar;
EditText barcode, qty, rack_number;
RecyclerView barcode_recylerview;
Button ScanComplete;
TextView plandetails_id, plandetails_name, dummy_qty, count;
ArrayList<Plans> arrayList;
RadioButton pieces, meters;
RadioGroup radioGroup;
LinearLayout pieces_layout;
Plans plans;
PreferenceManager preferenceManager;
Boolean status = true;
PlanDetailsAdapter planDetailsAdapter;
private String Response;
Dialog dialog;
public static void start(Context context, Plans plans){
Intent in = new Intent(context, PlanDetails.class);
in.putExtra("key", plans);
context.startActivity(in);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState){
setContentView(R.layout.activity_plandetials);
super.onCreate(savedInstanceState);
setupdate();
}
private void setupdate(){
plandetails_toolbar = findViewById(R.id.plandetails_toolbar);
barcode = findViewById(R.id.barcode);
qty = findViewById(R.id.qty);
dummy_qty = findViewById(R.id.dummy_qty);
rack_number = findViewById(R.id.rack_number);
count = findViewById(R.id.count);
barcode_recylerview = findViewById(R.id.barcode_recylerview);
ScanComplete = findViewById(R.id.ScanComplete);
plandetails_id = findViewById(R.id.plandetails_id);
plandetails_name = findViewById(R.id.plandetails_name);
pieces = findViewById(R.id.pieces);
meters = findViewById(R.id.meters);
radioGroup = findViewById(R.id.radio_group);
pieces_layout = findViewById(R.id.pieces_layout);
arrayList = new ArrayList<>();
preferenceManager = new PreferenceManager(this);
setSupportActionBar(plandetails_toolbar);
getSupportActionBar().setTitle(getResources().getString(R.string.plan_details));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
plans = getIntent().getParcelableExtra(getResources().getString(R.string.key));
barcode.requestFocus();
plandetails_id.setText(Html.fromHtml(Constants.Plan_Id + plans.getPlanId()));
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());
pieces.setChecked(true);
barcode.setOnFocusChangeListener(new View.OnFocusChangeListener(){
@Override
public void onFocusChange(View view, boolean hasFocus){
if(!hasFocus){
}else{
Constants.hideSoftKeyboard(barcode,PlanDetails.this);
}
}
});
}
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;
}
}
public void MetersClicked(View view){
boolean checked = ((RadioButton) view).isChecked();
switch (view.getId()){
case R.id.meters:
if(checked){
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);
}
break;
}
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
}
return super.onOptionsItemSelected(item);
}
public class AutoChecked 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(Constants.isNetworkAvailable(PlanDetails.this)){
if(val.toString().contains("\n")){
if(status){
if(Constants.isNetworkAvailable(PlanDetails.this)){
if(arrayList.size() > 0){
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;
}
}
UploadBarcode(barcode.getText().toString().replace("\n", ""), "1", plans.getPlanId());
Constants.ProgressDialogShow(PlanDetails.this);
barcode.setText("");
}else{
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");
}
});
}else{
float value = Float.parseFloat(qty.getText().toString());
if(value > 0){
if(Constants.isNetworkAvailable(PlanDetails.this)){
//barcode.setFocusable(false);
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("");
}
});
}
});
return;
}
}
UploadBarcode(barcode.getText().toString().replace("\n", ""), qty.getText().toString(), plans.getPlanId());
Constants.ProgressDialogShow(PlanDetails.this);
barcode.setText("");
}else{
Constants.getToast(PlanDetails.this, getResources().getString(R.string.connection));
}
}
}
}
}
}else{
Constants.getToast(PlanDetails.this, getResources().getString(R.string.connection));
}
}catch(NullPointerException np){
np.printStackTrace();
}
}
@Override
public void afterTextChanged(Editable editable) {
}
}
@Override
public void onClick(View view){
switch(view.getId()){
case R.id.ScanComplete:
if(Constants.isNetworkAvailable(PlanDetails.this)){
if(arrayList.size() > 0 ){
if(Constants.isNetworkAvailable(PlanDetails.this)){
if(rack_number.getText().toString().length()>0){
Constants.ProgressDialogShow(PlanDetails.this);
UploadAllBarcodes(Constants.BarcodeComplete,rack_number.getText().toString());
}else{
Constants.getToast(PlanDetails.this,"Enter Rack Id");
}
}else{
Constants.getToast(PlanDetails.this,getResources().getString(R.string.connection));
}
}else{
Constants.getToast(PlanDetails.this, "No Scan items ");
}
}else{
Constants.getToast(PlanDetails.this, getResources().getString(R.string.connection));
}
break;
}
}
public void UploadAllBarcodes(String barcodeall,String rack){
JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
object.put(getResources().getString(R.string.rack_no),rack);
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
}
}catch(JSONException e){
e.printStackTrace();
}
Log.e("Upload All", 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(barcodeall)
.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(new Runnable() {
@Override
public void run(){
Toast.makeText(PlanDetails.this, e.getMessage(), Toast.LENGTH_SHORT).show();
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("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();
}
}
});
}
}
}catch(JSONException e){
e.printStackTrace();
}
}
});
}catch(NullPointerException io){
io.printStackTrace();
}finally{
response.body().close();
}
}
});
}
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);
object.put(getResources().getString(R.string.quantity_upload),qty);
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
}
} catch (JSONException e) {
e.printStackTrace();
}
Log.e("Upload Barcode", 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.BarcodeUpload)
.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(new Runnable() {
@Override
public void run() {
Constants.getToast(PlanDetails.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("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){
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("");
}
});
}
});
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
} catch (NullPointerException io) {
io.printStackTrace();
} finally {
response.body().close();
}
}
});
}
public void DeleteBarcode(final Plans plans, final int position){
Constants.ProgressDialogShow(PlanDetails.this);
final JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
object.put(getResources().getString(R.string.barcode_upload), plans.getBarcode());
object.put(getResources().getString(R.string.rule_id), plans.getPlanId());
object.put(getResources().getString(R.string.quantity_upload), plans.getQty());
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
}
}catch(JSONException e){
e.printStackTrace();
}
Log.e("delele Barcode ", 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.BarcodeDelete)
.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(new Runnable() {
@Override
public void run() {
Constants.ProgressDialogDismiss();
Constants.getToast(PlanDetails.this, e.getMessage());
}
});
}
@Override
public void onResponse(Response response) throws IOException {
if (response.isSuccessful()) {
Constants.ProgressDialogDismiss();
String res = response.body().string();
Log.e("delete Barcode Response", res);
try {
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);
}
});
} 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{
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(PlanDetails.this, jsonObject.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
}
});
}
}
} catch (JSONException e) {
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
}
}
});
}
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 ");
}
}
});
}
private void Dologin(){
dialog = new Dialog(PlanDetails.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_session);
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
dialog.show();
final TextView userid = dialog.findViewById(R.id.relogin_userid);
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,"Please Enter Password");
}else{
doLogin(preferenceManager.getUserId(), Constants.getSHA256(pass.getText().toString()));
Constants.ProgressDialogShow(PlanDetails.this);
}
}else{
Constants.getToast(PlanDetails.this,getResources().getString(R.string.connection));
}
}
});
}
private void doLogin(String userId, String pass){
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.android_version),Constants.VERSION);
}
}catch(JSONException e){
e.printStackTrace();
}
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);
Request request = new Request.Builder()
.url(Constants.Login)
.post(body)
.addHeader(Constants.Type, Constants.App_json)
.build();
client.newCall(request).enqueue(new Callback(){
@Override
public void onFailure(Request request, IOException e){
if(e.getCause() != null && e.getCause() instanceof UnknownHostException){
}else{
Log.e("error ====>" , e.getMessage());
}
Constants.ProgressDialogDismiss();
}
@Override
public void onResponse(final Response response) throws IOException{
Constants.ProgressDialogDismiss();
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();
}
}
}catch(JSONException e){
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
}else{
}
}
});
}catch(NullPointerException io){
io.printStackTrace();
}finally{
response.body().close();
}
}
});
}
@Override
public void onBackPressed(){
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){
}
})
.show();
}
}
}
package w.soulofpluto.posstock;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
/*
Create by Ramesh Babu
*/
public class PlanDetailsAdapter extends RecyclerView.Adapter<PlanDetailsAdapter.ViewHolder> {
private Context context;
private ArrayList<Plans> arrayList;
public PlanDetailsAdapter(Context context, ArrayList<Plans> storesArrayList){
this.context = context;
this.arrayList = storesArrayList;
}
@NonNull
@Override
public PlanDetailsAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem = layoutInflater.inflate(R.layout.plansdetails_item, parent, false);
PlanDetailsAdapter.ViewHolder viewHolder = new PlanDetailsAdapter.ViewHolder(listItem);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull PlanDetailsAdapter.ViewHolder holder, final int 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();
}
}
});
}
@Override
public int getItemCount(){
return arrayList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
public TextView plandetails_barcode,plandetails_qty;
ImageView plandetails_delete;
public ViewHolder(View itemView){
super(itemView);
plandetails_barcode = itemView.findViewById(R.id.plandetails_barcode);
plandetails_qty = itemView.findViewById(R.id.plandetails_qty);
plandetails_delete = itemView.findViewById(R.id.plandetails_delete);
}
}
}
package w.soulofpluto.posstock;
import android.os.Parcel;
import android.os.Parcelable;
/*
Create by Ramesh Babu
*/
public class Plans implements Parcelable {
String PlanId;
String Name;
String Section;
String division;
String Barcode;
String Qty;
protected Plans(Parcel in) {
PlanId = in.readString();
Name = in.readString();
Section = in.readString();
division = in.readString();
Barcode = in.readString();
Qty = in.readString();
}
public static final Creator<Plans> CREATOR = new Creator<Plans>() {
@Override
public Plans createFromParcel(Parcel in) {
return new Plans(in);
}
@Override
public Plans[] newArray(int size) {
return new Plans[size];
}
};
public Plans() {
}
public String getPlanId() {
return PlanId;
}
public void setPlanId(String planId) {
PlanId = planId;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getSection() {
return Section;
}
public void setSection(String section) {
Section = section;
}
public String getDivision() {
return division;
}
public void setDivision(String division) {
this.division = division;
}
public String getBarcode() {
return Barcode;
}
public void setBarcode(String barcode) {
Barcode = barcode;
}
public String getQty() {
return Qty;
}
public void setQty(String qty) {
Qty = qty;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(PlanId);
parcel.writeString(Name);
parcel.writeString(Section);
parcel.writeString(division);
parcel.writeString(Barcode);
parcel.writeString(Qty);
}
public String toString() {
return Name;
}
}
package w.soulofpluto.posstock;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
/*
Create by Ramesh Babu
*/
public class PreferenceManager {
public static final String KEY_USER_ID = "user_id";
public static final String KEY_PASSWORD = "password";
public static final String KEY_EMAIL = "email";
public static final String CUST_TOKEN = "CUSTOMER_TOKEN";
public static final String STORE_ID = "store_id";
public static final String FIRST_NAME = "first_name";
public static final String LAST_NAME = "last_name";
public static final String MODULE = "Module";
public static final String PREFIX = "ds_prefix";
public static final String KEY_LOGGED = "is_logged";
public static final String ID = "ID";
public static final String BLUETOOTH = "bluetooth";
public static final String STORENAME = "storeName";
public static final String APP_SHARED_PREFS = PreferenceManager.class.getSimpleName();
public static SharedPreferences _sharedPrefs;
public static SharedPreferences.Editor _prefsEditor;
@SuppressWarnings("static-access")
public PreferenceManager(Context context){
_sharedPrefs = context.getSharedPreferences(APP_SHARED_PREFS, Activity.MODE_PRIVATE);
_prefsEditor = _sharedPrefs.edit();
}
public static PreferenceManager getInstance(){
return (PreferenceManager) _sharedPrefs;
}
public void delete(){
_prefsEditor.remove(KEY_USER_ID);
_prefsEditor.apply();
}
public void setFirstName(String firstName){
_prefsEditor.putString(FIRST_NAME,firstName);
_prefsEditor.apply();
}
public String getFirstName(){
return _sharedPrefs.getString(FIRST_NAME,"");
}
public void setModule(String Mod){
_prefsEditor.putString(MODULE,Mod);
_prefsEditor.apply();
}
public String getModule(){
return _sharedPrefs.getString(MODULE,"");
} public void setBLUETOOTH(String Mod){
_prefsEditor.putString(BLUETOOTH,Mod);
_prefsEditor.apply();
}
public String getBLUETOOTH(){
return _sharedPrefs.getString(BLUETOOTH,"");
}
public void setLastName(String lastName){
_prefsEditor.putString(LAST_NAME,lastName);
_prefsEditor.apply();
}
public String getLastName(){
return _sharedPrefs.getString(LAST_NAME,"");
}
public void setStoreId(String quoteId){
_prefsEditor.putString(STORE_ID,quoteId);
_prefsEditor.apply();
}
public String getStoreId(){
return _sharedPrefs.getString(STORE_ID,"");
}
public void setPrefix(String prefix){
_prefsEditor.putString(PREFIX,prefix);
_prefsEditor.apply();
}
public String getPrefix(){
return _sharedPrefs.getString(PREFIX,"");
}
public void setCustToken(String token){
_prefsEditor.putString(CUST_TOKEN,token);
_prefsEditor.apply();
}
public String getCustToken(){
return _sharedPrefs.getString(CUST_TOKEN,"");
}
public void setID(String id){
_prefsEditor.putString(ID, id);
_prefsEditor.apply();
}
public String getID(){
return _sharedPrefs.getString(ID, "");
}
public void setEmail(String email){
_prefsEditor.putString(KEY_EMAIL, email);
_prefsEditor.apply();
}
public String getEmail(){
return _sharedPrefs.getString(KEY_EMAIL, "");
}
public void setPassword(String pass){
_prefsEditor.putString(KEY_PASSWORD, pass);
_prefsEditor.apply();
}
public String getPassword(){
return _sharedPrefs.getString(KEY_PASSWORD, "");
}
public void setStoreName(String storename){
_prefsEditor.putString(STORENAME, storename);
_prefsEditor.apply();
}
public String getStoreName(){
return _sharedPrefs.getString(STORENAME, "");
}
public void setUserId(String userId){
_prefsEditor.putString(KEY_USER_ID, userId);
_prefsEditor.apply();
}
public String getUserId(){
return _sharedPrefs.getString(KEY_USER_ID, "");
}
public void setLogged(boolean key){
_prefsEditor.putBoolean(KEY_LOGGED, key);
_prefsEditor.apply();
}
public boolean isLogged(){
return _sharedPrefs.getBoolean(KEY_LOGGED, false);
}
}
package w.soulofpluto.posstock;
/*
Create by Ramesh Babu
*/
public class RackWise {
String id;
int Qty;
String scanned_by;
String scanning_start_at;
String scanning_end_at;
public String getScanned_by() {
return scanned_by;
}
public void setScanned_by(String scanned_by) {
this.scanned_by = scanned_by;
}
public String getScanning_start_at() {
return scanning_start_at;
}
public void setScanning_start_at(String scanning_start_at) {
this.scanning_start_at = scanning_start_at;
}
public String getScanning_end_at() {
return scanning_end_at;
}
public void setScanning_end_at(String scanning_end_at) {
this.scanning_end_at = scanning_end_at;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getQty() {
return Qty;
}
public void setQty(int qty) {
Qty = qty;
}
}
package w.soulofpluto.posstock;
import android.content.Context;
import android.text.Html;
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.ArrayList;
/*
Create by Ramesh Babu
*/
public class RackWiseAdapter extends RecyclerView.Adapter<RackWiseAdapter.ViewHolder>{
private Context context;
private ArrayList<RackWise> arrayList;
public RackWiseAdapter(Context context, ArrayList<RackWise> storesArrayList){
this.context = context;
this.arrayList = storesArrayList;
}
@NonNull
@Override
public RackWiseAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem = layoutInflater.inflate(R.layout.rackwise_item, parent, false);
RackWiseAdapter.ViewHolder viewHolder = new RackWiseAdapter.ViewHolder(listItem);
return viewHolder;
}
@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("");
}else{
holder.rack_id.setText(Html.fromHtml(Constants.Id + items.getId()));
}
holder.rack_userid.setText(Html.fromHtml(Constants.User+items.getScanned_by()));
holder.rack_from.setText(Html.fromHtml(Constants.From+items.getScanning_start_at()));
holder.rack_to.setText(Html.fromHtml(Constants.To+items.getScanning_end_at()));
holder.rack_qty.setText(String.valueOf(items.getQty()));
}
@Override
public int getItemCount(){
return arrayList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
public TextView rack_id,rack_qty,rack_userid,rack_from,rack_to;
public ViewHolder(View itemView){
super(itemView);
rack_id = itemView.findViewById(R.id.rack_id);
rack_qty = itemView.findViewById(R.id.rack_qty);
rack_userid = itemView.findViewById(R.id.rack_userid);
rack_from = itemView.findViewById(R.id.rack_from);
rack_to = itemView.findViewById(R.id.rack_to);
}
}
}
package w.soulofpluto.posstock;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Html;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
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.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 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;
/*
Create by Ramesh Babu
*/
public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
PreferenceManager preferenceManager;
ArrayList<Plans> arrayList;
TextView total_scanned;
ArrayList<RackWise> rackWiseArrayList;
RecyclerView rack_recylerview;
Spinner rack_spinner;
Toolbar rackwise_toolbar;
String rackid;
RackWiseAdapter rackWiseAdapter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState){
setContentView(R.layout.activity_ractwiseqty);
preferenceManager = new PreferenceManager(this);
rack_recylerview = findViewById(R.id.rack_recylerview);
rack_spinner = findViewById(R.id.rack_spinner);
rackwise_toolbar = findViewById(R.id.rackwise_toolbar);
total_scanned = findViewById(R.id.total_scanned);
rackWiseArrayList = new ArrayList<>();
setSupportActionBar(rackwise_toolbar);
getSupportActionBar().setTitle("RackWise Qty");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if(Constants.isNetworkAvailable(this)){
FetchData(Constants.Dashboard);
Constants.ProgressDialogShow(RackWiseQty.this);
}else{
Constants.getToast(RackWiseQty.this,getResources().getString(R.string.connection));
}
rack_spinner.setOnItemSelectedListener(this);
super.onCreate(savedInstanceState);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item){
switch (item.getItemId()){
case android.R.id.home:
finish();
break;
}
return super.onOptionsItemSelected(item);
}
private void FetchData(String Url){
JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd");
Date todayDate = new Date();
Date from = getDateWithOffset(-7, 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);
}
}catch(JSONException e){
e.printStackTrace();
}
Log.e("Rackwise object ====>",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(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())
.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();
}
});
}
@Override
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);
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();
}
}
});
}
}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,preferenceManager.getStoreId());
}
}
}
}catch(JSONException e){
e.printStackTrace();
}
}
});
}catch(NullPointerException io){
io.printStackTrace();
}finally{
response.body().close();
}
}
});
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l){
switch (adapterView.getId()){
case R.id.rack_spinner:
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);
}
});
}else{
if(Constants.isNetworkAvailable(this)){
try {
getRackWiseData(rackid);
Constants.ProgressDialogShow(RackWiseQty.this);
}catch (NullPointerException np){
np.printStackTrace();
}catch (NumberFormatException npe){
npe.printStackTrace();
}
}else{
Constants.getToast(RackWiseQty.this,getResources().getString(R.string.connection));
}
}
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
private void getRackWiseData(String planid){
JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
object.put(getResources().getString(R.string.plan_id),planid);
}
}catch(JSONException e){
e.printStackTrace();
}catch (NullPointerException np){
np.printStackTrace();
}
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.RackWiseQty)
.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(new Runnable(){
@Override
public void run(){
Constants.getToast(RackWiseQty.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("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);
}
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();
}
}
});
}
}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,preferenceManager.getStoreId());
}
}
}
}catch(JSONException e){
e.printStackTrace();
}
}
});
}catch(NullPointerException io){
io.printStackTrace();
}finally{
response.body().close();
}
}
});
}
}
package w.soulofpluto.posstock;
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.TextWatcher;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
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;
import androidx.appcompat.widget.Toolbar;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
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;
/*
Create by Ramesh Babu
*/
public class SearchByBarcode extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
Toolbar searchbybarcode_toolbar;
Spinner searchbybarcode_spinner;
EditText searchby_barcode;
TextView searchbybarcode_rack;
ArrayList<Plans> arrayList;
PreferenceManager preferenceManager;
String planid;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_searchbybarcode);
searchbybarcode_toolbar = findViewById(R.id.searchbybarcode_toolbar);
searchbybarcode_spinner = findViewById(R.id.searchbybarcode_spinner);
searchbybarcode_rack = findViewById(R.id.searchbybarcode_rack);
searchby_barcode = findViewById(R.id.searchbybarcode_edit);
preferenceManager = new PreferenceManager(this);
setSupportActionBar(searchbybarcode_toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("Barcode Search");
if(Constants.isNetworkAvailable(this)){
FetchData(Constants.Dashboard);
Constants.ProgressDialogShow(SearchByBarcode.this);
}else{
Constants.getToast(SearchByBarcode.this,getResources().getString(R.string.connection));
}
searchbybarcode_spinner.setOnItemSelectedListener(this);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
searchby_barcode.setShowSoftInputOnFocus(false);
}
searchby_barcode.addTextChangedListener(new Checked());
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item){
switch (item.getItemId()){
case android.R.id.home:
finish();
break;
}
return super.onOptionsItemSelected(item);
}
public void getBarcodeCheck(String planId, final String Barcode){
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.barcode_upload), Barcode);
object.put(getResources().getString(R.string.android_version),Constants.VERSION);
}
}catch(JSONException e){
e.printStackTrace();
}
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.BarcodeSearch)
.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(new Runnable() {
@Override
public void run() {
Constants.getToast(SearchByBarcode.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(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) {
Log.e("Length",String.valueOf(getResources().getString(R.string.data).length()));
if(object.has(getResources().getString(R.string.data))){
if(object.getString(getResources().getString(R.string.msg)).equalsIgnoreCase("no data found")){
searchby_barcode.setText("");
searchbybarcode_rack.setText(object.getString(getResources().getString(R.string.msg)));
//Constants.getToast(SearchByBarcode.this, object.getString(getResources().getString(R.string.msg)));
}else{
searchby_barcode.setText("");
try{
JSONObject jsonObject = object.getJSONObject(getResources().getString(R.string.data));
searchbybarcode_rack.setText(Html.fromHtml(Constants.Id) + jsonObject.getString("rack_id") + "\n"
+ (Html.fromHtml(Constants.Barcode) + jsonObject.getString("barcode")) + "\n"
+ (Html.fromHtml(Constants.From) + jsonObject.getString("scanning_start_at")) + "\n"
+ (Html.fromHtml(Constants.To) + jsonObject.getString("scanning_end_at")));
}catch(JSONException e){
e.printStackTrace();
}
}
}
}else if(object.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(new Runnable(){
@Override
public void run(){
try{
Constants.getToast(SearchByBarcode.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
}
});
}else{
try{
Constants.getToast(SearchByBarcode.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}catch(NullPointerException io){
io.printStackTrace();
}finally{
response.body().close();
}
}
});
}
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(Constants.isNetworkAvailable(SearchByBarcode.this)){
if(val.toString().contains("\n")){
if(Constants.isNetworkAvailable(SearchByBarcode.this)){
if(planid.equalsIgnoreCase("0")){
Constants.getToast(SearchByBarcode.this,"Choose Plan Id");
searchby_barcode.setText("");
}else{
getBarcodeCheck(planid,searchby_barcode.getText().toString().replace("\n", ""));
}
}
}
}else{
Constants.getToast(SearchByBarcode.this, getResources().getString(R.string.connection));
}
}catch(NullPointerException np){
np.printStackTrace();
}
}
@Override
public void afterTextChanged(Editable editable){
}
}
private void FetchData(String Url){
JSONObject object = new JSONObject();
try{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
SimpleDateFormat currentDate = new SimpleDateFormat("yyyy-MM-dd");
Date todayDate = new Date();
Date from = getDateWithOffset(-7, 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);
}
}catch(JSONException e){
e.printStackTrace();
}
Log.e("Searchby object ====>",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(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())
.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(SearchByBarcode.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("SearchByBarcode" , 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>(SearchByBarcode.this, android.R.layout.simple_dropdown_item_1line, arrayList);
searchbybarcode_spinner.setAdapter(adapter);
}else if (object.has(getResources().getString(R.string.msg))){
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(SearchByBarcode.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e){
e.printStackTrace();
}
}
});
}
}else if(object.getInt(getResources().getString(R.string.success)) == 3){
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Constants.getToast(SearchByBarcode.this, object.getString(getResources().getString(R.string.msg)));
}catch(JSONException e) {
e.printStackTrace();
}
}
});
preferenceManager.setUserId("");
preferenceManager.setLogged(false);
preferenceManager.setCustToken("");
preferenceManager.setStoreId("");
Login.logout(SearchByBarcode.this,preferenceManager.getStoreId());
}
}
}
}catch(JSONException e){
e.printStackTrace();
}
}
});
}catch(NullPointerException io){
io.printStackTrace();
}finally{
response.body().close();
}
}
});
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l){
switch (adapterView.getId()){
case R.id.searchbybarcode_spinner:
Plans plan = arrayList.get(i);
planid = plan.PlanId;
Log.e("Search by barcode ===>",planid);
if(planid.equalsIgnoreCase("0")){
//Constants.getToast(RackWiseQty.this,"Please Choose PlanId");
searchbybarcode_rack.setText("");
}else{
searchbybarcode_rack.setText("");
}
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
}
package w.soulofpluto.posstock;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
/*
Create by Ramesh Babu
*/
public class SplashActivity extends AppCompatActivity{
PreferenceManager preferenceManager;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState){
setContentView(R.layout.activity_splash);
preferenceManager = new PreferenceManager(this);
runOnUiThread(new Runnable(){
@Override
public void run(){
splashMethod();
}
});
super.onCreate(savedInstanceState);
}
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, DashBoardActivity.class));
finish();
}else{
startActivity(new Intent(SplashActivity.this, Login.class));
finish();
}
}
};
handler.postDelayed(runnable, 2500);
}
}
package w.soulofpluto.posstock;
/*
Create by Ramesh Babu
*/
public class Store {
int StoreId;
String StoreName;
public int getStoreId() {
return StoreId;
}
public void setStoreId(int storeId) {
StoreId = storeId;
}
public String getStoreName() {
return StoreName;
}
public void setStoreName(String storeName) {
StoreName = storeName;
}
public String toString() {
return StoreName;
}
}
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_back_background"/>
<foreground android:drawable="@drawable/ic_back_foreground"/>
</adaptive-icon>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient android:angle="180"
android:endColor="#0000FF"
android:startColor="#87ceeb" />
</shape>
</item>
</selector>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="41.37931"
android:viewportHeight="41.37931"
android:tint="#FFEAED">
<group android:translateX="8.689655"
android:translateY="8.689655">
<path
android:fillColor="#FF000000"
android:pathData="M15,17v2h2v-2h2v-2h-2v-2h-2v2h-2v2h2zM20,2L4,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM5,5h6v2L5,7L5,5zM20,20L4,20L20,4v16z"/>
</group>
</vector>
<vector
android:height="24dp"
android:viewportHeight="512"
android:viewportWidth="512" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M353.574,176.526l-40.078,-1.47l-8.689,237.284l40.078,1.464z"/>
<path android:fillColor="#FF000000" android:pathData="M235.948,175.791h40.104v237.285h-40.104z"/>
<path android:fillColor="#FF000000" android:pathData="M207.186,412.334l-8.689,-237.285l-40.078,1.471l8.69,237.284z"/>
<path android:fillColor="#FF000000" android:pathData="M17.379,76.867v40.104h41.789L92.32,493.706C93.229,504.059 101.899,512 112.292,512h286.74c10.394,0 19.07,-7.947 19.972,-18.301l33.153,-376.728h42.464V76.867H17.379zM380.665,471.896H130.654L99.426,116.971h312.474L380.665,471.896z"/>
<path android:fillColor="#FF000000" android:pathData="M321.504,0H190.496c-18.428,0 -33.42,14.992 -33.42,33.42v63.499h40.104V40.104h117.64v56.815h40.104V33.42C354.924,14.992 339.932,0 321.504,0z"/>
</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">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</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>
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_back_background"/>
<foreground android:drawable="@drawable/ic_back_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/ic_back_background"/>
<foreground android:drawable="@drawable/ic_back_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_height="match_parent"
android:background="@color/bg">
<androidx.appcompat.widget.Toolbar
android:id="@+id/dashboard_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>
<Button
android:id="@+id/stock_audit"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="@string/stockaudit"
android:layout_margin="10dp"
style="@style/headerfont"
android:textColor="@android:color/white"
android:background="@drawable/background_all"
android:padding="10dp"/>
<Button
android:id="@+id/rack_qty"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="@string/rackreport"
android:layout_margin="10dp"
style="@style/headerfont"
android:textColor="@android:color/white"
android:background="@drawable/background_all"
android:padding="10dp"/>
<Button
android:id="@+id/searchby_barcode"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="@string/searchbarcode"
android:layout_margin="10dp"
style="@style/headerfont"
android:textColor="@android:color/white"
android:background="@drawable/background_all"
android:padding="10dp"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Version : 1.0"
android:layout_alignParentRight="true"
style="@style/textfont"
android:layout_margin="10dp"
/>
</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"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:gravity="center">
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textColor="@android:color/black"
android:textSize="20sp"
style="@style/textfont"
/>
<Button
android:id="@+id/ok"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/ok"
style="@style/textfont"
android:textColor="@android:color/white"
android:background="@drawable/background_all"
/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<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:titleTextAppearance="@style/Toolbartitleheader"
app:titleTextColor="@android:color/white">
</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"/>-->
<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_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: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" >
<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>
<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"
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"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity"
android:background="@color/bg">
<androidx.appcompat.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
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"
android:background="@drawable/background_all"
app:titleTextAppearance="@style/Toolbartitleheader">
</androidx.appcompat.widget.Toolbar>
<!-- <EditText
android:layout_below="@+id/main_toolbar"
android:id="@+id/barcode"
android:layout_width="match_parent"
android:layout_height="80dp"
android:hint="TG21489489"
android:layout_alignParentLeft="true"
android:maxLines="2"/>-->
<androidx.recyclerview.widget.RecyclerView
android:layout_below="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/plans_List"
/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/plandetails_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>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/plandetails_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:textColor="@android:color/black"
style="@style/textfont"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/plandetails_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:textColor="@android:color/black"
style="@style/textfont"
/>
<!--<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/plandetails_division"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:textColor="@android:color/black"
style="@style/textfont"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/plandetails_section"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:textColor="@android:color/black"
style="@style/textfont"
/>-->
<LinearLayout
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"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:text="@string/pieces"
android:checked="true"
android:onClick="PiecesClicked"
style="@style/textfont"/>
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/meters"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:text="@string/meters"
android:onClick="MetersClicked"
style="@style/textfont"/>
</RadioGroup>
</LinearLayout>
<LinearLayout
android:id="@+id/pieces_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:visibility="visible"
android:layout_margin="3dp">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/dummy_qty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/quantity"
android:layout_margin="3dp"
android:textColor="@android:color/black"
android:layout_gravity="center"
android:visibility="invisible"
style="@style/textfont"/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/qty"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:layout_gravity="center"
android:visibility="invisible"
style="@style/textfont"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:gravity="center">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_alignParentLeft="true"
android:text="@string/scanneditems"
android:textSize="20sp"
android:textColor="@android:color/black"
style="@style/headerfont"/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/rack_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:hint="@string/rack"
style="@style/headerfont"
android:inputType="number"
android:singleLine="true"/>
</RelativeLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatEditText
android:layout_below="@+id/plandetails_toolbar"
android:id="@+id/barcode"
android:layout_width="match_parent"
android:layout_height="60dp"
android:hint="TG21489489"
android:layout_alignParentLeft="true"
android:maxLines="2"
android:layout_marginTop="5dp"
style="@style/textfont"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
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"
/>
<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"
/>
<androidx.appcompat.widget.AppCompatTextView
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"
android:background="@color/bg"
android:layout_margin="3dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/barcode_recylerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/ScanComplete"
/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/ScanComplete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/scanningcomplete"
android:background="@drawable/background_all"
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/rackwise_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>
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/rack_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:gravity="center">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/total_scanned"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/textfont"
android:textColor="@color/colorPrimaryDark"
android:layout_weight="0.7"
android:layout_margin="5dp"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="QTY"
style="@style/textfont"
android:textColor="@color/colorPrimaryDark"
android:gravity="center"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rack_recylerview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/searchbybarcode_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>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_margin="5dp">
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/searchbybarcode_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/searchbybarcode_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/textfont"
android:textColor="@color/colorPrimaryDark"
android:layout_margin="5dp"
android:maxLines="2"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/searchbybarcode_rack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/textfont"
android:textColor="@android:color/black"
android:layout_margin="5dp"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<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="@drawable/background_all"
android:gravity="center">
<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"/>
<!-- <androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:layout_marginTop="20dp"
android:text="@string/spalsh"
android:textColor="@android:color/white"
android:textAppearance="@style/textfont"/>-->
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:textColor="@color/colorPrimaryDark"
style="@style/Toolbartitleheader"
android:text="Plan Details">
</TextView>
<ImageView
android:id="@+id/close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:drawable/ic_menu_close_clear_cancel"
android:layout_alignParentRight="true">
</ImageView>
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="10dp">
<TextView
android:id="@+id/plan_division"
style="@style/textfont"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:text="Division"
android:textColor="@android:color/black">
</TextView>
<TextView
android:id="@+id/plan_section"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:textColor="@android:color/black"
android:text="Section"
style="@style/textfont">
<!--style="@style/textfont"-->
</TextView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:gravity="center">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/relogin_userid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textColor="@android:color/black"
android:textSize="20sp"
style="@style/textfont"
/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/relogin_pass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textColor="@android:color/black"
android:hint="Password"
android:inputType="textPassword"
style="@style/textfont"
/>
<Button
android:id="@+id/relogin_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/relogin"
style="@style/textfont"
android:textColor="@android:color/white"
android:background="@drawable/background_all"
/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardCornerRadius="3dp"
android:layout_margin="3dp">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<TextView
android:id="@+id/plandetails_barcode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:textColor="@android:color/black"
style="@style/textfont"
android:layout_gravity="center"
/>
<TextView
android:id="@+id/plandetails_qty"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:textColor="@android:color/black"
style="@style/textfont"
android:layout_gravity="center"
/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:gravity="center">
<ImageView
android:id="@+id/plandetails_delete"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/ic_delete"
android:layout_gravity="center"/>
</RelativeLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardCornerRadius="3dp"
android:layout_margin="5dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp">
<TextView
android:id="@+id/plan_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:textColor="@android:color/black"
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"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<Button
android:id="@+id/view_section"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="@string/view"
android:textAllCaps="false"
android:layout_toLeftOf="@+id/start_scan"
style="@style/textfont"
android:background="@drawable/background_all"
android:textColor="@android:color/white"
android:layout_marginRight="5dp">
</Button>
<Button
android:id="@+id/start_scan"
android:layout_width="wrap_content"
android:layout_height="35dp"
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>
</RelativeLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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"
android:layout_height="wrap_content"
app:cardCornerRadius="3dp"
android:layout_margin="3dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="5dp"
android:weightSum="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="0.7">
<TextView
android:id="@+id/rack_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
style="@style/textfont"/>
<TextView
android:id="@+id/rack_userid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
style="@style/textfont"/>
<TextView
android:id="@+id/rack_from"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
style="@style/textfont"/>
<TextView
android:id="@+id/rack_to"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
style="@style/textfont"/>
</LinearLayout>
<TextView
android:id="@+id/rack_qty"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
style="@style/textfont"
android:layout_weight="0.3"
android:layout_gravity="center"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/dashboard_logout"
android:icon="@drawable/ic_power"
android:title="Delete"
app:showAsAction="always"/>
</menu>
\ 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/ic_back_background"/>
<foreground android:drawable="@drawable/ic_back_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/ic_back_background"/>
<foreground android:drawable="@drawable/ic_back_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/ic_back_background"/>
<foreground android:drawable="@drawable/ic_launcher_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/ic_back_background"/>
<foreground android:drawable="@drawable/ic_launcher_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="bg">#6A95A5A6</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_back_background">#1F31A6</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">Pos Stock Audit</string>
<string name="success" translatable="false">success</string>
<string name="msg" translatable="false">msg</string>
<string name="data" translatable="false">data</string>
<string name="connection" translatable="false">Please check your internet connection</string>
<string name="empid">emp_id</string>
<string name="password">password</string>
<string name="usertoken">user_access_token</string>
<string name="storeid">store_id</string>
<string name="prefix">ds_prefix</string>
<string name="dongle">using_dongle</string>
<string name="id">id</string>
<string name="store_name">store_name</string>
<string name="val_empandpass">Enter EmployeeId and Password</string>
<string name="val_empid">Enter EmployeeId </string>
<string name="val_pass">Enter Password</string>
<string name="no_stores">No Stores Available</string>
<string name="login">Login</string>
<string name="dashboard">DashBoard</string>
<string name="test">Plans List</string>
<string name="spalsh">Splash Screen</string>
<string name="userId">Employee Id</string>
<string name="userIdPassword">Password</string>
<string name="stockaudit"> Stock Audit Plans </string>
<string name="rackreport"> Rack Wise Qty </string>
<string name="searchbarcode"> SEARCH BY BARCODE </string>
<string name="ok"> OK </string>
<string name="relogin"> ReLogin </string>
<string name="pieces">Pieces</string>
<string name="meters">Meters</string>
<string name="startscan">Start Scan</string>
<string name="view">View Plan</string>
<string name="quantity">Quantity : </string>
<string name="scanneditems">Scanned Items : 0</string>
<string name="barcode">Barcode</string>
<string name="qty">Qty</string>
<string name="scanningcomplete">Scanning complete</string>
<string name="rack"> Rack No </string>
<string name="auditstatus">audit_status</string>
<string name="fromdate">created_from_date</string>
<string name="todate">created_to_date</string>
<string name="accesstoken">Pos-Access-Token</string>
<string name="storeidtoken">Pos-User-Access-Store-Id</string>
<string name="barcode_upload">barcode</string>
<string name="rule_id">pos_stock_audit_rule_id</string>
<string name="quantity_upload">quantity</string>
<string name="rack_no">rack_information</string>
<string name="plan_id">pos_stock_audit_rule_id</string>
<string name="android_version">android_version</string>
<string name="plan_details">Plan Details</string>
<string name="key">key</string>
<!--<string name="section"><font color=#cc0029>SECTION :</font></string>-->
<string name="scanning">Barcode Scanning...</string>
</resources>
\ No newline at end of file
<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>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Toolbartitleheader">
<item name="android:fontFamily">@font/whitneyhtf_book</item>
<item name="android:textSize">18sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="headerfont">
<item name="android:fontFamily">@font/whitneyhtf_book</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:textStyle">bold</item>
</style>
<style name="textfont">
<item name="android:fontFamily">@font/whitneyhtf_book</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@android:color/black</item>
</style>
<style name="customfontstyle"
parent="@android:style/TextAppearance.Small">
<item name="android:fontFamily">@font/worksans_extralight</item>
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">posapi.plutokm.com</domain>
</domain-config>
</network-security-config>
\ No newline at end of file
package w.soulofpluto.posstock;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
\ No newline at end of file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
\ No newline at end of file
#Wed Jan 27 12:34:28 IST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@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=
@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
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
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%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app'
rootProject.name = "POSSTOCK"
\ No newline at end of file
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