// Path: urlless/greet/src/main/java/com/google/android/instantapps/samples/greet/GreetActivity.java
// public class GreetActivity extends AppCompatActivity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_greet);
//     }
// }


import com.google.android.play.core.splitinstall.model.SplitInstallSessionStatus;
import android.content.Intent;
import android.os.Build;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.google.android.instantapps.samples.greet.GreetActivity;
import com.google.android.play.core.splitinstall.SplitInstallHelper;
import com.google.android.play.core.splitinstall.SplitInstallManager;
import com.google.android.play.core.splitinstall.SplitInstallManagerFactory;
import com.google.android.play.core.splitinstall.SplitInstallRequest;
import com.google.android.play.core.splitinstall.SplitInstallSessionState;
import com.google.android.play.core.splitinstall.SplitInstallStateUpdatedListener;
/*
 * Copyright 2018 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.instantapps.samples.urlless.feature;



public class MainActivity extends AppCompatActivity {

    private static final String TAG = "UrlLess";

    private SplitInstallManager splitInstallManager;

    /**
     * Perform actions on callbacks of state updates for the install session.
     */
    private SplitInstallStateUpdatedListener stateListener =
            new SplitInstallStateUpdatedListener() {
        @Override
        public void onStateUpdate(SplitInstallSessionState splitInstallSessionState) {
            if (splitInstallSessionState.status() == SplitInstallSessionStatus.FAILED &&
                    splitInstallSessionState.sessionId() < 0) {
                Log.d(TAG, "Service process died");
                return;
            }
            if (splitInstallSessionState.status() == SplitInstallSessionStatus.CANCELED) {
                Log.d(TAG, "Installation cancelled");
            } else if (splitInstallSessionState.status() == SplitInstallSessionStatus.FAILED) {
                Log.e(TAG, "Install failed");
            } else if (splitInstallSessionState.status() == SplitInstallSessionStatus.INSTALLED) {
                Log.d(TAG, "Split successfully installed, launching GreetActivity");
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                    // Update app context with the code and resources of the installed module.
                    SplitInstallHelper.updateAppInfo(MainActivity.this);
                }
                startActivity(new Intent(MainActivity.this, GreetActivity.class));
            }
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
// Path: urlless/greet/src/main/java/com/google/android/instantapps/samples/greet/GreetActivity.java
// public class GreetActivity extends AppCompatActivity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_greet);
//     }
// }


// Path: urlless/feature/src/main/java/com/google/android/instantapps/samples/urlless/feature/MainActivity.java
import com.google.android.play.core.splitinstall.model.SplitInstallSessionStatus;
import android.content.Intent;
import android.os.Build;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.google.android.instantapps.samples.greet.GreetActivity;
import com.google.android.play.core.splitinstall.SplitInstallHelper;
import com.google.android.play.core.splitinstall.SplitInstallManager;
import com.google.android.play.core.splitinstall.SplitInstallManagerFactory;
import com.google.android.play.core.splitinstall.SplitInstallRequest;
import com.google.android.play.core.splitinstall.SplitInstallSessionState;
import com.google.android.play.core.splitinstall.SplitInstallStateUpdatedListener;

/*
 * Copyright 2018 Google LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.instantapps.samples.urlless.feature;



public class MainActivity extends AppCompatActivity {

    private static final String TAG = "UrlLess";

    private SplitInstallManager splitInstallManager;

    /**
     * Perform actions on callbacks of state updates for the install session.
     */
    private SplitInstallStateUpdatedListener stateListener =
            new SplitInstallStateUpdatedListener() {
        @Override
        public void onStateUpdate(SplitInstallSessionState splitInstallSessionState) {
            if (splitInstallSessionState.status() == SplitInstallSessionStatus.FAILED &&
                    splitInstallSessionState.sessionId() < 0) {
                Log.d(TAG, "Service process died");
                return;
            }
            if (splitInstallSessionState.status() == SplitInstallSessionStatus.CANCELED) {
                Log.d(TAG, "Installation cancelled");
            } else if (splitInstallSessionState.status() == SplitInstallSessionStatus.FAILED) {
                Log.e(TAG, "Install failed");
            } else if (splitInstallSessionState.status() == SplitInstallSessionStatus.INSTALLED) {
                Log.d(TAG, "Split successfully installed, launching GreetActivity");
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                    // Update app context with the code and resources of the installed module.
                    SplitInstallHelper.updateAppInfo(MainActivity.this);
                }
                startActivity(new Intent(MainActivity.this, GreetActivity.class));
            }
        }
    };

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