Commit b45a4fc4 authored by Amit Kumar's avatar Amit Kumar 💻
Browse files

Add widget page to panel

parent c726070b
Pipeline #126888 passed with stage
in 4 minutes and 10 seconds
package com.android.systemui.shared;
import android.os.Build;
import xyz.paphonb.quickstep.compat.ActivityManagerCompat;
import xyz.paphonb.quickstep.compat.InputCompat;
import xyz.paphonb.quickstep.compat.QuickstepCompatFactory;
......
......@@ -95,7 +95,7 @@ android {
res.srcDirs += ['src/quickstep/res', 'src/quickstep/recents_ui_overrides/res']
}
apiQ {
java.srcDirs = ['src/apiOreo/java/foundation/e']
java.srcDirs = ['src/apiOreo/java/']
res.srcDirs = ['src/apiOreo/res']
manifest.srcFile "src/apiOreo/AndroidManifest.xml"
}
......
......@@ -5,7 +5,6 @@ import static foundation.e.blisslauncher.features.test.LauncherState.NORMAL;
import static foundation.e.blisslauncher.features.test.anim.LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS;
import static foundation.e.blisslauncher.features.test.dragndrop.DragLayer.ALPHA_INDEX_OVERLAY;
import android.Manifest;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.LayoutTransition;
......@@ -14,21 +13,14 @@ import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.WallpaperManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.location.LocationManager;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
......@@ -38,38 +30,22 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.inputmethod.EditorInfo;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.jakewharton.rxbinding3.widget.RxTextView;
import foundation.e.blisslauncher.BuildConfig;
import foundation.e.blisslauncher.R;
import foundation.e.blisslauncher.core.Preferences;
import foundation.e.blisslauncher.core.Utilities;
import foundation.e.blisslauncher.core.customviews.pageindicators.PageIndicatorDots;
import foundation.e.blisslauncher.core.database.DatabaseManager;
import foundation.e.blisslauncher.core.database.model.ApplicationItem;
import foundation.e.blisslauncher.core.database.model.FolderItem;
import foundation.e.blisslauncher.core.database.model.LauncherItem;
import foundation.e.blisslauncher.core.database.model.ShortcutItem;
import foundation.e.blisslauncher.core.executors.AppExecutors;
import foundation.e.blisslauncher.core.touch.ItemClickHandler;
import foundation.e.blisslauncher.core.touch.ItemLongClickListener;
import foundation.e.blisslauncher.core.utils.Constants;
import foundation.e.blisslauncher.core.utils.GraphicsUtil;
import foundation.e.blisslauncher.core.utils.LongArrayMap;
import foundation.e.blisslauncher.features.launcher.Hotseat;
import foundation.e.blisslauncher.features.launcher.SearchInputDisposableObserver;
import foundation.e.blisslauncher.features.suggestions.AutoCompleteAdapter;
import foundation.e.blisslauncher.features.suggestions.SuggestionsResult;
import foundation.e.blisslauncher.features.test.Alarm;
import foundation.e.blisslauncher.features.test.CellLayout;
import foundation.e.blisslauncher.features.test.IconTextView;
......@@ -88,17 +64,8 @@ import foundation.e.blisslauncher.features.test.dragndrop.DragView;
import foundation.e.blisslauncher.features.test.dragndrop.DropTarget;
import foundation.e.blisslauncher.features.test.dragndrop.SpringLoadedDragController;
import foundation.e.blisslauncher.features.test.graphics.DragPreviewProvider;
import foundation.e.blisslauncher.features.widgets.WidgetViewBuilder;
import foundation.e.blisslauncher.features.widgets.WidgetsActivity;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.jetbrains.annotations.NotNull;
public class LauncherPagedView extends PagedView<PageIndicatorDots> implements View.OnTouchListener,
......@@ -130,7 +97,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
private LayoutTransition mLayoutTransition;
final WallpaperManager mWallpaperManager;
final LongArrayMap<CellLayout> mWorkspaceScreens = new LongArrayMap<>();
public final LongArrayMap<CellLayout> mWorkspaceScreens = new LongArrayMap<>();
final ArrayList<Long> mScreenOrder = new ArrayList<>();
// Variables relating to touch disambiguation (scrolling workspace vs. scrolling a widget)
......
......@@ -75,7 +75,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.jakewharton.rxbinding3.widget.RxTextView;
import foundation.e.blisslauncher.BlissLauncher;
import foundation.e.blisslauncher.BuildConfig;
import foundation.e.blisslauncher.R;
......@@ -133,7 +132,6 @@ import foundation.e.blisslauncher.features.weather.WeatherSourceListenerService;
import foundation.e.blisslauncher.features.weather.WeatherUpdateService;
import foundation.e.blisslauncher.features.weather.WeatherUtils;
import foundation.e.blisslauncher.features.widgets.WidgetManager;
import foundation.e.blisslauncher.features.widgets.WidgetViewBuilder;
import foundation.e.blisslauncher.features.widgets.WidgetsActivity;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
......@@ -150,7 +148,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import me.relex.circleindicator.CircleIndicator;
public class LauncherActivity extends AppCompatActivity implements
......@@ -456,11 +453,11 @@ public class LauncherActivity extends AppCompatActivity implements
}
RoundedWidgetView widgetView = widgetManager.dequeAddWidgetView();
while (widgetView != null) {
/*while (widgetView != null) {
widgetView = WidgetViewBuilder.create(this, widgetView);
addWidgetToContainer(widgetView);
widgetView = widgetManager.dequeAddWidgetView();
}
}*/
}
}
......@@ -1397,7 +1394,7 @@ public class LauncherActivity extends AppCompatActivity implements
DividerItemDecoration.VERTICAL
);
suggestionRecyclerView.addItemDecoration(dividerItemDecoration);
getCompositeDisposable().add(RxTextView.textChanges(mSearchInput)
/*getCompositeDisposable().add(RxTextView.textChanges(mSearchInput)
.debounce(300, TimeUnit.MILLISECONDS)
.map(CharSequence::toString)
.distinctUntilChanged()
......@@ -1412,7 +1409,7 @@ public class LauncherActivity extends AppCompatActivity implements
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(
new SearchInputDisposableObserver(this, suggestionAdapter, widgetsPage)));
new SearchInputDisposableObserver(this, suggestionAdapter, widgetsPage)));*/
mSearchInput.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
......@@ -1500,7 +1497,7 @@ public class LauncherActivity extends AppCompatActivity implements
.subscribeOn(Schedulers.from(AppExecutors.getInstance().diskIO()))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(height -> {
RoundedWidgetView widgetView = WidgetViewBuilder.create(this, hostView);
RoundedWidgetView widgetView = null;
if (height != 0) {
int minHeight = hostView.getAppWidgetInfo().minResizeHeight;
int maxHeight = mDeviceProfile.availableHeightPx * 3 / 4;
......@@ -3180,7 +3177,7 @@ public class LauncherActivity extends AppCompatActivity implements
R.id.search_input);
ImageView clearSuggestions = swipeSearchContainer.findViewById(
R.id.clearSuggestionImageView);
searchDisposableObserver = RxTextView.textChanges(searchEditText)
/*searchDisposableObserver = RxTextView.textChanges(searchEditText)
.debounce(300, TimeUnit.MILLISECONDS)
.map(CharSequence::toString)
.distinctUntilChanged()
......@@ -3204,7 +3201,7 @@ public class LauncherActivity extends AppCompatActivity implements
((RecyclerView) swipeSearchContainer.findViewById(
R.id.suggestionRecyclerView)).getAdapter(),
swipeSearchContainer
));
));*/
searchEditText.requestFocus();
refreshSuggestedApps(swipeSearchContainer, true);
}
......
......@@ -9,16 +9,17 @@ import foundation.e.blisslauncher.core.customviews.BlissFrameLayout;
import foundation.e.blisslauncher.core.database.model.LauncherItem;
import foundation.e.blisslauncher.features.suggestions.AutoCompleteAdapter;
import foundation.e.blisslauncher.features.suggestions.SuggestionsResult;
import foundation.e.blisslauncher.features.test.TestActivity;
import io.reactivex.observers.DisposableObserver;
import java.util.ArrayList;
public class SearchInputDisposableObserver extends DisposableObserver<SuggestionsResult> {
private AutoCompleteAdapter networkSuggestionAdapter;
private LauncherActivity launcherActivity;
private TestActivity launcherActivity;
private ViewGroup appSuggestionsViewGroup;
public SearchInputDisposableObserver(LauncherActivity activity, RecyclerView.Adapter autoCompleteAdapter, ViewGroup viewGroup) {
public SearchInputDisposableObserver(TestActivity activity, RecyclerView.Adapter autoCompleteAdapter, ViewGroup viewGroup) {
this.networkSuggestionAdapter = (AutoCompleteAdapter) autoCompleteAdapter;
this.launcherActivity = activity;
this.appSuggestionsViewGroup = viewGroup;
......
......@@ -17,6 +17,8 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import foundation.e.blisslauncher.R;
import foundation.e.blisslauncher.features.launcher.LauncherActivity;
import foundation.e.blisslauncher.features.test.TestActivity;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
......@@ -30,7 +32,7 @@ public class AutoCompleteAdapter extends
public AutoCompleteAdapter(Context context) {
super();
mOnSuggestionClickListener = (LauncherActivity) context;
mOnSuggestionClickListener = (TestActivity) context;
mInflater = LayoutInflater.from(context);
}
......
......@@ -99,6 +99,10 @@ class VariantDeviceProfile(
val verticalDragHandleSizePx: Int
// Widget
val maxWidgetWidth: Int
val maxWidgetHeight: Int
// Widgets
val appWidgetScale = PointF(1.0f, 1.0f)
......@@ -239,6 +243,9 @@ class VariantDeviceProfile(
updateWorkspacePadding()
// This is done last, after iconSizePx is calculated above.
// TODO: mBadgeRenderer = BadgeRenderer(iconSizePx)
maxWidgetWidth = availableWidthPx - 2 * Utilities.pxFromDp(8f, dm)
maxWidgetHeight = cellHeightPx * inv.numRows
}
private fun updateAvailableDimensions(
......
......@@ -12,10 +12,12 @@ import foundation.e.blisslauncher.BlissLauncher;
import foundation.e.blisslauncher.R;
import foundation.e.blisslauncher.core.customviews.RoundedWidgetView;
import foundation.e.blisslauncher.features.launcher.LauncherActivity;
import foundation.e.blisslauncher.features.test.TestActivity;
public class WidgetViewBuilder {
public static RoundedWidgetView create(LauncherActivity launcherActivity,
public static RoundedWidgetView create(
TestActivity launcherActivity,
@NonNull RoundedWidgetView roundedWidgetView) {
if (BlissLauncher.getApplication(launcherActivity).getAppWidgetHost() == null) return null;
roundedWidgetView.post(() -> updateWidgetOption(launcherActivity, roundedWidgetView,
......
......@@ -42,4 +42,5 @@
android:visibility="gone" />
</foundation.e.blisslauncher.features.test.dragndrop.DragLayer>
</foundation.e.blisslauncher.features.test.LauncherRootView>
\ No newline at end of file
......@@ -10,6 +10,7 @@ public class OverlayCallbackImpl implements TestActivity.LauncherOverlay {
private final TestActivity mLauncher;
private static final String TAG = "OverlayCallbackImpl";
private float mProgress = 0;
private TestActivity.LauncherOverlayCallbacks mLauncherOverlayCallbacks;
......@@ -20,12 +21,14 @@ public class OverlayCallbackImpl implements TestActivity.LauncherOverlay {
@Override
public void onScrollInteractionBegin() {
Log.d(TAG, "onScrollInteractionBegin() called");
mLauncherOverlayCallbacks.onScrollBegin();
}
@Override
public void onScrollInteractionEnd() {
Log.d(TAG, "onScrollInteractionEnd() called");
if(mProgress > 0.5f) mLauncherOverlayCallbacks.onScrollChanged(1f);
else mLauncherOverlayCallbacks.onScrollChanged(0f);
}
@Override
......@@ -36,6 +39,7 @@ public class OverlayCallbackImpl implements TestActivity.LauncherOverlay {
);
if(mLauncherOverlayCallbacks != null) {
mLauncherOverlayCallbacks.onScrollChanged(progress);
mProgress = progress;
}
}
......
Supports Markdown
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