diff --git a/app/src/main/java/com/luxlunaris/noadpadlight/ui/InfoFragment.java b/app/src/main/java/com/luxlunaris/noadpadlight/ui/InfoFragment.java new file mode 100644 index 0000000..31d570d --- /dev/null +++ b/app/src/main/java/com/luxlunaris/noadpadlight/ui/InfoFragment.java @@ -0,0 +1,75 @@ +package com.luxlunaris.noadpadlight.ui; + +import android.os.Bundle; + +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import com.luxlunaris.noadpadlight.R; +import com.luxlunaris.noadpadlight.control.classes.SETTINGS_TAGS; +import com.luxlunaris.noadpadlight.control.classes.Settings; + +/** + * It's a simple un-interactive prompt that + * displays some text to the user. + */ +public class InfoFragment extends DialogFragment { + + /** + * Text displayed as info + */ + String text; + + /** + * Dismisses the fragment + */ + Button gotItButton; + + /** + * Displays the info text + */ + TextView textArea; + + public InfoFragment() { + // Required empty public constructor + } + + public static InfoFragment newInstance(String text) { + InfoFragment fragment = new InfoFragment(); + fragment.text = text; + return fragment; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ + View view = inflater.inflate(R.layout.fragment_info, container, false); + gotItButton = view.findViewById(R.id.info_frag_button); + gotItButton.setOnClickListener(new GotItHandler()); + textArea = view.findViewById(R.id.infoFragmentText); + textArea.setText(text); + THEMES theme = THEMES.getThemeByName(Settings.getString(SETTINGS_TAGS.THEME)); + gotItButton.setBackgroundColor(theme.BG_COLOR); + gotItButton.setTextColor(theme.FG_COLOR); + textArea.setBackgroundColor(theme.BG_COLOR); + textArea.setTextColor(theme.FG_COLOR); + view.setBackgroundColor(theme.BG_COLOR); + return view; + } + + class GotItHandler implements View.OnClickListener { + + @Override + public void onClick(View v) { + dismiss(); + } + } + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/luxlunaris/noadpadlight/ui/ReaderActivity.java b/app/src/main/java/com/luxlunaris/noadpadlight/ui/ReaderActivity.java index 0e99fdc..f15bb4b 100644 --- a/app/src/main/java/com/luxlunaris/noadpadlight/ui/ReaderActivity.java +++ b/app/src/main/java/com/luxlunaris/noadpadlight/ui/ReaderActivity.java @@ -88,19 +88,11 @@ private void jumpToPosition(int position){ @Override protected void onPause() { super.onPause(); - - - + //get the edited text from the edittext view String editedText = textView.getText().toString(); - - - - //if the edited text is empty, delete the Page - - if(editedText.trim().isEmpty()){ boolean t = page.delete(); return; diff --git a/app/src/main/java/com/luxlunaris/noadpadlight/ui/SettingsActivity.java b/app/src/main/java/com/luxlunaris/noadpadlight/ui/SettingsActivity.java index 400b8a0..d9c410a 100644 --- a/app/src/main/java/com/luxlunaris/noadpadlight/ui/SettingsActivity.java +++ b/app/src/main/java/com/luxlunaris/noadpadlight/ui/SettingsActivity.java @@ -2,6 +2,8 @@ import android.os.Bundle; +import android.view.View; +import android.widget.Button; import android.widget.LinearLayout; @@ -23,6 +25,19 @@ protected void onCreate(Bundle savedInstanceState) { linearLayout = findViewById(R.id.settings_lin_layout); + Button showInfo = new Button(this); + linearLayout.addView(showInfo, 0); + showInfo.setText("Credits & more Info"); + showInfo.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + InfoFragment infoFrag = InfoFragment.newInstance(getResources().getString(R.string.credits_eng)); + infoFrag.show(getSupportFragmentManager(), ""); + } + }); + + + ToggleFragment lauchToBlankPageToggle = ToggleFragment.newInstance("Auto-launch the app to a blank page.", SETTINGS_TAGS.LAUNCH_TO_BLANK_PAGE); getSupportFragmentManager().beginTransaction().add(linearLayout.getId(), lauchToBlankPageToggle, "" ).commit(); diff --git a/app/src/main/res/layout/fragment_info.xml b/app/src/main/res/layout/fragment_info.xml new file mode 100644 index 0000000..9433f8a --- /dev/null +++ b/app/src/main/res/layout/fragment_info.xml @@ -0,0 +1,38 @@ + + + +