diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 96d7421..fd0938e 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/misc.xml b/.idea/misc.xml index f7fa969..69deca8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -24,5 +24,7 @@ - + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5b315cc..ae86d35 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -20,9 +20,9 @@ - - + + diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/AppDataManager.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/AppDataManager.java index e835b4d..e0e03d4 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/AppDataManager.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/AppDataManager.java @@ -36,4 +36,24 @@ public AppDataManager(@ApplicationContext Context context, mPreferencesHelper = preferencesHelper; mApiHelper = apiHelper; } + + @Override + public void simpanNama(String nama) { + mPreferencesHelper.simpanNama(nama); + } + + @Override + public String getNama() { + return mPreferencesHelper.getNama(); + } + + @Override + public void setAvatar(int avatar) { + mPreferencesHelper.setAvatar(avatar); + } + + @Override + public int getAvatar() { + return mPreferencesHelper.getAvatar(); + } } diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/prefs/AppPreferencesHelper.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/prefs/AppPreferencesHelper.java index ad69d08..50ae086 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/prefs/AppPreferencesHelper.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/prefs/AppPreferencesHelper.java @@ -25,4 +25,25 @@ public AppPreferencesHelper(@ApplicationContext Context context, @PreferenceInfo String prefFileName) { mPrefs = context.getSharedPreferences(prefFileName, Context.MODE_PRIVATE); } + + @Override + public void simpanNama(String nama) { + mPrefs.edit().putString("nama", nama).apply(); + } + + @Override + public String getNama() { + return mPrefs.getString("nama", null); + } + + @Override + public void setAvatar(int avatar) { + mPrefs.edit().putInt("avatar", avatar).apply(); + } + + @Override + public int getAvatar() { + return mPrefs.getInt("avatar",0); + } + } diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/prefs/PreferencesHelper.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/prefs/PreferencesHelper.java index 4bca928..b300c3a 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/prefs/PreferencesHelper.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/data/prefs/PreferencesHelper.java @@ -17,4 +17,10 @@ public interface PreferencesHelper { + void simpanNama(String nama); + String getNama(); + + void setAvatar(int avatar); + int getAvatar(); + } diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/di/componen/ActivityComponent.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/di/componen/ActivityComponent.java index 087f1a9..ac2ac2c 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/di/componen/ActivityComponent.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/di/componen/ActivityComponent.java @@ -3,6 +3,10 @@ import com.squishydev.setoz.englishkidstalk.di.PerActivity; import com.squishydev.setoz.englishkidstalk.di.module.ActivityModule; +<<<<<<< HEAD +import com.squishydev.setoz.englishkidstalk.ui.buatAkun.BuatAkunActivity; +import com.squishydev.setoz.englishkidstalk.ui.inputnama.InputNamaActivity; +======= import com.squishydev.setoz.englishkidstalk.ui.inputnama.InputNamaActivity; import com.squishydev.setoz.englishkidstalk.ui.konfirmasiakun.KonfirmasiAkunActivity; import com.squishydev.setoz.englishkidstalk.ui.levelselect.fragment.LevelSelectFragment; @@ -11,6 +15,7 @@ import com.squishydev.setoz.englishkidstalk.ui.menuselect.profilemenu.ProfileFragment; import com.squishydev.setoz.englishkidstalk.ui.pilihavatar.PilihAvatarActivity; import com.squishydev.setoz.englishkidstalk.ui.splashscreen.SplashScreenActivity; +>>>>>>> cedef8f54a54247d77537ea610273c5a91fb8cd7 import dagger.Component; @@ -26,6 +31,10 @@ @Component(dependencies = ApplicationComponent.class, modules = ActivityModule.class) public interface ActivityComponent { + void inject(InputNamaActivity inputNamaActivity); + + void inject(BuatAkunActivity buatAkunActivity); + void inject(SplashScreenActivity splashScreenActivity); void inject(PilihAvatarActivity pilihAvatarActivity); @@ -41,4 +50,4 @@ public interface ActivityComponent { void inject(ProfileFragment profileFragment); void inject(LevelSelectFragment levelSelectFragmentFragment); -} \ No newline at end of file +} diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/di/module/ActivityModule.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/di/module/ActivityModule.java index 58c97f8..5142cc5 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/di/module/ActivityModule.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/di/module/ActivityModule.java @@ -6,6 +6,10 @@ import com.squishydev.setoz.englishkidstalk.di.ActivityContext; import com.squishydev.setoz.englishkidstalk.di.PerActivity; +import com.squishydev.setoz.englishkidstalk.ui.buatAkun.BuatAkunMvpPresenter; +import com.squishydev.setoz.englishkidstalk.ui.buatAkun.BuatAkunMvpView; +import com.squishydev.setoz.englishkidstalk.ui.inputnama.InputNamaMvpPresenter; +import com.squishydev.setoz.englishkidstalk.ui.inputnama.InputNamaMvpView; import com.squishydev.setoz.englishkidstalk.ui.inputnama.InputNamaMvpPresenter; import com.squishydev.setoz.englishkidstalk.ui.inputnama.InputNamaMvpView; import com.squishydev.setoz.englishkidstalk.ui.inputnama.InputNamaPresenter; @@ -74,7 +78,20 @@ LinearLayoutManager provideLinearLayoutManager(AppCompatActivity activity) { } @Provides - LevelSelectMvpPresenter provideLevelSelectPresenter(LevelSelectPresenter presenter){ + InputNamaMvpPresenter provideInputNamaMvpPresenter( + InputNamaMvpPresenter presenter){ + return presenter; + } + + @Provides + LevelSelectMvpPresenter provideLevelSelectPresenter( + LevelSelectPresenter presenter){ + return presenter; + } + + @Provides + BuatAkunMvpPresenter provideBuatAkunMvpPresenter( + BuatAkunMvpPresenter presenter){ return presenter; } diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/base/MvpView.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/base/MvpView.java index 7613e76..90f4d58 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/base/MvpView.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/base/MvpView.java @@ -14,8 +14,6 @@ public interface MvpView { void hideLoading(); -// void openActivityOnTokenExpire(); - void onError(@StringRes int resId); void onError(String message); diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunActivity.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunActivity.java new file mode 100644 index 0000000..fa12790 --- /dev/null +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunActivity.java @@ -0,0 +1,43 @@ +package com.squishydev.setoz.englishkidstalk.ui.buatAkun; + +import android.content.Context; +import android.content.Intent; +import android.databinding.DataBindingUtil; +import android.os.Bundle; + +import com.squishydev.setoz.englishkidstalk.R; +import com.squishydev.setoz.englishkidstalk.ui.base.BaseActivity; + +import javax.inject.Inject; + +public class BuatAkunActivity extends BaseActivity implements BuatAkunMvpView { + + @Inject + BuatAkunMvpPresenter mPresenter; + + public static Intent getStartIntent(Context context) { + Intent intent = new Intent(context, BuatAkunActivity.class); + return intent; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_buat_akun); + + getActivityComponent().inject(this); + + mPresenter.onAttach(BuatAkunActivity.this); + } + + @Override + protected void onDestroy() { + mPresenter.onDetach(); + super.onDestroy(); + } + + @Override + protected void setUp() { + ActivityBuatAkunBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_buat_akun); + } +} diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunMvpPresenter.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunMvpPresenter.java new file mode 100644 index 0000000..9f18907 --- /dev/null +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunMvpPresenter.java @@ -0,0 +1,10 @@ +package com.squishydev.setoz.englishkidstalk.ui.buatAkun; + +import com.squishydev.setoz.englishkidstalk.di.PerActivity; +import com.squishydev.setoz.englishkidstalk.ui.base.MvpPresenter; + +@PerActivity +public interface BuatAkunMvpPresenter extends MvpPresenter { + +} + diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunMvpView.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunMvpView.java new file mode 100644 index 0000000..7437989 --- /dev/null +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunMvpView.java @@ -0,0 +1,7 @@ +package com.squishydev.setoz.englishkidstalk.ui.buatAkun; + +import com.squishydev.setoz.englishkidstalk.ui.base.MvpView; + +public interface BuatAkunMvpView extends MvpVie\w { + +} diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunPresenter.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunPresenter.java new file mode 100644 index 0000000..e97a70e --- /dev/null +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/buatAkun/BuatAkunPresenter.java @@ -0,0 +1,21 @@ +package com.squishydev.setoz.englishkidstalk.ui.buatAkun; + +import com.squishydev.setoz.englishkidstalk.data.DataManager; +import com.squishydev.setoz.englishkidstalk.ui.base.BasePresenter; + +import javax.inject.Inject; + +import io.reactivex.disposables.CompositeDisposable; + +public class BuatAkunPresenter extends BasePresenter + implements BuatAkunMvpPresenter { + + private static final String TAG = "BuatAkunPresenter"; + + @Inject + public BuatAkunPresenter(DataManager dataManager, + CompositeDisposable compositeDisposable) { + super(dataManager, compositeDisposable); + } + +} diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaActivity.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaActivity.java index 8b67384..e713c6f 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaActivity.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaActivity.java @@ -4,6 +4,7 @@ import android.content.Intent; import android.databinding.DataBindingUtil; import android.os.Bundle; +import android.view.View; import com.squishydev.setoz.englishkidstalk.R; import com.squishydev.setoz.englishkidstalk.databinding.ActivityInputNamaBinding; @@ -39,9 +40,14 @@ protected void onDestroy() { @Override protected void setUp() { - ActivityInputNamaBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_input_nama); - binding.btnNext.setOnClickListener(v ->{ - startActivity(new Intent(InputNamaActivity.this, PilihAvatarActivity.class)); + final ActivityInputNamaBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_input_nama); + binding.btnNext1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String nama = binding.etNama; + mPresenter.simpanNama(nama); + startActivity(new Intent(InputNamaActivity.this, PilihAvatarActivity.class)); + } }); } } diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaMvpPresenter.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaMvpPresenter.java index d1db90b..0ef7195 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaMvpPresenter.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaMvpPresenter.java @@ -5,6 +5,10 @@ @PerActivity public interface InputNamaMvpPresenter extends MvpPresenter { +<<<<<<< HEAD + void simpanNama(String nama); +======= +>>>>>>> cedef8f54a54247d77537ea610273c5a91fb8cd7 } diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaPresenter.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaPresenter.java index 9fa1655..c7ade22 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaPresenter.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/inputnama/InputNamaPresenter.java @@ -18,4 +18,9 @@ public InputNamaPresenter(DataManager dataManager, super(dataManager, compositeDisposable); } + @Override + public void simpanNama(String nama) { + getDataManager().simpanNama(nama); + } + } diff --git a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/konfirmasiakun/KonfirmasiAkunActivity.java b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/konfirmasiakun/KonfirmasiAkunActivity.java index 2eb38f7..7e12246 100644 --- a/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/konfirmasiakun/KonfirmasiAkunActivity.java +++ b/app/src/main/java/com/squishydev/setoz/englishkidstalk/ui/konfirmasiakun/KonfirmasiAkunActivity.java @@ -43,5 +43,8 @@ protected void setUp() { binding.tvTidak.setOnClickListener(v -> { startActivity(new Intent(KonfirmasiAkunActivity.this, LevelSelectActivity.class)); }); + binding.btnIya.setOnClickListener(v -> { + startActivity(new Intent(KonfirmasiAkunActivity.this, BuatAkunActivity.class)); + }); } } diff --git a/app/src/main/res/layout/activity_buat_akun.xml b/app/src/main/res/layout/activity_buat_akun.xml index 1490c8a..ddb068b 100644 --- a/app/src/main/res/layout/activity_buat_akun.xml +++ b/app/src/main/res/layout/activity_buat_akun.xml @@ -1,4 +1,5 @@ + - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_challenge.xml b/app/src/main/res/layout/activity_challenge.xml index 05748fe..307e914 100644 --- a/app/src/main/res/layout/activity_challenge.xml +++ b/app/src/main/res/layout/activity_challenge.xml @@ -23,7 +23,8 @@ + android:hint="Alee" + android:fontFamily="casual"/>