Android Open Source - SeeKampf Rest Details Activity






From Project

Back to project page SeeKampf.

License

The source code is released under:

GNU General Public License

If you think the Android project SeeKampf listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.avedo.seekampf.core;
/*w ww  .ja v a2  s  .  c o  m*/
import net.avedo.seekampf.R;
import net.avedo.seekampf.fragments.HomeDetailsFragment;
import net.avedo.seekampf.fragments.IslandDetailsFragment;
import net.avedo.seekampf.fragments.MessageDetailsFragment;
import net.avedo.seekampf.fragments.RestDetailsFragment;
import net.avedo.seekampf.utils.Constants;
import net.avedo.seekampf.utils.Interfaces;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;

public class RestDetailsActivity extends Activity implements
    Interfaces.OnFragmentActionListener {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_activity);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    // Ensure that there are additional information passed along.
    Intent intent = getIntent();
    if (intent == null) {
      setResult(Constants.ACTIVITY_RESULT_MISSING_ARGUMENT);
      finish();
    }

        // Ensure that there are additional information passed along.
        Bundle extras = intent.getExtras();
        if (extras == null) {
            setResult(Constants.ACTIVITY_RESULT_MISSING_ARGUMENT);
            finish();
        } else {
            // Get the fragment id ...
            int serviceFragment = extras.getInt(Constants.INTENT_EXTRA_FRAGMENT,
                    Constants.FRAGMENT_MESSAGE_DETAILS);

            // ... and set it as main view.
            this.setFragment(serviceFragment, extras);
        }
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
      NavUtils.navigateUpFromSameTask(this);
      return true;
    }
    
    return super.onOptionsItemSelected(item);
  }

  @Override
  public void onFragmentAction(int action, Bundle extras) {
    // Nothing to do here!
  }

  @Override
  public void onFragmentRequest(int request, Bundle extras) {
        // Nothing to do here!
    }

  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
    case Constants.ACTIVITY_REQUEST_EDIT:
      switch (resultCode) {
      case Constants.ACTIVITY_RESULT_OK:
//        onFragmentRequest(Constants.FRAGMENT_REQUEST_DETAILS,
//            data.getExtras());
        break;
      }
      break;
    }
  }

    private void setFragment(int fragmentId, Bundle extras) {
        RestDetailsFragment fragment;

        switch(fragmentId) {
            case Constants.FRAGMENT_MESSAGE_DETAILS:
                fragment = new MessageDetailsFragment();
                getActionBar().setTitle(R.string.messages);
                break;
            case Constants.FRAGMENT_ISLAND_DETAILS:
                fragment = new IslandDetailsFragment();
                getActionBar().setTitle(R.string.islands);
                break;
            case Constants.FRAGMENT_HOME_DETAILS:
                fragment = new HomeDetailsFragment();
                getActionBar().setTitle(R.string.islands);
                break;
            default:
                fragment = new MessageDetailsFragment();
        }

        // Place the content fragment.
        fragment.setArguments(extras);
        getFragmentManager().beginTransaction()
                .replace(R.id.contentFrgmt, fragment).commit();
    }
}




Java Source Code List

net.avedo.seekampf.BuildConfig.java
net.avedo.seekampf.core.ChangeLog.java
net.avedo.seekampf.core.CustomAdapter.java
net.avedo.seekampf.core.MainActivity.java
net.avedo.seekampf.core.OceanView.java
net.avedo.seekampf.core.OverScrollerCompat.java
net.avedo.seekampf.core.RestDetailsActivity.java
net.avedo.seekampf.core.ScaleGestureDetectorCompat.java
net.avedo.seekampf.core.VolleyActivity.java
net.avedo.seekampf.core.Zoomer.java
net.avedo.seekampf.fragments.AboutFragment.java
net.avedo.seekampf.fragments.AllianceListFragment.java
net.avedo.seekampf.fragments.AuctionListFragment.java
net.avedo.seekampf.fragments.HomeDetailsFragment.java
net.avedo.seekampf.fragments.HomeFragment.java
net.avedo.seekampf.fragments.IslandDetailsFragment.java
net.avedo.seekampf.fragments.IslandListFragment.java
net.avedo.seekampf.fragments.MessageDetailsFragment.java
net.avedo.seekampf.fragments.MessageListFragment.java
net.avedo.seekampf.fragments.OceanFragment.java
net.avedo.seekampf.fragments.PlayerListFragment.java
net.avedo.seekampf.fragments.RestDetailsFragment.java
net.avedo.seekampf.fragments.RestListFragment.java
net.avedo.seekampf.fragments.SettingsFragment.java
net.avedo.seekampf.models.Alliance.java
net.avedo.seekampf.models.Auction.java
net.avedo.seekampf.models.BaseModel.java
net.avedo.seekampf.models.Island.java
net.avedo.seekampf.models.Message.java
net.avedo.seekampf.models.Player.java
net.avedo.seekampf.utils.AuthGsonRequest.java
net.avedo.seekampf.utils.Constants.java
net.avedo.seekampf.utils.Interfaces.java
net.avedo.seekampf.utils.VolleyErrorHelper.java