From 7b20783dd6de98dd99aa104b2251eb43aa31cac7 Mon Sep 17 00:00:00 2001 From: YuutaW <17158086+Trumeet@users.noreply.github.com> Date: Sat, 13 Apr 2019 12:09:55 -0700 Subject: First Commit Signed-off-by: YuutaW <17158086+Trumeet@users.noreply.github.com> --- .../moe/yuuta/flow/ExampleInstrumentedTest.java | 26 ++++ app/src/main/AndroidManifest.xml | 23 +++ app/src/main/java/moe/yuuta/flow/MainActivity.java | 103 +++++++++++++ .../res/drawable-v24/ic_launcher_foreground.xml | 34 +++++ .../main/res/drawable/ic_launcher_background.xml | 170 +++++++++++++++++++++ app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../res/mipmap-anydpi-v26/ic_launcher_round.xml | 5 + app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 2963 bytes app/src/main/res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 4905 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2060 bytes app/src/main/res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2783 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4490 bytes .../main/res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 6895 bytes app/src/main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 6387 bytes .../main/res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 10413 bytes app/src/main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 9128 bytes .../main/res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 15132 bytes app/src/main/res/values/strings.xml | 6 + .../test/java/moe/yuuta/flow/ExampleUnitTest.java | 17 +++ 19 files changed, 389 insertions(+) create mode 100644 app/src/androidTest/java/moe/yuuta/flow/ExampleInstrumentedTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/moe/yuuta/flow/MainActivity.java create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/test/java/moe/yuuta/flow/ExampleUnitTest.java (limited to 'app/src') diff --git a/app/src/androidTest/java/moe/yuuta/flow/ExampleInstrumentedTest.java b/app/src/androidTest/java/moe/yuuta/flow/ExampleInstrumentedTest.java new file mode 100644 index 0000000..2569893 --- /dev/null +++ b/app/src/androidTest/java/moe/yuuta/flow/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package moe.yuuta.flow; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.assertEquals; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("moe.yuuta.flow", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..22133a8 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/moe/yuuta/flow/MainActivity.java b/app/src/main/java/moe/yuuta/flow/MainActivity.java new file mode 100644 index 0000000..cba4bbd --- /dev/null +++ b/app/src/main/java/moe/yuuta/flow/MainActivity.java @@ -0,0 +1,103 @@ +package moe.yuuta.flow; + +import android.os.Bundle; +import android.os.Vibrator; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; + +import java.util.Arrays; + +// You don't need to use AppCompatActivity and AppCompat styles. +public class MainActivity extends AppCompatActivity { + private static final String TAG = MainActivity.class.getSimpleName(); + + private FlowFragment mFragment; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + Log.i(TAG, "onCreate()"); + if (mFragment == null) { + mFragment = new FlowFragment(); + mFragment.setPages(Arrays.asList(new Page1(), new Page2(), new Page3())); + getSupportFragmentManager() + .beginTransaction() + .replace(android.R.id.content, mFragment) + .commitAllowingStateLoss(); + Log.i(TAG, "done"); + } + } + + public static class Page1 extends PageFragment { + public Page1() { + mInfo = new FlowInfo(new HeaderConfig("Page 1", "lol", false), null); + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + TextView view = new TextView(requireContext()); + view.setText("Page 1"); + return view; + } + } + + public static class Page2 extends PageFragment { + public Page2() { + mInfo = new FlowInfo(new HeaderConfig("Page 2", "built with love", false), null); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + TextView view = new TextView(requireContext()); + view.setText("Page 2"); + mInfo = new FlowInfo(new HeaderConfig("Page 2 lol", "built with love", false), + new NavigationBarConfig("2", "1", View.VISIBLE, View.VISIBLE, View.VISIBLE, getHostFragment().getGeneralFlowNavListener(), + getHostFragment().getGeneralFlowNavListener())); + getHostFragment().notifyCurrentFlowInfoUpdated(); + return view; + } + } + + public static class Page3 extends PageFragment { + public Page3() { + mInfo = new FlowInfo(new HeaderConfig("Page 3", "zzz~", true), null); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + TextView view = new TextView(requireContext()); + view.setText("Page 3"); + return view; + } + + @Override + public boolean onBackPressed() { + Vibrator vibrator = (Vibrator) requireContext().getSystemService(VIBRATOR_SERVICE); + vibrator.vibrate(new long[]{50L, 30L}, 1); + return true; + } + } + + @Override + public void onBackPressed() { + if (mFragment != null && mFragment.onBackPressed()) return; + super.onBackPressed(); + } +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..1f6bb29 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..0d025f9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..898f3ed Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..dffca36 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..64ba76f Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..dae5e08 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..e5ed465 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..14ed0af Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..b0907ca Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..d8ae031 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..2c18de9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..beed3cd Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..28c31c2 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ + + Flow + + diff --git a/app/src/test/java/moe/yuuta/flow/ExampleUnitTest.java b/app/src/test/java/moe/yuuta/flow/ExampleUnitTest.java new file mode 100644 index 0000000..84848a0 --- /dev/null +++ b/app/src/test/java/moe/yuuta/flow/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package moe.yuuta.flow; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file -- cgit v1.2.3-70-g09d2