Skip to content

Commit

Permalink
added : guide added
Browse files Browse the repository at this point in the history
  • Loading branch information
yasinhajilou committed Jul 29, 2020
1 parent 6532462 commit 23bb0af
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
package com.example.dileit.view.activity;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;

import android.animation.ValueAnimator;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ScrollView;

import com.example.dileit.R;
import com.example.dileit.constant.LeitnerStateConstant;
import com.example.dileit.databinding.ActivityLeitnerManagerBinding;
import com.example.dileit.databinding.DialogGuideBinding;
import com.example.dileit.model.entity.Leitner;
import com.example.dileit.view.adapter.viewpager.LeitnerManagerViewPagerAdapter;
import com.example.dileit.viewmodel.InternalViewModel;
Expand Down Expand Up @@ -75,6 +79,25 @@ public boolean onCreateOptionsMenu(Menu menu) {

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.menu_help_manager:
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
DialogGuideBinding dialogGuideBinding = DialogGuideBinding.inflate(getLayoutInflater());
// View view = getLayoutInflater().inflate(R.layout.dialog_guide, null);
alertDialog.setView(dialogGuideBinding.getRoot());
AlertDialog alertDialog1 = alertDialog.create();
dialogGuideBinding.btnTabGuideEng.setOnClickListener(view -> {
dialogGuideBinding.scrollPerGuide.setVisibility(View.GONE);
dialogGuideBinding.scrollEngGuide.setVisibility(View.VISIBLE);
});
dialogGuideBinding.btnTabGuidePer.setOnClickListener(view -> {
dialogGuideBinding.scrollPerGuide.setVisibility(View.VISIBLE);
dialogGuideBinding.scrollEngGuide.setVisibility(View.GONE);
});
alertDialog1.show();
break;
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);

FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()){
return;
}
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(task -> {
if (!task.isSuccessful()){
return;
}


}
});
}

Expand Down
85 changes: 85 additions & 0 deletions app/src/main/res/layout/dialog_guide.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<com.google.android.material.card.MaterialCardView
android:id="@+id/tab_leitner_guide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="16dp">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">

<com.google.android.material.button.MaterialButton
android:id="@+id/btn_tab_guide_eng"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/productsansregular"
android:text="@string/english"
android:textAllCaps="false"
android:textColor="?attr/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/btn_tab_guide_per"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.button.MaterialButton
android:id="@+id/btn_tab_guide_per"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/productsansregular"
android:text="@string/persian"
android:textAllCaps="false"
android:textColor="?attr/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/btn_tab_guide_eng"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

</com.google.android.material.card.MaterialCardView>


<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/scroll_per_guide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/dana"
android:padding="8dp"
android:text="@string/leitner_guide_per"
android:visibility="gone" />
</ScrollView>


<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible">

<TextView
android:id="@+id/scroll_eng_guide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/dana"
android:padding="8dp"
android:text="@string/leitner_guide_eng" />
</ScrollView>

</LinearLayout>
36 changes: 36 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,40 @@
<string name="year">Year</string>
<string name="card_content_category">Card Category</string>

<string name="leitner_guide_per">لایتنر چیه؟\n\n
یکی از بهترین استراتژی‌های به خاطرسپردن مطالب پیرَوی از سیستم لایتنره. \"دیلایت\" اینجاست که به شما کمک کنه \"لغات دیکشنری\" ویا \"موارد دلخواه اضافه شدتون\" رو طبق این سیستم به خاطر بسپرین.\n\n
چطور کار می‌کنه؟\n\n
هربار که شما کارت جدیدی به جعبه لایتنر اضافه میکنید، به دسته \"New\" انتقال پیدا میکنه.در واقع این دسته، کارت‌هایی هستن که تاحالا مرور
نشدن.\n
زمانی که این دسته کارت ها مرور بشن وارد بخش \"Review\" میشن، اگر شما جواب کارت رو ندونید به قسمت \"box1\" میره و اگه جواب کارت رو بدونید، به همون بخش و قسمت \"box2\" میره.\n\n
زمان مرور کردن کارت‌ها، در هر \"box\" که باشید، هر بار که جواب کارتی رو ندونید به \"box1\" برمیگرده و اگر جواب اون رو بدونید به \"box\" بعدی انتقال پیدا میکنه.\n
\n
اگر هنگام مرور، جواب کارت‌های جعبه پنجم رو میدونستید به بخش بعدی یعنی \"Learned\" انتقال پیدا می‌کنه، که به این معنیه که شما محتوای اون کارت رو یاد گرفتید.\n
زمان دقیق مرور هر جعبه که \"دیلایت\" برای شما به صورت خودکار مدیریت می‌کنه:\n
جعبه اول: هر روز\n
جعبه دوم: هر ۲ روز\n
جعبه سوم: هر ۴ روز\n
جعبه چهارم: هر ۹ روز\n
جعبه پنجم: هر ۱۴ روز\n</string>

<string name="leitner_guide_eng">
What is Leitner?
\n
\nOne of the best strategies for memorizing words and phrases is following Leitner system principles. "\Dileit"\ is here to helps you memorizing "\Dictionary words"\ and "Customised items" in order to Leitner principles.
\n\n
How does it work?\n\n
Each time you adding a new card in Leitner Box, it will found in the "\New"\ section. In fact, in this section, There are cards which you have never reviewed.
\n \n
When cards of this section reviewed, they will move to "\Review"\ section, while you are reviewing this section, if you don\'t know the answer of card it will place in "\Box1"\ and if you know the answer of card it will place in "\Box2"\.
\n\nwhile reviewing cards, in each "\Box"\, if you know the answer of card it will move to the next box and if you don\'t know the answer, it will back to "\Box1\".
\n
\nIn the time of reviewing if you know the answer to "\Box5"\ it will move to the next section called "\Learned"\. It means you learned that card.
\nYou should review each "\box"\ in a specific time which "\Dileit"\ handles it for you:
\n
\nBox1: every day
\nBox2: every 2 days
\nBox1: every 4 days
\nBox1: every 9 days
\nBox1: every 14 days
</string>
</resources>

0 comments on commit 23bb0af

Please sign in to comment.