Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
StockAuditEAN
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramesh Babu Puvvadi
StockAuditEAN
Commits
79d8faed
Commit
79d8faed
authored
Mar 07, 2022
by
User
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stock Audit changes noted version 1.1
parent
d0891c19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
152 additions
and
112 deletions
+152
-112
build.gradle
app/build.gradle
+6
-14
AppUtils.java
app/src/main/java/w/soulofpluto/posstockaudit/AppUtils.java
+1
-0
Constants.java
app/src/main/java/w/soulofpluto/posstockaudit/Constants.java
+28
-26
DashBoardActivity.java
...n/java/w/soulofpluto/posstockaudit/DashBoardActivity.java
+5
-3
HomeActivity.java
...c/main/java/w/soulofpluto/posstockaudit/HomeActivity.java
+7
-4
Login.java
app/src/main/java/w/soulofpluto/posstockaudit/Login.java
+6
-6
MainActivity.java
...c/main/java/w/soulofpluto/posstockaudit/MainActivity.java
+32
-14
PlanDetails.java
...rc/main/java/w/soulofpluto/posstockaudit/PlanDetails.java
+47
-21
Plans.java
app/src/main/java/w/soulofpluto/posstockaudit/Plans.java
+1
-5
RackWiseAdapter.java
...ain/java/w/soulofpluto/posstockaudit/RackWiseAdapter.java
+19
-19
RackWiseQty.java
...rc/main/java/w/soulofpluto/posstockaudit/RackWiseQty.java
+0
-0
SearchByBarcode.java
...ain/java/w/soulofpluto/posstockaudit/SearchByBarcode.java
+0
-0
No files found.
app/build.gradle
View file @
79d8faed
...
...
@@ -9,18 +9,18 @@ android {
applicationId
"w.soulofpluto.posstock"
minSdkVersion
16
targetSdkVersion
30
versionCode
1
versionName
"1.
0
"
versionCode
2
versionName
"1.
1
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled
true
}
buildTypes
{
release
{
minifyEnabled
false
shrinkResources
false
zipAlignEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
minifyEnabled
false
shrinkResources
false
zipAlignEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
...
...
@@ -35,23 +35,15 @@ dependencies {
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'
implementation
platform
(
'com.google.firebase:firebase-bom:28.4.0'
)
implementation
'com.google.firebase:firebase-analytics'
implementation
'com.google.firebase:firebase-crashlytics:18.2.1'
implementation
'com.karumi:dexter:6.2.3'
testImplementation
'junit:junit:4.12'
androidTestImplementation
'androidx.test.ext:junit:1.1.2'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.3.0'
...
...
app/src/main/java/w/soulofpluto/posstockaudit/AppUtils.java
View file @
79d8faed
...
...
@@ -12,6 +12,7 @@ import static android.content.Context.ACTIVITY_SERVICE;
*/
public
class
AppUtils
{
public
static
void
deleteCache
(
Context
context
)
{
Log
.
e
(
"AppUtils ====<"
,
"Calling deleteCache"
);
try
{
...
...
app/src/main/java/w/soulofpluto/posstockaudit/Constants.java
View file @
79d8faed
...
...
@@ -29,8 +29,8 @@ public class Constants{
//public static String BASE_URL = "https://49588a.emporter.eu/";
//public static String BASE_URL = "https://30ad04.emporter.eu/";
//public static String BASE_URL = "http://182.18.167.139/";
public
static
String
BASE_URL
=
"http://192.168.34.16/"
;
//
public static String BASE_URL = "http://posapi.plutokm.com/";
//
public static String BASE_URL = "http://192.168.34.16/";
public
static
String
BASE_URL
=
"http://posapi.plutokm.com/"
;
public
static
String
MenuBar
=
Constants
.
BASE_URL
+
"/Users/generateUserMenuBarLinksForAndroidApp"
;
public
static
String
Logout
=
Constants
.
BASE_URL
+
"/login/doLogout/"
;
public
static
String
Login
=
Constants
.
BASE_URL
+
"/login/doLogin"
;
...
...
@@ -65,6 +65,8 @@ public class Constants{
public
static
StringBuilder
stringBuilder
;
public
static
void
getToast
(
Context
context
,
String
data
){
/* ((Activity)context).runOnUiThread(() -> {
});*/
Toast
toast
=
Toast
.
makeText
(
context
,
data
,
Toast
.
LENGTH_SHORT
);
toast
.
setGravity
(
Gravity
.
CENTER
,
0
,
0
);
toast
.
show
();
...
...
@@ -215,29 +217,29 @@ public class Constants{
return
null
;
}
public
static
String
Barcode
(
String
mrp
){
if
(
mrp
.
length
()
==
11
){
return
mrp
;
}
else
if
(
mrp
.
length
()
==
10
){
return
mrp
+
" "
;
}
else
if
(
mrp
.
length
()
==
9
){
return
mrp
+
" "
;
}
else
if
(
mrp
.
length
()
==
8
){
return
mrp
+
" "
;
}
else
if
(
mrp
.
length
()
==
7
){
return
mrp
+
" "
;
}
else
if
(
mrp
.
length
()
==
6
){
return
mrp
+
" "
;
}
else
if
(
mrp
.
length
()
==
5
){
return
mrp
+
" "
;
}
else
if
(
mrp
.
length
()
==
4
){
return
mrp
+
" "
;
}
else
if
(
mrp
.
length
()
==
3
){
return
mrp
+
" "
;
}
else
if
(
mrp
.
length
()
==
2
){
return
mrp
+
" "
;
}
else
if
(
mrp
.
length
()
==
1
){
return
mrp
+
" "
;
public
static
String
Barcode
(
String
bar
){
if
(
bar
.
length
()
==
11
){
return
bar
;
}
else
if
(
bar
.
length
()
==
10
){
return
bar
+
" "
;
}
else
if
(
bar
.
length
()
==
9
){
return
bar
+
" "
;
}
else
if
(
bar
.
length
()
==
8
){
return
bar
+
" "
;
}
else
if
(
bar
.
length
()
==
7
){
return
bar
+
" "
;
}
else
if
(
bar
.
length
()
==
6
){
return
bar
+
" "
;
}
else
if
(
bar
.
length
()
==
5
){
return
bar
+
" "
;
}
else
if
(
bar
.
length
()
==
4
){
return
bar
+
" "
;
}
else
if
(
bar
.
length
()
==
3
){
return
bar
+
" "
;
}
else
if
(
bar
.
length
()
==
2
){
return
bar
+
" "
;
}
else
if
(
bar
.
length
()
==
1
){
return
bar
+
" "
;
}
return
null
;
}
...
...
@@ -585,7 +587,7 @@ public class Constants{
return
null
;
}
public
static
String
IndianRupee
sf
ormat
(
String
amount
){
public
static
String
IndianRupee
F
ormat
(
String
amount
){
NumberFormat
formatter
=
NumberFormat
.
getCurrencyInstance
(
new
Locale
(
"en"
,
"in"
));
String
moneyString
=
formatter
.
format
(
Double
.
valueOf
(
amount
));
return
moneyString
;
...
...
app/src/main/java/w/soulofpluto/posstockaudit/DashBoardActivity.java
View file @
79d8faed
...
...
@@ -26,10 +26,11 @@ import java.util.concurrent.TimeUnit;
*/
public
class
DashBoardActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
{
Toolbar
dashboard_toolbar
;
Button
stock_audit
,
rack_qty
,
searchBy_Barcode
,
transfer
;
Toolbar
dashboard_toolbar
;
Button
stock_audit
,
rack_qty
,
searchBy_Barcode
,
transfer
;
TextView
version
;
PreferenceManager
preferenceManager
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
){
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -91,6 +92,7 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
Constants
.
ProgressDialogDismiss
();
}
@Override
public
void
onResponse
(
Response
response
)
throws
IOException
{
Constants
.
ProgressDialogDismiss
();
if
(
response
.
isSuccessful
()){
...
...
@@ -104,7 +106,7 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
preferenceManager
.
setLogged
(
false
);
preferenceManager
.
setCustToken
(
""
);
preferenceManager
.
setStoreId
(
""
);
Login
.
l
ogout
(
DashBoardActivity
.
this
);
Login
.
L
ogout
(
DashBoardActivity
.
this
);
}
else
{
Constants
.
getToast
(
DashBoardActivity
.
this
,
jsonObject
.
getString
(
"msg"
));
}
...
...
app/src/main/java/w/soulofpluto/posstockaudit/HomeActivity.java
View file @
79d8faed
...
...
@@ -44,10 +44,10 @@ import static w.soulofpluto.posstockaudit.Constants.Logout;
ArrayList
<
String
>
arrayList
;
RecyclerView
recyclerView
;
private
static
final
int
REQUEST_PERMISSION
=
100
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
){
setContentView
(
R
.
layout
.
activity_home
);
//requestRuntimePermission();
home_toolbar
=
findViewById
(
R
.
id
.
home_toolbar
);
version
=
findViewById
(
R
.
id
.
version
);
recyclerView
=
findViewById
(
R
.
id
.
menu_list
);
...
...
@@ -87,8 +87,8 @@ import static w.soulofpluto.posstockaudit.Constants.Logout;
if
(
requestCode
!=
REQUEST_PERMISSION
||
grantResults
.
length
==
0
)
{
return
;
}
}
private
void
setUI
(){
final
OkHttpClient
client
=
new
OkHttpClient
();
client
.
setConnectTimeout
(
250
,
TimeUnit
.
SECONDS
);
...
...
@@ -137,7 +137,7 @@ import static w.soulofpluto.posstockaudit.Constants.Logout;
try
{
Log
.
e
(
"session"
,
object
.
getString
(
"msg"
));
Constants
.
getToast
(
HomeActivity
.
this
,
object
.
getString
(
"msg"
));
Login
.
l
ogout
(
HomeActivity
.
this
);
Login
.
L
ogout
(
HomeActivity
.
this
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -154,11 +154,13 @@ import static w.soulofpluto.posstockaudit.Constants.Logout;
}
});
}
@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
()){
...
...
@@ -206,7 +208,7 @@ import static w.soulofpluto.posstockaudit.Constants.Logout;
preferenceManager
.
setCustToken
(
""
);
preferenceManager
.
setStoreId
(
""
);
preferenceManager
.
setBLUETOOTH
(
""
);
Login
.
l
ogout
(
HomeActivity
.
this
);
Login
.
L
ogout
(
HomeActivity
.
this
);
}
else
{
Constants
.
getToast
(
HomeActivity
.
this
,
jsonObject
.
getString
(
"msg"
));
}
...
...
@@ -222,6 +224,7 @@ import static w.soulofpluto.posstockaudit.Constants.Logout;
}
});
}
@Override
public
void
onBackPressed
(){
int
count
=
0
;
...
...
app/src/main/java/w/soulofpluto/posstockaudit/Login.java
View file @
79d8faed
...
...
@@ -48,8 +48,8 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
private
PreferenceManager
preferenceManager
;
private
String
Store_Name
;
public
static
void
l
ogout
(
Context
context
){
AppUtils
.
clearAppData
(
context
);
public
static
void
L
ogout
(
Context
context
){
//
AppUtils.clearAppData(context);
Activity
activity
=
(
Activity
)
context
;
Intent
in_logout
=
new
Intent
(
context
,
Login
.
class
);
in_logout
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
);
...
...
@@ -122,17 +122,17 @@ public class Login extends AppCompatActivity implements View.OnClickListener, Ad
store
.
setStoreName
(
jsonObject
.
getString
(
getResources
().
getString
(
R
.
string
.
store_name
)));
stores
.
add
(
store
);
}
ArrayAdapter
<
Store
>
adapter
=
new
ArrayAdapter
<
Store
>(
Login
.
this
,
R
.
layout
.
spinner_item
,
stores
);
ArrayAdapter
<
Store
>
adapter
=
new
ArrayAdapter
<>(
Login
.
this
,
R
.
layout
.
spinner_item
,
stores
);
storeId
.
setAdapter
(
adapter
);
}
}
}
else
{
Constants
.
getToast
(
Login
.
this
,
getResources
().
getString
(
R
.
string
.
no_stores
));
storeId
.
setAdapter
(
null
);
Constants
.
getToast
(
Login
.
this
,
getResources
().
getString
(
R
.
string
.
no_stores
));
storeId
.
setAdapter
(
null
);
}
}
}
else
{
runOnUiThread
(()
->
Constants
.
getToast
(
Login
.
this
,
Response
));
runOnUiThread
(()
->
Constants
.
getToast
(
Login
.
this
,
Response
));
}
}
catch
(
JSONException
e
){
e
.
printStackTrace
();
...
...
app/src/main/java/w/soulofpluto/posstockaudit/MainActivity.java
View file @
79d8faed
...
...
@@ -92,9 +92,16 @@ public class MainActivity extends AppCompatActivity {
preferenceManager
.
setLogged
(
false
);
preferenceManager
.
setCustToken
(
""
);
preferenceManager
.
setStoreId
(
""
);
Login
.
l
ogout
(
MainActivity
.
this
);
Login
.
L
ogout
(
MainActivity
.
this
);
}
else
{
Constants
.
getToast
(
MainActivity
.
this
,
jsonObject
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
runOnUiThread
(()
->
{
try
{
Constants
.
getToast
(
MainActivity
.
this
,
jsonObject
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
});
}
}
}
catch
(
JSONException
e
)
{
...
...
@@ -185,18 +192,29 @@ public class MainActivity extends AppCompatActivity {
if
(
object1
.
has
(
getResources
().
getString
(
R
.
string
.
data
)))
{
plansArrayList
.
clear
();
JSONArray
jsonArray
=
object1
.
getJSONArray
(
getResources
().
getString
(
R
.
string
.
data
));
for
(
int
i
=
0
;
i
<
jsonArray
.
length
();
i
++)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
Plans
plans
=
new
Plans
();
plans
.
setPlanId
(
String
.
valueOf
(
jsonObject
.
getInt
(
"id"
)));
plans
.
setName
(
jsonObject
.
getString
(
"stock_audit_name"
));
plans
.
setDivision
(
Constants
.
convertString
(
jsonObject
.
getString
(
"item_divisions"
)));
plans
.
setSection
(
Constants
.
convertString
(
jsonObject
.
getString
(
"item_sections"
)));
plansArrayList
.
add
(
plans
);
if
(
jsonArray
.
length
()>
0
){
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
(
object1
.
has
(
getResources
().
getString
(
R
.
string
.
msg
)))
{
runOnUiThread
(()
->
{
try
{
Constants
.
getToast
(
MainActivity
.
this
,
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
});
}
CustomAdapter
customAdapter
=
new
CustomAdapter
(
MainActivity
.
this
,
plansArrayList
);
plans_list
.
setLayoutManager
(
new
LinearLayoutManager
(
MainActivity
.
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
plans_list
.
setAdapter
(
customAdapter
);
}
else
if
(
object1
.
has
(
getResources
().
getString
(
R
.
string
.
msg
)))
{
runOnUiThread
(()
->
{
try
{
...
...
@@ -218,7 +236,7 @@ public class MainActivity extends AppCompatActivity {
preferenceManager
.
setLogged
(
false
);
preferenceManager
.
setCustToken
(
""
);
preferenceManager
.
setStoreId
(
""
);
Login
.
l
ogout
(
MainActivity
.
this
);
Login
.
L
ogout
(
MainActivity
.
this
);
}
}
}
...
...
app/src/main/java/w/soulofpluto/posstockaudit/PlanDetails.java
View file @
79d8faed
...
...
@@ -38,6 +38,7 @@ import com.squareup.okhttp.Response;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.lang.reflect.Constructor
;
import
java.net.UnknownHostException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -67,10 +68,10 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
MediaPlayer
mp
;
String
Rack_No
;
public
static
void
start
(
Context
context
,
Plans
plans
,
String
rack
n
o
){
public
static
void
start
(
Context
context
,
Plans
plans
,
String
rack
N
o
){
Intent
in
=
new
Intent
(
context
,
PlanDetails
.
class
);
in
.
putExtra
(
"key"
,
plans
);
in
.
putExtra
(
"rack"
,
rack
n
o
);
in
.
putExtra
(
"rack"
,
rack
N
o
);
context
.
startActivity
(
in
);
}
...
...
@@ -196,44 +197,45 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
np
.
printStackTrace
();
}
}
else
{
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
));
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
)));
}
}
else
{
if
(
TextUtils
.
isEmpty
(
qty
.
getText
().
toString
())){
runOnUiThread
(()
->
{
barcode
.
setText
(
""
);
Constants
.
getToast
(
PlanDetails
.
this
,
"Enter Qty"
);
runOnUiThread
(()
->
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"
,
""
)))
{
getNotification
(
"Already scanned this item"
);
return
;
}
}
try
{
try
{
UploadBarcode
(
barcode
.
getText
().
toString
().
replace
(
"\n"
,
""
),
qty
.
getText
().
toString
(),
plans
.
getPlanId
());
Constants
.
ProgressDialogShow
(
PlanDetails
.
this
);
barcode
.
setText
(
""
);
}
catch
(
NullPointerException
np
){
}
catch
(
NullPointerException
np
){
np
.
printStackTrace
();
}
}
else
{
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
));
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
)
));
}
}
}
}
}
}
else
{
getNotification
(
getResources
().
getString
(
R
.
string
.
connection
));
//getNotification(getResources().getString(R.string.connection));
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
)));
}
}
catch
(
NullPointerException
np
){
np
.
printStackTrace
();
np
.
printStackTrace
();
}
}
@Override
...
...
@@ -251,16 +253,16 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
Constants
.
ProgressDialogShow
(
PlanDetails
.
this
);
UploadAllBarCodes
(
Constants
.
BarcodeComplete
,
rack_number
.
getText
().
toString
());
}
else
{
Constants
.
getToast
(
PlanDetails
.
this
,
"Enter Rack Id"
);
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
"Enter Rack Id"
)
);
}
}
else
{
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
));
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
)
));
}
}
else
{
Constants
.
getToast
(
PlanDetails
.
this
,
"No Scan items "
);
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
"No Scan items "
)
);
}
}
else
{
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
));
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
)
));
}
break
;
}
...
...
@@ -269,15 +271,30 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
public
void
getNotification
(
String
text
){
runOnUiThread
(()
->
{
mp
=
MediaPlayer
.
create
(
PlanDetails
.
this
,
R
.
raw
.
beep
);
if
(
mp
.
isPlaying
())
{
if
(
mp
!=
null
&&
mp
.
isPlaying
())
{
Log
.
e
(
"Media Player start"
,
" ====>1"
);
mp
.
stop
();
try
{
mp
.
prepare
();
mp
.
start
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalStateException
e1
){
e1
.
printStackTrace
();
}
catch
(
NullPointerException
np
){
np
.
printStackTrace
();
}
}
else
{
try
{
Log
.
e
(
"Media Player start"
,
" ====>2"
);
mp
.
start
();
mp
.
setLooping
(
true
);
}
catch
(
IllegalStateException
i
){
i
.
printStackTrace
();
}
catch
(
NullPointerException
n
){
n
.
printStackTrace
();
}
}
mp
.
start
();
final
Dialog
dialog1
=
new
Dialog
(
PlanDetails
.
this
);
dialog1
.
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
dialog1
.
setContentView
(
R
.
layout
.
activity_dialog
);
...
...
@@ -293,8 +310,16 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
barcode
.
setFocusable
(
true
);
barcode
.
requestFocus
();
barcode
.
setText
(
""
);
mp
.
stop
();
mp
.
release
();
try
{
if
(
mp
!=
null
&&
mp
.
isPlaying
())
{
mp
.
stop
();
mp
.
release
();
}
}
catch
(
IllegalStateException
ise
){
ise
.
printStackTrace
();
}
catch
(
NullPointerException
npe
){
npe
.
printStackTrace
();
}
});
});
}
...
...
@@ -432,7 +457,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
plans
.
setColumnId
(
1
);
}
arrayList
.
add
(
plans
);
Collections
.
sort
(
arrayList
,
Plans
.
sortBy
Name
);
Collections
.
sort
(
arrayList
,
Plans
.
sortBy
Id
);
setUI
(
arrayList
);
if
(
arrayList
.
size
()
>
0
){
runOnUiThread
(()
->
{
...
...
@@ -640,7 +665,8 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
preferenceManager
.
setLogged
(
true
);
dialog
.
dismiss
();
}
else
{
Toast
.
makeText
(
PlanDetails
.
this
,
obj
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)),
Toast
.
LENGTH_SHORT
).
show
();
Constants
.
getToast
(
PlanDetails
.
this
,
obj
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
//Toast.makeText(PlanDetails.this,obj.getString(getResources().getString(R.string.msg)), Toast.LENGTH_SHORT).show();
}
}
}
catch
(
JSONException
e
){
...
...
app/src/main/java/w/soulofpluto/posstockaudit/Plans.java
View file @
79d8faed
...
...
@@ -27,8 +27,6 @@ public class Plans implements Parcelable {
ColumnId
=
columnId
;
}
protected
Plans
(
Parcel
in
)
{
PlanId
=
in
.
readString
();
Name
=
in
.
readString
();
...
...
@@ -44,7 +42,6 @@ public class Plans implements Parcelable {
public
Plans
createFromParcel
(
Parcel
in
)
{
return
new
Plans
(
in
);
}
@Override
public
Plans
[]
newArray
(
int
size
)
{
return
new
Plans
[
size
];
...
...
@@ -52,7 +49,6 @@ public class Plans implements Parcelable {
};
public
Plans
()
{
}
public
String
getPlanId
()
{
...
...
@@ -122,5 +118,5 @@ public class Plans implements Parcelable {
return
Name
;
}
public
static
Comparator
<
Plans
>
sortBy
Name
=
(
t1
,
t2
)
->
t2
.
getColumnId
()
-
t1
.
getColumnId
();
public
static
Comparator
<
Plans
>
sortBy
Id
=
(
t1
,
t2
)
->
t2
.
getColumnId
()
-
t1
.
getColumnId
();
}
app/src/main/java/w/soulofpluto/posstockaudit/RackWiseAdapter.java
View file @
79d8faed
...
...
@@ -25,39 +25,39 @@ public class RackWiseAdapter extends RecyclerView.Adapter<RackWiseAdapter.ViewHo
@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
);
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
()
==
0
){
// holder.rack_id.setText(Html.fromHtml(Constants.Id + "0")
);
}
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
()));
public
void
onBindViewHolder
(
@NonNull
RackWiseAdapter
.
ViewHolder
holder
,
final
int
position
)
{
final
RackWise
items
=
arrayList
.
get
(
position
);
if
(
items
.
getId
()
==
0
){
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
(){
public
int
getItemCount
()
{
return
arrayList
.
size
();
}
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
public
TextView
rack_id
,
rack_qty
,
rack_
useri
d
,
rack_from
,
rack_to
;
public
ViewHolder
(
View
itemView
){
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
public
TextView
rack_id
,
rack_qty
,
rack_
UserI
d
,
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_
useri
d
=
itemView
.
findViewById
(
R
.
id
.
rack_userid
);
rack_
UserI
d
=
itemView
.
findViewById
(
R
.
id
.
rack_userid
);
rack_from
=
itemView
.
findViewById
(
R
.
id
.
rack_from
);
rack_to
=
itemView
.
findViewById
(
R
.
id
.
rack_to
);
}
...
...
app/src/main/java/w/soulofpluto/posstockaudit/RackWiseQty.java
View file @
79d8faed
This diff is collapsed.
Click to expand it.
app/src/main/java/w/soulofpluto/posstockaudit/SearchByBarcode.java
View file @
79d8faed
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment