Skip to content

Commit

Permalink
Move ReportActivity to termux-shared so that other termux plugins can…
Browse files Browse the repository at this point in the history
… use it too
  • Loading branch information
agnostic-apollo committed Jun 20, 2021
1 parent b7b12eb commit 7f36d7b
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
android:theme="@style/Theme.AppCompat.Light.DarkActionBar" />

<activity
android:name=".app.activities.ReportActivity"
android:name=".shared.activities.ReportActivity"
android:theme="@style/Theme.AppCompat.TermuxReportActivity"
android:documentLaunchMode="intoExisting"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import androidx.preference.PreferenceFragmentCompat;

import com.termux.R;
import com.termux.app.models.ReportInfo;
import com.termux.shared.activities.ReportActivity;
import com.termux.shared.models.ReportInfo;
import com.termux.app.models.UserAction;
import com.termux.shared.interact.ShareUtils;
import com.termux.shared.packages.PackageUtils;
Expand Down Expand Up @@ -84,7 +85,7 @@ public void run() {
aboutString.append("\n\n").append(TermuxUtils.getDeviceInfoMarkdownString(context));
aboutString.append("\n\n").append(TermuxUtils.getImportantLinksMarkdownString(context));

ReportActivity.startReportActivity(context, new ReportInfo(UserAction.ABOUT, TermuxConstants.TERMUX_APP.TERMUX_SETTINGS_ACTIVITY_NAME, title, null, aboutString.toString(), null, false));
ReportActivity.startReportActivity(context, new ReportInfo(UserAction.ABOUT.getName(), TermuxConstants.TERMUX_APP.TERMUX_SETTINGS_ACTIVITY_NAME, title, null, aboutString.toString(), null, false));
}
}.start();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import com.termux.shared.shell.ShellUtils;
import com.termux.shared.terminal.TermuxTerminalViewClientBase;
import com.termux.shared.termux.TermuxConstants;
import com.termux.app.activities.ReportActivity;
import com.termux.app.models.ReportInfo;
import com.termux.shared.activities.ReportActivity;
import com.termux.shared.models.ReportInfo;
import com.termux.app.models.UserAction;
import com.termux.app.terminal.io.KeyboardShortcut;
import com.termux.app.terminal.io.extrakeys.ExtraKeysView;
Expand Down Expand Up @@ -660,7 +660,7 @@ public void run() {
if (termuxAptInfo != null)
reportString.append("\n\n").append(termuxAptInfo);

ReportActivity.startReportActivity(mActivity, new ReportInfo(UserAction.REPORT_ISSUE_FROM_TRANSCRIPT, TermuxConstants.TERMUX_APP.TERMUX_ACTIVITY_NAME, title, null, reportString.toString(), "\n\n" + TermuxUtils.getReportIssueMarkdownString(mActivity), false));
ReportActivity.startReportActivity(mActivity, new ReportInfo(UserAction.REPORT_ISSUE_FROM_TRANSCRIPT.getName(), TermuxConstants.TERMUX_APP.TERMUX_ACTIVITY_NAME, title, null, reportString.toString(), "\n\n" + TermuxUtils.getReportIssueMarkdownString(mActivity), false));
}
}.start();
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/termux/app/utils/CrashUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import androidx.annotation.Nullable;

import com.termux.R;
import com.termux.app.activities.ReportActivity;
import com.termux.shared.activities.ReportActivity;
import com.termux.shared.notification.NotificationUtils;
import com.termux.shared.file.FileUtils;
import com.termux.app.models.ReportInfo;
import com.termux.shared.models.ReportInfo;
import com.termux.app.models.UserAction;
import com.termux.shared.settings.preferences.TermuxAppSharedPreferences;
import com.termux.shared.settings.preferences.TermuxPreferenceConstants;
Expand Down Expand Up @@ -89,7 +89,7 @@ public void run() {

Logger.logDebug(logTag, "The crash log file at \"" + TermuxConstants.TERMUX_CRASH_LOG_FILE_PATH + "\" found. Sending \"" + title + "\" notification.");

Intent notificationIntent = ReportActivity.newInstance(context, new ReportInfo(UserAction.CRASH_REPORT, logTag, title, null, reportString, "\n\n" + TermuxUtils.getReportIssueMarkdownString(context), true));
Intent notificationIntent = ReportActivity.newInstance(context, new ReportInfo(UserAction.CRASH_REPORT.getName(), logTag, title, null, reportString, "\n\n" + TermuxUtils.getReportIssueMarkdownString(context), true));
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

// Setup the notification channel if not already set up
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/termux/app/utils/PluginUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
import androidx.annotation.Nullable;

import com.termux.R;
import com.termux.shared.activities.ReportActivity;
import com.termux.shared.notification.NotificationUtils;
import com.termux.shared.termux.TermuxConstants;
import com.termux.shared.termux.TermuxConstants.TERMUX_APP.TERMUX_SERVICE;
import com.termux.app.activities.ReportActivity;
import com.termux.shared.logger.Logger;
import com.termux.shared.settings.preferences.TermuxAppSharedPreferences;
import com.termux.shared.settings.preferences.TermuxPreferenceConstants.TERMUX_APP;
import com.termux.shared.settings.properties.SharedProperties;
import com.termux.shared.settings.properties.TermuxPropertyConstants;
import com.termux.app.models.ReportInfo;
import com.termux.shared.models.ReportInfo;
import com.termux.shared.models.ExecutionCommand;
import com.termux.app.models.UserAction;
import com.termux.shared.data.DataUtils;
Expand Down Expand Up @@ -159,7 +159,7 @@ public static void processPluginExecutionCommandError(final Context context, Str
reportString.append("\n\n").append(TermuxUtils.getAppInfoMarkdownString(context, true));
reportString.append("\n\n").append(TermuxUtils.getDeviceInfoMarkdownString(context));

Intent notificationIntent = ReportActivity.newInstance(context, new ReportInfo(UserAction.PLUGIN_EXECUTION_COMMAND, logTag, title, null, reportString.toString(), null,true));
Intent notificationIntent = ReportActivity.newInstance(context, new ReportInfo(UserAction.PLUGIN_EXECUTION_COMMAND.getName(), logTag, title, null, reportString.toString(), null,true));
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

// Setup the notification channel if not already set up
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@



<!-- Termux Report And ShareUtils -->
<string name="action_copy">Copy</string>
<string name="action_share">Share</string>

<string name="title_share_with">Share With</string>
<string name="title_report_text">Report Text</string>



<!-- Termux File Receiver -->
<string name="title_file_received">Save file in ~/downloads/</string>
<string name="action_file_received_edit">Edit</string>
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@
</style>


<style name="Theme.AppCompat.TermuxReportActivity" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimaryDark">#FF0000</item>
</style>

<style name="Toolbar.Title" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">14sp</item>
</style>


<style name="TermuxAlertDialogStyle" parent="@android:style/Theme.Material.Light.Dialog.Alert">
<!-- Seen in buttons on alert dialog: -->
<item name="android:colorAccent">#212121</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.termux.app.activities;
package com.termux.shared.activities;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
Expand All @@ -14,11 +14,11 @@
import android.view.MenuInflater;
import android.view.MenuItem;

import com.termux.R;
import com.termux.shared.R;
import com.termux.shared.termux.TermuxConstants;
import com.termux.shared.markdown.MarkdownUtils;
import com.termux.shared.interact.ShareUtils;
import com.termux.app.models.ReportInfo;
import com.termux.shared.models.ReportInfo;

import org.commonmark.node.FencedCodeBlock;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.termux.app.models;
package com.termux.shared.models;

import com.termux.shared.markdown.MarkdownUtils;
import com.termux.shared.termux.TermuxUtils;
Expand All @@ -8,7 +8,7 @@
public class ReportInfo implements Serializable {

/** The user action that was being processed for which the report was generated. */
public final UserAction userAction;
public final String userAction;
/** The internal app component that sent the report. */
public final String sender;
/** The report title. */
Expand All @@ -26,7 +26,7 @@ public class ReportInfo implements Serializable {
/** The timestamp for the report. */
public final String reportTimestamp;

public ReportInfo(UserAction userAction, String sender, String reportTitle, String reportStringPrefix, String reportString, String reportStringSuffix, boolean addReportInfoToMarkdown) {
public ReportInfo(String userAction, String sender, String reportTitle, String reportStringPrefix, String reportString, String reportStringSuffix, boolean addReportInfoToMarkdown) {
this.userAction = userAction;
this.sender = sender;
this.reportTitle = reportTitle;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions termux-shared/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@



<!-- ReportActivity -->
<string name="action_copy">Copy</string>
<string name="action_share">Share</string>
<string name="title_report_text">Report Text</string>



<!-- ShareUtils -->
<string name="title_share_with">Share With</string>

Expand Down
10 changes: 10 additions & 0 deletions termux-shared/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http:https://schemas.android.com/apk/res/android">
<style name="Theme.AppCompat.TermuxReportActivity" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimaryDark">#FF0000</item>
</style>

<style name="Toolbar.Title" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">14sp</item>
</style>
</resources>

0 comments on commit 7f36d7b

Please sign in to comment.