├── .gitignore ├── .idea ├── .name ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── glowingsoft │ │ └── carplaterecognizer │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ │ └── com │ │ │ └── glowingsoft │ │ │ └── carplaterecognizer │ │ │ ├── api │ │ │ ├── GlobleClass.java │ │ │ └── WebRequest.java │ │ │ ├── ui │ │ │ ├── EditActivity.java │ │ │ ├── MainActivity.java │ │ │ └── SettingActivity.java │ │ │ └── utils │ │ │ └── InputFilterMinMax.java │ └── res │ │ ├── drawable-hdpi │ │ ├── ic_add_a_photo_white_24dp.png │ │ ├── ic_arrow_back_white_24dp.png │ │ ├── ic_keyboard_arrow_left_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_a400_24dp.png │ │ ├── ic_mode_edit_white_24dp.png │ │ ├── ic_settings_white_24dp.png │ │ └── ic_share_white_24dp.png │ │ ├── drawable-mdpi │ │ ├── ic_add_a_photo_white_24dp.png │ │ ├── ic_arrow_back_white_24dp.png │ │ ├── ic_keyboard_arrow_left_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_a400_24dp.png │ │ ├── ic_mode_edit_white_24dp.png │ │ ├── ic_settings_white_24dp.png │ │ └── ic_share_white_24dp.png │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable-xhdpi │ │ ├── ic_add_a_photo_white_24dp.png │ │ ├── ic_arrow_back_white_24dp.png │ │ ├── ic_keyboard_arrow_left_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_a400_24dp.png │ │ ├── ic_mode_edit_white_24dp.png │ │ ├── ic_settings_white_24dp.png │ │ └── ic_share_white_24dp.png │ │ ├── drawable-xxhdpi │ │ ├── ic_add_a_photo_white_24dp.png │ │ ├── ic_arrow_back_white_24dp.png │ │ ├── ic_keyboard_arrow_left_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_a400_24dp.png │ │ ├── ic_mode_edit_white_24dp.png │ │ ├── ic_settings_white_24dp.png │ │ └── ic_share_white_24dp.png │ │ ├── drawable-xxxhdpi │ │ ├── ic_add_a_photo_white_24dp.png │ │ ├── ic_arrow_back_white_24dp.png │ │ ├── ic_keyboard_arrow_left_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_500_36dp.png │ │ ├── ic_mode_edit_light_blue_a400_24dp.png │ │ ├── ic_mode_edit_white_24dp.png │ │ ├── ic_settings_white_24dp.png │ │ └── ic_share_white_24dp.png │ │ ├── drawable │ │ ├── cam.png │ │ ├── edittext_background.xml │ │ ├── ic_launcher_background.xml │ │ ├── loadingimage.gif │ │ ├── nothingtoshow.png │ │ ├── numpl.jpg │ │ ├── photo.png │ │ └── upload.png │ │ ├── font │ │ └── poppins.xml │ │ ├── layout │ │ ├── activity_edit.xml │ │ ├── activity_main.xml │ │ └── activity_setting.xml │ │ ├── menu │ │ └── main_menu.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ └── logo.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── font_certs.xml │ │ ├── preloaded_fonts.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── glowingsoft │ └── carplaterecognizer │ └── ExampleUnitTest.java ├── assets └── screenshot.jpg ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Plate Recognizer -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | xmlns:android 11 | 12 | ^$ 13 | 14 | 15 | 16 |
17 |
18 | 19 | 20 | 21 | xmlns:.* 22 | 23 | ^$ 24 | 25 | 26 | BY_NAME 27 | 28 |
29 |
30 | 31 | 32 | 33 | .*:id 34 | 35 | http://schemas.android.com/apk/res/android 36 | 37 | 38 | 39 |
40 |
41 | 42 | 43 | 44 | .*:name 45 | 46 | http://schemas.android.com/apk/res/android 47 | 48 | 49 | 50 |
51 |
52 | 53 | 54 | 55 | name 56 | 57 | ^$ 58 | 59 | 60 | 61 |
62 |
63 | 64 | 65 | 66 | style 67 | 68 | ^$ 69 | 70 | 71 | 72 |
73 |
74 | 75 | 76 | 77 | .* 78 | 79 | ^$ 80 | 81 | 82 | BY_NAME 83 | 84 |
85 |
86 | 87 | 88 | 89 | .* 90 | 91 | http://schemas.android.com/apk/res/android 92 | 93 | 94 | ANDROID_ATTRIBUTE_ORDER 95 | 96 |
97 |
98 | 99 | 100 | 101 | .* 102 | 103 | .* 104 | 105 | 106 | BY_NAME 107 | 108 |
109 |
110 |
111 |
112 |
113 |
-------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## LPR Android App 2 | 3 | - **Download** the [APK package](https://github.com/parkpow/alpr-anpr-android/releases). 4 | - You can also build it from source. We recommand using [Android Studio](https://developer.android.com/studio). 5 | - Get an **API token** from [Plate Recognizer](https://platerecognizer.com/) and put it in the app settings. 6 | - You may also want to check a [similar project](https://github.com/kjbaker-uk/platerecognizer-android-example) in Kotlin. 7 | 8 | ![screenshot](assets/screenshot.jpg) 9 | 10 | ## Automatic License Plate Recognition (ALPR, ANPR) on Mobile App - Android 11 | Get high-accuracy, developer-friendly **automatic license plate recognition** ([ALPR](https://platerecognizer.com/?utm_source=github&utm_medium=website)) or automatic number plate recognition ([ANPR](https://platerecognizer.com/?utm_source=github&utm_medium=website)) on a mobile app in Android! 12 | 13 | Our machine-learning software: 14 | 15 | - Works on **dark, low-res, blurry images** and tough angles, all vehicle types, etc. See our full [ALPR results](https://platerecognizer.com/alpr-results/?utm_source=github&utm_medium=website). 16 | - Decodes **license plate** , vehicle type (e.g. SUV, van, pickup truck), [**vehicle make model**](https://platerecognizer.com/vehicle-make-model-recognition-with-color/?utm_source=github&utm_medium=website) (e.g. Honda Accord), color, and orientation. Ignores bumper stickers, car signs, etc. 17 | - Is optimized for all [50 USA States](https://platerecognizer.com/alpr-for-usa/?utm_source=github&utm_medium=website), [India](https://platerecognizer.com/anpr-for-india?utm_source=github&utm_medium=website), [Brazil](https://platerecognizer.com/anpr-for-brazil/?utm_source=github&utm_medium=website) and [**90+ countries worldwide**](https://platerecognizer.com/countries/?utm_source=github&utm_medium=website). 18 | 19 | Using this Android Mobile App, you can easily take a photo with your phone camera and the app will decode the license plate seen in the photo. 20 | 21 | Sign up for a [**Free Trial**](https://app.platerecognizer.com/accounts/signup/?utm_source=github&utm_medium=website) now (no credit card required) or **learn more** at [https://platerecognizer.com](https://platerecognizer.com/). 22 | 23 | ![Plate-Recognizer-ALPR-ANPR-Github-Mobile-App](https://user-images.githubusercontent.com/61606720/103375155-4b0eba80-4a8e-11eb-8d39-4cfc3f66d7f3.jpg) 24 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 30 5 | buildToolsVersion "30.0.2" 6 | defaultConfig { 7 | applicationId "com.glowingsoft.carplaterecognizer" 8 | minSdkVersion 19 9 | targetSdkVersion 30 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | implementation fileTree(dir: 'libs', include: ['*.jar']) 24 | implementation 'androidx.appcompat:appcompat:1.1.0' 25 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 26 | testImplementation 'junit:junit:4.12' 27 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 28 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 29 | 30 | implementation 'com.github.jrvansuita:PickImage:2.5.1' 31 | implementation 'id.zelory:compressor:2.1.0' 32 | implementation 'com.squareup.picasso:picasso:2.5.2' 33 | implementation 'com.loopj.android:android-async-http:1.4.11' 34 | implementation 'com.google.android.material:material:1.1.0' 35 | } 36 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/glowingsoft/carplaterecognizer/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.glowingsoft.carplaterecognizer; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.glowingsoft.carplaterecognizer", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 19 | 23 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 42 | 45 | 46 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/glowingsoft/carplaterecognizer/api/GlobleClass.java: -------------------------------------------------------------------------------- 1 | package com.glowingsoft.carplaterecognizer.api; 2 | 3 | import android.app.Application; 4 | import android.util.Log; 5 | 6 | public class GlobleClass extends Application { 7 | private static final String TAG="Global class"; 8 | public static final String BASE_URL = "https://api.platerecognizer.com/"; 9 | public static GlobleClass singleton; 10 | 11 | @Override 12 | public void onCreate() { 13 | super.onCreate(); 14 | Log.d("response", "onCreate: url sent"); 15 | singleton=this; 16 | } 17 | public static GlobleClass getInstance(){ 18 | return singleton; 19 | } 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/glowingsoft/carplaterecognizer/api/WebRequest.java: -------------------------------------------------------------------------------- 1 | package com.glowingsoft.carplaterecognizer.api; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.preference.PreferenceManager; 6 | import android.util.Log; 7 | 8 | import com.glowingsoft.carplaterecognizer.ui.MainActivity; 9 | import com.loopj.android.http.AsyncHttpClient; 10 | import com.loopj.android.http.RequestParams; 11 | import com.loopj.android.http.ResponseHandlerInterface; 12 | 13 | public class WebRequest { 14 | public static AsyncHttpClient client; 15 | 16 | static { 17 | //create object of loopj client 18 | //443 will save you from ssl exception 19 | client = new AsyncHttpClient(true, 80, 443); 20 | 21 | 22 | } 23 | 24 | //concatenation of base url and file name 25 | // private static String getAbsoluteUrl(String relativeUrl) { 26 | // Log.d("response URL: ", GlobleClass.BASE_URL + relativeUrl+" "); 27 | // return GlobleClass.BASE_URL + relativeUrl; 28 | // } 29 | public static void post(Context context, String url, RequestParams params, ResponseHandlerInterface responseHandler) { 30 | client.post(context, url,params, responseHandler); 31 | Log.d("response", "post: request sent"); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/glowingsoft/carplaterecognizer/ui/EditActivity.java: -------------------------------------------------------------------------------- 1 | package com.glowingsoft.carplaterecognizer.ui; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.annotation.SuppressLint; 6 | import android.content.Intent; 7 | import android.os.Bundle; 8 | import android.view.View; 9 | import android.widget.Button; 10 | import android.widget.EditText; 11 | import android.widget.ImageButton; 12 | 13 | import com.glowingsoft.carplaterecognizer.R; 14 | 15 | import javax.sql.StatementEvent; 16 | 17 | public class EditActivity extends AppCompatActivity { 18 | EditText plate,region,vihical; 19 | Button saveResult; 20 | ImageButton back; 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_edit); 25 | getSupportActionBar().hide(); 26 | back=findViewById(R.id.back_btn_type); 27 | back.setOnClickListener(new View.OnClickListener() { 28 | @Override 29 | public void onClick(View v) { 30 | finish(); 31 | } 32 | }); 33 | plate = findViewById(R.id.car_plate_edit); 34 | region = findViewById(R.id.region_code_edit); 35 | vihical = findViewById(R.id.vihical_type_edit); 36 | Intent intent = getIntent(); 37 | plate.setText(intent.getStringExtra("car_plate")); 38 | region.setText(intent.getStringExtra("region_code")); 39 | vihical.setText(intent.getStringExtra("car_type")); 40 | saveResult = findViewById(R.id.save_btn); 41 | saveResult.setOnClickListener(new View.OnClickListener() { 42 | @Override 43 | public void onClick(View v) { 44 | saveDate(); 45 | } 46 | }); 47 | } 48 | 49 | private void saveDate() { 50 | String plate_edit=plate.getText().toString(); 51 | String region_edit=region.getText().toString(); 52 | String car_edit=vihical.getText().toString(); 53 | Intent data = new Intent(); 54 | data.putExtra("car_plate",plate_edit ); 55 | data.putExtra("region_code",region_edit ); 56 | data.putExtra( "car_type",car_edit); 57 | setResult(RESULT_OK, data); 58 | finish(); 59 | 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/glowingsoft/carplaterecognizer/ui/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.glowingsoft.carplaterecognizer.ui; 2 | import androidx.annotation.Nullable; 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import androidx.appcompat.widget.LinearLayoutCompat; 5 | import androidx.cardview.widget.CardView; 6 | import cz.msebera.android.httpclient.Header; 7 | import android.annotation.SuppressLint; 8 | import android.content.Context; 9 | import android.content.Intent; 10 | import android.content.SharedPreferences; 11 | import android.graphics.Bitmap; 12 | import android.graphics.BitmapFactory; 13 | import android.graphics.BlurMaskFilter; 14 | import android.graphics.Canvas; 15 | import android.graphics.Matrix; 16 | import android.graphics.Paint; 17 | import android.graphics.PorterDuff; 18 | import android.graphics.drawable.BitmapDrawable; 19 | import android.graphics.drawable.Drawable; 20 | import android.media.ExifInterface; 21 | import android.net.Uri; 22 | import android.os.Bundle; 23 | import android.os.Environment; 24 | import android.util.Log; 25 | import android.view.Gravity; 26 | import android.view.Menu; 27 | import android.view.MenuInflater; 28 | import android.view.MenuItem; 29 | import android.view.View; 30 | import android.widget.Button; 31 | import android.widget.ImageButton; 32 | import android.widget.ImageView; 33 | import android.widget.ProgressBar; 34 | import android.widget.TextView; 35 | import android.widget.Toast; 36 | 37 | import com.glowingsoft.carplaterecognizer.R; 38 | import com.glowingsoft.carplaterecognizer.api.WebRequest; 39 | import com.google.android.material.floatingactionbutton.FloatingActionButton; 40 | import com.loopj.android.http.JsonHttpResponseHandler; 41 | import com.loopj.android.http.RequestParams; 42 | import com.squareup.picasso.Callback; 43 | import com.squareup.picasso.Picasso; 44 | import com.vansuita.pickimage.bean.PickResult; 45 | import com.vansuita.pickimage.bundle.PickSetup; 46 | import com.vansuita.pickimage.dialog.PickImageDialog; 47 | import com.vansuita.pickimage.enums.EPickType; 48 | import com.vansuita.pickimage.listeners.IPickResult; 49 | import org.json.JSONArray; 50 | import org.json.JSONException; 51 | import org.json.JSONObject; 52 | import java.io.File; 53 | import java.io.FileInputStream; 54 | import java.io.FileNotFoundException; 55 | import java.io.FileOutputStream; 56 | import java.io.IOException; 57 | import java.text.DateFormat; 58 | import java.text.SimpleDateFormat; 59 | import java.util.Date; 60 | import java.util.Locale; 61 | import java.util.TimeZone; 62 | 63 | public class MainActivity extends AppCompatActivity implements IPickResult,View.OnClickListener { 64 | ImageView imageView,emptyImage; 65 | TextView plate_txt,region_txt,vihical_txt; 66 | Context context; 67 | ImageButton editResult; 68 | Button nextImage; 69 | ProgressBar progressBar; 70 | SharedPreferences sharedPreferences; 71 | String SHARED_PREF_NAME ="user_pref"; 72 | String token = ""; 73 | String countrycode=""; 74 | Date date; 75 | DateFormat df; 76 | String plate_type="",region_type="",car_type="",last_digits="",timeStamp=""; 77 | CardView plateCard,regionCard,vihicalCard; 78 | FloatingActionButton floatingActionButton; 79 | String imagepath; 80 | 81 | 82 | 83 | 84 | @Override 85 | protected void onCreate(Bundle savedInstanceState) { 86 | super.onCreate(savedInstanceState); 87 | context=this; 88 | setContentView(R.layout.activity_main); 89 | sharedPreferences=getSharedPreferences(SHARED_PREF_NAME,MODE_PRIVATE); 90 | date = new Date(); 91 | df = new SimpleDateFormat("MM/dd/"); 92 | // Use London time zone to format the date in 93 | df.setTimeZone(TimeZone.getTimeZone("Etc/UTC")); 94 | nextImage=findViewById(R.id.next_image); 95 | nextImage.setOnClickListener(this); 96 | floatingActionButton=findViewById(R.id.fab); 97 | floatingActionButton.setOnClickListener(this); 98 | progressBar=findViewById(R.id.homeprogress); 99 | plate_txt = findViewById(R.id.car_plate); 100 | region_txt = findViewById(R.id.region_code); 101 | vihical_txt = findViewById(R.id.vihicle_type); 102 | emptyImage=findViewById(R.id.empty_image); 103 | plateCard=findViewById(R.id.cardView); 104 | vihicalCard=findViewById(R.id.cardView3); 105 | regionCard=findViewById(R.id.cardView2); 106 | editResult=findViewById(R.id.setting_edit_btn); 107 | editResult.setOnClickListener(this); 108 | imageView = findViewById(R.id.imageView); 109 | imageView.setOnClickListener(this); 110 | } 111 | //dialoag box setup 112 | @SuppressLint("WrongConstant") 113 | PickSetup setup = new PickSetup() 114 | .setTitle("Choose") 115 | .setCancelText("Cancel") 116 | .setFlip(true) 117 | .setMaxSize(50) 118 | .setWidth(50) 119 | .setHeight(50) 120 | .setProgressText("Loading Image") 121 | .setPickTypes(EPickType.GALLERY, EPickType.CAMERA) 122 | .setCameraButtonText("Camera") 123 | .setGalleryButtonText("Gallery") 124 | .setIconGravity(Gravity.TOP) 125 | .setButtonOrientation(LinearLayoutCompat.HORIZONTAL) 126 | .setSystemDialog(false) 127 | .setGalleryIcon(R.drawable.photo) 128 | .setCameraIcon(R.drawable.cam); 129 | 130 | //to change token value 131 | @Override 132 | protected void onResume() { 133 | super.onResume(); 134 | // String editvisibility=plate_txt.getText().toString(); 135 | if( sharedPreferences.contains("checked") && sharedPreferences.getBoolean("checked", false)) { 136 | editResult.setVisibility(View.VISIBLE); 137 | } 138 | else { 139 | editResult.setVisibility(View.GONE); 140 | } 141 | last_digits=sharedPreferences.getString("LastDigits", ""); 142 | // Toast.makeText(MainActivity.this, last_digits, Toast.LENGTH_SHORT).show(); 143 | token=sharedPreferences.getString("CarToken", ""); 144 | if (token.equals("")){ 145 | Toast.makeText(context, "Token Not Found", Toast.LENGTH_SHORT).show(); 146 | }else { 147 | WebRequest.client.addHeader("Authorization","Token "+token); 148 | } 149 | } 150 | //pick result method to get image after getting image form gallary or camera 151 | @Override 152 | public void onPickResult(PickResult r) { 153 | if (r.getError() == null) { 154 | RequestParams params=new RequestParams(); 155 | String file=r.getPath(); 156 | String compressed=compressImage(file); 157 | countrycode=sharedPreferences.getString("RegionCode",""); 158 | String baseurl=sharedPreferences.getString("BaseUrl","https://api.platerecognizer.com/v1/plate-reader/"); 159 | 160 | 161 | Log.d("response", "filepath: "+file+" "); 162 | try { 163 | params.put("upload", new File(compressed)); 164 | } catch (FileNotFoundException e) { 165 | e.printStackTrace(); 166 | } 167 | params.put("regions",countrycode); 168 | Log.d("response", "image to upload: "+params+" "); 169 | WebRequest.post(context,baseurl,params,new JsonHttpResponseHandler() 170 | { 171 | @Override 172 | public void onStart() { 173 | progressBar.setVisibility(View.VISIBLE); 174 | region_txt.setText(null); 175 | plate_txt.setText(null); 176 | vihical_txt.setText(null); 177 | imageView.setImageResource(R.drawable.upload); 178 | 179 | Log.d("response", "onStart: "); 180 | super.onStart(); 181 | } 182 | @Override 183 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { 184 | super.onSuccess(statusCode, headers, response); 185 | 186 | Log.d("response ",response.toString()+" "); 187 | try { 188 | //image path 189 | imagepath="https://us-east-1.linodeobjects.com/platerec-api/uploads/"+df.format(date)+response.getString("filename"); 190 | //json array or results 191 | JSONArray Jsresults = response.getJSONArray("results"); 192 | if (Jsresults.length()>0) 193 | { 194 | for (int i = 0; i < Jsresults.length(); i++) { 195 | JSONObject tabObj = Jsresults.getJSONObject(i); 196 | plate_txt.setText(tabObj.getString("plate")); 197 | region_txt.setText(tabObj.getJSONObject("region").getString("code")); 198 | vihical_txt.setText(tabObj.getJSONObject("vehicle").getString("type")); 199 | timeStamp=response.getString("timestamp"); 200 | Picasso.with(context) 201 | .load(imagepath) 202 | .into(imageView, new Callback() { 203 | @Override 204 | public void onSuccess() { 205 | progressBar.setVisibility(View.GONE); 206 | } 207 | @Override 208 | public void onError() { 209 | 210 | } 211 | }); 212 | regionCard.setVisibility(View.VISIBLE); 213 | plateCard.setVisibility(View.VISIBLE); 214 | vihicalCard.setVisibility(View.VISIBLE); 215 | nextImage.setVisibility(View.VISIBLE); 216 | floatingActionButton.setVisibility(View.VISIBLE); 217 | emptyImage.setVisibility(View.GONE); 218 | } 219 | 220 | } 221 | } catch (JSONException e) { 222 | e.printStackTrace(); 223 | } 224 | } 225 | @Override 226 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { 227 | super.onFailure(statusCode, headers, throwable, errorResponse); 228 | Log.d("response1", "onFailure: " + errorResponse + " "); 229 | progressBar.setVisibility(View.GONE); 230 | editResult.setVisibility(View.GONE); 231 | regionCard.setVisibility(View.GONE); 232 | plateCard.setVisibility(View.GONE); 233 | vihicalCard.setVisibility(View.GONE); 234 | nextImage.setVisibility(View.GONE); 235 | floatingActionButton.setVisibility(View.GONE); 236 | emptyImage.setVisibility(View.VISIBLE); 237 | Toast.makeText(MainActivity.this, errorResponse+"", Toast.LENGTH_SHORT).show(); 238 | } 239 | @Override 240 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONArray errorResponse) { 241 | super.onFailure(statusCode, headers, throwable, errorResponse); 242 | Log.d("response2", "onFailure: "+errorResponse+" "); 243 | progressBar.setVisibility(View.GONE); 244 | editResult.setVisibility(View.GONE); 245 | regionCard.setVisibility(View.GONE); 246 | plateCard.setVisibility(View.GONE); 247 | vihicalCard.setVisibility(View.GONE); 248 | nextImage.setVisibility(View.GONE); 249 | emptyImage.setVisibility(View.VISIBLE); 250 | Toast.makeText(MainActivity.this,errorResponse.toString()+"",Toast.LENGTH_LONG).show(); 251 | } 252 | @Override 253 | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { 254 | super.onFailure(statusCode, headers, responseString, throwable); 255 | Log.d("response3", "onFailure: "+responseString+" "); 256 | progressBar.setVisibility(View.GONE); 257 | editResult.setVisibility(View.GONE); 258 | regionCard.setVisibility(View.GONE); 259 | plateCard.setVisibility(View.GONE); 260 | vihicalCard.setVisibility(View.GONE); 261 | nextImage.setVisibility(View.GONE); 262 | emptyImage.setVisibility(View.VISIBLE); 263 | Toast.makeText(MainActivity.this,responseString+"No Internet Connection",Toast.LENGTH_LONG).show(); 264 | } 265 | }); 266 | } else { 267 | //Handle possible errors 268 | //TODO: do what you have to do with r.getError(); 269 | Toast.makeText(this, r.getError().getMessage(), Toast.LENGTH_LONG).show(); 270 | } 271 | } 272 | 273 | @Override 274 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 275 | super.onActivityResult(requestCode, resultCode, data); 276 | //check if request code is for inserting new list then perform insertion 277 | if (requestCode == 123 && resultCode == RESULT_OK) { 278 | String plate = data.getStringExtra("car_plate"); 279 | String region = data.getStringExtra("region_code"); 280 | String car = data.getStringExtra("car_type"); 281 | Log.d("response", "onActivityResult: "+plate+" "); 282 | plate_txt.setText(plate); 283 | region_txt.setText(region); 284 | vihical_txt.setText(car); 285 | Toast.makeText(this, "Results saved", Toast.LENGTH_SHORT).show(); 286 | } 287 | } 288 | @Override 289 | public void onClick(View v) { 290 | if (v.getId()==R.id.imageView) 291 | { 292 | if (token.isEmpty()) { 293 | Toast.makeText(this,"Go to Settings to Set Your Token", Toast.LENGTH_LONG).show(); 294 | return; 295 | } 296 | PickImageDialog.build(setup).show(MainActivity.this); 297 | } 298 | if (v.getId()==R.id.setting_edit_btn) 299 | { 300 | 301 | plate_type = plate_txt.getText().toString(); 302 | region_type=region_txt.getText().toString(); 303 | car_type=vihical_txt.getText().toString(); 304 | if (plate_type.isEmpty()) 305 | { 306 | Toast.makeText(MainActivity.this,"Nothing to Edit Now",Toast.LENGTH_SHORT).show(); 307 | } 308 | else { 309 | Intent intent = new Intent(MainActivity.this, EditActivity.class); 310 | intent.putExtra("car_plate", plate_type); 311 | intent.putExtra("region_code", region_type); 312 | intent.putExtra("car_type", car_type); 313 | startActivityForResult(intent, 123); 314 | } 315 | } 316 | if (v.getId()==R.id.next_image) 317 | { 318 | PickImageDialog.build(setup).show(MainActivity.this); 319 | } 320 | if (v.getId()==R.id.fab) 321 | { 322 | String plate = plate_txt.getText().toString(); 323 | String region = region_txt.getText().toString(); 324 | String car = vihical_txt.getText().toString(); 325 | Uri bmpUri = getLocalBitmapUri(imageView); 326 | //set it as current date. 327 | String share="Date & TimeStamp: "+timeStamp+"\nCar Plate: "+plate+"\nRegion Code: "+region+"\nVihicle Type: "+car+"\nToken Code: "+last_digits; 328 | Log.d("response", "onActivityResult: "+plate+" "); 329 | if (bmpUri != null) { 330 | Uri imageUri = Uri.parse("android.resource://" + getPackageName() 331 | + "/drawable/" + "ic_launcher"); 332 | Intent shareIntent = new Intent(); 333 | shareIntent.setAction(Intent.ACTION_SEND); 334 | shareIntent.putExtra(Intent.EXTRA_TEXT, share); 335 | shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); 336 | shareIntent.setType("image/jpeg"); 337 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 338 | startActivity(Intent.createChooser(shareIntent, "send")); 339 | } 340 | else { 341 | Log.d("response", "onFailure:"); 342 | } 343 | } 344 | } 345 | 346 | 347 | @Override 348 | public boolean onCreateOptionsMenu(Menu menu) { 349 | MenuInflater inflater = getMenuInflater(); 350 | inflater.inflate(R.menu.main_menu, menu); 351 | return true; 352 | } 353 | @Override 354 | public boolean onOptionsItemSelected(MenuItem item) { 355 | if (item.getItemId()==R.id.settings) 356 | { 357 | Intent intent =new Intent(MainActivity.this,SettingActivity.class); 358 | startActivity(intent); 359 | return true; 360 | } 361 | return super.onOptionsItemSelected(item); 362 | } 363 | public Uri getLocalBitmapUri(ImageView imageView) { 364 | // Extract Bitmap from ImageView drawable 365 | Drawable drawable = imageView.getDrawable(); 366 | Bitmap bmp = null; 367 | if (drawable instanceof BitmapDrawable){ 368 | bmp = ((BitmapDrawable) imageView.getDrawable()).getBitmap(); 369 | } else { 370 | return null; 371 | } 372 | // Store image to default external storage directory 373 | Uri bmpUri = null; 374 | try { 375 | File file = new File(Environment.getExternalStorageDirectory().getPath(), 376 | ".Foldername/PlateRecognizer" + System.currentTimeMillis() + ".jpeg"); 377 | file.getParentFile().mkdirs(); 378 | FileOutputStream out = new FileOutputStream(file); 379 | bmp.compress(Bitmap.CompressFormat.JPEG, 100, out); 380 | out.close(); 381 | bmpUri = Uri.fromFile(file); 382 | } catch (IOException e) { 383 | e.printStackTrace(); 384 | } 385 | return bmpUri; 386 | } 387 | 388 | public String compressImage(String filePath) { 389 | 390 | int resized=sharedPreferences.getInt("Resize", -1); 391 | 392 | Bitmap scaledBitmap = null; 393 | BitmapFactory.Options options = new BitmapFactory.Options(); 394 | options.inJustDecodeBounds = true; 395 | Bitmap bmp = BitmapFactory.decodeFile(filePath, options); 396 | 397 | int actualHeight = options.outHeight; 398 | int actualWidth = options.outWidth; 399 | 400 | float maxHeight =resized*7.0f; 401 | float maxWidth = resized*12.0f; 402 | float imgRatio = actualWidth / actualHeight; 403 | float maxRatio = maxWidth / maxHeight; 404 | 405 | if (actualHeight > maxHeight || actualWidth > maxWidth) 406 | { 407 | if (imgRatio < maxRatio) { 408 | imgRatio = maxHeight / actualHeight; 409 | actualWidth = (int) (imgRatio * actualWidth); 410 | actualHeight = (int) maxHeight; 411 | 412 | } else if (imgRatio > maxRatio) { 413 | imgRatio = maxWidth / actualWidth; 414 | actualHeight = (int) (imgRatio * actualHeight); 415 | actualWidth = (int) maxWidth; 416 | } else { 417 | actualHeight = (int) maxHeight; 418 | actualWidth = (int) maxWidth; 419 | } 420 | } 421 | options.inSampleSize = calculateInSampleSize(options, actualWidth, 422 | actualHeight); 423 | // inJustDecodeBounds set to false to load the actual bitmap 424 | options.inJustDecodeBounds = false; 425 | // this options allow android to claim the bitmap memory if it runs low on memory 426 | options.inPurgeable = true; 427 | options.inInputShareable = true; 428 | options.inTempStorage = new byte[16 * 1024]; 429 | try { 430 | // load the bitmap from its path 431 | bmp = BitmapFactory.decodeFile(filePath, options); 432 | } catch (OutOfMemoryError exception) { 433 | exception.printStackTrace(); 434 | } 435 | try { 436 | scaledBitmap = Bitmap.createBitmap(actualWidth, 437 | actualHeight,Bitmap.Config.ARGB_8888); 438 | } catch (OutOfMemoryError exception) { 439 | exception.printStackTrace(); 440 | } 441 | float ratioX = actualWidth / (float) options.outWidth; 442 | float ratioY = actualHeight / (float) options.outHeight; 443 | float middleX = actualWidth / 2.0f; 444 | float middleY = actualHeight / 2.0f; 445 | 446 | Matrix scaleMatrix = new Matrix(); 447 | scaleMatrix.setScale(ratioX, ratioY, middleX, middleY); 448 | 449 | Canvas canvas = new Canvas(scaledBitmap); 450 | canvas.setMatrix(scaleMatrix); 451 | canvas.drawBitmap(bmp, middleX - bmp.getWidth() / 2, middleY - bmp.getHeight() / 2, new Paint(Paint.FILTER_BITMAP_FLAG)); 452 | // check the rotation of the image and display it properly 453 | ExifInterface exif; 454 | try { 455 | exif = new ExifInterface(filePath); 456 | int orientation = exif.getAttributeInt( 457 | ExifInterface.TAG_ORIENTATION, 0); 458 | Log.d("EXIF", "Exif: " + orientation); 459 | Matrix matrix = new Matrix(); 460 | if (orientation == 6) { 461 | matrix.postRotate(90); 462 | Log.d("EXIF", "Exif: " + orientation); 463 | } else if (orientation == 3) { 464 | matrix.postRotate(180); 465 | Log.d("EXIF", "Exif: " + orientation); 466 | } else if (orientation == 8) { 467 | matrix.postRotate(270); 468 | Log.d("EXIF", "Exif: " + orientation); 469 | } 470 | scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, 471 | scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix, 472 | true); 473 | } catch (IOException e) { 474 | e.printStackTrace(); 475 | } 476 | FileOutputStream out = null; 477 | String filename = getFilename(this); 478 | try { 479 | out = new FileOutputStream(filename); 480 | // write the compressed bitmap at the destination specified by filename. 481 | scaledBitmap.compress(Bitmap.CompressFormat.JPEG, resized, out); 482 | 483 | } catch (FileNotFoundException e) { 484 | e.printStackTrace(); 485 | } 486 | return filename; 487 | } 488 | public static String getFilename(Context context) { 489 | File file = new File(context.getFilesDir().getPath(), ".Foldername/PlateRecognizerHistory"); 490 | 491 | if (!file.exists()) { 492 | file.mkdirs(); 493 | } 494 | String uriSting = (file.getAbsolutePath() + "/" + System.currentTimeMillis() + ".jpg"); 495 | 496 | return uriSting; 497 | 498 | } 499 | 500 | public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { 501 | 502 | final int height = options.outHeight; 503 | 504 | final int width = options.outWidth; 505 | 506 | int inSampleSize = 1; 507 | 508 | if (height > reqHeight || width > reqWidth) { 509 | 510 | final int heightRatio = Math.round((float) height/ (float) 511 | reqHeight); 512 | 513 | final int widthRatio = Math.round((float) width / (float) reqWidth); 514 | 515 | inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio; 516 | 517 | } final float totalPixels = width * height; 518 | 519 | final float totalReqPixelsCap = reqWidth * reqHeight * 2; 520 | 521 | while (totalPixels / (inSampleSize * inSampleSize) > totalReqPixelsCap) { 522 | inSampleSize++; 523 | } 524 | return inSampleSize; 525 | } 526 | } 527 | -------------------------------------------------------------------------------- /app/src/main/java/com/glowingsoft/carplaterecognizer/ui/SettingActivity.java: -------------------------------------------------------------------------------- 1 | package com.glowingsoft.carplaterecognizer.ui; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import androidx.constraintlayout.widget.ConstraintLayout; 5 | 6 | import android.content.SharedPreferences; 7 | import android.os.Bundle; 8 | import android.text.InputFilter; 9 | import android.view.View; 10 | import android.widget.AdapterView; 11 | import android.widget.ArrayAdapter; 12 | import android.widget.Button; 13 | import android.widget.CheckBox; 14 | import android.widget.EditText; 15 | import android.widget.ImageButton; 16 | import android.widget.Spinner; 17 | import android.widget.TextView; 18 | import android.widget.Toast; 19 | 20 | import com.glowingsoft.carplaterecognizer.utils.InputFilterMinMax; 21 | import com.glowingsoft.carplaterecognizer.R; 22 | 23 | import java.util.ArrayList; 24 | 25 | public class SettingActivity extends AppCompatActivity { 26 | EditText apitoken,regionCodeEdit; 27 | Button applychanged; 28 | String SHARED_PREF_NAME ="user_pref"; 29 | SharedPreferences pref; 30 | ImageButton imageButton; 31 | TextView currenttoken; 32 | SharedPreferences.Editor editor; 33 | ConstraintLayout currentlayout,editlayout; 34 | String token = ""; 35 | // String token = "ddecd03711e795147f3feb345ec198eff5d957b6"; 36 | String defaultUrl="https://api.platerecognizer.com/v1/plate-reader/"; 37 | String regioncode=""; 38 | CheckBox checkBox; 39 | EditText urlEdit; 40 | Spinner resizeImageEdit; 41 | ArrayAdapter adapter; 42 | 43 | @Override 44 | protected void onCreate(Bundle savedInstanceState) { 45 | super.onCreate(savedInstanceState); 46 | setContentView(R.layout.activity_setting); 47 | getSupportActionBar().hide(); 48 | currentlayout=findViewById(R.id.current_token_layout); 49 | editlayout=findViewById(R.id.edit_current_token_layout); 50 | imageButton=findViewById(R.id.setting_edit_btn); 51 | currenttoken=findViewById(R.id.current_token); 52 | checkBox=findViewById(R.id.checkBox); 53 | resizeImageEdit = findViewById(R.id.spinner); 54 | // Create an ArrayAdapter using the string array and a default spinner layout 55 | adapter = ArrayAdapter.createFromResource(this, 56 | R.array.size, android.R.layout.simple_spinner_item); 57 | // Specify the layout to use when the list of choices appears 58 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 59 | // Apply the adapter to the spinner 60 | resizeImageEdit.setAdapter(adapter); 61 | urlEdit=findViewById(R.id.default_url); 62 | urlEdit.setText(defaultUrl); 63 | 64 | imageButton.setOnClickListener(new View.OnClickListener() { 65 | @Override 66 | public void onClick(View v) { 67 | currentlayout.setVisibility(View.GONE); 68 | editlayout.setVisibility(View.VISIBLE); 69 | } 70 | }); 71 | 72 | pref =getSharedPreferences(SHARED_PREF_NAME, MODE_PRIVATE); 73 | editor = pref.edit();; 74 | ImageButton back =findViewById(R.id.backT_btn_type); 75 | back.setOnClickListener(new View.OnClickListener() { 76 | @Override 77 | public void onClick(View v) { 78 | finish(); 79 | } 80 | }); 81 | apitoken=findViewById(R.id.token_Code); 82 | regionCodeEdit=findViewById(R.id.editText2); 83 | regioncode=pref.getString("RegionCode",""); 84 | regionCodeEdit.setText(regioncode); 85 | applychanged=findViewById(R.id.button); 86 | String settoken=""; 87 | String edittedtoken ="",gettoken=""; 88 | edittedtoken=pref.getString("CarToken", ""); 89 | apitoken.setText(edittedtoken); 90 | if (edittedtoken.isEmpty()) 91 | { 92 | currenttoken.setText("No Token"); 93 | apitoken.setText(token); 94 | } 95 | if (!edittedtoken.isEmpty()) { 96 | gettoken = apitoken.getText().toString(); 97 | settoken = gettoken.substring(gettoken.length() - 6); 98 | currenttoken.setText("**********" + settoken); 99 | } 100 | applychanged.setOnClickListener(new View.OnClickListener() { 101 | @Override 102 | public void onClick(View v) { 103 | if (apitoken.equals("") || apitoken.length()<1){ 104 | apitoken.setError("Add Token"); 105 | }else { 106 | String currentToken = apitoken.getText().toString(); 107 | editor.putString("CarToken", currentToken).apply(); 108 | String regioncodes =regionCodeEdit.getText().toString(); 109 | editor.putString("RegionCode",regioncodes).apply(); 110 | String lastDigits = currentToken.substring(currentToken.length()-6); 111 | editor.putString("LastDigits",lastDigits).apply(); 112 | String reziseString=resizeImageEdit.getSelectedItem().toString(); 113 | int resizeInt=Integer.parseInt(reziseString); 114 | editor.putInt("Resize",resizeInt).apply(); 115 | String baseurl = urlEdit.getText().toString(); 116 | editor.putString("BaseUrl",baseurl); 117 | 118 | // save inputed spinner position to sharedpreferences 119 | int userChoice = resizeImageEdit.getSelectedItemPosition(); 120 | editor.putInt("userChoiceSpinner", userChoice); 121 | editor.commit(); 122 | finish(); 123 | Toast.makeText(SettingActivity.this, "Saved Successfully", Toast.LENGTH_SHORT).show(); 124 | } 125 | if(checkBox.isChecked()) { 126 | editor.putBoolean("checked", true); 127 | editor.apply(); 128 | }else{ 129 | editor.putBoolean("checked", false); 130 | editor.apply(); 131 | } 132 | } 133 | }); 134 | } 135 | 136 | @Override 137 | protected void onResume() { 138 | super.onResume(); 139 | if(pref.contains("checked") && pref.getBoolean("checked",false) == true) { 140 | checkBox.setChecked(true); 141 | }else { 142 | checkBox.setChecked(false); 143 | } 144 | String baseurl=pref.getString("BaseUrl","https://api.platerecognizer.com/v1/plate-reader/"); 145 | urlEdit.setText(baseurl); 146 | 147 | int spinnerValue = pref.getInt("userChoiceSpinner",-1); 148 | if(spinnerValue != -1) 149 | // set the value of the spinner 150 | resizeImageEdit.setSelection(spinnerValue); 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /app/src/main/java/com/glowingsoft/carplaterecognizer/utils/InputFilterMinMax.java: -------------------------------------------------------------------------------- 1 | package com.glowingsoft.carplaterecognizer.utils; 2 | 3 | import android.text.InputFilter; 4 | import android.text.Spanned; 5 | 6 | public class InputFilterMinMax implements InputFilter { 7 | private int min, max; 8 | 9 | public InputFilterMinMax(int min, int max) { 10 | this.min = min; 11 | this.max = max; 12 | } 13 | @Override 14 | public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { 15 | try { 16 | int input = Integer.parseInt(dest.toString() + source.toString()); 17 | if (isInRange(min, max, input)) 18 | return null; 19 | } catch (NumberFormatException nfe) { } 20 | return ""; 21 | } 22 | 23 | private boolean isInRange(int a, int b, int c) { 24 | return b > a ? c >= a && c <= b : c >= b && c <= a; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_add_a_photo_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-hdpi/ic_add_a_photo_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-hdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_mode_edit_light_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-hdpi/ic_mode_edit_light_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_mode_edit_light_blue_a400_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-hdpi/ic_mode_edit_light_blue_a400_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_mode_edit_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-hdpi/ic_mode_edit_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-hdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_share_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-hdpi/ic_share_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_add_a_photo_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-mdpi/ic_add_a_photo_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-mdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_mode_edit_light_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-mdpi/ic_mode_edit_light_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_mode_edit_light_blue_a400_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-mdpi/ic_mode_edit_light_blue_a400_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_mode_edit_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-mdpi/ic_mode_edit_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-mdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_share_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-mdpi/ic_share_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_add_a_photo_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xhdpi/ic_add_a_photo_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xhdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_mode_edit_light_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xhdpi/ic_mode_edit_light_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_mode_edit_light_blue_a400_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xhdpi/ic_mode_edit_light_blue_a400_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_mode_edit_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xhdpi/ic_mode_edit_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_share_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xhdpi/ic_share_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_add_a_photo_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxhdpi/ic_add_a_photo_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxhdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_mode_edit_light_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxhdpi/ic_mode_edit_light_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_mode_edit_light_blue_a400_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxhdpi/ic_mode_edit_light_blue_a400_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_mode_edit_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxhdpi/ic_mode_edit_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_add_a_photo_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxxhdpi/ic_add_a_photo_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxxhdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_mode_edit_light_blue_500_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxxhdpi/ic_mode_edit_light_blue_500_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_mode_edit_light_blue_a400_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxxhdpi/ic_mode_edit_light_blue_a400_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_mode_edit_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxxhdpi/ic_mode_edit_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/cam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable/cam.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/edittext_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/loadingimage.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable/loadingimage.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/nothingtoshow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable/nothingtoshow.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/numpl.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable/numpl.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/photo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable/photo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parkpow/alpr-anpr-android/05315858c60415e772bd41affed4d0806ef3a8ef/app/src/main/res/drawable/upload.png -------------------------------------------------------------------------------- /app/src/main/res/font/poppins.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_edit.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 13 | 29 | 30 | 36 | 37 | 38 | 39 | 40 | 55 | 56 | 72 | 73 | 89 | 90 | 266 | 267 | 281 | 282 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_setting.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 31 | 32 | 38 | 39 | 40 | 44 | 45 | 46 | 49 | 50 | 67 | 68 | 79 | 80 | 96 | 97 | 110 | 111 | 112 | 113 | 129 | 130 | 146 | 147 |