Skip to content

Commit

Permalink
Release 0.2.0-rc1
Browse files Browse the repository at this point in the history
This is the first release since the rewrite. Therefore, the changelog is
simple: Rewrite the app.
  • Loading branch information
nift4 committed Feb 10, 2021
1 parent 88edf79 commit 6b50db9
Show file tree
Hide file tree
Showing 8 changed files with 406 additions and 65 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ android {
defaultConfig {
applicationId "org.androidbootmanager.app"
minSdkVersion 26
// we're not going to google play
//noinspection OldTargetApi
targetSdkVersion 27
versionCode 2001
versionName "0.2.0-pre1"
versionCode 2010
versionName "0.2.0-rc1"
}
signingConfigs {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
Expand All @@ -19,6 +21,7 @@
import androidx.recyclerview.widget.RecyclerView;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.io.SuFile;

import org.androidbootmanager.app.R;
Expand All @@ -27,6 +30,8 @@
import org.androidbootmanager.app.ui.wizard.WizardActivity;
import org.androidbootmanager.app.util.ActionAbortedCleanlyError;
import org.androidbootmanager.app.util.ConfigFile;
import org.androidbootmanager.app.util.ConfigTextWatcher;
import org.androidbootmanager.app.util.MiscUtils;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -111,8 +116,58 @@ public ViewHolder(View view) {
pic = view.findViewById(R.id.entry_pic);
name = view.findViewById(R.id.entry_name);
container.setOnClickListener((v) -> {
// TODO
updateEntries();
assert e != null;
ConfigFile proposed_;
try {
proposed_ = ConfigFile.importFromFile(e.file);
} catch (ActionAbortedCleanlyError actionAbortedCleanlyError) {
actionAbortedCleanlyError.printStackTrace();
Toast.makeText(requireContext(),"Loading configuration file: Error. Action aborted cleanly. Creating new.",Toast.LENGTH_LONG).show();
proposed_ = new ConfigFile();
}
final ConfigFile proposed = proposed_;
View dialog = LayoutInflater.from(requireContext()).inflate(R.layout.edit_entry,null);
((EditText) dialog.findViewById(R.id.editentryTitle)).setText(e.config.get("title"));
((EditText) dialog.findViewById(R.id.editentryTitle)).addTextChangedListener(new ConfigTextWatcher(proposed, "title"));
((EditText) dialog.findViewById(R.id.editentryKernel)).setText(e.config.get("linux"));
((EditText) dialog.findViewById(R.id.editentryKernel)).addTextChangedListener(new ConfigTextWatcher(proposed, "linux"));
((EditText) dialog.findViewById(R.id.editentryDtb)).setText(e.config.get("dtb"));
((EditText) dialog.findViewById(R.id.editentryDtb)).addTextChangedListener(new ConfigTextWatcher(proposed, "dtb"));
((EditText) dialog.findViewById(R.id.editentryInitrd)).setText(e.config.get("initrd"));
((EditText) dialog.findViewById(R.id.editentryInitrd)).addTextChangedListener(new ConfigTextWatcher(proposed, "initrd"));
((EditText) dialog.findViewById(R.id.editentryCmdline)).setText(e.config.get("options"));
((EditText) dialog.findViewById(R.id.editentryCmdline)).addTextChangedListener(new ConfigTextWatcher(proposed, "options"));
((EditText) dialog.findViewById(R.id.editentryDataPart)).setText(e.config.get("xdata"));
dialog.findViewById(R.id.editentryDataPart).setEnabled(false);
((EditText) dialog.findViewById(R.id.editentrySysPart)).setText(e.config.get("xsystem"));
dialog.findViewById(R.id.editentrySysPart).setEnabled(false);
new AlertDialog.Builder(requireContext())
.setCancelable(true)
.setNeutralButton(R.string.cancel, (p1, p2) -> p1.dismiss())
.setNegativeButton(R.string.delete, (p1, p2) -> MiscUtils.sure(requireContext(), p1, getString(R.string.delete_msg_2, e.config.get("title")), (p112, p212) -> {
if (e.config.get("xsystem") != null && e.config.get("xdata") != null) {
if (e.config.get("xsystem").equals("real") || e.config.get("xdata").equals("real"))
new AlertDialog.Builder(requireContext())
.setTitle(R.string.failed)
.setMessage(R.string.delete_real_rom)
.setCancelable(true)
.setNegativeButton(R.string.ok, (d, p) -> d.dismiss())
.show();
} else {
if (!SuFile.open(e.file).delete())
Toast.makeText(requireContext(),"Deleting configuration file: Error.",Toast.LENGTH_LONG).show();
Shell.su("rm -rf /data/abm/bootset/" + e.file.replace("/data/abm/bootset/lk2nd/entries/","").replace(".conf","")).submit();
updateEntries();
}
}))
.setPositiveButton(R.string.save, (p1, p2) -> {
e.config = proposed;
e.save();
updateEntries();
})
.setTitle(R.string.edit_entry)
.setView(dialog)
.show();
});
}

Expand Down Expand Up @@ -148,6 +203,7 @@ public void updateEntries() {
Toast.makeText(requireContext(), "Loading entry: Error. Action aborted cleanly.", Toast.LENGTH_LONG).show();
}
}
if (adapter != null) adapter.notifyDataSetChanged();
adapter = new ROMRecyclerViewAdapter(entries);
recyclerView.setAdapter(adapter);
}
}
Loading

0 comments on commit 6b50db9

Please sign in to comment.