<jupyter_start><jupyter_text>Development Learning Journal 1. Initial Settings & `activity_main.xml`  **Notes and References**Hi. I'm currently learning android development and this is my personal learning notebook. All the code is from GeeksforGeeks and you can watch the original tutorial in the below link. Have fun learning :) !https://www.youtube.com/watch?v=wFHR-dR7TpQ&ab_channel=GeeksforGeeks  New Concepts & Methods- `android:layout_centerHorizontal="true"`- `android:layout_marginStart="20dp"`- `android:layout_marginEnd="20dp"`- `android:textAllCaps="false"`- `android:background="@drawable/button_back"`- `app:backgroundTint="@color/yellow"`:  - Attention! this is `app`, NOT `android`!  Dependencies & External resources configration  1 Firebasehttps://console.firebase.google.com<jupyter_code>path1 = "/content/here/MyDrive/Android/Text Recognition App/01 Tool-Firebase.png"
path2 = "/content/here/MyDrive/Android/Text Recognition App/02 Firebase-ML Kit.png"
path3 = "/content/here/MyDrive/Android/Text Recognition App/03 Add ML Kit to your app.png"
fig, ax = plt.subplots(1, 3, figsize=(15, 25))

img1 = cv2.imread(path1)
img2 = cv2.imread(path2)
img3 = cv2.imread(path3)

ax[0].imshow(img1)
ax[0].axis('off')
ax[1].imshow(img2)
ax[1].axis('off')
ax[2].imshow(img3)
ax[2].axis('off')
plt.tight_layout()<jupyter_output><empty_output><jupyter_text>2 `Dependencies` - Firebase & ML KitAdd in `build.gradle (Module)`:1. Firebase2. ML Kit Text Recognition- Remove:  - `implementation 'com.google.firebase:firebase-ml-vision:24.0.1'`- Add instead:    - `implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.2.0'`<jupyter_code>dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    implementation 'com.google.firebase:firebase-core:19.0.0'                           # Add this
    implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.2.0' # Add this
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

# Then sync now!<jupyter_output><empty_output><jupyter_text>3 Set `colors.xml`- path: `[res]`-`[values]`-`[colors.xml]`<jupyter_code><?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="purple_200">#FFBB86FC</color>
    <color name="purple_500">#FF6200EE</color>
    <color name="purple_700">#FF3700B3</color>
    <color name="teal_200">#FF03DAC5</color>
    <color name="teal_700">#FF018786</color>
    <color name="black">#FF000000</color>
    <color name="white">#FFFFFFFF</color>

    <color name="black_shade_1">#292D36</color> # add this
    <color name="yellow">#ffa500</color>        # add this. (yellow for text)
</resources><jupyter_output><empty_output><jupyter_text>4 Set permissions in `AndroidManifest.xml`- for camera and- for internet<jupyter_code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.textdetector">

    <uses-permission android:name="android.permission.CAMERA"/>     # add this
    <uses-permission android:name="android.permission.INTERNET"/>   # add this.

    <application
        ...
        
    </application>
</manifest><jupyter_output><empty_output><jupyter_text>5 Image resources into `[res] > [drawable]`<jupyter_code>fig, ax = plt.subplots(1, 2, figsize=(13, 25))

path1 = "/content/here/MyDrive/Android/Text Recognition App/Drawable 01.png"
path2 = "/content/here/MyDrive/Android/Text Recognition App/Drawable 02.png"

img1 = cv2.imread(path1)
img2 = cv2.imread(path2)

ax[0].imshow(img1)
ax[0].axis('off')
ax[1].imshow(img2)
ax[1].axis('off')
plt.tight_layout()<jupyter_output><empty_output><jupyter_text>6 Set App Iconin `AndroidManifest.xml`<jupyter_code>path1 = "/content/here/MyDrive/Android/Text Recognition App/App Icon 01.png"
path2 = "/content/here/MyDrive/Android/Text Recognition App/App Icon 02.png"

fig, ax = plt.subplots(1, 2, figsize=(13, 25))

img1 = cv2.imread(path1)
img2 = cv2.imread(path2)

ax[0].imshow(img1)
ax[0].axis('off')
ax[1].imshow(img2)
ax[1].axis('off')
plt.tight_layout()
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.textdetector">

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/scanner"      # Change this to icon of your choice.
        android:label="@string/app_name"
        android:roundIcon="@drawable/scanner" # Change this as well.
        ...
    </application>

</manifest><jupyter_output><empty_output><jupyter_text>7 `Drawable Resource File`- for a custom made button<jupyter_code>path1 = "/content/here/MyDrive/Android/Text Recognition App/Drawable resource file 01.png"
path2 = "/content/here/MyDrive/Android/Text Recognition App/Drawable resource file 02.png"
path3 = "/content/here/MyDrive/Android/Text Recognition App/Drawable resource file 03.png"

paths = [path1, path2, path3]

for path in paths:
    show(path)
    print('')<jupyter_output><empty_output><jupyter_text>8 Create components - `ImageView`, `TextView` & `Button`<jupyter_code>path1 = "/content/here/MyDrive/Android/Text Recognition App/Layout - TextView.png"
path2 = "/content/here/MyDrive/Android/Text Recognition App/Layout - Button.png"

paths = [path1, path2]

for path in paths:
    show(path)
    print('')
# activity_main.xml

<?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"
    android:background="@color/black_shade_1"
    tools:context=".MainActivity">

    <ImageView
        android:id="@+id/idVILogo"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_centerHorizontal="true"
        android:src="@drawable/scanner"
        android:layout_marginTop="70dp"
        />

    <TextView
        android:id="@+id/idTVHead"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/idVILogo"
        android:text="Welcome to Text Detector"
        android:textAlignment="center"
        android:gravity="center"
        android:layout_centerHorizontal="true"
        android:textColor="@color/yellow"
        android:textSize="18sp"
        android:textStyle="bold"
        android:layout_marginStart="20dp"
        android:layout_marginEnd="20dp"
        android:layout_marginTop="30dp"
        android:layout_marginBottom="10dp"/>

    <Button
        android:id="@+id/idBtnCapture"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/idTVHead"
        android:layout_marginStart="20dp"
        android:layout_marginEnd="20dp"
        android:layout_marginTop="30dp"
        android:text="Capture Image"
        android:textAllCaps="false"
        android:background="@drawable/button_back"
        app:backgroundTint="@color/yellow"
        />

</RelativeLayout><jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1476393704987997, 'fraction_numerical': 0.03094158442251267, 'mean_word_length': 4.608825729244577, 'pattern_counts': {'":': 0, '<': 74, '<?xml version=': 4, '>': 73, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 15}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '611495', 'license': 'Apache-2.0', 'n_tokens_mistral': 2688, 'n_tokens_neox': 2505, 'n_words': 403, 'path': '00 Tutorial/OCR II Text Recognition 1 Layout.ipynb', 'repo_name': 'Coding-Forest/2021-Android-Text-Recognition', 'size': '7498'}