Skip to content

Commit

Permalink
resolve #67
Browse files Browse the repository at this point in the history
  • Loading branch information
valkriaine committed May 11, 2022
1 parent fab210b commit 24a3664
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 31 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId "com.factor.launcher"
minSdkVersion 22
targetSdkVersion 31
versionCode 36
versionName "0.65.8"
versionCode 37
versionName "0.65.9"

renderscriptTargetApi 31
renderscriptSupportModeEnabled true
Expand Down
24 changes: 8 additions & 16 deletions app/src/main/java/com/factor/launcher/activities/HomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import androidx.core.content.PermissionChecker;
import androidx.core.view.WindowCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;
import com.factor.launcher.R;
import com.factor.launcher.databinding.ActivityHomeBinding;
Expand All @@ -37,8 +38,6 @@ public class HomeActivity extends AppCompatActivity implements LifecycleOwner

private boolean areSettingsChanged = false;

private boolean isVisible = true;

@SuppressLint("MissingPermission")
@Override
protected void onCreate(Bundle savedInstanceState)
Expand Down Expand Up @@ -102,8 +101,6 @@ protected void onResume()
return;
}

isVisible = true;

detectWallpaperChanges();

if(isWallpaperChanged || areSettingsChanged)
Expand All @@ -114,21 +111,16 @@ protected void onResume()
}
}

//set isVisible to false when activity is no longer visible
@Override
protected void onPause()
{
super.onPause();
isVisible = false;
}

@Override
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.home_fragment_container);
if (!(fragment instanceof OnSystemActionsCallBack) || !((OnSystemActionsCallBack) fragment).onNewIntent())
finishAfterTransition();
if (hasWindowFocus())
{
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.home_fragment_container);
if (!(fragment instanceof OnSystemActionsCallBack) || !((OnSystemActionsCallBack) fragment).onNewIntent())
finishAfterTransition();
}
}


Expand Down Expand Up @@ -165,7 +157,7 @@ public void reload()
{
AppSettingsManager.getInstance(getApplication()).respondToSettingsChange();

if (isVisible)
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
{
areSettingsChanged = false;
Log.d("settings_changed", "reload");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,24 +170,23 @@ public boolean onNewIntent()
{
if (isWidgetExpanded && !animatorCollapse.isStarted())
animatorCollapse.start();
}

if (binding.homePager.getCurrentItem() == 1)
{
if (appListManager.isDisplayingHidden())
binding.appsList.setAdapter(appListManager.setDisplayHidden(false));

if (binding.appsList.getLayoutManager() != null)
(binding.appsList.getLayoutManager()).smoothScrollToPosition(binding.appsList, new RecyclerView.State(), 0);
if (binding.homePager.getCurrentItem() == 1)
{
if (appListManager.isDisplayingHidden())
binding.appsList.setAdapter(appListManager.setDisplayHidden(false));

if (binding.appsList.getLayoutManager() != null)
(binding.appsList.getLayoutManager()).smoothScrollToPosition(binding.appsList, new RecyclerView.State(), 0);

binding.homePager.setCurrentItem(0, true);
}

if (binding.tilesList.getLayoutManager() != null)
binding.tilesList.getLayoutManager().smoothScrollToPosition(binding.tilesList, new RecyclerView.State(), 0);
binding.homePager.setCurrentItem(0, true);
}

if (binding.tilesList.getLayoutManager() != null)
binding.tilesList.getLayoutManager().smoothScrollToPosition(binding.tilesList, new RecyclerView.State(), 0);

}
return true;
}

Expand Down Expand Up @@ -272,7 +271,7 @@ public void onStart()

private void forceNotificationListener()
{
//appListManager.clearAllNotifications();
appListManager.clearAllNotifications();
if (notificationListenerIntent != null && getContext() != null)
{
try
Expand Down

0 comments on commit 24a3664

Please sign in to comment.