Commit 5350c54f authored by Dayona Joseph's avatar Dayona Joseph Committed by Romain Hunault

Revert "Add Language translation for folder name"

This reverts commit 848c69eb.
parent 5bf90d15
[Dolphin]
Timestamp=2020,4,23,12,14,17
Version=4
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<AndroidXmlCodeStyleSettings>
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
</AndroidXmlCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
......
......@@ -58,10 +58,6 @@ public class BlissLauncher extends Application {
iconsPackHandler = new IconsHandler(this);
}
public void initAppProvider() {
connectAppProvider();
}
private void connectAppProvider() {
mAppProvider = AppProvider.getInstance(this);
}
......
......@@ -152,7 +152,6 @@ public class HorizontalPager extends ViewGroup implements Insettable {
@Override
protected void dispatchDraw(Canvas canvas) {
Log.d(TAG, "dispatchDraw() called with: canvas = [" + canvas + "]");
final long drawingTime = getDrawingTime();
// todo be smarter about which children need drawing
final int count = getChildCount();
......
package foundation.e.blisslauncher.core.database;
import android.content.Context;
import android.util.Log;
import android.widget.GridLayout;
import java.util.ArrayList;
......@@ -19,6 +18,8 @@ public class DatabaseManager {
private AppExecutors mAppExecutors;
private static final String TAG = "DatabaseManager";
private static volatile DatabaseManager INSTANCE;
private Context mContext;
......@@ -44,7 +45,9 @@ public class DatabaseManager {
}
public void saveLayouts(List<GridLayout> pages, GridLayout dock) {
mAppExecutors.diskIO().execute(() -> saveLauncherItems(pages, dock));
List<GridLayout> tempPages = pages;
GridLayout tempDock = dock;
mAppExecutors.diskIO().execute(() -> saveLauncherItems(tempPages, tempDock));
}
private void saveLauncherItems(final List<GridLayout> pages, final GridLayout dock) {
......@@ -99,7 +102,6 @@ public class DatabaseManager {
}
}
}
Log.i("Database", "saveLauncherItems: "+items.size());
LauncherDB.getDatabase(mContext).launcherDao().insertAll(items);
}
......
package foundation.e.blisslauncher.core.executors;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class AppExecutors {
private static final AppExecutors ourInstance = new AppExecutors();
private Executor diskExecutor;
private Executor appExecutor;
private ExecutorService diskExecutor;
private ExecutorService appExecutor;
private Executor searchExecutor;
private Executor shortcutExecutor;
private ExecutorService shortcutExecutor;
public static AppExecutors getInstance() {
return ourInstance;
......@@ -20,15 +21,15 @@ public class AppExecutors {
shortcutExecutor = Executors.newSingleThreadExecutor();
}
public Executor diskIO(){
public ExecutorService diskIO(){
return diskExecutor;
}
public Executor appIO(){
public ExecutorService appIO(){
return appExecutor;
}
public Executor shortcutIO() {
public ExecutorService shortcutIO() {
return shortcutExecutor;
}
}
......@@ -506,7 +506,9 @@ public class AppProvider {
}
public void clear() {
sInstance = null;
this.sInstance = null;
mLauncherItems = new ArrayList<>();
mAppsRepository.updateAppsRelay(Collections.emptyList());
}
public synchronized boolean isRunning() {
......
......@@ -127,6 +127,7 @@ import foundation.e.blisslauncher.core.utils.UserHandle;
import foundation.e.blisslauncher.features.notification.NotificationRepository;
import foundation.e.blisslauncher.features.notification.NotificationService;
import foundation.e.blisslauncher.features.shortcuts.DeepShortcutManager;
import foundation.e.blisslauncher.features.shortcuts.ShortcutKey;
import foundation.e.blisslauncher.features.suggestions.AutoCompleteAdapter;
import foundation.e.blisslauncher.features.suggestions.SearchSuggestionUtil;
import foundation.e.blisslauncher.features.suggestions.SuggestionProvider;
......@@ -267,6 +268,8 @@ public class LauncherActivity extends AppCompatActivity implements
mLauncherView = LayoutInflater.from(this).inflate(
foundation.e.blisslauncher.R.layout.activity_main, null);
//BlissLauncher.getApplication(LauncherActivity.this).getAppProvider().reload();
setContentView(mLauncherView);
setupViews();
......@@ -356,14 +359,14 @@ public class LauncherActivity extends AppCompatActivity implements
private void createOrUpdateIconGrid() {
getCompositeDisposable().add(
AppsRepository.getAppsRepository().getAppsRelay()
.distinct()
.distinctUntilChanged()
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DisposableObserver<List<LauncherItem>>() {
@Override
public void onNext(List<LauncherItem> launcherItems) {
if (launcherItems == null || launcherItems.size() <= 0) {
BlissLauncher.getApplication(LauncherActivity.this).getAppProvider().reload();
} else if (!allAppsDisplayed) {
} else if(!allAppsDisplayed) {
showApps(launcherItems);
}
}
......@@ -498,7 +501,7 @@ public class LauncherActivity extends AppCompatActivity implements
ApplicationItem applicationItem = AppUtils.createAppItem(this, appAddEvent.getPackageName(),
appAddEvent.getUserHandle());
addLauncherItem(applicationItem);
DatabaseManager.getManager(this).saveLayouts(pages, mDock);
//DatabaseManager.getManager(this).saveLayouts(pages, mDock);
if (moveTo != -1) {
mHorizontalPager.setCurrentPage(moveTo);
moveTo = -1;
......@@ -953,7 +956,6 @@ public class LauncherActivity extends AppCompatActivity implements
if (isWobbling)
handleWobbling(false);
createUI(launcherItems);
subscribeToEvents();
isUiDone = true;
createPageChangeListener();
createFolderTitleListener();
......@@ -962,9 +964,11 @@ public class LauncherActivity extends AppCompatActivity implements
createIndicator();
createOrUpdateBadgeCount();
allAppsDisplayed = true;
subscribeToEvents();
}
private void subscribeToEvents() {
Log.d(TAG, "subscribeToEvents() called");
events = EventRelay.getInstance();
events.subscribe(new EventsObserverImpl(this));
}
......@@ -1242,7 +1246,7 @@ public class LauncherActivity extends AppCompatActivity implements
currentPageNumber = 0;
mHorizontalPager.setUiCreated(true);
DatabaseManager.getManager(this).saveLayouts(pages, mDock);
//DatabaseManager.getManager(this).saveLayouts(pages, mDock);
mDock.setEnabled(true);
setUpSwipeSearchContainer();
}
......@@ -1629,6 +1633,7 @@ public class LauncherActivity extends AppCompatActivity implements
} else {
page.addView(view, index);
}
//DatabaseManager.getManager(this).saveLayouts(pages, mDock);
}
/**
......@@ -1956,6 +1961,7 @@ public class LauncherActivity extends AppCompatActivity implements
startActivity(i);
}
} else if (launcherItem.itemType == Constants.ITEM_TYPE_SHORTCUT) {
DeepShortcutManager.getInstance(this).unpinShortcut(ShortcutKey.fromItem((ShortcutItem) launcherItem));
removeShortcutView((ShortcutItem) launcherItem, blissFrameLayout);
}
});
......@@ -2526,7 +2532,7 @@ public class LauncherActivity extends AppCompatActivity implements
index);
} else {
FolderItem folder = new FolderItem();
folder.title = "Untitled";
folder.title = getString(R.string.untitled);
folder.id = String.valueOf(System.currentTimeMillis());
folder.items = new ArrayList<>();
app1.container = Long.parseLong(folder.id);
......@@ -2922,7 +2928,6 @@ public class LauncherActivity extends AppCompatActivity implements
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
final boolean alreadyOnHome = hasWindowFocus() &&
((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
!= Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
......
......@@ -16,19 +16,21 @@ public class AddItemActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LauncherApps launcherApps = (LauncherApps) getSystemService(Context.LAUNCHER_APPS_SERVICE);
LauncherApps.PinItemRequest request = launcherApps.getPinItemRequest(getIntent());
if (request == null) {
finish();
return;
}
if (getIntent() != null && getIntent().getAction().equalsIgnoreCase(LauncherApps.ACTION_CONFIRM_PIN_SHORTCUT)) {
LauncherApps launcherApps = (LauncherApps) getSystemService(Context.LAUNCHER_APPS_SERVICE);
LauncherApps.PinItemRequest request = launcherApps.getPinItemRequest(getIntent());
if (request == null) {
finish();
return;
}
if (request.getRequestType() == LauncherApps.PinItemRequest.REQUEST_TYPE_SHORTCUT) {
InstallShortcutReceiver.queueShortcut(
new ShortcutInfoCompat(request.getShortcutInfo()), this);
request.accept();
finish();
return;
if (request.getRequestType() == LauncherApps.PinItemRequest.REQUEST_TYPE_SHORTCUT) {
InstallShortcutReceiver.queueShortcut(
new ShortcutInfoCompat(request.getShortcutInfo()), this.getApplicationContext());
request.accept();
finish();
}
}
}
}
......@@ -52,16 +52,18 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
}
ShortcutItem shortcutItem = createShortcutItem(data, context);
EventRelay.getInstance().push(new ShortcutAddEvent(shortcutItem));
context.startActivity(new Intent(Intent.ACTION_MAIN)
/*context.startActivity(new Intent(Intent.ACTION_MAIN)
.addCategory(Intent.CATEGORY_HOME)
.setPackage(context.getPackageName())
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));*/
}
public static void queueShortcut(ShortcutInfoCompat info, Context context) {
Log.d(TAG, "queueShortcut() called with: info = [" + info + "], context = [" + context + "]");
UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
ShortcutItem shortcutItem = new ShortcutItem();
shortcutItem.id = info.getId();
Log.i(TAG, "queueShortcut: "+ shortcutItem.id);
shortcutItem.user = new UserHandle(userManager.getSerialNumberForUser(info.getUserHandle()),
info.getUserHandle());
shortcutItem.packageName = info.getPackage();
......@@ -73,10 +75,10 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
icon);
shortcutItem.launchIntent = info.makeIntent();
EventRelay.getInstance().push(new ShortcutAddEvent(shortcutItem));
context.startActivity(new Intent(Intent.ACTION_MAIN)
/*context.startActivity(new Intent(Intent.ACTION_MAIN)
.addCategory(Intent.CATEGORY_HOME)
.setPackage(context.getPackageName())
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));*/
}
private static ShortcutItem createShortcutItem(Intent data, Context context) {
......
......@@ -31,7 +31,7 @@ public class DuckDuckGoProvider implements SuggestionProvider {
}))
.onErrorReturn(throwable -> new ArrayList<>())
.flatMapIterable(duckDuckGoResults -> duckDuckGoResults)
.take(5)
.take(3)
.map(DuckDuckGoResult::getPhrase)
.toList()
.map(suggestions -> {
......
......@@ -30,7 +30,7 @@ public class QwantProvider implements SuggestionProvider {
}))
.filter(qwantResult -> qwantResult.getStatus().equals("success"))
.flatMapIterable(qwantResult -> qwantResult.getData().getItems())
.take(5)
.take(3)
.map(QwantItem::getValue)
.toList()
.map(suggestions -> {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment