Updater: add changelog button
Add a changelog button in the menu toolbar throwing the user in the recent changes page Change-Id: I16609825c0662fc22b95189cbdf324a8c0b94f81
This commit is contained in:
committed by
Kristian Angelov
parent
f62a57c463
commit
76b9f49684
@@ -22,4 +22,8 @@
|
||||
android:checkable="true"
|
||||
android:title="@string/menu_mobile_data_warning"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/menu_show_changelog"
|
||||
android:title="@string/menu_show_changelog"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
||||
|
@@ -58,6 +58,8 @@
|
||||
<string name="menu_delete_update">Delete</string>
|
||||
<string name="menu_copy_url">Copy URL</string>
|
||||
<string name="menu_export_update">Export update</string>
|
||||
<string name="menu_show_changelog">Show changelog</string>
|
||||
<string name="menu_changelog_url" translatable="false">https://download.lineageos.org/<xliff:g id="device_name">%1$s</xliff:g>/changes</string>
|
||||
|
||||
<string name="dialog_checking_for_updates">Checking for updates</string>
|
||||
<string name="snack_updates_found">New updates found</string>
|
||||
|
@@ -25,6 +25,7 @@ import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.icu.text.DateFormat;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
@@ -226,6 +227,12 @@ public class UpdatesActivity extends UpdatesListActivity {
|
||||
.apply();
|
||||
return true;
|
||||
}
|
||||
case R.id.menu_show_changelog: {
|
||||
Intent openUrl = new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse(Utils.getChangelogURL(this)));
|
||||
startActivity(openUrl);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@@ -155,6 +155,12 @@ public class Utils {
|
||||
return serverUrl + "/v1/" + device + "/" + type + "/" + incrementalVersion;
|
||||
}
|
||||
|
||||
public static String getChangelogURL(Context context) {
|
||||
String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE,
|
||||
SystemProperties.get(Constants.PROP_DEVICE));
|
||||
return context.getString(R.string.menu_changelog_url, device);
|
||||
}
|
||||
|
||||
public static void triggerUpdate(Context context, String downloadId) {
|
||||
final Intent intent = new Intent(context, UpdaterService.class);
|
||||
intent.setAction(UpdaterService.ACTION_INSTALL_UPDATE);
|
||||
|
Reference in New Issue
Block a user