Adding deprecation dialog. #492

Merged
mmarif merged 3 commits from :deprecation-dialog into master 2020-05-09 19:08:07 +00:00
3 changed files with 117 additions and 1 deletions

View File

@ -0,0 +1,77 @@
package org.mian.gitnex.helpers;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import org.mian.gitnex.R;
/**
* Author opyale
*/
public class DeprecationDialog extends AlertDialog.Builder {
private Context context;
private String title;
private String message;
public DeprecationDialog(@NonNull Context context) {
super(context);
this.context = context;
setup();
}
public DeprecationDialog(@NonNull Context context, int themeResId) {
super(context, themeResId);
this.context = context;
setup();
}
@NonNull
@SuppressLint("InflateParams")
@Override
public AlertDialog create() {
setCancelable(false);
setPositiveButton(context.getResources().getString(R.string.okButton), (dialog, which) -> dialog.dismiss());
View view = LayoutInflater.from(context).inflate(R.layout.layout_deprecation_dialog, null);
TextView customTitle = view.findViewById(R.id.customTitle);
TextView customMessage = view.findViewById(R.id.customMessage);
customTitle.setText(title);
customMessage.setText(message);
setView(view);
return super.create();
}
private void setup() {
this.message = "";
this.title = context.getResources().getString(R.string.featureDeprecated);
}
public void setMessage(String message) {
this.message = message;
}
public void setTitle(String title) {
this.title = title;
}
}

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="30dp"
android:paddingTop="20dp"
android:paddingRight="30dp"
android:paddingBottom="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:text="@string/screamingInFearEmoticon"
android:textColor="?attr/primaryTextColor"
android:textSize="50sp" />
<TextView
android:id="@+id/customTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center_horizontal"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<TextView
android:id="@+id/customMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center_horizontal"
android:textColor="?attr/primaryTextColor" />
</LinearLayout>

View File

@ -197,6 +197,9 @@
<string name="commentSuccess">Comment posted</string>
<string name="commentError">Something went wrong, please try again</string>
<string name="featureDeprecated">This function will be removed in the future.</string>
<string name="screamingInFearEmoticon" translatable="false">😱</string>
<string name="generalImgContentText">Avatar</string>
<string name="generalPageTitle" translatable="false">GitNex</string>
@ -622,7 +625,6 @@
<string name="mtm_decision_once">Once</string>
<string name="mtm_decision_abort">Abort</string>
<string name="issueSubscribtion">Issue Subscribed</string>
<string name="issueSubscribtionError">Issue Subscription failed</string>
<string name="issueUnsubscribtion">Issue Unsubscribed</string>