Commit 5499f2ed authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Removed the new features dialog

parent 359e5116
package com.frostnerd.dnschanger.dialogs;
import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.frostnerd.dnschanger.BuildConfig;
import com.frostnerd.dnschanger.R;
import com.frostnerd.dnschanger.util.ThemeHandler;
import com.frostnerd.dnschanger.util.Preferences;
import com.frostnerd.utils.lifecyclehelper.UtilityDialog;
/**
* Copyright Daniel Wolf 2017
* All rights reserved.
* <p>
* Terms on usage of my code can be found here: https://git.frostnerd.com/PublicAndroidApps/DnsChanger/blob/master/README.md
* <p>
* <p>
* development@frostnerd.com
*/
public class NewFeaturesDialog extends UtilityDialog {
public NewFeaturesDialog(@NonNull Context context) {
super(context, ThemeHandler.getDialogTheme(context));
setCancelable(true);
setCanceledOnTouchOutside(true);
setButton(BUTTON_POSITIVE, context.getString(R.string.close), new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
setTitle(R.string.new_features);
View content;
setView(content = getLayoutInflater().inflate(R.layout.dialog_new_features, null, false));
((TextView)content.findViewById(R.id.text)).setText(BuildConfig.VERSION_NAME);
ListView list = content.findViewById(R.id.list);
String[] arr = context.getResources().getStringArray(getStringArrayID(context));
for(int i = 0; i < arr.length; i++){
arr[i] = "- " + arr[i];
}
list.setAdapter(new ArrayAdapter<>(context, R.layout.item_new_feature, arr));
Preferences.getInstance(context).put( "features_" + BuildConfig.VERSION_NAME.replace(".", "_"),true);
}
@Override
protected void destroy() {
}
private static int getStringArrayID(Context context){
return context.getResources().getIdentifier("features_" + BuildConfig.VERSION_NAME.replace(".", "_"),
"array", context.getPackageName());
}
public static boolean shouldShowDialog(Context context) {
return getStringArrayID(context) != 0 && !Preferences.getInstance(context).getBoolean("features_" + BuildConfig.VERSION_NAME.replace(".", "_"), false);
}
}
......@@ -42,7 +42,6 @@ import com.frostnerd.dnschanger.R;
import com.frostnerd.dnschanger.activities.MainActivity;
import com.frostnerd.dnschanger.database.entities.DNSEntry;
import com.frostnerd.dnschanger.database.entities.IPPortPair;
import com.frostnerd.dnschanger.dialogs.NewFeaturesDialog;
import com.frostnerd.dnschanger.dialogs.VPNInfoDialog;
import com.frostnerd.dnschanger.services.DNSVpnService;
import com.frostnerd.dnschanger.util.DNSQueryUtil;
......@@ -239,9 +238,6 @@ public class MainFragment extends Fragment {
}
});
setEditTextLabel();
if(NewFeaturesDialog.shouldShowDialog(requireContext())){
new NewFeaturesDialog(requireContext()).show();
}
LogFactory.writeMessage(requireContext(), LOG_TAG, "Done with OnCreate");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment