Browse Source

Add new tab button to desktop tabs view

master
Anthony Restaino 9 years ago
parent
commit
c684472f6e
  1. 5
      app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java
  2. 2
      app/src/main/java/acr/browser/lightning/controller/UIController.java
  3. 8
      app/src/main/java/acr/browser/lightning/fragment/TabsFragment.java
  4. 21
      app/src/main/res/layout/tab_strip.xml

5
app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java

@ -1023,6 +1023,11 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements @@ -1023,6 +1023,11 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
return mPresenter.newTab(url, show);
}
@Override
public void newTabClicked() {
mPresenter.newTab(null, true);
}
// TODO move this to presenter
private synchronized void deleteTab(int position) {
mPresenter.deleteTab(position);

2
app/src/main/java/acr/browser/lightning/controller/UIController.java

@ -53,4 +53,6 @@ public interface UIController { @@ -53,4 +53,6 @@ public interface UIController {
void showCloseDialog(int position);
void newTabClicked();
}

8
app/src/main/java/acr/browser/lightning/fragment/TabsFragment.java

@ -112,6 +112,14 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View @@ -112,6 +112,14 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
} else {
view = inflater.inflate(R.layout.tab_strip, container, false);
layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false);
ImageView newTab = (ImageView) view.findViewById(R.id.new_tab_button);
newTab.setColorFilter(ThemeUtils.getIconDarkThemeColor(getActivity()));
newTab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mUiController.newTabClicked();
}
});
}
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.tabs_list);
recyclerView.setLayoutManager(layoutManager);

21
app/src/main/res/layout/tab_strip.xml

@ -1,9 +1,26 @@ @@ -1,9 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@color/black"
android:orientation="horizontal"
android:weightSum="1">
<android.support.v7.widget.RecyclerView
android:id="@+id/tabs_list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:overScrollMode="never"
android:scrollbars="none"
android:id="@+id/tabs_list" />
android:fadingEdge="horizontal"/>
<ImageView
android:id="@+id/new_tab_button"
android:layout_width="30dp"
android:layout_height="match_parent"
android:background="?actionBarItemBackground"
android:src="@drawable/ic_action_plus"/>
</LinearLayout>

Loading…
Cancel
Save