예제 #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    status = (EditText) findViewById(R.id.status);

    Button send = (Button) findViewById(R.id.send);

    send.setOnClickListener(onSend);

    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.registerOnSharedPreferenceChangeListener(prefListener);

    bindService(new Intent(ITwitterMonitor.class.getName()), svcConn, Context.BIND_AUTO_CREATE);

    adapter = new TimelineAdapter();

    ListView list = (ListView) findViewById(R.id.timeline);

    //		list.addHeaderView(buildHeader());
    list.setAdapter(adapter);
    list.setOnItemClickListener(onStatusClick);
    list.setOnItemSelectedListener(selectionListener);

    TabHost.TabSpec spec = getTabHost().newTabSpec("tag1");

    spec.setContent(R.id.status_tab);
    spec.setIndicator("Status", getResources().getDrawable(R.drawable.status));
    getTabHost().addTab(spec);

    spec = getTabHost().newTabSpec("tag2");
    spec.setContent(R.id.friends);
    spec.setIndicator("Friends", getResources().getDrawable(R.drawable.friends));
    getTabHost().addTab(spec);

    getTabHost().setCurrentTab(0);

    try {
      for (Twitter.User u : getClient().getFriends()) {
        friends.add(u.screenName);
      }
    } catch (Throwable t) {
      Log.e("Patchy", "Exception in JTwitter#getFriends()", t);
      goBlooey(t);
    }

    Collections.sort(friends);

    friendsList = (ListView) findViewById(R.id.friends);

    friendsAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, friends);
    friendsList.setAdapter(friendsAdapter);
    friendsList.setItemsCanFocus(false);
    friendsList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

    locMgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 10000.0f, onLocationChange);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    TabHost host = (TabHost) findViewById(R.id.tab_host);
    host.setup();

    // Tab 1
    TabHost.TabSpec spec = host.newTabSpec("Timeline");
    spec.setContent(R.id.tab1);
    spec.setIndicator("Timeline");
    host.addTab(spec);

    // Tab 2
    spec = host.newTabSpec("Direct Message");
    spec.setContent(R.id.tab2);
    spec.setIndicator("Direct Message");
    host.addTab(spec);

    // Tab 3
    spec = host.newTabSpec("Profile");
    spec.setContent(R.id.tab3);
    spec.setIndicator("Profile");
    host.addTab(spec);
  }
예제 #3
0
 public void onCreate(Bundle paramBundle) {
   super.onCreate(paramBundle);
   requestWindowFeature(1);
   getWindow().setFlags(1024, 1024);
   // setContentView(2130903041);
   setContentView(R.layout.activity_help);
   Log.d("chilon", "help activity");
   TabHost localTabHost = (TabHost) findViewById(R.id.TabHost1);
   localTabHost.setup();
   TabHost.TabSpec localTabSpec1 = localTabHost.newTabSpec("instructions");
   localTabSpec1.setIndicator(getResources().getString(R.string.tab_text));
   localTabSpec1.setContent(R.id.ScrollViewHelpText);
   localTabHost.addTab(localTabSpec1);
   TabHost.TabSpec localTabSpec2 = localTabHost.newTabSpec("example");
   localTabSpec2.setIndicator(getResources().getString(R.string.tab_image));
   localTabSpec2.setContent(R.id.ScrollViewHelpImage);
   localTabHost.addTab(localTabSpec2);
   localTabHost.setCurrentTabByTag("instructions");
   ImageView localImageView = (ImageView) findViewById(R.id.imageViewHelp);
   DisplayMetrics localDisplayMetrics = new DisplayMetrics();
   getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
   int i = localDisplayMetrics.widthPixels;
   int j = localDisplayMetrics.heightPixels;
   Log.d("chilon", "onpost create for Help - width  " + i);
   if (i < j) localImageView.setImageResource(R.drawable.help);
   while (true) {
     localImageView.setImageResource(R.drawable.helpland);
   }
 }
예제 #4
0
  private void setupTab(final View view, final String tag) {
    View tabview = createTabView(tabHost.getContext(), tag);

    // TabSpec은 공개된 생성자가 없으므로 직접 생성할 수 없으며, TabHost의 newTabSpec메서드로 생성
    TabHost.TabSpec setContent = tabHost.newTabSpec(tag).setIndicator(tabview);

    if (tag.equals("알람")) setContent.setContent(new Intent(this, AlarmActivity.class));
    else if (tag.equals("친구")) setContent.setContent(new Intent(this, FriendActivity.class));
    else if (tag.equals("설정")) setContent.setContent(new Intent(this, SettingActivity.class));

    tabHost.addTab(setContent);
  }
  public void initializeTabs() {
    /* Setup your tab icons and content views.. Nothing special in this..*/
    TabHost.TabSpec spec = mTabHost.newTabSpec(AppConstants.TAB_A);
    mTabHost.setCurrentTab(-3);
    spec.setContent(
        new TabHost.TabContentFactory() {
          public View createTabContent(String tag) {
            return findViewById(R.id.realtabcontent);
          }
        });
    spec.setIndicator("TAB A");
    mTabHost.addTab(spec);

    spec = mTabHost.newTabSpec(AppConstants.TAB_B);
    spec.setContent(
        new TabHost.TabContentFactory() {
          public View createTabContent(String tag) {
            return findViewById(R.id.realtabcontent);
          }
        });
    spec.setIndicator("TAB B");
    mTabHost.addTab(spec);

    spec = mTabHost.newTabSpec(AppConstants.TAB_C);
    spec.setContent(
        new TabHost.TabContentFactory() {
          public View createTabContent(String tag) {
            return findViewById(R.id.realtabcontent);
          }
        });
    spec.setIndicator("TAB C");
    mTabHost.addTab(spec);

    spec = mTabHost.newTabSpec(AppConstants.TAB_D);
    spec.setContent(
        new TabHost.TabContentFactory() {
          public View createTabContent(String tag) {
            return findViewById(R.id.realtabcontent);
          }
        });
    spec.setIndicator("TAB D");
    mTabHost.addTab(spec);

    spec = mTabHost.newTabSpec(AppConstants.TAB_E);
    spec.setContent(
        new TabHost.TabContentFactory() {
          public View createTabContent(String tag) {
            return findViewById(R.id.realtabcontent);
          }
        });
    spec.setIndicator("TAB E");
    mTabHost.addTab(spec);
  }
예제 #6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main2);

    res = getResources();
    mitab = (TabHost) findViewById(R.id.mitab);
    mitab.setup();

    TabHost.TabSpec perfil = mitab.newTabSpec("Perfil");
    perfil.setContent(R.id.perfil);
    perfil.setIndicator(
        "Perfil", ContextCompat.getDrawable(this, android.R.drawable.ic_btn_speak_now));
    mitab.addTab(perfil);

    TabHost.TabSpec limpieza = mitab.newTabSpec("Limpieza");
    limpieza.setContent(R.id.perfil);
    limpieza.setIndicator(
        "Limpieza", ContextCompat.getDrawable(this, android.R.drawable.ic_btn_speak_now));
    mitab.addTab(limpieza);

    TabHost.TabSpec recoge = mitab.newTabSpec("Recoge");
    recoge.setContent(R.id.perfil);
    recoge.setIndicator(
        "Recoge", ContextCompat.getDrawable(this, android.R.drawable.ic_btn_speak_now));
    mitab.addTab(recoge);

    TabHost.TabSpec eventos = mitab.newTabSpec("Eventos");
    eventos.setContent(R.id.perfil);
    eventos.setIndicator(
        "Eventos", ContextCompat.getDrawable(this, android.R.drawable.ic_btn_speak_now));
    mitab.addTab(eventos);

    mitab.setOnTabChangedListener(
        new TabHost.OnTabChangeListener() {
          @Override
          public void onTabChanged(String tabId) {
            Log.i("AndroidTabsDemo", "Pulsada pestaña: " + tabId);

            if (tabId.equals("Perfil")) {}

            if (tabId.equals("Limpieza")) {}

            if (tabId.equals("Recoge")) {}

            if (tabId.equals("Eventos")) {}
          }
        });
  }
예제 #7
0
  private static void AddTab(
      Activity_Tab activity,
      TabHost tabHost,
      TabHost.TabSpec tabSpec,
      TabInfo tabInfo,
      String label,
      int drawable) {
    tabSpec.setContent(activity.new TabFactory(activity));

    View tabIndicator =
        LayoutInflater.from(activity)
            .inflate(R.layout.tab_indicator, tabHost.getTabWidget(), false);
    TextView txtTitle = (TextView) tabIndicator.findViewById(R.id.title);
    ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);

    txtTitle.setText(label);
    txtTitle.setTextSize(
        Float.parseFloat(activity.getResources().getString(R.string.size_pointer)));
    txtTitle.setTypeface(StaticUtils.getTypeface(activity, Font.THSarabanNew));
    icon.setImageResource(drawable);

    tabSpec.setIndicator(tabIndicator);

    tabHost.addTab(tabSpec);
  }
예제 #8
0
파일: ags.java 프로젝트: nhnam/ZaloRE
 public void a(TabHost.TabSpec paramTabSpec, Class<?> paramClass, Bundle paramBundle) {
   paramTabSpec.setContent(new agt(this.mContext));
   agu localagu = new agu(paramTabSpec.getTag(), paramClass, paramBundle);
   this.alL.add(localagu);
   this.Rk.addTab(paramTabSpec);
   notifyDataSetChanged();
 }
    public void addTab(TabHost.TabSpec tabSpec, Class<?> clss) {
      tabSpec.setContent(new DummyTabFactory(mContext));

      TabInfo info = new TabInfo(clss);
      mTabs.add(info);
      mTabHost.addTab(tabSpec);
      notifyDataSetChanged();
    }
예제 #10
0
  protected void initTabs() {
    LayoutInflater inflater = LayoutInflater.from(FindPwdTabsActivity.this);
    View phoneView = inflater.inflate(R.layout.common_tabbar_item_lightblue, null);
    ((HandyTextView) phoneView.findViewById(R.id.tabbar_item_htv_label)).setText("手机号码");
    TabHost.TabSpec phoneTabSpec =
        mTabHost.newTabSpec(FindPwdPhoneActivity.class.getName()).setIndicator(phoneView);
    phoneTabSpec.setContent(new Intent(FindPwdTabsActivity.this, FindPwdPhoneActivity.class));
    mTabHost.addTab(phoneTabSpec);

    View emailView = inflater.inflate(R.layout.common_tabbar_item_lightblue, null);
    ((HandyTextView) emailView.findViewById(R.id.tabbar_item_htv_label)).setText("电子邮箱");
    emailView.findViewById(R.id.tabbar_item_ligthblue_driver_left).setVisibility(View.VISIBLE);
    TabHost.TabSpec emailTabSpec =
        mTabHost.newTabSpec(FindPwdEmailActivity.class.getName()).setIndicator(emailView);
    emailTabSpec.setContent(new Intent(FindPwdTabsActivity.this, FindPwdEmailActivity.class));
    mTabHost.addTab(emailTabSpec);
  }
예제 #11
0
 private void addTab(TabWidget tabWidget, int contentId, String id, String label) {
   TabHost.TabSpec spec = tabHost.newTabSpec(id);
   spec.setContent(contentId);
   TextView textIndicator =
       (TextView) getLayoutInflater().inflate(R.layout.gd_tab_indicator, tabWidget, false);
   textIndicator.setText(label);
   spec.setIndicator(textIndicator);
   tabHost.addTab(spec);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pm);
    TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);

    TabHost.TabSpec tab1 = tabHost.newTabSpec("Gelen");
    TabHost.TabSpec tab2 = tabHost.newTabSpec("Giden");

    tab1.setIndicator("Gelen");
    tab1.setContent(new Intent(this, GelenPMActivity.class));

    tab2.setIndicator("Giden");
    tab2.setContent(new Intent(this, GidenPmActivity.class));

    tabHost.addTab(tab1);
    tabHost.addTab(tab2);
  }
  private void initTab(
      String tabId, int tabContentId, int tabTitleTextId, ListController listController) {
    TabHost.TabSpec spec = tabHost.newTabSpec(tabId);
    spec.setContent(tabContentId);
    spec.setIndicator(getString(tabTitleTextId));
    tabHost.addTab(spec);

    listControllers.put(tabId, listController);
  }
예제 #14
0
    public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
      tabSpec.setContent(new DummyTabFactory(mContext));
      String tag = tabSpec.getTag();

      TabInfo info = new TabInfo(tag, clss, args);
      mTabs.add(info);
      mTabHost.addTab(tabSpec);
      notifyDataSetChanged();
    }
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);

    TabHost tabs = (TabHost) findViewById(R.id.tabhost);
    tabs.setup();

    TabHost.TabSpec spec = tabs.newTabSpec("tag1");

    spec.setContent(R.id.tabPage1);
    spec.setIndicator("Document 1");
    tabs.addTab(spec);

    spec = tabs.newTabSpec("tag2");
    spec.setContent(R.id.tabPage2);
    spec.setIndicator("Document 2");
    tabs.addTab(spec);

    tabs.setCurrentTab(0);
  }
예제 #16
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    /// create the TabHost that will contain the Tabs
    TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
    TabHost.TabSpec tab1 = tabHost.newTabSpec("First Tab");
    TabHost.TabSpec tab2 = tabHost.newTabSpec("Second Tab");

    // Set the Tab name and Activity
    // that will be opened when particular Tab will be selected
    tab1.setIndicator("User Events");
    tab1.setContent(new Intent(this, EventActivity.class));

    tab2.setIndicator("Driving");
    tab2.setContent(new Intent(this, DrivingActivity.class));

    /** Add the tabs to the TabHost to display. */
    tabHost.addTab(tab1);
    tabHost.addTab(tab2);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    helper = new RestaurantHelper(this);

    name = (EditText) findViewById(R.id.name);
    address = (EditText) findViewById(R.id.addr);
    notes = (EditText) findViewById(R.id.notes);
    types = (RadioGroup) findViewById(R.id.types);

    Button save = (Button) findViewById(R.id.save);

    save.setOnClickListener(onSave);

    ListView list = (ListView) findViewById(R.id.restaurants);

    model = helper.getAll();
    startManagingCursor(model);
    adapter = new RestaurantAdapter(model);
    list.setAdapter(adapter);

    TabHost.TabSpec spec = getTabHost().newTabSpec("tag1");

    spec.setContent(R.id.restaurants);
    spec.setIndicator("List", getResources().getDrawable(R.drawable.list));
    getTabHost().addTab(spec);

    spec = getTabHost().newTabSpec("tag2");
    spec.setContent(R.id.details);
    spec.setIndicator("Details", getResources().getDrawable(R.drawable.restaurant));
    getTabHost().addTab(spec);

    getTabHost().setCurrentTab(0);

    list.setOnItemClickListener(onListClick);
  }
예제 #18
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // FIXME - change to use a menu like the web browser app (instead of tabs)

    setContentView(R.layout.tabs);

    TabHost tabs = (TabHost) this.findViewById(android.R.id.tabhost);
    tabs.setup();

    TabHost.TabSpec one = tabs.newTabSpec("one");
    one.setContent(R.id.content1);
    one.setIndicator("labelone", this.getResources().getDrawable(R.drawable.icon));
    // one.setIndicator("One");
    tabs.addTab(one);

    TabHost.TabSpec two = tabs.newTabSpec("two");
    two.setContent(R.id.content2);
    two.setIndicator("Two");
    tabs.addTab(two);

    tabs.setCurrentTab(0);
  }
예제 #19
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // tab1
    TabHost TbH = (TabHost) findViewById(R.id.tabHost); // llamamos al Tabhost
    TbH.setup(); // lo activamos

    TabHost.TabSpec tab1 = TbH.newTabSpec("tab1"); // aspectos de cada Tab (pestaña)
    TabHost.TabSpec tab2 = TbH.newTabSpec("tab2");
    TabHost.TabSpec tab3 = TbH.newTabSpec("tab3");

    tab1.setIndicator("UNO"); // qué queremos que aparezca en las pestañas
    tab1.setContent(R.id.ejemplo1); // definimos el id de cada Tab (pestaña)

    tab2.setIndicator("DOS");
    tab2.setContent(R.id.ejemplo2);

    tab3.setIndicator("TRES");
    tab3.setContent(R.id.ejemplo3);

    TbH.addTab(tab1); // añadimos los tabs ya programados
    TbH.addTab(tab2);
    TbH.addTab(tab3);
  }
  private void addTab(String labelId, int drawableId, Class<?> c) {
    TabHost tabHost = getTabHost();
    Intent intent = new Intent(this, c);
    TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId);

    View tabIndicator =
        LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
    TextView title = (TextView) tabIndicator.findViewById(R.id.title);
    title.setText(labelId);
    ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
    icon.setImageResource(drawableId);

    spec.setIndicator(tabIndicator);
    spec.setContent(intent);
    tabHost.addTab(spec);
  }
예제 #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.robotics_mini_mouse);

    TabHost tabs = (TabHost) findViewById(R.id.tabhost_robo_mini_mouse);

    tabs.setup();

    TabHost.TabSpec spec1 = tabs.newTabSpec("intro");

    spec1.setContent(R.id.linear_robo_mini_mouse_intro);
    spec1.setIndicator("  Introduction  ");

    tabs.addTab(spec1);

    TabHost.TabSpec spec4 = tabs.newTabSpec("arena");

    spec4.setContent(R.id.linear_robo_mini_mouse_arena);
    spec4.setIndicator("  Arena  ");

    tabs.addTab(spec4);

    TabHost.TabSpec spec2 = tabs.newTabSpec("specs");

    spec2.setContent(R.id.linear_robo_mini_mouse_specs);
    spec2.setIndicator("  Specifications  ");

    tabs.addTab(spec2);

    TabHost.TabSpec spec3 = tabs.newTabSpec("stmt");

    spec3.setContent(R.id.linear_robo_mini_mouse_stmt);
    spec3.setIndicator("  Statement  ");

    tabs.addTab(spec3);

    TabHost.TabSpec spec6 = tabs.newTabSpec("prizes");

    spec6.setContent(R.id.linear_robo_mini_mouse_prizes);
    spec6.setIndicator(" Prizes  ");

    tabs.addTab(spec6);

    TabHost.TabSpec spec5 = tabs.newTabSpec("contact");

    spec5.setContent(R.id.linear_robo_mini_mouse_contact);
    spec5.setIndicator("  Contact  ");

    tabs.addTab(spec5);
  }
예제 #22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.ec_eracer);

    TabHost tabs = (TabHost) findViewById(R.id.tabhost_ec_eracer);

    tabs.setup();

    TabHost.TabSpec spec1 = tabs.newTabSpec("intro");

    spec1.setContent(R.id.linear_ec_eracer_intro);
    spec1.setIndicator("  Introduction  ");

    tabs.addTab(spec1);

    TabHost.TabSpec spec4 = tabs.newTabSpec("eventspecifications");

    spec4.setContent(R.id.linear_ec_eracer_specs);
    spec4.setIndicator("  Event Specifications  ");

    tabs.addTab(spec4);

    TabHost.TabSpec spec11 = tabs.newTabSpec("teamspecifications");

    spec11.setContent(R.id.linear_ec_eracer_team_specs);
    spec11.setIndicator("  Team Specifications  ");

    tabs.addTab(spec11);

    TabHost.TabSpec spec7 = tabs.newTabSpec("criteria");

    spec7.setContent(R.id.linear_ec_eracer_judge);
    spec7.setIndicator("  Judging Criteria  ");

    tabs.addTab(spec7);

    TabHost.TabSpec spec3 = tabs.newTabSpec("Contact");

    spec3.setContent(R.id.linear_ec_eracer_contact);
    spec3.setIndicator("  Contact  ");

    tabs.addTab(spec3);

    TabHost.TabSpec spec12 = tabs.newTabSpec("Prizes");

    spec12.setContent(R.id.linear_ec_eracer_prize);
    spec12.setIndicator("  Prizes  ");

    tabs.addTab(spec12);
  }
 public void addTab(TabHost.TabSpec paramTabSpec, Class<?> paramClass, Bundle paramBundle)
 {
   paramTabSpec.setContent(new DummyTabFactory(this.mContext));
   String str = paramTabSpec.getTag();
   TabInfo localTabInfo = new TabInfo(str, paramClass, paramBundle);
   if (this.mAttached)
   {
     TabInfo.access$102(localTabInfo, this.mFragmentManager.findFragmentByTag(str));
     if ((localTabInfo.fragment != null) && (!localTabInfo.fragment.isDetached()))
     {
       FragmentTransaction localFragmentTransaction = this.mFragmentManager.beginTransaction();
       localFragmentTransaction.detach(localTabInfo.fragment);
       localFragmentTransaction.commit();
     }
   }
   this.mTabs.add(localTabInfo);
   addTab(paramTabSpec);
 }
예제 #24
0
  /**
   * Ajout d'une tab au conteneur
   *
   * @param activity activit� concern�e
   * @param tabHost Hote des Tabs
   * @param tabSpec nouvelle spec de la tab
   * @param tabInfo infos de la � cr�er
   */
  private static void addTab(
      DiffusionTabActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) {

    // On Attache une factory � la spec de la tab
    tabSpec.setContent(activity.new TabFactory(activity));
    String tag = tabSpec.getTag();

    // On v�rifie si un fragment est d�j� li� � cette spec au quel cas
    // on le d�sactive afin de garantir l'�tat initial cach�
    tabInfo.fragment = activity.getSupportFragmentManager().findFragmentByTag(tag);
    if (tabInfo.fragment != null && !tabInfo.fragment.isDetached()) {
      FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
      ft.detach(tabInfo.fragment);
      ft.commit();
      activity.getSupportFragmentManager().executePendingTransactions();
    }
    tabHost.addTab(tabSpec);
  }
예제 #25
0
  public void addTab(final TabHost.TabSpec tabSpec, final Class<?> clss, final Bundle args) {
    tabSpec.setContent(new DummyTabFactory(mActivity));
    final String tag = tabSpec.getTag();

    final TabInfo info = new TabInfo(tag, clss, args);

    // Check to see if we already have a fragment for this tab, probably
    // from a previously saved state. If so, deactivate it, because our
    // initial state is that a tab isn't shown.
    info.fragment = mActivity.getSupportFragmentManager().findFragmentByTag(tag);
    if (info.fragment != null && !info.fragment.isDetached()) {
      final FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
      ft.detach(info.fragment);
      ft.commit();
    }

    mTabs.put(tag, info);
    mTabHost.addTab(tabSpec);
  }
예제 #26
0
  public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
    tabSpec.setContent(new DummyTabFactory(mContext));
    String tag = tabSpec.getTag();

    TabInfo info = new TabInfo(tag, clss, args);

    if (mAttached) {
      // If we are already attached to the window, then check to make
      // sure this tab's fragment is inactive if it exists.  This shouldn't
      // normally happen.
      info.fragment = mFragmentManager.findFragmentByTag(tag);
      if (info.fragment != null && !info.fragment.isDetached()) {
        FragmentTransaction ft = mFragmentManager.beginTransaction();
        ft.detach(info.fragment);
        ft.commit();
      }
    }

    mTabs.add(info);
    addTab(tabSpec);
  }
예제 #27
0
  /**
   * There is one chart for each signal type. Returns the chart component of a specific signal type.
   *
   * @return
   */
  public LineChart getChart(String signalTypeId) {
    if (!charts.containsKey(signalTypeId)) {
      // Create a chart component
      // chart = (LineChart) findViewById(R.id.chart);
      final LineChart chart = new LineChart(this);
      // chart.setUnit("Db");
      chart.setUnit("");
      // chart.setDrawUnitsInChart(true);
      chart.setDrawYValues(false);
      chart.setDrawBorder(false);
      chart.setTouchEnabled(true);
      chart.setDragEnabled(true);
      chart.setNoDataTextDescription("No data gathered.");
      chart.setDescription("Samples");
      chart.setPinchZoom(true); // if disabled, scaling can be done on x- and y-axis separately
      // set an alternative background color
      // mChart.setBackgroundColor(Color.GRAY)

      // Creates a chart tab.
      // http://www.java2s.com/Code/Android/UI/DynamicTabDemo.htm
      // http://www.java2s.com/Code/Android/UI/UsingatabcontentfactoryforthecontentviaTabHostTabSpecsetContentandroidwidgetTabHostTabContentFactory.htm
      TabHost.TabSpec spec = tabHost.newTabSpec(signalTypeId);
      spec.setIndicator(signalTypeId);
      spec.setContent(
          new TabHost.TabContentFactory() {
            public View createTabContent(String tag) {
              return chart;
            }
          });
      tabHost.addTab(spec);
      // addContentToTab(tabHost.getChildCount(), chart);

      charts.put(signalTypeId, chart);
      tabHost.invalidate();
    }

    return charts.get(signalTypeId);
  }
예제 #28
0
  // onCreate
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // requestWindowFeature(Window.FEATURE_NO_TITLE);

    // startActivity(new Intent(this,IntroActivity.class));

    textView10 = (TextView) findViewById(R.id.textView1);

    // ActionBar Basic Setting
    mAb = getActionBar();
    mAb.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00B0F0")));
    mAb.setTitle("문지기");
    mAb.setDisplayShowHomeEnabled(false);

    // Tabs_frame
    TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
    Log.i(TAG, "tabHost : " + tabHost);
    tabHost.setup(); // TabHost 객체를 생성하여 setup() 메소드를 실행

    // tab1 = tab_home
    TabHost.TabSpec spec1 = tabHost.newTabSpec("tab1");
    spec1.setContent(R.id.imageView1);
    spec1.setIndicator("", getResources().getDrawable(R.drawable.ic_home));
    tabHost.addTab(spec1);
    // tabHost.addTab(tabHost.newTabSpec("tab1")
    // .setIndicator("",getResources().getDrawable(R.drawable.ic_home))
    // .setContent(R.id.tab_home));

    // tab2 = tab_log
    TabHost.TabSpec spec2 = tabHost.newTabSpec("tab2");
    spec2.setContent(R.id.linearLayoutLog);
    spec2.setIndicator("", getResources().getDrawable(R.drawable.ic_log));
    tabHost.addTab(spec2);

    // tab3 = tab_imageprocess
    TabHost.TabSpec spec3 = tabHost.newTabSpec("tab3");
    spec3.setContent(R.id.linearLayoutImageProcess);
    spec3.setIndicator("", getResources().getDrawable(R.drawable.ic_imageprocess));
    tabHost.addTab(spec3);

    // tab4 = tab_imagecapture
    TabHost.TabSpec spec4 = tabHost.newTabSpec("tab4");
    spec4.setContent(R.id.LinearLayoutImageCapture);
    spec4.setIndicator("", getResources().getDrawable(R.drawable.ic_imagecapture));
    tabHost.addTab(spec4);

    // tab5 = tab_setting
    TabHost.TabSpec spec5 = tabHost.newTabSpec("tab5");
    spec5.setContent(R.id.LinearLayoutSetting);
    spec5.setIndicator("", getResources().getDrawable(R.drawable.ic_setting));
    tabHost.addTab(spec5);

    tabHost.setCurrentTab(0);
    tabHost.getTabWidget().setDividerDrawable(null);

    for (int tab = 0; tab < tabHost.getTabWidget().getChildCount(); ++tab) {
      tabHost.getTabWidget().getChildAt(tab).getLayoutParams().height = 120;
    }

    for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
      tabHost
          .getTabWidget()
          .getChildAt(i)
          .setBackgroundColor(Color.parseColor("#EBEBEB")); // 235235235

      tabHost.getTabWidget().setCurrentTab(1);
    }

    tabHost.setOnTabChangedListener(this);

    mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
    if (mNfcAdapter != null) {
      // Register callback
      mNfcAdapter.setNdefPushMessageCallback(null, this);
      mNfcAdapter.setOnNdefPushCompleteCallback(null, this);
    } else {
      setToast("이 장치는 nfc가 활성화되지 않았습니다.");
    }

    // create an NDEF message with two records of plain text type

    intent = new Intent(getApplicationContext(), MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    mPendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);

    // set an intent filter for all MIME data
    IntentFilter ndefIntent = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
    try {
      ndefIntent.addDataType("*/*");
      mIntentFilters = new IntentFilter[] {ndefIntent};
    } catch (Exception e) {
      Log.e("TagDispatch", e.toString());
    }
    /*
    appIcon = (Button)findViewById(R.id.appicon);
    appName = (TextView)findViewById(R.id.appName);
    tabName = (TextView)findViewById(R.id.tabName);
    appName.setBackgroundColor(Color.TRANSPARENT);
    tabName.setBackgroundColor(Color.TRANSPARENT);

    tab0 = (Button)findViewById(R.id.tab0);
    tab1 = (Button)findViewById(R.id.tab1);
    tab2 = (Button)findViewById(R.id.tab2);
    tab3 = (Button)findViewById(R.id.tab3);
    tab4 = (Button)findViewById(R.id.tab4);
    tab0.setOnClickListener(this);
    tab1.setOnClickListener(this);
    tab2.setOnClickListener(this);
    tab3.setOnClickListener(this);
    tab4.setOnClickListener(this);
    tab0.setBackgroundColor(Color.TRANSPARENT);
    tab1.setBackgroundColor(Color.TRANSPARENT);
    tab2.setBackgroundColor(Color.TRANSPARENT);
    tab3.setBackgroundColor(Color.TRANSPARENT);
    tab4.setBackgroundColor(Color.TRANSPARENT);
    */

    // mAb = getActionBar(); // �쁾�븸��?�諛붾��? �꺆 �삎�떇�쑝濡� 蹂�寃�
    // mAb.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    mImageView1 = (LinearLayout) findViewById(R.id.imageView1);
    // mImageView111 = (ImageView) findViewById(R.id.imageView111);
    // mImageView1.setOnClickListener(this);
    // mLinearLayout1 = (LinearLayout) findViewById(R.id.linearLayoutLog);
    // mLinearLayout2 = (LinearLayout) findViewById(R.id.linearLayoutImageProcess);
    // mLinearLayout3 = (LinearLayout) findViewById(R.id.LinearLayoutImageCapture);
    // mLinearLayout4 = (LinearLayout) findViewById(R.id.LinearLayoutSetting);

    /*addActionBarTab("Home"); // �쁾�븸��?�諛붿뿉 2媛쒖?�� �꺆 踰꾪?�� ?��붽�
    addActionBarTab("Log");
    addActionBarTab("Image");
    addActionBarTab("Capture");
    addActionBarTab("Setting");*/

    initializeSetting();
    initializeMainWork();
    initializeHandler();
    initializeSocket();
    initializeLog();
    initializeVideo();
    initializeCapture();

    Debug.getNativeHeapSize();
    Debug.getNativeHeapFreeSize();
    Debug.getNativeHeapAllocatedSize();

    ///////////////////////////////////
    // CONNECTION_SERVER = true;
    // CONNECTION_USER = true;
    // mVideo.setUri("rtsp://172.30.99.9:8080/application.sdp");

  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView: ");
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    View view = inflater.inflate(R.layout.mdtp_date_picker_dialog, null);

    tabHost = (TabHost) view.findViewById(R.id.tabHost);
    tabHost.findViewById(R.id.tabHost);
    tabHost.setup();
    TabHost.TabSpec startDatePage = tabHost.newTabSpec("start");
    startDatePage.setContent(R.id.start_date_group);
    startDatePage.setIndicator("FROM");

    TabHost.TabSpec endDatePage = tabHost.newTabSpec("end");
    endDatePage.setContent(R.id.end_date_group);
    endDatePage.setIndicator("TO");

    tabHost.addTab(startDatePage);
    tabHost.addTab(endDatePage);

    mDayOfWeekView = (TextView) view.findViewById(R.id.date_picker_header);
    mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day);
    mMonthAndDayViewEnd = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day_end);
    mMonthAndDayView.setOnClickListener(this);
    mMonthAndDayViewEnd.setOnClickListener(this);

    mSelectedMonthTextView = (TextView) view.findViewById(R.id.date_picker_month);
    mSelectedMonthTextViewEnd = (TextView) view.findViewById(R.id.date_picker_month_end);

    mSelectedDayTextView = (TextView) view.findViewById(R.id.date_picker_day);
    mSelectedDayTextViewEnd = (TextView) view.findViewById(R.id.date_picker_day_end);

    mYearView = (TextView) view.findViewById(R.id.date_picker_year);
    mYearViewEnd = (TextView) view.findViewById(R.id.date_picker_year_end);
    mYearView.setOnClickListener(this);
    mYearViewEnd.setOnClickListener(this);

    int listPosition = -1;
    int listPositionOffset = 0;
    int listPositionEnd = -1;
    int listPositionOffsetEnd = 0;
    int currentView = MONTH_AND_DAY_VIEW;
    int currentViewEnd = MONTH_AND_DAY_VIEW;
    if (savedInstanceState != null) {
      mWeekStart = savedInstanceState.getInt(KEY_WEEK_START);
      mWeekStartEnd = savedInstanceState.getInt(KEY_WEEK_START_END);
      mMinYear = savedInstanceState.getInt(KEY_YEAR_START);
      mMaxYear = savedInstanceState.getInt(KEY_YEAR_END);
      currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW);
      currentViewEnd = savedInstanceState.getInt(KEY_CURRENT_VIEW_END);
      listPosition = savedInstanceState.getInt(KEY_LIST_POSITION);
      listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET);
      listPositionEnd = savedInstanceState.getInt(KEY_LIST_POSITION_END);
      listPositionOffsetEnd = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET_END);
      mMinDate = (Calendar) savedInstanceState.getSerializable(KEY_MIN_DATE);
      mMaxDate = (Calendar) savedInstanceState.getSerializable(KEY_MAX_DATE);
      mMinDateEnd = (Calendar) savedInstanceState.getSerializable(KEY_MIN_DATE_END);
      mMaxDateEnd = (Calendar) savedInstanceState.getSerializable(KEY_MAX_DATE_END);
      highlightedDays = (Calendar[]) savedInstanceState.getSerializable(KEY_HIGHLIGHTED_DAYS);
      selectableDays = (Calendar[]) savedInstanceState.getSerializable(KEY_SELECTABLE_DAYS);
      highlightedDaysEnd =
          (Calendar[]) savedInstanceState.getSerializable(KEY_HIGHLIGHTED_DAYS_END);
      selectableDaysEnd = (Calendar[]) savedInstanceState.getSerializable(KEY_SELECTABLE_DAYS_END);
      mThemeDark = savedInstanceState.getBoolean(KEY_THEME_DARK);
      mAccentColor = savedInstanceState.getInt(KEY_ACCENT);
      mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE);
      mDismissOnPause = savedInstanceState.getBoolean(KEY_DISMISS);
    }

    final Activity activity = getActivity();
    mDayPickerView =
        new com.borax12.materialdaterangepicker.date.SimpleDayPickerView(activity, this);
    mYearPickerView = new com.borax12.materialdaterangepicker.date.YearPickerView(activity, this);
    mDayPickerViewEnd =
        new com.borax12.materialdaterangepicker.date.SimpleDayPickerView(activity, this);
    mYearPickerViewEnd =
        new com.borax12.materialdaterangepicker.date.YearPickerView(activity, this);

    Resources res = getResources();
    mDayPickerDescription = res.getString(R.string.mdtp_day_picker_description);
    mSelectDay = res.getString(R.string.mdtp_select_day);
    mYearPickerDescription = res.getString(R.string.mdtp_year_picker_description);
    mSelectYear = res.getString(R.string.mdtp_select_year);

    int bgColorResource =
        mThemeDark
            ? R.color.mdtp_date_picker_view_animator_dark_theme
            : R.color.mdtp_date_picker_view_animator;
    view.setBackgroundColor(activity.getResources().getColor(bgColorResource));

    mAnimator =
        (com.borax12.materialdaterangepicker.date.AccessibleDateAnimator)
            view.findViewById(R.id.animator);
    mAnimatorEnd =
        (com.borax12.materialdaterangepicker.date.AccessibleDateAnimator)
            view.findViewById(R.id.animator_end);

    mAnimator.addView(mDayPickerView);
    mAnimator.addView(mYearPickerView);
    mAnimator.setDateMillis(mCalendar.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(ANIMATION_DURATION);
    mAnimator.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2 = new AlphaAnimation(1.0f, 0.0f);
    animation2.setDuration(ANIMATION_DURATION);
    mAnimator.setOutAnimation(animation2);

    mAnimatorEnd.addView(mDayPickerViewEnd);
    mAnimatorEnd.addView(mYearPickerViewEnd);
    mAnimatorEnd.setDateMillis(mCalendarEnd.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animationEnd = new AlphaAnimation(0.0f, 1.0f);
    animationEnd.setDuration(ANIMATION_DURATION);
    mAnimatorEnd.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2End = new AlphaAnimation(1.0f, 0.0f);
    animation2End.setDuration(ANIMATION_DURATION);
    mAnimatorEnd.setOutAnimation(animation2);

    Button okButton = (Button) view.findViewById(R.id.ok);
    okButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            tryVibrate();
            if (mCallBack != null) {
              mCallBack.onDateSet(
                  DatePickerDialog.this,
                  mCalendar.get(Calendar.YEAR),
                  mCalendar.get(Calendar.MONTH),
                  mCalendar.get(Calendar.DAY_OF_MONTH),
                  mCalendarEnd.get(Calendar.YEAR),
                  mCalendarEnd.get(Calendar.MONTH),
                  mCalendarEnd.get(Calendar.DAY_OF_MONTH));
            }
            dismiss();
          }
        });
    okButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium"));

    Button cancelButton = (Button) view.findViewById(R.id.cancel);
    cancelButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            tryVibrate();
            if (getDialog() != null) getDialog().cancel();
          }
        });
    cancelButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium"));
    cancelButton.setVisibility(isCancelable() ? View.VISIBLE : View.GONE);

    // If an accent color has not been set manually, try and get it from the context
    if (mAccentColor == -1) {
      int accentColor = Utils.getAccentColorFromThemeIfAvailable(getActivity());
      if (accentColor != -1) {
        mAccentColor = accentColor;
      }
    }
    if (mAccentColor != -1) {
      if (mDayOfWeekView != null)
        mDayOfWeekView.setBackgroundColor(Utils.darkenColor(mAccentColor));
      view.findViewById(R.id.day_picker_selected_date_layout).setBackgroundColor(mAccentColor);
      view.findViewById(R.id.day_picker_selected_date_layout_end).setBackgroundColor(mAccentColor);
      okButton.setTextColor(mAccentColor);
      cancelButton.setTextColor(mAccentColor);
      mYearPickerView.setAccentColor(mAccentColor);
      mDayPickerView.setAccentColor(mAccentColor);
      mYearPickerViewEnd.setAccentColor(mAccentColor);
      mDayPickerViewEnd.setAccentColor(mAccentColor);
    }

    updateDisplay(false);
    setCurrentView(currentView);

    if (listPosition != -1) {
      if (currentView == MONTH_AND_DAY_VIEW) {
        mDayPickerView.postSetSelection(listPosition);
      } else if (currentView == YEAR_VIEW) {
        mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset);
      }
    }

    if (listPositionEnd != -1) {
      if (currentViewEnd == MONTH_AND_DAY_VIEW) {
        mDayPickerViewEnd.postSetSelection(listPositionEnd);
      } else if (currentViewEnd == YEAR_VIEW) {
        mYearPickerViewEnd.postSetSelectionFromTop(listPositionEnd, listPositionOffsetEnd);
      }
    }

    mHapticFeedbackController = new HapticFeedbackController(activity);

    tabHost.setOnTabChangedListener(
        new TabHost.OnTabChangeListener() {
          @Override
          public void onTabChanged(String tabId) {
            com.borax12.materialdaterangepicker.date.MonthAdapter.CalendarDay calendarDay;
            if (tabId == "start") {
              calendarDay =
                  new com.borax12.materialdaterangepicker.date.MonthAdapter.CalendarDay(
                      mCalendar.getTimeInMillis());
              mDayPickerView.goTo(calendarDay, true, true, false);
            } else {
              calendarDay =
                  new com.borax12.materialdaterangepicker.date.MonthAdapter.CalendarDay(
                      mCalendarEnd.getTimeInMillis());
              mDayPickerViewEnd.goTo(calendarDay, true, true, false);
            }
          }
        });
    return view;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mainapp);

    TableLayout t1 = (TableLayout) findViewById(R.id.tableLayout1);
    TableLayout t2 = (TableLayout) findViewById(R.id.tableLayout2);
    TableLayout t3 = (TableLayout) findViewById(R.id.tableLayout3);

    t1.setVisibility(View.GONE);
    t2.setVisibility(View.GONE);
    t3.setVisibility(View.GONE);

    TabHost tabs = (TabHost) findViewById(R.id.TabHost01);

    tabs.setup();

    TabHost.TabSpec spec1 = tabs.newTabSpec("tag1");

    spec1.setContent(R.id.myPlacesList);
    spec1.setIndicator(
        getString(R.string.maTabPlaces),
        getResources().getDrawable(android.R.drawable.ic_menu_mylocation));

    tabs.addTab(spec1);

    TabHost.TabSpec spec2 = tabs.newTabSpec("tag2");
    spec2.setContent(R.id.myRoutesList);
    spec2.setIndicator(
        getString(R.string.maTabRoutes),
        getResources().getDrawable(android.R.drawable.ic_menu_myplaces));

    tabs.addTab(spec2);

    myPlaces = (ListView) findViewById(R.id.myPlacesList);
    myRoutes = (ListView) findViewById(R.id.myRoutesList);

    history = History.getHistory(this);
    routes = History.getRoutes(this);
    historyAdapter = new History.HistoryAdapter(this);
    routesAdapter = new History.RoutesAdapter(this);
    myPlaces.setAdapter(historyAdapter);
    myRoutes.setAdapter(routesAdapter);
    Utils.setListViewHeightBasedOnChildren((ListView) findViewById(R.id.myPlacesList));
    Utils.setListViewHeightBasedOnChildren((ListView) findViewById(R.id.myRoutesList));

    myPlaces.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            HistoryItem h = history.get(arg2);

            String str = h.address;
            if (!h.name.equals("")) str = h.name;

            createShortcut(str, null, h.address);
          }
        });

    myRoutes.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            RouteHistoryItem r = routes.get(arg2);
            String n1 = r.start.substring(0, 5);
            if (r.start.length() > 0) n1 += ".";
            String n2 = r.end; // .substring(0, 5); if (r.end.length() > 0) n2 +=".";
            Utils.addHomeScreenShortcut(
                ShortcutActivity.this, n1 + "-" + n2, r.start, r.end, r.coords, r.coords2);
          }
        });
  }