-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
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
69 changes: 69 additions & 0 deletions
69
HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/OutdatedWarningDialog.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,69 @@ | ||
package com.tungsten.hmclpe.launcher.dialogs; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.app.Dialog; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.net.Uri; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.CheckBox; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.tungsten.hmclpe.R; | ||
|
||
public class OutdatedWarningDialog extends Dialog implements View.OnClickListener { | ||
|
||
private CheckBox checkBox; | ||
private Button pojav; | ||
private Button fcl; | ||
private Button positive; | ||
|
||
public OutdatedWarningDialog(@NonNull Context context) { | ||
super(context); | ||
setCancelable(false); | ||
setContentView(R.layout.dialog_outdated_warning); | ||
|
||
checkBox = findViewById(R.id.hide); | ||
pojav = findViewById(R.id.pojav); | ||
fcl = findViewById(R.id.fcl); | ||
positive = findViewById(R.id.positive); | ||
pojav.setOnClickListener(this); | ||
fcl.setOnClickListener(this); | ||
positive.setOnClickListener(this); | ||
} | ||
|
||
public static void init(Context context) { | ||
SharedPreferences sharedPreferences = context.getSharedPreferences("warning", Context.MODE_PRIVATE); | ||
boolean shouldShow = sharedPreferences.getBoolean("outdated_warning", true); | ||
if (shouldShow) { | ||
OutdatedWarningDialog dialog = new OutdatedWarningDialog(context); | ||
dialog.show(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onClick(View view) { | ||
if (view == pojav) { | ||
Uri uri = Uri.parse("https://github.com/PojavLauncherTeam/PojavLauncher"); | ||
Intent intent = new Intent(Intent.ACTION_VIEW, uri); | ||
getContext().startActivity(intent); | ||
} | ||
if (view == fcl) { | ||
Uri uri = Uri.parse("https://alist.8mi.tech/FCL"); | ||
Intent intent = new Intent(Intent.ACTION_VIEW, uri); | ||
getContext().startActivity(intent); | ||
} | ||
if (view == positive) { | ||
if (checkBox.isChecked()) { | ||
SharedPreferences sharedPreferences = getContext().getSharedPreferences("warning", Context.MODE_PRIVATE); | ||
@SuppressLint("CommitPrefEdits") SharedPreferences.Editor editor = sharedPreferences.edit(); | ||
editor.putBoolean("outdated_warning", false); | ||
editor.apply(); | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:padding="15dp" | ||
android:layout_width="450dp" | ||
android:layout_height="wrap_content"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textSize="@dimen/text_size_big" | ||
android:textColor="@color/colorPureBlack" | ||
android:textStyle="bold" | ||
android:text="@string/dialog_outdated_warning_title"/> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="10dp" | ||
android:textSize="@dimen/text_size_middle" | ||
android:textColor="@color/colorPureBlack" | ||
android:text="@string/dialog_outdated_warning_msg"/> | ||
|
||
<LinearLayout | ||
android:layout_marginTop="10dp" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal"> | ||
|
||
<CheckBox | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:text="@string/dialog_outdated_warning_hide" | ||
android:id="@+id/hide"/> | ||
|
||
<View | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<Button | ||
android:singleLine="true" | ||
android:textAllCaps="false" | ||
android:layout_width="60dp" | ||
android:layout_height="40dp" | ||
android:gravity="center" | ||
android:text="Pojav" | ||
android:textSize="15sp" | ||
android:textColor="@color/colorLinkBlue" | ||
android:background="@drawable/launcher_button_parent" | ||
android:id="@+id/pojav"/> | ||
|
||
<Button | ||
android:layout_marginStart="10dp" | ||
android:singleLine="true" | ||
android:textAllCaps="false" | ||
android:layout_width="60dp" | ||
android:layout_height="40dp" | ||
android:gravity="center" | ||
android:text="FCL" | ||
android:textSize="15sp" | ||
android:textColor="@color/colorLinkBlue" | ||
android:background="@drawable/launcher_button_parent" | ||
android:id="@+id/fcl"/> | ||
|
||
<Button | ||
android:layout_marginStart="10dp" | ||
android:singleLine="true" | ||
android:textAllCaps="false" | ||
android:layout_width="60dp" | ||
android:layout_height="40dp" | ||
android:gravity="center" | ||
android:text="@string/dialog_outdated_warning_positive" | ||
android:textSize="15sp" | ||
android:textColor="@color/colorLinkBlue" | ||
android:background="@drawable/launcher_button_parent" | ||
android:id="@+id/positive"/> | ||
|
||
</LinearLayout> | ||
|
||
</LinearLayout> |
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