Skip to content

Commit

Permalink
Disable drawer menu action to open webUI on Android TV (fixes #275) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Catfriend1 committed Jan 24, 2019
1 parent 56455fc commit 5c95fd2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.nutomic.syncthingandroid.service.Constants;
import com.nutomic.syncthingandroid.service.RestApi;
import com.nutomic.syncthingandroid.service.SyncthingService;
import com.nutomic.syncthingandroid.util.Util;

import java.net.URL;

Expand Down Expand Up @@ -59,6 +60,8 @@ public class DrawerFragment extends Fragment implements SyncthingService.OnServi
private MainActivity mActivity;
private SharedPreferences sharedPreferences = null;

private Boolean mRunningOnTV = false;

@Override
public void onServiceStateChange(SyncthingService.State currentState) {
mServiceState = currentState;
Expand Down Expand Up @@ -88,6 +91,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
public void onViewCreated(View view, Bundle savedInstanceState) {
mActivity = (MainActivity) getActivity();
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mActivity);
mRunningOnTV = Util.isRunningOnTV(mActivity);

mVersion = view.findViewById(R.id.version);
mDrawerActionShowQrCode = view.findViewById(R.id.drawerActionShowQrCode);
Expand Down Expand Up @@ -130,7 +134,7 @@ private void updateUI() {
mVersion.setVisibility(View.VISIBLE);
mDrawerActionShowQrCode.setVisibility(syncthingRunning ? View.VISIBLE : View.GONE);
mDrawerRecentChanges.setVisibility(syncthingRunning ? View.VISIBLE : View.GONE);
mDrawerActionWebGui.setVisibility(syncthingRunning ? View.VISIBLE : View.GONE);
mDrawerActionWebGui.setVisibility((syncthingRunning && !mRunningOnTV) ? View.VISIBLE : View.GONE);
mDrawerActionRestart.setVisibility(syncthingRunning ? View.VISIBLE : View.GONE);
mDrawerTipsAndTricks.setVisibility(View.VISIBLE);
mDrawerActionExit.setVisibility(View.VISIBLE);
Expand Down

0 comments on commit 5c95fd2

Please sign in to comment.