Commit 44d758ae by User

added project directory

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">
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<codeStyleSettings language="XML">
<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
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="resolveModulePerSourceSet" value="false" />
<option name="testRunner" value="PLATFORM" />
</GradleProjectSettings>
</option>
</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
apply plugin: 'com.android.application'
android{
compileSdkVersion 29
defaultConfig {
applicationId "w.soulofpluto.camera"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
implementation 'com.google.android.material:material:1.0.0-beta01'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-vision:11.0.2'
implementation 'info.androidhive:barcode-reader:1.1.5'
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'io.reactivex:rxandroid:1.0.1'
implementation 'io.reactivex:rxjava:1.0.14'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
{
"project_info": {
"project_number": "54135562732",
"firebase_url": "https://publishedappsplay.firebaseio.com",
"project_id": "publishedappsplay",
"storage_bucket": "publishedappsplay.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:54135562732:android:dd94de8c2fb5d640",
"android_client_info": {
"package_name": "com.nextinnovation.pt.barcodescanner"
}
},
"oauth_client": [
{
"client_id": "54135562732-lgmk1l24ceq7qi4kicr7in3siee7537m.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.nextinnovation.pt.barcodescanner",
"certificate_hash": "44fe06ab8398f0835871e42ec35418f40a4fbc9e"
}
},
{
"client_id": "54135562732-cjohia0msut8qrisfuh0ta707bulfki2.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCrkEgM5RYDCegLKzrR9N4nfnGoMELbdFw"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "54135562732-cjohia0msut8qrisfuh0ta707bulfki2.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
\ 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
package w.soulofpluto.camera;
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.camera", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="w.soulofpluto.camera">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:hardwareAccelerated="true"
android:largeHeap="true"
android:requestLegacyExternalStorage="true">
<activity
android:name="w.soulofpluto.camera.SplashActivity"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateAlwaysVisible">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="w.soulofpluto.camera.LoginActivity"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateAlwaysVisible">
</activity>
<activity
android:name="w.soulofpluto.camera.MainActivity"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateAlwaysVisible">
</activity>
<activity
android:name=".BarcodeScannerActivity"
android:label="@string/app_name"
android:exported="false"
android:theme="@style/AppOverlayTheme"
android:screenOrientation="landscape">
</activity>
</application>
</manifest>
\ No newline at end of file
package w.soulofpluto.camera;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Handler;
import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class APICall1 extends AsyncTask<Void, Void, Void> {
private final Context mContext;
private HashMap<String, String> hashMapJson = null;
private HashMap<String, File> hashMapFiles = null;
private HashMap<String, String> hashMap = null;
public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
//private final String credential;
//OkHttpClient client = new OkHttpClient();
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(1000, TimeUnit.SECONDS)
.writeTimeout(1000, TimeUnit.SECONDS)
.readTimeout(1000, TimeUnit.SECONDS)
.retryOnConnectionFailure(true)
.build();
private String json;
private String url;
Object object;
private static String result;
private boolean isDialogCancelled;
APIRespose apiRespose;
//private ACProgressFlower dialog;
// basic methos for call back
/**
* @param url
* @param hashMapFiles
* @param hashMapJson
* @param object view context
* @param apiRespose
*/
public APICall1(String url, HashMap<String, File> hashMapFiles, HashMap<String, String> hashMapJson, Object object, APIRespose apiRespose) {
this.url = url;
this.object = object;
this.apiRespose = apiRespose;
mContext = (Context) object;
this.hashMapJson = hashMapJson;
this.hashMapFiles = hashMapFiles;
}
String postMultiPart(String url, HashMap<String, File> hashMapFiles, HashMap<String, String> hashMapJson) throws IOException {
MultipartBody.Builder multiBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM);
// add type entity
for (String key : hashMapJson.keySet()) {
multiBuilder.addFormDataPart(key, hashMapJson.get(key));
}
// add type entity
if (hashMapFiles != null) {
MediaType mediaType = MediaType.parse("image/jpg");
for (String key : hashMapFiles.keySet()) {
if (hashMapFiles.get(key) != null) {
String fileName = hashMapFiles.get(key).getName();
multiBuilder.addFormDataPart("base64OfJpeg", fileName, RequestBody.create(mediaType, hashMapFiles.get(key)));
}
}
}
//Response response = null;
//System.out.println("Data =====>"+multiBuilder.toString());
RequestBody requestBody = multiBuilder.build();
Request request = new Request.Builder()
//.header("Authorization", credential)
.url(url)
.post(requestBody)
.build();
Response response = client.newCall(request).execute();
if(response==null || response.body()== null){
System.out.println("Called =============>");
response = client.newCall(request).execute();
}
return response.body().string();
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... voids){
result = "";
//.if multipart
if (hashMapJson != null) {
//Thread.sleep(400);
try{
result = postMultiPart(url, hashMapFiles, hashMapJson);
}catch(IOException e) {
e.printStackTrace();
}
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
System.out.println("Response ====>" + result);
apiRespose.onResponse(result);
super.onPostExecute(aVoid);
}
public interface APIRespose {
void onResponse(String result);
}
}
package w.soulofpluto.camera;
import android.os.Bundle;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.google.android.gms.vision.barcode.Barcode;
import java.util.List;
import info.androidhive.barcode.BarcodeReader;
/*
Create by Ramesh Babu
*/
public class BarcodeFragment extends Fragment implements BarcodeReader.BarcodeReaderListener {
private static final String TAG = BarcodeFragment.class.getSimpleName();
private BarcodeReader barcodeReader;
public BarcodeFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_barcode, container, false);
barcodeReader = (BarcodeReader) getChildFragmentManager().findFragmentById(R.id.barcode_fragment);
barcodeReader.setListener(this);
return view;
}
@Override
public void onScanned(final Barcode barcode) {
Log.e(TAG, "onScanned: " + barcode.displayValue);
barcodeReader.playBeep();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getActivity(), "Barcode: " + barcode.displayValue, Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onScannedMultiple(List<Barcode> barcodes) {
}
@Override
public void onBitmapScanned(SparseArray<Barcode> sparseArray) {
}
@Override
public void onScanError(String errorMessage) {
Log.e(TAG, "onScanError: " + errorMessage);
}
@Override
public void onCameraPermissionDenied() {
Toast.makeText(getActivity(), "Camera permission denied!", Toast.LENGTH_LONG).show();
}
}
package w.soulofpluto.camera;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.util.SparseArray;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.vision.barcode.Barcode;
import java.util.List;
import info.androidhive.barcode.BarcodeReader;
/*
Create by Ramesh Babu
*/
public class BarcodeScannerActivity extends AppCompatActivity implements BarcodeReader.BarcodeReaderListener {
private static final String TAG = BarcodeScannerActivity.class.getSimpleName();
private BarcodeReader barcodeReader;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_barcode);
// getting barcode instance
barcodeReader = (BarcodeReader) getSupportFragmentManager().findFragmentById(R.id.barcode_fragment);
/***
* Providing beep sound. The sound file has to be placed in
* `assets` folder
*/
// barcodeReader.setBeepSoundFile("shutter.mp3");
/**
* Pausing / resuming barcode reader. This will be useful when you want to
* do some foreground user interaction while leaving the barcode
* reader in background
* */
// barcodeReader.pauseScanning();
// barcodeReader.resumeScanning();
}
@Override
public void onScanned(final Barcode barcode) {
Log.e(TAG, "onScanned: " + barcode.rawValue);
barcodeReader.playBeep();
//finish();
Intent intent=new Intent();
intent.putExtra("MESSAGE",barcode.displayValue);
setResult(2,intent);
finish();
/*runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), "Barcode: " + barcode.displayValue, Toast.LENGTH_SHORT).show();
}
});*/
}
@Override
public void onScannedMultiple(List<Barcode> barcodes) {
}
@Override
public void onBitmapScanned(SparseArray<Barcode> sparseArray) {
}
@Override
public void onScanError(String errorMessage) {
}
@Override
public void onCameraPermissionDenied() {
Toast.makeText(getApplicationContext(), "Camera permission denied!", Toast.LENGTH_LONG).show();
finish();
}
}
\ No newline at end of file
package w.soulofpluto.camera;
import android.view.MenuItem;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
/*
Create by Ramesh Babu
*/
public class BaseScannerActivity extends AppCompatActivity {
public void setupToolbar(String text) {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(text);
final ActionBar ab = getSupportActionBar();
if(ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
\ No newline at end of file
package w.soulofpluto.camera;
import android.content.Context;
import android.hardware.Camera;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import java.io.IOException;
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
private SurfaceHolder mHolder;
private Camera mCamera;
public CameraPreview(Context context, Camera camera) {
super(context);
mCamera = camera;
mHolder = getHolder();
mHolder.addCallback(this);
// deprecated setting, but required on Android versions prior to 3.0
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
public void surfaceCreated(SurfaceHolder holder) {
try {
// create the surface and start camera preview
if (mCamera == null) {
mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
}
} catch (IOException e) {
Log.d(VIEW_LOG_TAG, "Error setting camera preview: " + e.getMessage());
}
}
public void refreshCamera(Camera camera) {
if (mHolder.getSurface() == null) {
// preview surface does not exist
return;
}
// stop preview before making changes
try {
mCamera.stopPreview();
} catch (Exception e) {
// ignore: tried to stop a non-existent preview
}
// set preview size and make any resize, rotate or
// reformatting changes here
// start preview with new settings
setCamera(camera);
try {
mCamera.setPreviewDisplay(mHolder);
mCamera.startPreview();
} catch (Exception e) {
Log.d(VIEW_LOG_TAG, "Error starting camera preview: " + e.getMessage());
}
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// If your preview can change or rotate, take care of those events here.
// Make sure to stop the preview before resizing or reformatting it.
refreshCamera(mCamera);
}
public void setCamera(Camera camera) {
//method to set a camera instance
mCamera = camera;
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
// mCamera.release();
}
}
\ No newline at end of file
package w.soulofpluto.camera;
/*
Create by Ramesh Babu
*/
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Base64;
import android.view.Gravity;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
import java.io.ByteArrayOutputStream;
import java.io.File;
public class Constants{
//public static String URL = "https://plutokm.com/save_grc_images_from_mobiles.php";
public static String URL = "https://www.plutokm.com/grc_capture_image2.php?barcode=";
static String base64Image;
public static boolean isNetworkAvailable(Context context){
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null;
}
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 getBase64String(Bitmap bitmap){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] imageBytes = baos.toByteArray();
String base64String = Base64.encodeToString(imageBytes, Base64.NO_WRAP);
return base64String;
}*/
public static String getBase64String(Bitmap bm){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 100, baos); //bm is the bitmap object
byte[] b = baos.toByteArray();
return Base64.encodeToString(b, Base64.DEFAULT);
}
/* public static String getBase64FromPath(Bitmap bitmap){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] imageBytes = baos.toByteArray();
String base64String = Base64.encodeToString(imageBytes, Base64.NO_WRAP);
return base64String;
}
*/
public static void hideKeyboard(Activity activity){
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
//Find the currently focused view, so we can grab the correct window token from it.
View view = activity.getCurrentFocus();
//If no view currently has focus, create a new one, just so we can grab a window token from it
if(view == null){
view = new View(activity);
}
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
public static void deleteCache(Context context){
try{
File dir = context.getCacheDir();
deleteDir(dir);
}catch(Exception e){
e.printStackTrace();
}
}
public static boolean deleteDir(File dir){
if (dir != null && dir.isDirectory()){
String[] children = dir.list();
for(int i = 0; i < children.length; i++){
boolean success = deleteDir(new File(dir, children[i]));
if(!success){
return false;
}
}
return dir.delete();
} else if(dir!= null && dir.isFile()) {
return dir.delete();
} else {
return false;
}
}
}
package w.soulofpluto.camera;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
private Context context;
private ArrayList<Model> arrayList;
public CustomAdapter(Context context, ArrayList<Model> list){
this.context = context;
this.arrayList = list;
}
@Override
public CustomAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i){
View View = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.custom_list_item, viewGroup, false);
return new CustomAdapter.ViewHolder(View);
}
public void addItem(int position, Model model) {
arrayList.add(position, model);
notifyItemRangeChanged(position, arrayList.size());
notifyItemInserted(position);
}
public void modifyItem(final int position, final Model model) {
//arrayList.remove(position);
arrayList.set(position, model);
notifyItemChanged(position);
}
@Override
public void onBindViewHolder(CustomAdapter.ViewHolder viewHolder, int i){
final Model model = arrayList.get(i);
viewHolder.item_sku.setText(model.getSKU());
//Bitmap bitmap = BitmapFactory.decodeFile(model.getFILEPATH());
Glide.with(context)
.load(model.getFILEPATH())
//.asBitmap()
//.load(bitmap)
.into(viewHolder.item_image);
//viewHolder.item_no.setText(String.valueOf(model.getID()));
//viewHolder.item_image.setImageBitmap(bitmap);
//System.out.println("Status ==> "+model.getSTATUS());
if(model.getSTATUS() == 0){
viewHolder.item_progress.setText("In Progress");
}else if(model.getSTATUS() ==1){
viewHolder.item_progress.setText("Completed");
}
}
@Override
public int getItemCount(){
return arrayList.size();
}
public void updateAt(int pos, int i) {
Model todoEntity = arrayList.get(pos);
//todoEntity.setText(text);
todoEntity.setSTATUS(i);
notifyItemChanged(pos);
}
public class ViewHolder extends RecyclerView.ViewHolder {
private TextView item_sku,item_progress,item_no;
private ImageView item_image;
public ViewHolder(View itemView){
super(itemView);
item_sku = itemView.findViewById(R.id.item_sku);
item_image = itemView.findViewById(R.id.item_image);
item_progress = itemView.findViewById(R.id.item_progress);
//item_no = itemView.findViewById(R.id.item_no);
}
}
}
package w.soulofpluto.camera;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class DataBaseHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 3;
private static final String DATABASE_NAME = "camera.db";
private Context mContext;
private static final String REG_TABLE = " camera";
private static final String _ID = "_id";
private static final String SKU = "sku";
private static final String FILENAME = "filename";
private static final String STATUS = "status";
private static final String CREATE_CAMERA = "CREATE TABLE" + REG_TABLE + "" +
"(" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT ," + SKU + " TEXT NOT NULL,"
+ FILENAME + " TEXT NOT NULL," + STATUS + " INTEGER" + ")";
public DataBaseHelper(Context context){
super(context, DATABASE_NAME, null, DATABASE_VERSION);
mContext = context;
}
@Override
public void onCreate(SQLiteDatabase db){
db.execSQL(CREATE_CAMERA);
}
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion){
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS camera");
//db.execSQL("DROP TABLE IF EXISTS quote_table");
onCreate(db);
}
public boolean insertcamera(String sku, String filename, int status){
SQLiteDatabase db = this.getWritableDatabase();
db.beginTransaction();
ContentValues contentValues = new ContentValues();
contentValues.put(SKU, sku);
contentValues.put(FILENAME, filename);
contentValues.put(STATUS, status);
db.insert(REG_TABLE, null, contentValues);
db.setTransactionSuccessful();
db.endTransaction();
db.close();
return true;
}
public Cursor getData(){
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from camera ", null );
Cursor Resultcursor = db.rawQuery("select * from camera " + " ORDER BY " + _ID + " DESC", null);
/*Cursor c = db.query("select * from camera ", null, null, null, null, null, _ID+" DESC");
Cursor Resultcursor = sql.rawQuery("select * from camera ORDER by ID DESC,null);*/
return Resultcursor;
}
public Cursor queryLastEvents(){
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.query("camera", null, null, null, null, null, "sku ASC", "10");
return res;
}
public void deleteData(){
/* SQLiteDatabase db = this.getReadableDatabase();
db.delete(REG_TABLE, null, null);
db.close();*/
SQLiteDatabase db = this.getWritableDatabase();
db.delete(REG_TABLE, null, null);
db.close();
}
public boolean updatecamera(int id,String sku, String filename, int status){
SQLiteDatabase db = this.getWritableDatabase();
db.beginTransaction();
ContentValues contentValues = new ContentValues();
contentValues.put(SKU, sku);
contentValues.put(FILENAME, filename);
contentValues.put(STATUS, status);
db.update(REG_TABLE, contentValues, _ID + " = ?", new String[]{"" + id});
System.out.println("update ====>"+ db.update("camera", contentValues, _ID + " = ?", new String[]{"" + id}));
db.setTransactionSuccessful();
db.endTransaction();
db.close();
return true;
}
public boolean deleteContact(int id){
SQLiteDatabase db = this.getReadableDatabase();
db.beginTransaction();
db.delete(REG_TABLE, _ID + " = ?", new String[] { String.valueOf(id)});
System.out.println("Delete ===>"+db.delete(REG_TABLE, _ID + " = ?", new String[] { String.valueOf(id)}));
db.setTransactionSuccessful();
db.endTransaction();
db.close();
return true;
}
public int gettotalCount(){
int _id = 0;
SQLiteDatabase db = this.getReadableDatabase();
//Cursor Resultcursor = db.rawQuery("select _id from camera " + " ORDER BY " + _ID + " DESC", "where limit 1");
//below one index based query
Cursor cr = db.rawQuery("select _id from camera ORDER BY "+ _ID +" DESC LIMIT 1",null);
if(cr.moveToLast()){
_id = cr.getInt(0);
}
/*long count = DatabaseUtils.queryNumEntries(db, REG_TABLE);*/
db.close();
return _id;
}
}
package w.soulofpluto.camera;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
/*
Create by Ramesh Babu
*/
public class LoginActivity extends AppCompatActivity implements View.OnClickListener {
EditText user,pass;
Button login;
PreferenceManager preferenceManager;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_login);
user = findViewById(R.id.user);
pass = findViewById(R.id.pass);
login= findViewById(R.id.login);
login.setOnClickListener(this);
preferenceManager = new PreferenceManager(this);
super.onCreate(savedInstanceState);
}
@Override
public void onClick(View view){
if(view == login){
if(TextUtils.isEmpty(user.getText().toString()) && TextUtils.isEmpty(pass.getText().toString())){
Toast.makeText(LoginActivity.this, "Enter User,Password", Toast.LENGTH_SHORT).show();
}else if(TextUtils.isEmpty(user.getText().toString())){
Toast.makeText(LoginActivity.this, "Enter User", Toast.LENGTH_SHORT).show();
}else if(TextUtils.isEmpty(pass.getText().toString())){
Toast.makeText(LoginActivity.this, "Enter Password", Toast.LENGTH_SHORT).show();
}else if (user.getText().toString().equalsIgnoreCase("user") && pass.getText().toString().equalsIgnoreCase("123")){
preferenceManager.setUserId(user.getText().toString());
preferenceManager.setPassword(pass.getText().toString());
preferenceManager.setLogged(true);
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
intent.putExtra("key","success");
startActivity(intent);
finish();
}else{
Toast.makeText(LoginActivity.this, "Enter Valid User,Password", Toast.LENGTH_SHORT).show();
}
}
}
}
package w.soulofpluto.camera;
import java.util.Comparator;
/*
Create by Ramesh Babu
*/
public class Model{
private int ID;
private String SKU;
private String FILEPATH;
private int STATUS;
public int getID() {
return ID;
}
public void setID(int ID) {
this.ID = ID;
}
public String getSKU() {
return SKU;
}
public void setSKU(String SKU) {
this.SKU = SKU;
}
public String getFILEPATH() {
return FILEPATH;
}
public void setFILEPATH(String FILEPATH) {
this.FILEPATH = FILEPATH;
}
/*public int getSTATUS() {
return STATUS;
}
public void setSTATUS(int status) {
this.ID = ID;
}*/
public int getSTATUS() {
return STATUS;
}
public void setSTATUS(int STATUS) {
this.STATUS = STATUS;
}
public static Comparator<Model> OrderbyID = new Comparator<Model>(){
public int compare(Model s2, Model s1){
int S1 = s2.getID();
int S2 = s1.getID();
return S2 - S1;
}
};
}
package w.soulofpluto.camera;
import android.app.Application;
import android.util.Log;
import java.io.File;
/*
Create by Ramesh Babu
*/
public class MyApplication extends Application {
private static MyApplication instance;
@Override
public void onCreate() {
super.onCreate();
instance = this;
}
public static MyApplication getInstance() {
return instance;
}
public void clearApplicationData() {
File cache = getCacheDir();
File appDir = new File(cache.getParent());
if (appDir.exists()) {
String[] children = appDir.list();
for (String s : children) {
if (!s.equals("lib")) {
deleteDir(new File(appDir, s));
Log.i("TAG", "File /data/data/APP_PACKAGE/" + s + " DELETED");
}
}
}
}
public static boolean deleteDir(File dir) {
if (dir != null && dir.isDirectory()) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
boolean success = deleteDir(new File(dir, children[i]));
if (!success) {
return false;
}
}
}
return dir.delete();
}
}
\ No newline at end of file
package w.soulofpluto.camera;
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.camera;
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);
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, MainActivity.class));
finish();
}else{
startActivity(new Intent(SplashActivity.this, LoginActivity.class));
finish();
}
}
};
handler.postDelayed(runnable, 2500);
}
}
<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:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
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="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
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>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!-- Barcode Reader fragment -->
<fragment
android:id="@+id/barcode_fragment"
android:name="info.androidhive.barcode.BarcodeReader"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:auto_focus="true"
app:use_flash="false" />
<!-- Scanner overlay animation -->
<info.androidhive.barcode.ScannerOverlay
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#44000000"
app:line_color="#7323DC"
app:line_speed="6"
app:line_width="4"
app:square_height="500"
app:square_width="650" />
</RelativeLayout>
<?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:gravity="center"
android:layout_margin="20dp">
<EditText
android:id="@+id/user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="user"
android:singleLine="true"/>
<EditText
android:id="@+id/pass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="123"
android:singleLine="true"/>
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:textColor="@android:color/white"
android:background="@color/colorPrimary"
android:minHeight="40dp"
/>
</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="horizontal"
android:weightSum="1"
android:layout_margin="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/image_layout">
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:orientation="vertical">
<EditText
android:id="@+id/autotext"
android:layout_width="match_parent"
android:layout_height="55dp"
android:hint="SKU"
android:maxLines="2"/>
<!--
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
>
<EditText
android:id="@+id/autotext"
android:layout_width="0dp"
android:layout_height="50dp"
android:hint="SKU"
android:maxLines="2"
android:layout_weight="0.5">
</EditText>
<EditText
android:id="@+id/capture"
android:layout_width="0dp"
android:layout_height="50dp"
android:hint="Capture"
android:maxLines="2"
android:layout_weight="0.5">
</EditText>
</LinearLayout>-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_gravity="top"
android:minHeight="?attr/actionBarSize"
android:background="@color/actionbar_opacity"
app:theme="@style/TransparentToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout>
\ 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">
</LinearLayout>
\ 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"
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:layout_margin="5dp"
android:gravity="center">
<TextView
android:id="@+id/item_sku"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.30"
android:textColor="@android:color/black"
android:text="Sku"/>
<ImageView
android:id="@+id/item_image"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="0.30"
android:src="@mipmap/ic_launcher"/>
<TextView
android:id="@+id/item_progress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:textColor="@android:color/black"
android:text="In Progress"/>
<!-- <TextView
android:id="@+id/item_no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:textColor="@android:color/black"
android:text="cout"/>-->
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Barcode Reader fragment -->
<fragment
android:id="@+id/barcode_fragment"
android:name="info.androidhive.barcode.BarcodeReader"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:auto_focus="true"
app:use_flash="false" />
<!-- Scanner overlay animation -->
<info.androidhive.barcode.ScannerOverlay
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#44000000"
app:line_color="#7323DC"
app:line_speed="6"
app:line_width="4"
app:square_height="200"
app:square_width="200" />
</RelativeLayout>
<?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/menu_scan"
android:icon="@drawable/scan"
android:title="Delete"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_take_picture"
android:title="Take Picture"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_logout"
android:icon="@drawable/ic_logout_24"
android:title="Logout"
app:showAsAction="ifRoom"/>
</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="@drawable/ic_launcher_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="@drawable/ic_launcher_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">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="primary">#3F51B5</color>
<color name="primary_dark">#303F9F</color>
<color name="primary_light">#C5CAE9</color>
<color name="accent">#E040FB</color>
<color name="primary_text">#212121</color>
<color name="secondary_text">#727272</color>
<color name="actionbar_opacity">#33000000</color>
</resources>
<resources>
<string name="app_name">Camera</string>
</resources>
<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="TransparentToolbar" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:windowActionBarOverlay">true</item>
<!-- Support Library compability -->
<item name="windowActionBarOverlay">true</item>
</style>
<style name="AppOverlayTheme" parent="@style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="colorPrimary">@color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">@color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields e.g. FloatActionButton -->
<item name="colorAccent">@color/accent</item>
<!-- Title Text Color -->
<item name="android:textColorPrimary">@color/primary_text</item>
<!-- color of the menu overflow icon (three vertical dots) -->
<item name="android:textColorSecondary">@color/secondary_text</item>
</style>
</resources>
package w.soulofpluto.camera;
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()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:3.1.0'
// 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
}
# 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=-Xmx1536m
# 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
#Mon Dec 30 10:51:02 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.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='Camera'
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