Skip to content

Commit cb3dc53

Browse files
committed
merge
2 parents df99ad6 + a7d835b commit cb3dc53

File tree

13 files changed

+271
-236
lines changed

13 files changed

+271
-236
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ android {
1515
minSdk 26
1616
targetSdk 34
1717

18-
versionCode 51
19-
versionName "v6.0.0"
18+
versionCode 52
19+
versionName "v6.0.1"
2020

2121
ndk {
2222
abiFilters 'arm64-v8a', 'armeabi-v7a','x86','x86_64'

app/src/main/java/in/hridayan/ashell/activities/CrashReportActivity.java

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@
66
import android.widget.Toast;
77
import androidx.activity.EdgeToEdge;
88
import androidx.appcompat.app.AppCompatActivity;
9-
import androidx.appcompat.widget.AppCompatImageButton;
10-
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
11-
import com.google.android.material.floatingactionbutton.FloatingActionButton;
12-
import com.google.android.material.textview.MaterialTextView;
139
import in.hridayan.ashell.R;
1410
import in.hridayan.ashell.ui.BehaviorFAB.FabExtendingOnScrollViewListener;
15-
import in.hridayan.ashell.ui.CoordinatedNestedScrollView;
1611
import in.hridayan.ashell.ui.ThemeUtils;
12+
import in.hridayan.ashell.databinding.ActivityCrashReportBinding;
1713
import in.hridayan.ashell.config.Const;
1814
import in.hridayan.ashell.utils.DeviceUtils;
1915
import in.hridayan.ashell.utils.HapticUtils;
@@ -22,55 +18,44 @@
2218
import java.util.Date;
2319

2420
public class CrashReportActivity extends AppCompatActivity {
25-
private MaterialTextView copyText, crashInfo;
26-
private AppCompatImageButton copyButton;
27-
private ExtendedFloatingActionButton reportButton;
28-
private FloatingActionButton shareButton;
29-
private CoordinatedNestedScrollView scrollView;
21+
private ActivityCrashReportBinding binding;
3022

3123
@Override
3224
protected void onCreate(Bundle savedInstanceState) {
3325
EdgeToEdge.enable(this);
3426
ThemeUtils.updateTheme(this);
3527

3628
super.onCreate(savedInstanceState);
37-
setContentView(R.layout.activity_crash_report);
3829

39-
copyText = findViewById(R.id.copy);
40-
copyButton = findViewById(R.id.copy_button);
41-
reportButton = findViewById(R.id.report_button);
42-
shareButton = findViewById(R.id.fab_share);
43-
scrollView = findViewById(R.id.scrollView);
30+
setContentView(R.layout.activity_crash_report);
4431

45-
new FabExtendingOnScrollViewListener(scrollView, reportButton);
32+
new FabExtendingOnScrollViewListener(binding.scrollView, binding.reportButton);
4633

4734
// Get the crash report from intent or SharedPreferences
4835
String stackTrace = getIntent().getStringExtra("stackTrace");
4936
String message = getIntent().getStringExtra("message");
5037

51-
// Show the crash info
52-
crashInfo = findViewById(R.id.crash_info);
53-
crashInfo.setText(stackTrace + "\n\n" + message);
38+
binding.crashLogTextView.setText(stackTrace + "\n\n" + message);
5439

55-
reportButton.setOnClickListener(
40+
binding.reportButton.setOnClickListener(
5641
v -> {
5742
HapticUtils.weakVibrate(v);
5843
sendCrashReport(stackTrace, message);
5944
});
6045

61-
copyText.setOnClickListener(
46+
binding.copyText.setOnClickListener(
6247
v -> {
6348
HapticUtils.weakVibrate(v);
6449
Utils.copyToClipboard(reportContent(stackTrace, message), this);
6550
});
6651

67-
copyButton.setOnClickListener(
52+
binding.copyIcon.setOnClickListener(
6853
v -> {
6954
HapticUtils.weakVibrate(v);
7055
Utils.copyToClipboard(reportContent(stackTrace, message), this);
7156
});
7257

73-
shareButton.setOnClickListener(
58+
binding.shareButton.setOnClickListener(
7459
v -> {
7560
HapticUtils.weakVibrate(v);
7661
Utils.shareOutput(this, this, "crash_report.txt", reportContent(stackTrace, message));
@@ -79,7 +64,6 @@ protected void onCreate(Bundle savedInstanceState) {
7964

8065
/*This function takes the report text and initiate the intent to send the email with the subject and body*/
8166
private void sendCrashReport(String stackTrace, String message) {
82-
8367
String subject = "Crash Report";
8468
String to = Const.DEV_EMAIL;
8569

app/src/main/java/in/hridayan/ashell/fragments/ChangelogFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ChangelogFragment extends Fragment {
2828
private FragmentChangelogBinding binding;
2929
private Pair<Integer, Integer> mRVPositionAndOffset;
3030

31-
private final String[] versionNames = {"v6.0.0","v5.2.1","v5.2.0",
31+
private final String[] versionNames = {"v6.0.1","v6.0.0","v5.2.1","v5.2.0",
3232
"v5.1.0", "v5.0.0", "v4.4.0", "v4.3.1", "v4.3.0", "v4.2.1", "v4.2.0", "v4.1.0", "v4.0.3",
3333
"v4.0.2", "v4.0.1", "v4.0.0", "v3.9.1", "v3.9.0", "v3.8.2", "v3.8.1", "v3.8.0", "v3.7.0",
3434
"v3.6.0", "v3.5.1", "v3.5.0", "v3.4.0", "v3.3.0", "v3.2.0", "v3.1.0", "v3.0.0", "v2.0.2",

app/src/main/java/in/hridayan/ashell/ui/bottomsheets/UpdateCheckerBottomSheet.java

Lines changed: 112 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -15,123 +15,125 @@
1515
import in.hridayan.ashell.BuildConfig;
1616
import in.hridayan.ashell.R;
1717
import in.hridayan.ashell.config.Preferences;
18+
import in.hridayan.ashell.ui.dialogs.FeedbackDialogs;
1819
import in.hridayan.ashell.utils.AppUpdater;
1920
import in.hridayan.ashell.utils.HapticUtils;
2021

2122
public class UpdateCheckerBottomSheet {
2223

23-
private final Activity activity;
24-
private final Context context;
25-
private BottomSheetDialog bottomSheetDialog;
26-
private View bottomSheetView;
27-
28-
private MaterialTextView currentVersionTextView;
29-
private MaterialTextView latestVersionTextView;
30-
private MaterialTextView descriptionTextView;
31-
private MaterialButton downloadButton;
32-
private MaterialButton cancelButton;
33-
private LinearProgressIndicator progressBar;
34-
private LottieAnimationView loadingDots;
35-
private FrameLayout progressBarLayout;
36-
37-
/**
38-
* Constructor to initialize the Update Checker Bottom Sheet.
39-
*
40-
* @param activity The activity context.
41-
* @param context The application context.
42-
*/
43-
public UpdateCheckerBottomSheet(@NonNull Activity activity, @NonNull Context context) {
44-
this.activity = activity;
45-
this.context = context;
46-
initializeBottomSheet();
47-
}
48-
49-
/**
50-
* Initializes the bottom sheet dialog and its UI components.
51-
*/
52-
private void initializeBottomSheet() {
53-
bottomSheetDialog = new BottomSheetDialog(activity);
54-
bottomSheetView = LayoutInflater.from(activity).inflate(R.layout.bottom_sheet_update_checker, null);
55-
bottomSheetDialog.setContentView(bottomSheetView);
56-
57-
// Initialize UI components
58-
progressBarLayout = bottomSheetView.findViewById(R.id.progressBarLayout);
59-
currentVersionTextView = bottomSheetView.findViewById(R.id.current_version);
60-
latestVersionTextView = bottomSheetView.findViewById(R.id.latest_version);
61-
descriptionTextView = bottomSheetView.findViewById(R.id.body);
62-
downloadButton = bottomSheetView.findViewById(R.id.download_button);
63-
cancelButton = bottomSheetView.findViewById(R.id.cancel_button);
64-
progressBar = bottomSheetView.findViewById(R.id.download_progress);
65-
loadingDots = bottomSheetView.findViewById(R.id.loading_animation);
66-
67-
adjustProgressBarLayout();
68-
setUpButtonListeners();
69-
}
70-
71-
/**
72-
* Adjusts the progress bar layout to maintain height consistency.
73-
*/
74-
private void adjustProgressBarLayout() {
75-
progressBarLayout.post(() -> {
76-
int currentHeight = progressBarLayout.getHeight();
77-
progressBarLayout.setMinimumHeight(currentHeight);
78-
ViewGroup.LayoutParams params = progressBarLayout.getLayoutParams();
79-
params.height = currentHeight;
80-
progressBarLayout.setLayoutParams(params);
24+
private final Activity activity;
25+
private final Context context;
26+
private BottomSheetDialog bottomSheetDialog;
27+
private View bottomSheetView;
28+
29+
private MaterialTextView currentVersionTextView;
30+
private MaterialTextView latestVersionTextView;
31+
private MaterialTextView descriptionTextView;
32+
private MaterialButton downloadButton;
33+
private MaterialButton cancelButton;
34+
private LinearProgressIndicator progressBar;
35+
private LottieAnimationView loadingDots;
36+
private FrameLayout progressBarLayout;
37+
38+
/**
39+
* Constructor to initialize the Update Checker Bottom Sheet.
40+
*
41+
* @param activity The activity context.
42+
* @param context The application context.
43+
*/
44+
public UpdateCheckerBottomSheet(@NonNull Activity activity, @NonNull Context context) {
45+
this.activity = activity;
46+
this.context = context;
47+
initializeBottomSheet();
48+
}
49+
50+
/** Initializes the bottom sheet dialog and its UI components. */
51+
private void initializeBottomSheet() {
52+
bottomSheetDialog = new BottomSheetDialog(activity);
53+
bottomSheetView =
54+
LayoutInflater.from(activity).inflate(R.layout.bottom_sheet_update_checker, null);
55+
bottomSheetDialog.setContentView(bottomSheetView);
56+
57+
// Initialize UI components
58+
progressBarLayout = bottomSheetView.findViewById(R.id.progressBarLayout);
59+
currentVersionTextView = bottomSheetView.findViewById(R.id.current_version);
60+
latestVersionTextView = bottomSheetView.findViewById(R.id.latest_version);
61+
descriptionTextView = bottomSheetView.findViewById(R.id.body);
62+
downloadButton = bottomSheetView.findViewById(R.id.download_button);
63+
cancelButton = bottomSheetView.findViewById(R.id.cancel_button);
64+
progressBar = bottomSheetView.findViewById(R.id.download_progress);
65+
loadingDots = bottomSheetView.findViewById(R.id.loading_animation);
66+
67+
adjustProgressBarLayout();
68+
setUpButtonListeners();
69+
}
70+
71+
/** Adjusts the progress bar layout to maintain height consistency. */
72+
private void adjustProgressBarLayout() {
73+
progressBarLayout.post(
74+
() -> {
75+
int currentHeight = progressBarLayout.getHeight();
76+
progressBarLayout.setMinimumHeight(currentHeight);
77+
ViewGroup.LayoutParams params = progressBarLayout.getLayoutParams();
78+
params.height = currentHeight;
79+
progressBarLayout.setLayoutParams(params);
8180
});
82-
}
83-
84-
/**
85-
* Populates the UI with version information.
86-
*/
87-
private void populateVersionInfo() {
88-
String currentVersionText = context.getString(R.string.current) + " " +
89-
context.getString(R.string.version) + " : " + BuildConfig.VERSION_NAME;
90-
String latestVersionText = context.getString(R.string.latest) + " " +
91-
context.getString(R.string.version) + " : " + Preferences.getLatestVersionName();
92-
93-
currentVersionTextView.setText(currentVersionText);
94-
latestVersionTextView.setText(latestVersionText);
95-
}
96-
97-
/**
98-
* Sets up listeners for the download and cancel buttons.
99-
*/
100-
private void setUpButtonListeners() {
101-
downloadButton.setOnClickListener(v -> {
102-
HapticUtils.weakVibrate(v);
103-
AppUpdater.fetchLatestReleaseAndInstall(activity, progressBar, descriptionTextView, loadingDots, downloadButton);
81+
}
82+
83+
/** Populates the UI with version information. */
84+
private void populateVersionInfo() {
85+
String currentVersionText =
86+
context.getString(R.string.current)
87+
+ " "
88+
+ context.getString(R.string.version)
89+
+ " : "
90+
+ BuildConfig.VERSION_NAME;
91+
String latestVersionText =
92+
context.getString(R.string.latest)
93+
+ " "
94+
+ context.getString(R.string.version)
95+
+ " : "
96+
+ Preferences.getLatestVersionName();
97+
98+
currentVersionTextView.setText(currentVersionText);
99+
latestVersionTextView.setText(latestVersionText);
100+
}
101+
102+
/** Sets up listeners for the download and cancel buttons. */
103+
private void setUpButtonListeners() {
104+
downloadButton.setOnClickListener(
105+
v -> {
106+
HapticUtils.weakVibrate(v);
107+
FeedbackDialogs.githubDownloadWarning(
108+
context, activity, progressBar, descriptionTextView, loadingDots, downloadButton);
104109
});
105110

106-
cancelButton.setOnClickListener(v -> {
107-
HapticUtils.weakVibrate(v);
108-
dismiss();
111+
cancelButton.setOnClickListener(
112+
v -> {
113+
HapticUtils.weakVibrate(v);
114+
dismiss();
109115
});
116+
}
117+
118+
/** Displays the update checker bottom sheet. */
119+
public void show() {
120+
populateVersionInfo();
121+
bottomSheetDialog.show();
122+
}
123+
124+
/** Dismisses the bottom sheet if it's currently displayed. */
125+
public void dismiss() {
126+
if (bottomSheetDialog != null && bottomSheetDialog.isShowing()) {
127+
bottomSheetDialog.dismiss();
110128
}
111-
112-
/**
113-
* Displays the update checker bottom sheet.
114-
*/
115-
public void show() {
116-
populateVersionInfo();
117-
bottomSheetDialog.show();
118-
}
119-
120-
/**
121-
* Dismisses the bottom sheet if it's currently displayed.
122-
*/
123-
public void dismiss() {
124-
if (bottomSheetDialog != null && bottomSheetDialog.isShowing()) {
125-
bottomSheetDialog.dismiss();
126-
}
127-
}
128-
129-
/**
130-
* Checks if the bottom sheet is currently displayed.
131-
*
132-
* @return True if showing, otherwise false.
133-
*/
134-
public boolean isShowing() {
135-
return bottomSheetDialog != null && bottomSheetDialog.isShowing();
136-
}
137-
}
129+
}
130+
131+
/**
132+
* Checks if the bottom sheet is currently displayed.
133+
*
134+
* @return True if showing, otherwise false.
135+
*/
136+
public boolean isShowing() {
137+
return bottomSheetDialog != null && bottomSheetDialog.isShowing();
138+
}
139+
}

0 commit comments

Comments
 (0)