Skip to content

Commit 6b50db9

Browse files
committed
Release 0.2.0-rc1
This is the first release since the rewrite. Therefore, the changelog is simple: Rewrite the app.
1 parent 88edf79 commit 6b50db9

File tree

8 files changed

+406
-65
lines changed

8 files changed

+406
-65
lines changed

app/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ android {
88
defaultConfig {
99
applicationId "org.androidbootmanager.app"
1010
minSdkVersion 26
11+
// we're not going to google play
1112
//noinspection OldTargetApi
1213
targetSdkVersion 27
13-
versionCode 2001
14-
versionName "0.2.0-pre1"
14+
versionCode 2010
15+
versionName "0.2.0-rc1"
1516
}
1617
signingConfigs {
1718
release {

app/src/main/java/org/androidbootmanager/app/ui/roms/ROMFragment.java

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
import android.view.LayoutInflater;
66
import android.view.View;
77
import android.view.ViewGroup;
8+
import android.widget.EditText;
89
import android.widget.ImageView;
910
import android.widget.TextView;
1011
import android.widget.Toast;
1112

1213
import androidx.annotation.NonNull;
14+
import androidx.appcompat.app.AlertDialog;
1315
import androidx.constraintlayout.widget.ConstraintLayout;
1416
import androidx.core.content.ContextCompat;
1517
import androidx.fragment.app.Fragment;
@@ -19,6 +21,7 @@
1921
import androidx.recyclerview.widget.RecyclerView;
2022

2123
import com.google.android.material.floatingactionbutton.FloatingActionButton;
24+
import com.topjohnwu.superuser.Shell;
2225
import com.topjohnwu.superuser.io.SuFile;
2326

2427
import org.androidbootmanager.app.R;
@@ -27,6 +30,8 @@
2730
import org.androidbootmanager.app.ui.wizard.WizardActivity;
2831
import org.androidbootmanager.app.util.ActionAbortedCleanlyError;
2932
import org.androidbootmanager.app.util.ConfigFile;
33+
import org.androidbootmanager.app.util.ConfigTextWatcher;
34+
import org.androidbootmanager.app.util.MiscUtils;
3035

3136
import java.util.ArrayList;
3237
import java.util.List;
@@ -111,8 +116,58 @@ public ViewHolder(View view) {
111116
pic = view.findViewById(R.id.entry_pic);
112117
name = view.findViewById(R.id.entry_name);
113118
container.setOnClickListener((v) -> {
114-
// TODO
115-
updateEntries();
119+
assert e != null;
120+
ConfigFile proposed_;
121+
try {
122+
proposed_ = ConfigFile.importFromFile(e.file);
123+
} catch (ActionAbortedCleanlyError actionAbortedCleanlyError) {
124+
actionAbortedCleanlyError.printStackTrace();
125+
Toast.makeText(requireContext(),"Loading configuration file: Error. Action aborted cleanly. Creating new.",Toast.LENGTH_LONG).show();
126+
proposed_ = new ConfigFile();
127+
}
128+
final ConfigFile proposed = proposed_;
129+
View dialog = LayoutInflater.from(requireContext()).inflate(R.layout.edit_entry,null);
130+
((EditText) dialog.findViewById(R.id.editentryTitle)).setText(e.config.get("title"));
131+
((EditText) dialog.findViewById(R.id.editentryTitle)).addTextChangedListener(new ConfigTextWatcher(proposed, "title"));
132+
((EditText) dialog.findViewById(R.id.editentryKernel)).setText(e.config.get("linux"));
133+
((EditText) dialog.findViewById(R.id.editentryKernel)).addTextChangedListener(new ConfigTextWatcher(proposed, "linux"));
134+
((EditText) dialog.findViewById(R.id.editentryDtb)).setText(e.config.get("dtb"));
135+
((EditText) dialog.findViewById(R.id.editentryDtb)).addTextChangedListener(new ConfigTextWatcher(proposed, "dtb"));
136+
((EditText) dialog.findViewById(R.id.editentryInitrd)).setText(e.config.get("initrd"));
137+
((EditText) dialog.findViewById(R.id.editentryInitrd)).addTextChangedListener(new ConfigTextWatcher(proposed, "initrd"));
138+
((EditText) dialog.findViewById(R.id.editentryCmdline)).setText(e.config.get("options"));
139+
((EditText) dialog.findViewById(R.id.editentryCmdline)).addTextChangedListener(new ConfigTextWatcher(proposed, "options"));
140+
((EditText) dialog.findViewById(R.id.editentryDataPart)).setText(e.config.get("xdata"));
141+
dialog.findViewById(R.id.editentryDataPart).setEnabled(false);
142+
((EditText) dialog.findViewById(R.id.editentrySysPart)).setText(e.config.get("xsystem"));
143+
dialog.findViewById(R.id.editentrySysPart).setEnabled(false);
144+
new AlertDialog.Builder(requireContext())
145+
.setCancelable(true)
146+
.setNeutralButton(R.string.cancel, (p1, p2) -> p1.dismiss())
147+
.setNegativeButton(R.string.delete, (p1, p2) -> MiscUtils.sure(requireContext(), p1, getString(R.string.delete_msg_2, e.config.get("title")), (p112, p212) -> {
148+
if (e.config.get("xsystem") != null && e.config.get("xdata") != null) {
149+
if (e.config.get("xsystem").equals("real") || e.config.get("xdata").equals("real"))
150+
new AlertDialog.Builder(requireContext())
151+
.setTitle(R.string.failed)
152+
.setMessage(R.string.delete_real_rom)
153+
.setCancelable(true)
154+
.setNegativeButton(R.string.ok, (d, p) -> d.dismiss())
155+
.show();
156+
} else {
157+
if (!SuFile.open(e.file).delete())
158+
Toast.makeText(requireContext(),"Deleting configuration file: Error.",Toast.LENGTH_LONG).show();
159+
Shell.su("rm -rf /data/abm/bootset/" + e.file.replace("/data/abm/bootset/lk2nd/entries/","").replace(".conf","")).submit();
160+
updateEntries();
161+
}
162+
}))
163+
.setPositiveButton(R.string.save, (p1, p2) -> {
164+
e.config = proposed;
165+
e.save();
166+
updateEntries();
167+
})
168+
.setTitle(R.string.edit_entry)
169+
.setView(dialog)
170+
.show();
116171
});
117172
}
118173

@@ -148,6 +203,7 @@ public void updateEntries() {
148203
Toast.makeText(requireContext(), "Loading entry: Error. Action aborted cleanly.", Toast.LENGTH_LONG).show();
149204
}
150205
}
151-
if (adapter != null) adapter.notifyDataSetChanged();
206+
adapter = new ROMRecyclerViewAdapter(entries);
207+
recyclerView.setAdapter(adapter);
152208
}
153209
}

0 commit comments

Comments
 (0)