Android Open Source - codemap Project Wizard






From Project

Back to project page codemap.

License

The source code is released under:

GNU General Public License

If you think the Android project codemap 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 com.hdweiss.codemap.view.project;
/* ww  w  .j a va 2s . c om*/
import java.io.IOException;
import java.util.ArrayList;

import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

import com.hdweiss.codemap.R;
import com.hdweiss.codemap.data.Project;
import com.hdweiss.codemap.util.Utils;

public class ProjectWizard extends DialogFragment {

  private Project project;  
  
  private EditText nameView;
  private EditText urlView;
  private Spinner syncSpinner;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    
    View view = inflater.inflate(R.layout.project_wizard, container);
    
    this.nameView = (EditText) view.findViewById(R.id.wizard_name);
    this.urlView = (EditText) view.findViewById(R.id.wizard_url);
    this.syncSpinner = (Spinner) view.findViewById(R.id.wizard_synchronizer);
    
    Button okButton = (Button) view.findViewById(R.id.wizard_ok);
    okButton.setOnClickListener(okClick);
    
    Button cancelButton = (Button) view.findViewById(R.id.wizard_cancel);
    cancelButton.setOnClickListener(cancelClick);
    
    setup();
    return view;
  }

  private void setup() {
    if(project != null) {
      nameView.setText(project.getName());
      urlView.setText(project.getUrl());
      getDialog().setTitle("Edit project");
    } else
      getDialog().setTitle("Add project");
    
    ArrayList<String> syncSources = new ArrayList<String>();
    syncSources.add("git");
    Utils.setupSpinner(syncSpinner, syncSources, "git");
  }
  
  public void setProject(Project project) {
    this.project = project;
  }
  
  public Project saveProject() {
    final String name = nameView.getText().toString();
    final String url = urlView.getText().toString();
    
    Project project = new Project(name);
    final String oldUrl = project.getUrl();
    project.setUrl(url);
    
    try {
      project.writeProject(getActivity());
    } catch (IOException e) {
      e.printStackTrace();
      Toast.makeText(getActivity(), "Error writing project",
          Toast.LENGTH_LONG).show();
    }
        
    ProjectBrowser browser = (ProjectBrowser) getActivity();
    browser.refresh();
    
    if (url.equals(oldUrl) == false)
      ProjectBrowser.updateProject(name, getActivity());
    
    return project;
  }
  
  private OnClickListener okClick = new OnClickListener() {
    public void onClick(View v) {
      saveProject();
      dismiss();
    }
  };
  
  private OnClickListener cancelClick = new OnClickListener() {
    public void onClick(View v) {
      dismiss();
    }
  };
}




Java Source Code List

com.hdweiss.codemap.data.CodeMapApp.java
com.hdweiss.codemap.data.CscopeEntry.java
com.hdweiss.codemap.data.CscopeWrapper.java
com.hdweiss.codemap.data.Cscope.java
com.hdweiss.codemap.data.ICodeMapItem.java
com.hdweiss.codemap.data.JGitWrapper.java
com.hdweiss.codemap.data.ProjectController.java
com.hdweiss.codemap.data.Project.java
com.hdweiss.codemap.data.SerializableItem.java
com.hdweiss.codemap.data.SerializableLink.java
com.hdweiss.codemap.util.AbsoluteLayout.java
com.hdweiss.codemap.util.CodeMapCursorPoint.java
com.hdweiss.codemap.util.CodeMapPoint.java
com.hdweiss.codemap.util.FlowLayout.java
com.hdweiss.codemap.util.ObjectSerializer.java
com.hdweiss.codemap.util.SpanUtils.java
com.hdweiss.codemap.util.SyntaxHighlighter.java
com.hdweiss.codemap.util.Utils.java
com.hdweiss.codemap.util.ZoomableAbsoluteLayout.java
com.hdweiss.codemap.util.ZoomableLinearLayout.java
com.hdweiss.codemap.view.CodeMapActivity.java
com.hdweiss.codemap.view.CodeMapTabListener.java
com.hdweiss.codemap.view.Preferences.java
com.hdweiss.codemap.view.project.ProjectAdapter.java
com.hdweiss.codemap.view.project.ProjectBrowser.java
com.hdweiss.codemap.view.project.ProjectItemView.java
com.hdweiss.codemap.view.project.ProjectWizard.java
com.hdweiss.codemap.view.workspace.CollisionManager.java
com.hdweiss.codemap.view.workspace.FindDeclarationTask.java
com.hdweiss.codemap.view.workspace.WorkspaceController.java
com.hdweiss.codemap.view.workspace.WorkspaceFragment.java
com.hdweiss.codemap.view.workspace.WorkspaceStateLoader.java
com.hdweiss.codemap.view.workspace.WorkspaceState.java
com.hdweiss.codemap.view.workspace.WorkspaceViewListeners.java
com.hdweiss.codemap.view.workspace.WorkspaceView.java
com.hdweiss.codemap.view.workspace.browser.WorkspaceBrowserAdapter.java
com.hdweiss.codemap.view.workspace.browser.WorkspaceBrowser.java
com.hdweiss.codemap.view.workspace.fragments.CodeMapAnnotation.java
com.hdweiss.codemap.view.workspace.fragments.CodeMapFunction.java
com.hdweiss.codemap.view.workspace.fragments.CodeMapImage.java
com.hdweiss.codemap.view.workspace.fragments.CodeMapItem.java
com.hdweiss.codemap.view.workspace.fragments.CodeMapLink.java
com.hdweiss.codemap.view.workspace.fragments.FunctionLinkSpan.java
com.hdweiss.codemap.view.workspace.outline.CscopeEntryAdapter.java
com.hdweiss.codemap.view.workspace.outline.OutlineAdapter.java
com.hdweiss.codemap.view.workspace.outline.OutlineBrowser.java
com.hdweiss.codemap.view.workspace.outline.OutlineItemComparator.java
com.hdweiss.codemap.view.workspace.outline.OutlineItemView.java
com.hdweiss.codemap.view.workspace.outline.OutlineItem.java