Skip to content

Great! Since it’s working now, let’s clean up the UI:

Remove the debug TextView and ScrollView

Replace progress bar + debug with a simple splash loading screen

Make the WebView fill the screen and look smooth

Add basic error handling UI inside WebView if loading fails

Sriko Android Project File Structure

app/
β”œβ”€β”€ src/
β”‚   └── main/
β”‚       β”œβ”€β”€ java/
β”‚       β”‚   └── com/
β”‚       β”‚       └── ram/
β”‚       β”‚           └── sriko/
β”‚       β”‚               β”œβ”€β”€ MainActivity.java
β”‚       β”‚               β”œβ”€β”€ SrikoApplication.java
β”‚       β”‚               β”œβ”€β”€ managers/
β”‚       β”‚               β”‚   └── ContentManager.java
β”‚       β”‚               β”œβ”€β”€ services/
β”‚       β”‚               β”‚   └── ContentSyncService.java
β”‚       β”‚               └── utils/
β”‚       β”‚                   β”œβ”€β”€ AnimationUtils.java
β”‚       β”‚                   β”œβ”€β”€ NetworkUtils.java
β”‚       β”‚                   └── WebViewHelper.java
β”‚       β”œβ”€β”€ res/
β”‚       β”‚   β”œβ”€β”€ layout/
β”‚       β”‚   β”‚   └── activity_main.xml
β”‚       β”‚   β”œβ”€β”€ values/
β”‚       β”‚   β”‚   β”œβ”€β”€ strings.xml
β”‚       β”‚   β”‚   β”œβ”€β”€ colors.xml
β”‚       β”‚   β”‚   └── themes.xml
β”‚       β”‚   β”œβ”€β”€ values-night/
β”‚       β”‚   β”‚   └── themes.xml
β”‚       β”‚   β”œβ”€β”€ drawable/
β”‚       β”‚   β”‚   β”œβ”€β”€ ic_launcher_background.xml
β”‚       β”‚   β”‚   └── logo_sriko.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
β”‚       β”‚   β”œβ”€β”€ mipmap-xxhdpi/
β”‚       β”‚   β”‚   β”œβ”€β”€ ic_launcher.png
β”‚       β”‚   β”‚   └── ic_launcher_round.png
β”‚       β”‚   β”œβ”€β”€ mipmap-xxxhdpi/
β”‚       β”‚   β”‚   β”œβ”€β”€ ic_launcher.png
β”‚       β”‚   β”‚   └── ic_launcher_round.png
β”‚       β”‚   └── xml/
β”‚       β”‚       β”œβ”€β”€ backup_rules.xml
β”‚       β”‚       └── data_extraction_rules.xml
β”‚       └── AndroidManifest.xml
β”œβ”€β”€ libs/
β”‚   β”œβ”€β”€ org.eclipse.jgit-6.0.0.1.202211151113.jar
β”‚   β”œβ”€β”€ slf4j-android-1.7.36.jar
β”‚   └── javaewah-1.1.13.jar
└── build.gradle

# Root project files:
β”œβ”€β”€ build.gradle (Project level)
β”œβ”€β”€ gradle.properties
β”œβ”€β”€ settings.gradle
└── local.properties

File Placement Guide

1. Java Source Files

Place in: app/src/main/java/com/ram/sriko/

  • MainActivity.java β†’ app/src/main/java/com/ram/sriko/MainActivity.java
  • SrikoApplication.java β†’ app/src/main/java/com/ram/sriko/SrikoApplication.java

2. Manager Classes

Create folder: app/src/main/java/com/ram/sriko/managers/

  • ContentManager.java β†’ app/src/main/java/com/ram/sriko/managers/ContentManager.java

3. Service Classes

Create folder: app/src/main/java/com/ram/sriko/services/

  • ContentSyncService.java β†’ app/src/main/java/com/ram/sriko/services/ContentSyncService.java

4. Utility Classes

Create folder: app/src/main/java/com/ram/sriko/utils/

  • AnimationUtils.java β†’ app/src/main/java/com/ram/sriko/utils/AnimationUtils.java
  • NetworkUtils.java β†’ app/src/main/java/com/ram/sriko/utils/NetworkUtils.java
  • WebViewHelper.java β†’ app/src/main/java/com/ram/sriko/utils/WebViewHelper.java

5. Manifest File

  • AndroidManifest.xml β†’ app/src/main/AndroidManifest.xml

6. Layout Files

  • activity_main.xml β†’ app/src/main/res/layout/activity_main.xml

7. Resource Files

  • strings.xml β†’ app/src/main/res/values/strings.xml
  • colors.xml β†’ app/src/main/res/values/colors.xml
  • themes.xml β†’ app/src/main/res/values/themes.xml
  • themes.xml (night) β†’ app/src/main/res/values-night/themes.xml

8. JAR Libraries

Create folder: app/libs/

Download and place these JARs: - org.eclipse.jgit-6.0.0.1.jar β†’ app/libs/ - slf4j-android-1.7.36.jar β†’ app/libs/ - javaewah-1.1.13.jar β†’ app/libs/

9. Gradle Files

  • build.gradle (app) β†’ app/build.gradle
  • build.gradle (project) β†’ build.gradle (root)
  • settings.gradle β†’ settings.gradle (root)

Steps to Create Project:

  1. Create New Project in Android Studio
  2. Choose "Empty Activity"
  3. Application name: "Sriko"
  4. Package name: com.ram.sriko
  5. Language: Java
  6. Minimum SDK: API 21

  7. Create Directory Structure

    mkdir -p app/src/main/java/com/ram/sriko/managers
    mkdir -p app/src/main/java/com/ram/sriko/services  
    mkdir -p app/src/main/java/com/ram/sriko/utils
    mkdir -p app/libs
    

  8. Add JAR Files

  9. Download the 3 JAR files
  10. Place in app/libs/ folder
  11. Add to app/build.gradle dependencies

  12. Copy Source Files

  13. Copy each Java file to its respective location
  14. Replace the generated files with provided versions

  15. Update Resource Files

  16. Replace/update XML files in res/ folders
  17. Add custom drawables and icons

This structure follows Android Studio's standard conventions and will work seamlessly with Gradle builds.


Here’s a polished version of your MainActivity.java with a splash screen loading and fullscreen WebView:

package com.ram.srisec;

import android.app.Activity; import android.os.Bundle; import android.os.AsyncTask; import android.webkit.WebView; import android.webkit.WebViewClient; import android.webkit.WebSettings; import android.view.ViewGroup; import android.view.Gravity; import android.widget.FrameLayout; import android.widget.ProgressBar; import android.graphics.Color; import android.widget.TextView; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.content.Context;

import java.io.File; import java.io.FileWriter; import java.io.IOException;

import org.eclipse.jgit.api.Git;

public class MainActivity extends Activity {

private static final String TAG = "MainActivity";
private static final String GIT_REMOTE_URL = "https://github.com/sriramreddydwarampudi/sriramreddydwarampudi.github.io";
private static final String GIT_LOCAL_FOLDER = "repo";

private WebView webView;
private ProgressBar progressBar;
private FrameLayout rootLayout;
private File gitRepoDir;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Root layout
    rootLayout = new FrameLayout(this);
    rootLayout.setBackgroundColor(Color.WHITE);

    // ProgressBar - splash loader
    progressBar = new ProgressBar(this);
    FrameLayout.LayoutParams pbParams = new FrameLayout.LayoutParams(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        ViewGroup.LayoutParams.WRAP_CONTENT
    );
    pbParams.gravity = Gravity.CENTER;
    progressBar.setLayoutParams(pbParams);
    rootLayout.addView(progressBar);

    // WebView setup
    webView = new WebView(this);
    FrameLayout.LayoutParams wvParams = new FrameLayout.LayoutParams(
        ViewGroup.LayoutParams.MATCH_PARENT,
        ViewGroup.LayoutParams.MATCH_PARENT
    );
    webView.setLayoutParams(wvParams);

    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setAllowContentAccess(true);
    settings.setAllowFileAccess(true);
    settings.setAllowFileAccessFromFileURLs(true);
    settings.setAllowUniversalAccessFromFileURLs(true);

    webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            // Hide loader once page loaded
            progressBar.setVisibility(ProgressBar.GONE);
            webView.setVisibility(WebView.VISIBLE);
        }

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            // Show a friendly error message inside WebView
            String errorHtml = "<html><body style='text-align:center; font-family:sans-serif;'>" +
                    "<h2>Oops! Unable to load page.</h2>" +
                    "<p>" + description + "</p></body></html>";
            view.loadData(errorHtml, "text/html", "UTF-8");
        }
    });

    webView.setVisibility(WebView.GONE); // Hide initially until loaded
    rootLayout.addView(webView);

    setContentView(rootLayout);

    gitRepoDir = new File(getFilesDir(), GIT_LOCAL_FOLDER);

    if (isConnected()) {
        new GitSyncTask().execute();
    } else {
        // No internet: load local content immediately
        loadSiteOrFallback();
    }
}

private boolean isConnected() {
    ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    if (cm != null) {
        NetworkInfo ni = cm.getActiveNetworkInfo();
        return ni != null && ni.isConnected();
    }
    return false;
}

private void loadSiteOrFallback() {
    File indexFile = new File(gitRepoDir, "index.html");
    if (!indexFile.exists()) {
        try {
            FileWriter fw = new FileWriter(indexFile);
            fw.write("<h1>Fallback: index.html not found</h1>");
            fw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    if (indexFile.exists()) {
        webView.loadUrl("file://" + indexFile.getAbsolutePath());
    } else {
        webView.loadData("<h1>Error: index.html not found</h1>", "text/html", "UTF-8");
    }
}

private class GitSyncTask extends AsyncTask<Void, Void, Boolean> {
    @Override
    protected void onPreExecute() {
        progressBar.setVisibility(ProgressBar.VISIBLE);
        webView.setVisibility(WebView.GONE);
    }

    @Override
    protected Boolean doInBackground(Void... voids) {
        try {
            if (gitRepoDir.exists()) {
                Git.open(gitRepoDir).pull().call();
            } else {
                Git.cloneRepository()
                    .setURI(GIT_REMOTE_URL)
                    .setDirectory(gitRepoDir)
                    .call();
            }
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    @Override
    protected void onPostExecute(Boolean success) {
        loadSiteOrFallback();
    }
}

}


What this does:

Shows a centered spinner on a white background while cloning/pulling your repo.

WebView fills the entire screen, hidden behind the spinner initially.

Once the local index.html loads, the spinner disappears and WebView is shown.

Simple friendly HTML error message inside WebView if loading fails.

Clean, minimal UI β€” perfect as a splash/loading experience.


If you want, I can help with styling the splash further (custom image, animations, etc.). But this is a solid base for a clean, professional look.

Would you like that?

<uses-permission android:name="android.permission.INTERNET"/>
<application android:allowBackup="true"
    android:usesCleartextTraffic="true"
    android:label="SriSec"
    android:theme="@android:style/Theme.Holo.Light.NoActionBar">

    <activity android:name=".MainActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

</application>

πŸ“¦ Required .jar Libraries

Place these in your AIDE libs/ folder:

  1. org.eclipse.jgit.jar

  2. slf4j-android.jar

  3. javaewah.jar

add android manifest.xml

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

activityxml

<!-- Add UI elements here -->

To include all .jar files from the libs/ folder in your Android project using build.gradle, here's what you need to do:


βœ… Step-by-Step: Add .jar Dependencies from libs/

  1. Put Your JARs in libs/ Folder

Place your JAR (e.g., org.eclipse.jgit-6.0.0.jar) inside:

app/libs/

If the libs/ folder doesn’t exist, create it.


  1. Modify build.gradle

Open your app/build.gradle (module-level file), and make sure the following is added inside dependencies:

dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // other dependencies... }

This line tells Gradle to include all .jar files in the libs/ folder.


  1. Sync Gradle

In Android Studio:

Click β€œSync Now” when prompted.

Or run: ./gradlew build

In AIDE:

This step is automatic if project.properties points to the correct libs/ folder.


  1. βœ… Verify Success

If the .jar file is correctly referenced, your IDE should resolve org.eclipse.jgit.* classes like:

import org.eclipse.jgit.api.Git;


Bonus: AIDE Users

If you're using AIDE, also check that project.properties includes:

android.library.reference.1=libs

Or just manually link the JAR from the Project Explorer (long press β†’ "Add to Build Path").

Matter is I made com.ram.srisec app which is offline app and updates it contents when internet available from sriramreddydwarampudi.github.io mkdocs ghpages repo.

The problem is it slow and long loading bar.

I want advanced app.improve it as com.ram.sriko .give all files to paste in android studio

<!-- Main Content with SwipeRefresh -->
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
    android:id="@+id/swipeRefresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <WebView
        android:id="@+id/webView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

<!-- Splash Screen Overlay -->
<LinearLayout
    android:id="@+id/splashScreen"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/splash_background"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="40dp">

    <ImageView
        android:id="@+id/logoImage"
        android:layout_width="120dp"
        android:layout_height="120dp"
        android:layout_marginBottom="32dp"
        android:contentDescription="@string/app_name"
        android:src="@drawable/logo_sriko" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:text="@string/app_name"
        android:textColor="@color/splash_text"
        android:textSize="28sp"
        android:textStyle="bold" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="40dp"
        android:text="@string/app_tagline"
        android:textColor="@color/splash_text_secondary"
        android:textSize="16sp" />

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="200dp"
        android:layout_height="6dp"
        android:layout_marginBottom="16dp"
        android:max="100"
        android:progress="0"
        android:progressTint="@color/primary_color" />

    <TextView
        android:id="@+id/statusText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/initializing"
        android:textColor="@color/splash_text_secondary"
        android:textSize="14sp" />

</LinearLayout>

Sriko Smart Content Platform Initializing... Loading content... Syncing content... Content updated Offline mode No internet connection Retry

#FFBB86FC #FF6200EE #FF3700B3 #FF03DAC5 #FF018786 #FF000000 #FFFFFFFF

<!-- App Colors -->
<color name="primary_color">#667eea</color>
<color name="primary_dark">#5a6fd8</color>
<color name="secondary_color">#764ba2</color>
<color name="accent_color">#f093fb</color>

<!-- Splash Colors -->
<color name="splash_background">#667eea</color>
<color name="splash_text">#FFFFFF</color>
<color name="splash_text_secondary">#E8ECFF</color>

<style name="Theme.Sriko.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowFullscreen">false</item>
    <item name="android:statusBarColor">@color/primary_color</item>
</style>

// app/build.gradle plugins { id 'com.android.application' }

android { namespace 'com.ram.sriko' compileSdk 34

defaultConfig {
    applicationId "com.ram.sriko"
    minSdk 21
    targetSdk 34
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
    pickFirst '**/META-INF/DEPENDENCIES'
    pickFirst '**/META-INF/LICENSE'
    pickFirst '**/META-INF/LICENSE.txt'
    pickFirst '**/META-INF/NOTICE'
    pickFirst '**/META-INF/NOTICE.txt'
}

}

dependencies { // Include all JARs from libs folder implementation fileTree(dir: 'libs', include: ['*.jar'])

// AndroidX dependencies
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'

// Testing
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

}

// build.gradle (Project level) plugins { id 'com.android.application' version '8.1.2' apply false }

// settings.gradle pluginManagement { repositories { google() mavenCentral() gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() } }

rootProject.name = "Sriko" include ':app'

// gradle.properties org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 android.useAndroidX=true android.enableJetifier=true

<group android:scaleX="0.8"
    android:scaleY="0.8"
    android:pivotX="54"
    android:pivotY="54">

    <!-- Background Circle -->
    <path
        android:fillColor="@color/primary_color"
        android:pathData="M54,54m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0" />

    <!-- Letter S -->
    <path
        android:fillColor="@color/white"
        android:pathData="M35,30 Q35,25 40,25 L60,25 Q65,25 65,30 Q65,35 60,35 L45,35 Q40,35 40,40 Q40,45 45,45 L55,45 Q60,45 60,50 Q60,55 55,55 L45,55 Q40,55 40,60 Q40,65 45,65 L65,65 Q70,65 70,70 Q70,75 65,75 L40,75 Q30,75 30,65 L30,60 Q30,50 40,50 L55,50 Q60,50 60,45 Q60,40 55,40 L45,40 Q35,40 35,30 Z" />

</group>

<path android:fillColor="@color/primary_color"
    android:pathData="M0,0h108v108h-108z" />

<path android:fillColor="#3f51b5"
    android:pathData="M19,0L19,108"
    android:strokeWidth="0.8"
    android:strokeColor="@color/primary_dark" />