Android: Settings and Emulation activities skip (Tv)MainActivity library rescan
This commit is contained in:
parent
92d24aec2e
commit
a0ab90f4c6
|
@ -43,6 +43,7 @@ import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
||||||
import org.dolphinemu.dolphinemu.overlay.InputOverlay;
|
import org.dolphinemu.dolphinemu.overlay.InputOverlay;
|
||||||
import org.dolphinemu.dolphinemu.overlay.InputOverlayPointer;
|
import org.dolphinemu.dolphinemu.overlay.InputOverlayPointer;
|
||||||
import org.dolphinemu.dolphinemu.ui.main.MainActivity;
|
import org.dolphinemu.dolphinemu.ui.main.MainActivity;
|
||||||
|
import org.dolphinemu.dolphinemu.ui.main.TvMainActivity;
|
||||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
||||||
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
|
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
|
||||||
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
||||||
|
@ -266,6 +267,15 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
{
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
if (TvUtil.isLeanback(getApplicationContext()))
|
||||||
|
{
|
||||||
|
TvMainActivity.skipRescanningLibrary();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainActivity.skipRescanningLibrary();
|
||||||
|
}
|
||||||
|
|
||||||
if (savedInstanceState == null)
|
if (savedInstanceState == null)
|
||||||
{
|
{
|
||||||
// Get params we were passed
|
// Get params we were passed
|
||||||
|
|
|
@ -20,9 +20,11 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
import org.dolphinemu.dolphinemu.ui.main.MainActivity;
|
import org.dolphinemu.dolphinemu.ui.main.MainActivity;
|
||||||
|
import org.dolphinemu.dolphinemu.ui.main.TvMainActivity;
|
||||||
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
|
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
|
||||||
import org.dolphinemu.dolphinemu.utils.DirectoryStateReceiver;
|
import org.dolphinemu.dolphinemu.utils.DirectoryStateReceiver;
|
||||||
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
||||||
|
import org.dolphinemu.dolphinemu.utils.TvUtil;
|
||||||
|
|
||||||
public final class SettingsActivity extends AppCompatActivity implements SettingsActivityView
|
public final class SettingsActivity extends AppCompatActivity implements SettingsActivityView
|
||||||
{
|
{
|
||||||
|
@ -46,6 +48,15 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
||||||
{
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
if (TvUtil.isLeanback(getApplicationContext()))
|
||||||
|
{
|
||||||
|
TvMainActivity.skipRescanningLibrary();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainActivity.skipRescanningLibrary();
|
||||||
|
}
|
||||||
|
|
||||||
setContentView(R.layout.activity_settings);
|
setContentView(R.layout.activity_settings);
|
||||||
|
|
||||||
Intent launcher = getIntent();
|
Intent launcher = getIntent();
|
||||||
|
|
|
@ -46,6 +46,7 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
||||||
private Toolbar mToolbar;
|
private Toolbar mToolbar;
|
||||||
private TabLayout mTabLayout;
|
private TabLayout mTabLayout;
|
||||||
private FloatingActionButton mFab;
|
private FloatingActionButton mFab;
|
||||||
|
private static boolean sShouldRescanLibrary = true;
|
||||||
|
|
||||||
private MainPresenter mPresenter = new MainPresenter(this, this);
|
private MainPresenter mPresenter = new MainPresenter(this, this);
|
||||||
|
|
||||||
|
@ -80,7 +81,14 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
||||||
{
|
{
|
||||||
super.onResume();
|
super.onResume();
|
||||||
mPresenter.addDirIfNeeded(this);
|
mPresenter.addDirIfNeeded(this);
|
||||||
GameFileCacheService.startRescan(this);
|
if (sShouldRescanLibrary)
|
||||||
|
{
|
||||||
|
GameFileCacheService.startRescan(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sShouldRescanLibrary = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -284,4 +292,9 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
||||||
showGames();
|
showGames();
|
||||||
GameFileCacheService.startLoad(this);
|
GameFileCacheService.startLoad(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void skipRescanningLibrary()
|
||||||
|
{
|
||||||
|
sShouldRescanLibrary = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ import java.util.Collection;
|
||||||
|
|
||||||
public final class TvMainActivity extends FragmentActivity implements MainView
|
public final class TvMainActivity extends FragmentActivity implements MainView
|
||||||
{
|
{
|
||||||
|
private static boolean sShouldRescanLibrary = true;
|
||||||
|
|
||||||
private MainPresenter mPresenter = new MainPresenter(this, this);
|
private MainPresenter mPresenter = new MainPresenter(this, this);
|
||||||
|
|
||||||
private BrowseSupportFragment mBrowseFragment;
|
private BrowseSupportFragment mBrowseFragment;
|
||||||
|
@ -65,7 +67,14 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
||||||
{
|
{
|
||||||
super.onResume();
|
super.onResume();
|
||||||
mPresenter.addDirIfNeeded(this);
|
mPresenter.addDirIfNeeded(this);
|
||||||
GameFileCacheService.startRescan(this);
|
if (sShouldRescanLibrary)
|
||||||
|
{
|
||||||
|
GameFileCacheService.startRescan(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sShouldRescanLibrary = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -316,4 +325,9 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
||||||
|
|
||||||
return new ListRow(header, rowItems);
|
return new ListRow(header, rowItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void skipRescanningLibrary()
|
||||||
|
{
|
||||||
|
sShouldRescanLibrary = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue