Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.four.editor;
- import android.content.SharedPreferences;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.TextView;
- import androidx.appcompat.app.AppCompatActivity;
- import java.io.File;
- import java.io.FileWriter;
- import java.io.IOException;
- /* loaded from: classes3.dex */
- public class MainActivity extends AppCompatActivity {
- EditText contentText;
- String currentsettings = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n<map>\n <string name=\"server\">supersecureserver.com</string>\n</map>";
- EditText editText;
- TextView result;
- @Override // androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, android.app.Activity
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(C0567R.layout.activity_main);
- SharedPreferences prefs = getApplicationContext().getSharedPreferences("server_discover_settings", 0);
- SharedPreferences.Editor editor = prefs.edit();
- if (!new File("/data/data/com.four.editor/shared_prefs/server_discover_settings.xml").exists()) {
- editor.putString("server", "supersecureserver.com");
- editor.apply();
- }
- ((TextView) findViewById(C0567R.C0570id.pseudopoll)).setText("Connected to: " + prefs.getString("server", "supersecureserver.com"));
- this.contentText = (EditText) findViewById(C0567R.C0570id.editTextFileContent);
- this.result = (TextView) findViewById(C0567R.C0570id.result);
- this.editText = (EditText) findViewById(C0567R.C0570id.editText);
- ((Button) findViewById(C0567R.C0570id.button)).setOnClickListener(new View.OnClickListener() { // from class: com.four.editor.MainActivity.1
- @Override // android.view.View.OnClickListener
- public void onClick(View view) {
- MainActivity mainActivity = MainActivity.this;
- mainActivity.writeFile(mainActivity.contentText.getText().toString(), MainActivity.this.editText.getText().toString());
- }
- });
- }
- /* JADX INFO: Access modifiers changed from: private */
- public void writeFile(String what, String where) {
- File file = new File(getFilesDir(), where);
- try {
- if (!file.exists()) {
- FileWriter fileWriter = new FileWriter(file);
- fileWriter.append((CharSequence) what);
- fileWriter.flush();
- fileWriter.close();
- TextView textView = this.result;
- textView.setText("File was succesfully saved to: " + file.toString());
- } else {
- TextView textView2 = this.result;
- textView2.setText("I am sorry !! the file: " + file.toString() + " already exists !");
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement