Commit 39a0de6d authored by Jilin Zheng's avatar Jilin Zheng
Browse files
 Conflicts:
	.idea/gradle.xml
	.idea/misc.xml
	app/build.gradle
	app/src/main/AndroidManifest.xml
	app/src/main/res/layout/activity_main.xml
	app/src/main/res/values-night/themes.xml
	app/src/main/res/values/strings.xml
	app/src/main/res/values/themes.xml
	gradle/wrapper/gradle-wrapper.properties
	settings.gradle
parents 3e897090 25ae26db
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="deploymentTargetDropDown">
    <targetSelectedWithDropDown>
      <Target>
        <type value="QUICK_BOOT_TARGET" />
        <deviceKey>
          <Key>
            <type value="VIRTUAL_DEVICE_PATH" />
            <value value="C:\Users\Jilin\.android\avd\Nexus_5X_API_30.avd" />
          </Key>
        </deviceKey>
      </Target>
    </targetSelectedWithDropDown>
    <timeTargetWasSelectedWithDropDown value="2023-04-21T03:04:20.704744900Z" />
  </component>
</project>
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
package com.example.toast;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
 * Instrumented test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @Test
    public void useAppContext() {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
        assertEquals("com.example.toast", appContext.getPackageName());
    }
}
 No newline at end of file
+37 −0
Original line number Diff line number Diff line
package com.example.toast;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    String[] toasts = {"Wanna hear a joke?", "It's quiz time! Let's meet at PHO.", "You guys look tired, let's take a break."};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }

    @Override
    protected void onStart() {
        super.onStart();

        int ii = 0;
        while (true) {
            try {
                Thread.sleep(5000);
                Toast.makeText(this,toasts[ii],Toast.LENGTH_SHORT).show();
                if (ii<2) {
                    ii++;
                } else {
                    ii = 0;
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
 No newline at end of file
+17 −0
Original line number Diff line number Diff line
package com.example.toast;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
public class ExampleUnitTest {
    @Test
    public void addition_isCorrect() {
        assertEquals(4, 2 + 2);
    }
}
 No newline at end of file