-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize Libraries and add search UI in panels
Create a separate location in the UI for each functionality - (Library) Bookmarks/History - Downloads - Add-ons - Web Apps Add launchers in the UI to open each of those locations - (Library) Bookmarks/History, Downloads and Web Apps from the tray - Add-ons from Hamburger Menu Add Search UI in: - Bookmarks - History - Downloads - Web Apps Signed-off-by: Songlin Jiang <[email protected]>
- Loading branch information
1 parent
4ccfb3b
commit af26d40
Showing
35 changed files
with
1,389 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
app/src/common/shared/com/igalia/wolvic/addons/views/AddonsPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
package com.igalia.wolvic.addons.views; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.content.Context; | ||
import android.content.res.Configuration; | ||
import android.util.AttributeSet; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.widget.FrameLayout; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.databinding.DataBindingUtil; | ||
|
||
import com.igalia.wolvic.BuildConfig; | ||
import com.igalia.wolvic.R; | ||
import com.igalia.wolvic.VRBrowserActivity; | ||
import com.igalia.wolvic.VRBrowserApplication; | ||
import com.igalia.wolvic.databinding.LibraryBinding; | ||
import com.igalia.wolvic.ui.delegates.LibraryNavigationDelegate; | ||
import com.igalia.wolvic.ui.widgets.WidgetManagerDelegate; | ||
|
||
import java.util.concurrent.Executor; | ||
|
||
public class AddonsPanel extends FrameLayout { | ||
|
||
private LibraryBinding mBinding; | ||
protected WidgetManagerDelegate mWidgetManager; | ||
protected Executor mUIThreadExecutor; | ||
private AddonsView mAddonsView; | ||
|
||
public AddonsPanel(@NonNull Context context) { | ||
super(context); | ||
initialize(); | ||
} | ||
|
||
public AddonsPanel(@NonNull Context context, @Nullable AttributeSet attrs) { | ||
super(context, attrs); | ||
initialize(); | ||
} | ||
|
||
public AddonsPanel(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
initialize(); | ||
} | ||
|
||
protected void initialize() { | ||
mWidgetManager = ((VRBrowserActivity) getContext()); | ||
mUIThreadExecutor = ((VRBrowserApplication) getContext().getApplicationContext()).getExecutors().mainThread(); | ||
|
||
mAddonsView = new AddonsView(getContext(), this); | ||
|
||
updateUI(); | ||
} | ||
|
||
@SuppressLint("ClickableViewAccessibility") | ||
public void updateUI() { | ||
removeAllViews(); | ||
|
||
LayoutInflater inflater = LayoutInflater.from(getContext()); | ||
|
||
// Inflate this data binding layout | ||
mBinding = DataBindingUtil.inflate(inflater, R.layout.library, this, true); | ||
mBinding.searchBar.setVisibility(View.GONE); | ||
mBinding.buttons.setVisibility(View.GONE); | ||
mBinding.setLifecycleOwner((VRBrowserActivity) getContext()); | ||
mBinding.setSupportsSystemNotifications(BuildConfig.SUPPORTS_SYSTEM_NOTIFICATIONS); | ||
mBinding.setDelegate(new LibraryNavigationDelegate() { | ||
@Override | ||
public void onClose(@NonNull View view) { | ||
requestFocus(); | ||
mWidgetManager.getFocusedWindow().hideAddonsPanel(); | ||
} | ||
|
||
@Override | ||
public void onBack(@NonNull View view) { | ||
requestFocus(); | ||
mAddonsView.onBack(); | ||
mBinding.setCanGoBack(mAddonsView.canGoBack()); | ||
} | ||
|
||
@Override | ||
public void onButtonClick(@NonNull View view) { | ||
requestFocus(); | ||
selectTab(); | ||
} | ||
}); | ||
mBinding.executePendingBindings(); | ||
|
||
selectTab(); | ||
|
||
setOnTouchListener((v, event) -> { | ||
v.requestFocusFromTouch(); | ||
return false; | ||
}); | ||
} | ||
|
||
@Override | ||
public void onConfigurationChanged(Configuration newConfig) { | ||
super.onConfigurationChanged(newConfig); | ||
|
||
if (mBinding != null) { | ||
mBinding.tabcontent.removeAllViews(); | ||
} | ||
|
||
mAddonsView.updateUI(); | ||
|
||
updateUI(); | ||
} | ||
|
||
public void onShow() { | ||
if (mAddonsView != null) { | ||
mAddonsView.onShow(); | ||
mBinding.searchBar.setQuery("", false); | ||
mBinding.searchBar.clearFocus(); | ||
} | ||
} | ||
|
||
public void onHide() { | ||
if (mAddonsView != null) { | ||
mAddonsView.onHide(); | ||
} | ||
} | ||
|
||
public boolean onBack() { | ||
if (mAddonsView != null) { | ||
return mAddonsView.onBack(); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public void onDestroy() { | ||
mAddonsView.onDestroy(); | ||
} | ||
|
||
private void selectTab() { | ||
mBinding.setCanGoBack(mAddonsView.canGoBack()); | ||
mBinding.tabcontent.addView(mAddonsView); | ||
mAddonsView.onShow(); | ||
} | ||
|
||
public void onViewUpdated(@NonNull String title) { | ||
if (mBinding != null) { | ||
mBinding.title.setText(title); | ||
mBinding.setCanGoBack(mAddonsView.canGoBack()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/src/common/shared/com/igalia/wolvic/ui/callbacks/DownloadsContextMenuCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.