正在查看: xDrip+ v04633772025.07.16 应用的 SendFeedBack.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: xDrip+ v04633772025.07.16 应用的 SendFeedBack.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.eveningoutpost.dexdrip.utilitymodels;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import com.eveningoutpost.dexdrip.BaseAppCompatActivity;
import com.eveningoutpost.dexdrip.models.JoH;
import com.eveningoutpost.dexdrip.watch.thinjam.BlueJayEntry;
import com.squareup.okhttp.FormEncodingBuilder;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import java.util.concurrent.TimeUnit;
public class SendFeedBack extends BaseAppCompatActivity {
EditText contact;
RatingBar myrating;
TextView ratingtext;
private String send_url;
private String type_of_message = "Unknown";
private String log_data = "";
@Override
protected void onCreate(Bundle bundle) {
Bundle extras;
String str;
super.onCreate(bundle);
setContentView(2131492939);
StringBuilder sb = new StringBuilder();
sb.append(getString(BlueJayEntry.isNative() ? 2131756156 : 2131757053));
sb.append("/joh-feedback");
this.send_url = sb.toString();
this.myrating = (RatingBar) findViewById(2131296875);
this.ratingtext = (TextView) findViewById(2131296876);
EditText editText = (EditText) findViewById(2131296519);
this.contact = editText;
editText.setText(PersistentStore.getString("feedback-contact-reference"));
Intent intent = getIntent();
if (intent != null && (extras = intent.getExtras()) != null) {
String string = extras.getString("request_translation");
if (string != null) {
((EditText) findViewById(2131297211)).setText("Dear developers, please may I request that you add translation capability for: " + string + "\n\n");
this.type_of_message = "Language request";
}
String string2 = extras.getString("generic_text");
if (string2 != null) {
this.log_data = string2;
EditText editText2 = (EditText) findViewById(2131297211);
if (this.log_data.length() > 300) {
str = "\n\nPlease describe what you think these logs may show. Explain the problem if there is one.\n\nAttached " + this.log_data.length() + " characters of log data. (hidden)\n\n";
} else {
str = this.log_data;
}
editText2.setText(str);
this.type_of_message = "Log Push";
this.myrating.setVisibility(8);
this.ratingtext.setVisibility(8);
}
}
if (this.type_of_message.equals("Unknown")) {
askType();
}
}
public void closeActivity(View view) {
finish();
}
private void askType() {
final CharSequence[] charSequenceArr = {"Bug Report", "Compliment", "Question", "Other"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Type of feedback?");
builder.setSingleChoiceItems(charSequenceArr, -1, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SendFeedBack.this.type_of_message = charSequenceArr[i].toString();
dialogInterface.dismiss();
}
});
builder.create().show();
}
private void askEmailAddress() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Please supply email address or other contact reference");
final EditText editText = new EditText(this);
editText.setInputType(33);
builder.setView(editText);
builder.setPositiveButton(getString(2131755953), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SendFeedBack.this.contact.setText(editText.getText().toString());
SendFeedBack.this.sendFeedback(null);
}
});
builder.setNegativeButton(getString(2131755280), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
});
AlertDialog create = builder.create();
try {
create.getWindow().setSoftInputMode(4);
} catch (NullPointerException unused) {
}
create.show();
}
public void sendFeedback(View view) {
EditText editText = (EditText) findViewById(2131296519);
EditText editText2 = (EditText) findViewById(2131297211);
final OkHttpClient okHttpClient = new OkHttpClient();
TimeUnit timeUnit = TimeUnit.SECONDS;
okHttpClient.setConnectTimeout(10L, timeUnit);
okHttpClient.setReadTimeout(30L, timeUnit);
okHttpClient.setWriteTimeout(30L, timeUnit);
okHttpClient.interceptors().add(new GzipRequestInterceptor());
if (editText2.length() == 0) {
toast("No text entered - cannot send blank");
return;
}
if (editText.length() == 0) {
toast("Without some contact info we cannot reply");
askEmailAddress();
return;
}
if (this.type_of_message.equals("Unknown")) {
askType();
return;
}
PersistentStore.setString("feedback-contact-reference", editText.getText().toString());
toast("Sending..");
try {
final RequestBody build = new FormEncodingBuilder().add("contact", editText.getText().toString()).add("body", editText2.getText().toString() + " \n\n===\nType: " + this.type_of_message + "\nLog data:\n\n" + this.log_data).add("rating", String.valueOf(this.myrating.getRating())).add("type", this.type_of_message).build();
new Thread(new Runnable() {
@Override
public void run() {
try {
Request build2 = new Request.Builder().url(SendFeedBack.this.send_url).post(build).build();
Log.i("jamorham feedback", "Sending feedback request");
Response execute = okHttpClient.newCall(build2).execute();
if (execute.isSuccessful()) {
JoH.static_toast_long(execute.body().string());
SendFeedBack.this.log_data = "";
SendFeedBack.this.finish();
} else {
JoH.static_toast_short("Error sending feedback: " + execute.message().toString());
}
} catch (Exception e) {
Log.e("jamorham feedback", "Got exception in execute: " + e.toString());
JoH.static_toast_short("Error with network connection");
}
}
}).start();
} catch (Exception e) {
JoH.static_toast_short(e.getMessage());
Log.e("jamorham feedback", "General exception: " + e.toString());
}
}
private void toast(final String str) {
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(SendFeedBack.this.getApplicationContext(), str, 0).show();
}
});
Log.d("jamorham feedback", "Toast msg: " + str);
} catch (Exception unused) {
Log.e("jamorham feedback", "Couldn't display toast: " + str);
}
}
}