Skip to content

Commit

Permalink
Changed|Fixed: Drawer extra-keys button will toggle instead of just o…
Browse files Browse the repository at this point in the history
…pening

Also fixed NullPointerException due to changes in 2a74d43
  • Loading branch information
agnostic-apollo committed Aug 25, 2021
1 parent c59835e commit 16c56a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public TermuxTerminalViewClient(TermuxActivity activity, TermuxTerminalSessionCl
this.mTermuxTerminalSessionClient = termuxTerminalSessionClient;
}

public TermuxActivity getActivity() {
return mActivity;
}

/**
* Should be called when mActivity.onCreate() is called
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import androidx.annotation.NonNull;
import androidx.drawerlayout.widget.DrawerLayout;

import com.termux.R;
import com.termux.app.terminal.TermuxTerminalSessionClient;
import com.termux.app.terminal.TermuxTerminalViewClient;
import com.termux.shared.terminal.io.TerminalExtraKeys;
Expand All @@ -34,8 +33,11 @@ public void onTerminalExtraKeyButtonClick(View view, String key, boolean ctrlDow
if(mTermuxTerminalViewClient != null)
mTermuxTerminalViewClient.onToggleSoftKeyboardRequest();
} else if ("DRAWER".equals(key)) {
DrawerLayout drawer = view.findViewById(R.id.drawer_layout);
drawer.openDrawer(Gravity.LEFT);
DrawerLayout drawerLayout = mTermuxTerminalViewClient.getActivity().getDrawer();
if (drawerLayout.isDrawerOpen(Gravity.LEFT))
drawerLayout.closeDrawer(Gravity.LEFT);
else
drawerLayout.openDrawer(Gravity.LEFT);
} else if ("PASTE".equals(key)) {
if(mTermuxTerminalSessionClient != null)
mTermuxTerminalSessionClient.onPasteTextFromClipboard(null);
Expand Down

0 comments on commit 16c56a9

Please sign in to comment.