diff --git a/app/build.gradle b/app/build.gradle
index 0195907..2bdc66f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -37,9 +37,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
- implementation 'androidx.navigation:navigation-fragment:2.3.0'
- implementation 'androidx.navigation:navigation-ui:2.3.0'
- implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
+ implementation 'com.google.android:flexbox:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 55e485c..d4c6030 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,12 +3,14 @@
package="ai.elimu.herufi">
+
@@ -18,5 +20,8 @@
+
+
diff --git a/app/src/main/java/ai/elimu/herufi/BaseApplication.java b/app/src/main/java/ai/elimu/herufi/BaseApplication.java
new file mode 100644
index 0000000..60152b8
--- /dev/null
+++ b/app/src/main/java/ai/elimu/herufi/BaseApplication.java
@@ -0,0 +1,42 @@
+package ai.elimu.herufi;
+
+import android.app.Application;
+import android.speech.tts.TextToSpeech;
+import android.util.Log;
+
+public class BaseApplication extends Application {
+
+ private TextToSpeech tts;
+
+ @Override
+ public void onCreate() {
+ Log.i(getClass().getName(), "onCreate");
+ super.onCreate();
+
+ // Initialize Text-to-Speech
+ getTTS();
+ }
+
+ public TextToSpeech getTTS() {
+ if (tts == null) {
+ tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
+ @Override
+ public void onInit(int status) {
+ Log.i(getClass().getName(), "TextToSpeech onInit");
+ }
+ });
+ }
+ return tts;
+ }
+
+ @Override
+ public void onTerminate() {
+ Log.i(getClass().getName(), "onTerminate");
+ super.onTerminate();
+
+ // Release the resources used by the TextToSpeech engine
+ if (tts != null) {
+ tts.shutdown();
+ }
+ }
+}
diff --git a/app/src/main/java/ai/elimu/herufi/MainActivity.java b/app/src/main/java/ai/elimu/herufi/MainActivity.java
index 5cb9408..0677a10 100644
--- a/app/src/main/java/ai/elimu/herufi/MainActivity.java
+++ b/app/src/main/java/ai/elimu/herufi/MainActivity.java
@@ -1,15 +1,12 @@
package ai.elimu.herufi;
+import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
-import com.google.android.material.bottomnavigation.BottomNavigationView;
-
import androidx.appcompat.app.AppCompatActivity;
-import androidx.navigation.NavController;
-import androidx.navigation.Navigation;
-import androidx.navigation.ui.AppBarConfiguration;
-import androidx.navigation.ui.NavigationUI;
+
+import ai.elimu.herufi.ui.LetterListActivity;
public class MainActivity extends AppCompatActivity {
@@ -22,16 +19,6 @@ protected void onCreate(Bundle savedInstanceState) {
// Verify that the content-provider APK has been installed
// TODO
-
- BottomNavigationView navView = findViewById(R.id.nav_view);
- // Passing each menu ID as a set of Ids because each
- // menu should be considered as top level destinations.
- AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
- R.id.navigation_home, R.id.navigation_notifications)
- .build();
- NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
- NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
- NavigationUI.setupWithNavController(navView, navController);
}
@Override
@@ -39,6 +26,8 @@ protected void onStart() {
Log.i(getClass().getName(), "onStart");
super.onStart();
-
+ Intent intent = new Intent(getApplicationContext(), LetterListActivity.class);
+ startActivity(intent);
+ finish();
}
}
diff --git a/app/src/main/java/ai/elimu/herufi/ui/LetterListActivity.java b/app/src/main/java/ai/elimu/herufi/ui/LetterListActivity.java
new file mode 100644
index 0000000..b80937a
--- /dev/null
+++ b/app/src/main/java/ai/elimu/herufi/ui/LetterListActivity.java
@@ -0,0 +1,69 @@
+package ai.elimu.herufi.ui;
+
+import android.os.Bundle;
+import android.speech.tts.TextToSpeech;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.google.android.flexbox.FlexboxLayout;
+
+import java.util.List;
+
+import ai.elimu.herufi.BaseApplication;
+import ai.elimu.herufi.R;
+import ai.elimu.herufi.util.ContentProviderHelper;
+import ai.elimu.model.v2.gson.content.LetterGson;
+
+public class LetterListActivity extends AppCompatActivity {
+
+ private FlexboxLayout flexboxLayout;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ Log.i(getClass().getName(), "onCreate");
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.activity_letter_list);
+
+ flexboxLayout = findViewById(R.id.letter_list_flexbox_layout);
+ }
+
+ @Override
+ protected void onStart() {
+ Log.i(getClass().getName(), "onStart");
+ super.onStart();
+
+ List letterGsons = ContentProviderHelper.getLetterGsons(getApplicationContext());
+ Log.i(getClass().getName(), "letterGsons.size(): " + letterGsons.size());
+
+ // Create a view for each letter in the list
+ flexboxLayout.removeAllViews();
+ for (final LetterGson letterGson : letterGsons) {
+ View letterView = LayoutInflater.from(this).inflate(R.layout.activity_letter_list_letter_view, flexboxLayout, false);
+
+ TextView textView = letterView.findViewById(R.id.letter_view_text_view);
+ textView.setText(letterGson.getText());
+
+ // Play letter sound when pressed
+ letterView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Log.i(getClass().getName(), "letterView onClick");
+
+ Log.i(getClass().getName(), "letterGson.getText(): '" + letterGson.getText() + "'");
+
+ BaseApplication baseApplication = (BaseApplication) getApplication();
+ TextToSpeech tts = baseApplication.getTTS();
+ tts.speak(letterGson.getText(), TextToSpeech.QUEUE_FLUSH, null, "letter_" + letterGson.getId());
+ }
+ });
+
+ flexboxLayout.addView(letterView);
+ }
+ }
+}
diff --git a/app/src/main/java/ai/elimu/herufi/ui/home/HomeFragment.java b/app/src/main/java/ai/elimu/herufi/ui/home/HomeFragment.java
deleted file mode 100644
index fcc82ab..0000000
--- a/app/src/main/java/ai/elimu/herufi/ui/home/HomeFragment.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package ai.elimu.herufi.ui.home;
-
-import android.os.Bundle;
-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.fragment.app.Fragment;
-import androidx.lifecycle.Observer;
-import androidx.lifecycle.ViewModelProviders;
-
-import java.util.List;
-
-import ai.elimu.herufi.R;
-import ai.elimu.herufi.util.ContentProviderHelper;
-import ai.elimu.model.v2.gson.content.LetterGson;
-
-public class HomeFragment extends Fragment {
-
- private HomeViewModel homeViewModel;
-
- public View onCreateView(@NonNull LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
- homeViewModel =
- ViewModelProviders.of(this).get(HomeViewModel.class);
- View root = inflater.inflate(R.layout.fragment_home, container, false);
- final TextView textView = root.findViewById(R.id.text_home);
- homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer() {
- @Override
- public void onChanged(@Nullable String s) {
- textView.setText(s);
- }
- });
- return root;
- }
-
- @Override
- public void onStart() {
- Log.i(getClass().getName(), "onStart");
- super.onStart();
-
- List letterGsons = ContentProviderHelper.getLetterGsons(getContext());
- Log.i(getClass().getName(), "letterGsons.size(): " + letterGsons.size());
- }
-}
diff --git a/app/src/main/java/ai/elimu/herufi/ui/home/HomeViewModel.java b/app/src/main/java/ai/elimu/herufi/ui/home/HomeViewModel.java
deleted file mode 100644
index f8ab6ea..0000000
--- a/app/src/main/java/ai/elimu/herufi/ui/home/HomeViewModel.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package ai.elimu.herufi.ui.home;
-
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-
-public class HomeViewModel extends ViewModel {
-
- private MutableLiveData mText;
-
- public HomeViewModel() {
- mText = new MutableLiveData<>();
- mText.setValue("This is home fragment");
- }
-
- public LiveData getText() {
- return mText;
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/ai/elimu/herufi/ui/notifications/NotificationsFragment.java b/app/src/main/java/ai/elimu/herufi/ui/notifications/NotificationsFragment.java
deleted file mode 100644
index 496584a..0000000
--- a/app/src/main/java/ai/elimu/herufi/ui/notifications/NotificationsFragment.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package ai.elimu.herufi.ui.notifications;
-
-import android.os.Bundle;
-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.fragment.app.Fragment;
-import androidx.lifecycle.Observer;
-import androidx.lifecycle.ViewModelProviders;
-
-import ai.elimu.herufi.R;
-
-public class NotificationsFragment extends Fragment {
-
- private NotificationsViewModel notificationsViewModel;
-
- public View onCreateView(@NonNull LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
- notificationsViewModel =
- ViewModelProviders.of(this).get(NotificationsViewModel.class);
- View root = inflater.inflate(R.layout.fragment_notifications, container, false);
- final TextView textView = root.findViewById(R.id.text_notifications);
- notificationsViewModel.getText().observe(getViewLifecycleOwner(), new Observer() {
- @Override
- public void onChanged(@Nullable String s) {
- textView.setText(s);
- }
- });
- return root;
- }
-
- @Override
- public void onStart() {
- Log.i(getClass().getName(), "onStart");
- super.onStart();
-
-
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/ai/elimu/herufi/ui/notifications/NotificationsViewModel.java b/app/src/main/java/ai/elimu/herufi/ui/notifications/NotificationsViewModel.java
deleted file mode 100644
index e0ebe06..0000000
--- a/app/src/main/java/ai/elimu/herufi/ui/notifications/NotificationsViewModel.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package ai.elimu.herufi.ui.notifications;
-
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-
-public class NotificationsViewModel extends ViewModel {
-
- private MutableLiveData mText;
-
- public NotificationsViewModel() {
- mText = new MutableLiveData<>();
- mText.setValue("This is notifications fragment");
- }
-
- public LiveData getText() {
- return mText;
- }
-}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/gradient_background.xml b/app/src/main/res/drawable/gradient_background.xml
new file mode 100644
index 0000000..b3f5c8f
--- /dev/null
+++ b/app/src/main/res/drawable/gradient_background.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_home_black_24dp.xml b/app/src/main/res/drawable/ic_home_black_24dp.xml
deleted file mode 100644
index f8bb0b5..0000000
--- a/app/src/main/res/drawable/ic_home_black_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/app/src/main/res/drawable/ic_notifications_black_24dp.xml
deleted file mode 100644
index 78b75c3..0000000
--- a/app/src/main/res/drawable/ic_notifications_black_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/layout/activity_letter_list.xml b/app/src/main/res/layout/activity_letter_list.xml
new file mode 100644
index 0000000..46e107d
--- /dev/null
+++ b/app/src/main/res/layout/activity_letter_list.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_letter_list_letter_view.xml b/app/src/main/res/layout/activity_letter_list_letter_view.xml
new file mode 100644
index 0000000..66562d6
--- /dev/null
+++ b/app/src/main/res/layout/activity_letter_list_letter_view.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 38c0aa8..2eedde7 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -6,28 +6,5 @@
android:layout_height="match_parent"
android:paddingTop="?attr/actionBarSize">
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
deleted file mode 100644
index f3d9b08..0000000
--- a/app/src/main/res/layout/fragment_home.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_notifications.xml b/app/src/main/res/layout/fragment_notifications.xml
deleted file mode 100644
index d417935..0000000
--- a/app/src/main/res/layout/fragment_notifications.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/bottom_nav_menu.xml b/app/src/main/res/menu/bottom_nav_menu.xml
deleted file mode 100644
index 682e104..0000000
--- a/app/src/main/res/menu/bottom_nav_menu.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml
deleted file mode 100644
index 3c52189..0000000
--- a/app/src/main/res/navigation/mobile_navigation.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values-bn/strings.xml b/app/src/main/res/values-bn/strings.xml
new file mode 100644
index 0000000..03a91ea
--- /dev/null
+++ b/app/src/main/res/values-bn/strings.xml
@@ -0,0 +1,3 @@
+
+ চিঠিপত্র
+
diff --git a/app/src/main/res/values-fil/strings.xml b/app/src/main/res/values-fil/strings.xml
new file mode 100644
index 0000000..452f096
--- /dev/null
+++ b/app/src/main/res/values-fil/strings.xml
@@ -0,0 +1,3 @@
+
+ Mga Sulat
+
diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml
new file mode 100644
index 0000000..793b3e4
--- /dev/null
+++ b/app/src/main/res/values-hi/strings.xml
@@ -0,0 +1,3 @@
+
+ पत्र
+
diff --git a/app/src/main/res/values-sw/strings.xml b/app/src/main/res/values-sw/strings.xml
new file mode 100644
index 0000000..b6f80bd
--- /dev/null
+++ b/app/src/main/res/values-sw/strings.xml
@@ -0,0 +1,3 @@
+
+ Herufi
+
diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml
new file mode 100644
index 0000000..760d031
--- /dev/null
+++ b/app/src/main/res/values-ur/strings.xml
@@ -0,0 +1,3 @@
+
+ خطوط
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 4faecfa..a7b71a4 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -1,6 +1,34 @@
- #6200EE
- #3700B3
- #03DAC5
-
\ No newline at end of file
+ @color/green_lighten_1
+ @color/green
+ @color/green_accent_1
+
+ #455A64
+ #F44336
+ #E91E63
+ #9C27B0
+ #8E24AA
+ #7E57C2
+ #9575CD
+ #673AB7
+ #5E35B1
+ #512DA8
+ #3F51B5
+ #2196F3
+ #03A9F4
+ #00BCD4
+ #009688
+ #B9f6CA
+ #81C784
+ #66BB6A
+ #4CAF50
+ #43A047
+ #388E3C
+ #8BC34A
+ #CDDC39
+ #FFEB3B
+ #FFC107
+ #FF9800
+ #FF5722
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9a21665..3cfd9c1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,5 +1,3 @@
- Herufi
- Home
- Notifications
-
\ No newline at end of file
+ Letters
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index fac9291..7e2a6ae 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -6,5 +6,4 @@
- @color/colorPrimaryDark
- @color/colorAccent
-
-
\ No newline at end of file
+