-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added info dialog frag and credits text in SettingsActivity.
- Loading branch information
1 parent
7b68438
commit 33a4463
Showing
5 changed files
with
143 additions
and
9 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
app/src/main/java/com/luxlunaris/noadpadlight/ui/InfoFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/frameLayout2" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".ui.InfoFragment"> | ||
|
||
<Button | ||
android:id="@+id/info_frag_button" | ||
android:layout_width="186dp" | ||
android:layout_height="40dp" | ||
android:layout_marginBottom="56dp" | ||
android:text="got it!" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.498" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
<EditText | ||
android:id="@+id/infoFragmentText" | ||
android:layout_width="313dp" | ||
android:layout_height="453dp" | ||
android:editable="false" | ||
android:ems="10" | ||
android:enabled="true" | ||
android:focusable="true" | ||
android:gravity="start|top" | ||
android:inputType="textMultiLine" | ||
app:layout_constraintBottom_toTopOf="@+id/info_frag_button" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.571" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintVertical_bias="0.584" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters