@Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {

      // Display Spinner
      activity.setRefreshing(true);
      super.onPageStarted(view, url, favicon);
    }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   switch (requestCode) {
     case REQUEST_AUTH_DRINKER:
       if (data == null) {
         Log.i(TAG, "No user selected.");
         return;
       }
       String username =
           data.getStringExtra(KegtabCommon.ACTIVITY_AUTH_DRINKER_RESULT_EXTRA_USERNAME);
       if (Strings.isNullOrEmpty(username)) {
         Log.i(TAG, "No user selected.");
         return;
       }
       int flowId = data.getIntExtra(EXTRA_FLOW_ID, 0);
       final Flow flow = mFlowManager.getFlowForFlowId(flowId);
       if (flow == null) {
         Log.w(TAG, "No flow for id " + flowId);
         return;
       }
       Log.i(TAG, "Flow " + flowId + " claimed by: " + username);
       flow.setUsername(username);
       return;
     default:
       super.onActivityResult(requestCode, resultCode, data);
   }
 }
 @Override
 protected void onPause() {
   Log.d(TAG, "onPause");
   mHandler.removeCallbacks(REFRESH_FLOWS_RUNNABLE);
   mCore.getBus().unregister(this);
   super.onPause();
 }
 @Override
 protected void onResume() {
   super.onResume();
   Log.d(TAG, "onResume");
   mCore.getBus().register(this);
   mHandler.post(REFRESH_FLOWS_RUNNABLE);
 }
 @Override
 public void onBackPressed() {
   if (!mFlowManager.getAllActiveFlows().isEmpty()) {
     endAllFlows();
   } else {
     super.onBackPressed();
   }
 }
 @Override
 protected void onStop() {
   if (isFinishing()) {
     endAllFlows();
   }
   mTapList.clear();
   super.onStop();
 }
 @Override
 protected void onStart() {
   super.onStart();
   synchronized (mTapsLock) {
     for (final KegTap tap : mCore.getTapManager().getVisibleTaps()) {
       mTapList.add(tap);
     }
     mPouringTapAdapter.notifyDataSetChanged();
   }
 }
 @Override
 protected void onPostResume() {
   super.onPostResume();
   final Flow flow = getCurrentlyFocusedFlow();
   Log.d(TAG, "onPostResume: focusedFlow: " + flow);
   if (flow != null) {
     updateControlsForFlow(flow);
     if (Strings.isNullOrEmpty(flow.getImagePath())) {
       if (mShowCamera && mConfig.getEnableAutoTakePhoto()) {
         mCameraFragment.schedulePicture();
       }
     }
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      getWindow()
          .setSharedElementEnterTransition(
              TransitionInflater.from(this).inflateTransition(R.transition.postsinfotransition));
    }

    setContentView(R.layout.post_details_layout);
    ButterKnife.bind(this);

    /*We want to set the menu visibility to none because this activity doesn't require a toolbar*/
    setMenuVisibility(false);
    initViews();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tap_list);
    // Show the Up button in the action bar.
    getActionBar().setDisplayHomeAsUpEnabled(true);

    if (findViewById(R.id.tap_detail_container) != null) {
      // The detail container view will be present only in the
      // large-screen layouts (res/values-large and
      // res/values-sw600dp). If this view is present, then the
      // activity should be in two-pane mode.
      mTwoPane = true;

      // In two-pane mode, list items should be given the
      // 'activated' state when touched.
      ((TapListFragment) getFragmentManager().findFragmentById(R.id.tap_list))
          .setActivateOnItemClick(true);
    }

    // TODO: If exposing deep links into your app, handle intents here.
  }
 @Override
 protected void onNewIntent(Intent intent) {
   super.onNewIntent(intent);
   setIntent(intent);
   refreshFlows();
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate()");

    mCore = KegbotCore.getInstance(this);
    mFlowManager = mCore.getFlowManager();
    mConfig = mCore.getConfiguration();
    mImageDownloader = mCore.getImageDownloader();

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
      actionBar.hide();
    }
    setContentView(R.layout.pour_in_progress_activity);

    mTapPager = (ViewPager) findViewById(R.id.tapPager);
    mPouringTapAdapter = new PouringTapAdapter(getFragmentManager());
    mTapPager.setAdapter(mPouringTapAdapter);
    mTapPager.setOnPageChangeListener(mPageChangeListener);

    mControlsFlipper = (ViewFlipper) findViewById(R.id.pour_controls_flipper);
    mClaimPourButton = (Button) findViewById(R.id.claimPourButton);
    mDrinkerName = (TextView) findViewById(R.id.pourDrinkerName);
    mDoneButton = (Button) findViewById(R.id.pourEndButton);
    mDrinkerImage = (ImageView) findViewById(R.id.pourDrinkerImage);
    mShoutText = (TextView) findViewById(R.id.shoutText);

    mClaimPourButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            final Flow flow = getCurrentlyFocusedFlow();
            if (flow == null || flow.isAuthenticated() || flow.isFinished()) {
              return;
            }

            Log.d(TAG, "Attempting to claim flow id=" + flow.getFlowId());
            final Intent intent =
                KegtabCommon.getAuthDrinkerActivityIntent(PourInProgressActivity.this);
            intent.putExtra(EXTRA_FLOW_ID, flow.getFlowId());
            startActivityForResult(intent, REQUEST_AUTH_DRINKER);
          }
        });

    mDoneButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            final FlowManager flowManager = mCore.getFlowManager();
            final Flow flow = getCurrentlyFocusedFlow();
            if (flow == null) {
              return;
            }
            Log.d(TAG, "Done button pressed, ending flow " + flow.getFlowId());
            flowManager.endFlow(flow);

            // If we're finishing a non-dormant flow, and other dormant flows
            // exist, assume those were started optimistically and finish them
            // now.
            if (flow.getVolumeMl() > 0) {
              final AppConfiguration config = mCore.getConfiguration();
              final long minVolume = config.getMinimumVolumeMl();
              for (final Flow suspectFlow : flowManager.getAllActiveFlows()) {
                if (suspectFlow.getVolumeMl() < minVolume) {
                  Log.d(TAG, "Also ending dormant flow: " + suspectFlow.getFlowId());
                  flowManager.endFlow(suspectFlow);
                }
              }
            }
          }
        });

    mShoutText = (EditText) findViewById(R.id.shoutText);
    mShoutText.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void afterTextChanged(Editable s) {
            final Flow flow = getCurrentlyFocusedFlow();
            if (flow == null) {
              Log.w(TAG, "Flow went away, dropping shout.");
              return;
            }
            flow.setShout(s.toString());
            flow.pokeActivity();
          }
        });

    mShowCamera = true;
    mCameraFragment = (CameraFragment) getFragmentManager().findFragmentById(R.id.camera);
    if (!mConfig.getUseCamera()) {
      mShowCamera = false;
      getFragmentManager().beginTransaction().hide(mCameraFragment).commit();
    }

    refreshFlows();
  }
Пример #13
0
 @Override
 protected void onResume() {
   super.onResume();
   setRefreshing(true);
 }