Loading res/drawable/ic_menu_preferences.xml 0 → 100644 +11 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="@color/inverted" android:pathData="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z" /> </vector> No newline at end of file res/layout-large-notouch/activity_updates.xml 0 → 100644 +129 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:id="@+id/main_container" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:padding="16dp" android:weightSum="2"> <RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:paddingEnd="16dp" android:paddingStart="16dp" android:layout_gravity="start"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/header_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="sans-serif-light" android:paddingBottom="16dp" android:textColor="?android:attr/textColorPrimary" android:textSize="56sp" /> <TextView android:id="@+id/header_build_version" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/header_title" android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" /> <TextView android:id="@+id/header_build_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/header_build_version" android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" /> <TextView android:id="@+id/header_last_check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/header_build_date" android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/header_last_check" android:layout_alignParentBottom="true" android:weightSum="2" android:orientation="horizontal"> <Button android:id="@+id/refresh" android:drawableLeft="@drawable/ic_menu_refresh" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="refresh" style="@style/Widget.AppCompat.Button.Borderless.Colored"/> <Button android:id="@+id/preferences" android:drawableLeft="@drawable/ic_menu_preferences" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="preferences" style="@style/Widget.AppCompat.Button.Borderless.Colored"/> </LinearLayout> </RelativeLayout> <RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:paddingEnd="16dp" android:paddingStart="16dp" android:layout_gravity="end"> <androidx.core.widget.NestedScrollView android:id="@+id/no_new_updates_view" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="46dp"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/list_no_updates" android:textColor="?android:textColorSecondary" /> </androidx.core.widget.NestedScrollView> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="12dp" android:clipToPadding="false" android:paddingBottom="5dp" android:scrollbars="vertical" android:layout_gravity="end" /> <ProgressBar android:id="@+id/refresh_progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:visibility="gone"/> </RelativeLayout> </LinearLayout> src/org/lineageos/updater/UpdatesActivity.java +81 −40 Original line number Diff line number Diff line Loading @@ -15,11 +15,13 @@ */ package org.lineageos.updater; import android.app.UiModeManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.content.ServiceConnection; import android.content.SharedPreferences; import android.icu.text.DateFormat; Loading @@ -35,11 +37,13 @@ import android.view.View; import android.view.animation.Animation; import android.view.animation.LinearInterpolator; import android.view.animation.RotateAnimation; import android.widget.Button; import android.widget.Spinner; import android.widget.Switch; import android.widget.TextView; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; Loading Loading @@ -79,11 +83,16 @@ public class UpdatesActivity extends UpdatesListActivity { private View mRefreshIconView; private RotateAnimation mRefreshAnimation; private boolean mIsTV; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_updates); UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE); mIsTV = uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION; RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); mAdapter = new UpdatesListAdapter(this); recyclerView.setAdapter(mAdapter); Loading Loading @@ -112,10 +121,12 @@ public class UpdatesActivity extends UpdatesListActivity { } }; if (!mIsTV) { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } TextView headerTitle = (TextView) findViewById(R.id.header_title); headerTitle.setText(getString(R.string.header_title_text, Loading @@ -131,6 +142,7 @@ public class UpdatesActivity extends UpdatesListActivity { headerBuildDate.setText(StringGenerator.getDateLocalizedUTC(this, DateFormat.LONG, BuildInfoUtils.getBuildDateTimestamp())); if (!mIsTV) { // Switch between header title and appbar title minimizing overlaps final CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); Loading @@ -151,15 +163,29 @@ public class UpdatesActivity extends UpdatesListActivity { } }); if (!Utils.hasTouchscreen(this)) { // This can't be collapsed without a touchscreen appBar.setExpanded(false); } mRefreshAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRefreshAnimation.setInterpolator(new LinearInterpolator()); mRefreshAnimation.setDuration(1000); if (!Utils.hasTouchscreen(this)) { // This can't be collapsed without a touchscreen appBar.setExpanded(false); } } else { findViewById(R.id.refresh).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadUpdatesList(true); } }); findViewById(R.id.preferences).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showPreferencesDialog(); } }); } } @Override Loading Loading @@ -395,6 +421,7 @@ public class UpdatesActivity extends UpdatesListActivity { } private void refreshAnimationStart() { if (!mIsTV) { if (mRefreshIconView == null) { mRefreshIconView = findViewById(R.id.menu_refresh); } Loading @@ -403,13 +430,27 @@ public class UpdatesActivity extends UpdatesListActivity { mRefreshIconView.startAnimation(mRefreshAnimation); mRefreshIconView.setEnabled(false); } } else { findViewById(R.id.recycler_view).setVisibility(View.GONE); findViewById(R.id.no_new_updates_view).setVisibility(View.GONE); findViewById(R.id.refresh_progress).setVisibility(View.VISIBLE); } } private void refreshAnimationStop() { if (!mIsTV) { if (mRefreshIconView != null) { mRefreshAnimation.setRepeatCount(0); mRefreshIconView.setEnabled(true); } } else { findViewById(R.id.refresh_progress).setVisibility(View.GONE); if (mAdapter.getItemCount() > 0) { findViewById(R.id.recycler_view).setVisibility(View.VISIBLE); } else { findViewById(R.id.no_new_updates_view).setVisibility(View.VISIBLE); } } } private void showPreferencesDialog() { Loading Loading
res/drawable/ic_menu_preferences.xml 0 → 100644 +11 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="@color/inverted" android:pathData="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z" /> </vector> No newline at end of file
res/layout-large-notouch/activity_updates.xml 0 → 100644 +129 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:id="@+id/main_container" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:padding="16dp" android:weightSum="2"> <RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:paddingEnd="16dp" android:paddingStart="16dp" android:layout_gravity="start"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/header_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="sans-serif-light" android:paddingBottom="16dp" android:textColor="?android:attr/textColorPrimary" android:textSize="56sp" /> <TextView android:id="@+id/header_build_version" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/header_title" android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" /> <TextView android:id="@+id/header_build_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/header_build_version" android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" /> <TextView android:id="@+id/header_last_check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/header_build_date" android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/header_last_check" android:layout_alignParentBottom="true" android:weightSum="2" android:orientation="horizontal"> <Button android:id="@+id/refresh" android:drawableLeft="@drawable/ic_menu_refresh" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="refresh" style="@style/Widget.AppCompat.Button.Borderless.Colored"/> <Button android:id="@+id/preferences" android:drawableLeft="@drawable/ic_menu_preferences" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="preferences" style="@style/Widget.AppCompat.Button.Borderless.Colored"/> </LinearLayout> </RelativeLayout> <RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:paddingEnd="16dp" android:paddingStart="16dp" android:layout_gravity="end"> <androidx.core.widget.NestedScrollView android:id="@+id/no_new_updates_view" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="46dp"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/list_no_updates" android:textColor="?android:textColorSecondary" /> </androidx.core.widget.NestedScrollView> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="12dp" android:clipToPadding="false" android:paddingBottom="5dp" android:scrollbars="vertical" android:layout_gravity="end" /> <ProgressBar android:id="@+id/refresh_progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:visibility="gone"/> </RelativeLayout> </LinearLayout>
src/org/lineageos/updater/UpdatesActivity.java +81 −40 Original line number Diff line number Diff line Loading @@ -15,11 +15,13 @@ */ package org.lineageos.updater; import android.app.UiModeManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.content.ServiceConnection; import android.content.SharedPreferences; import android.icu.text.DateFormat; Loading @@ -35,11 +37,13 @@ import android.view.View; import android.view.animation.Animation; import android.view.animation.LinearInterpolator; import android.view.animation.RotateAnimation; import android.widget.Button; import android.widget.Spinner; import android.widget.Switch; import android.widget.TextView; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; Loading Loading @@ -79,11 +83,16 @@ public class UpdatesActivity extends UpdatesListActivity { private View mRefreshIconView; private RotateAnimation mRefreshAnimation; private boolean mIsTV; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_updates); UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE); mIsTV = uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION; RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); mAdapter = new UpdatesListAdapter(this); recyclerView.setAdapter(mAdapter); Loading Loading @@ -112,10 +121,12 @@ public class UpdatesActivity extends UpdatesListActivity { } }; if (!mIsTV) { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } TextView headerTitle = (TextView) findViewById(R.id.header_title); headerTitle.setText(getString(R.string.header_title_text, Loading @@ -131,6 +142,7 @@ public class UpdatesActivity extends UpdatesListActivity { headerBuildDate.setText(StringGenerator.getDateLocalizedUTC(this, DateFormat.LONG, BuildInfoUtils.getBuildDateTimestamp())); if (!mIsTV) { // Switch between header title and appbar title minimizing overlaps final CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); Loading @@ -151,15 +163,29 @@ public class UpdatesActivity extends UpdatesListActivity { } }); if (!Utils.hasTouchscreen(this)) { // This can't be collapsed without a touchscreen appBar.setExpanded(false); } mRefreshAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRefreshAnimation.setInterpolator(new LinearInterpolator()); mRefreshAnimation.setDuration(1000); if (!Utils.hasTouchscreen(this)) { // This can't be collapsed without a touchscreen appBar.setExpanded(false); } } else { findViewById(R.id.refresh).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadUpdatesList(true); } }); findViewById(R.id.preferences).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showPreferencesDialog(); } }); } } @Override Loading Loading @@ -395,6 +421,7 @@ public class UpdatesActivity extends UpdatesListActivity { } private void refreshAnimationStart() { if (!mIsTV) { if (mRefreshIconView == null) { mRefreshIconView = findViewById(R.id.menu_refresh); } Loading @@ -403,13 +430,27 @@ public class UpdatesActivity extends UpdatesListActivity { mRefreshIconView.startAnimation(mRefreshAnimation); mRefreshIconView.setEnabled(false); } } else { findViewById(R.id.recycler_view).setVisibility(View.GONE); findViewById(R.id.no_new_updates_view).setVisibility(View.GONE); findViewById(R.id.refresh_progress).setVisibility(View.VISIBLE); } } private void refreshAnimationStop() { if (!mIsTV) { if (mRefreshIconView != null) { mRefreshAnimation.setRepeatCount(0); mRefreshIconView.setEnabled(true); } } else { findViewById(R.id.refresh_progress).setVisibility(View.GONE); if (mAdapter.getItemCount() > 0) { findViewById(R.id.recycler_view).setVisibility(View.VISIBLE); } else { findViewById(R.id.no_new_updates_view).setVisibility(View.VISIBLE); } } } private void showPreferencesDialog() { Loading