public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_forumeafc);
   final GlobalClass globalVariable = (GlobalClass) getApplicationContext();
   show1 = (TextView) findViewById(R.id.show2);
   show1.setText("Astro Medical Chart");
   back1 = (ImageButton) findViewById(R.id.back);
   back1.setOnClickListener(
       new View.OnClickListener() {
         public void onClick(View v) {
           if (globalVariable.getEmail() == null) {
             Intent intenthome = new Intent(getApplicationContext(), UserActivity.class);
             intenthome.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
             startActivity(intenthome);
           } else {
             Intent intenthome = new Intent(getApplicationContext(), MainActivity.class);
             intenthome.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
             startActivity(intenthome);
           }
         }
       });
   TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
   tabHost.getTabWidget().setDividerDrawable(null);
   TabHost.TabSpec firstTabSpec = tabHost.newTabSpec("tid1");
   TabHost.TabSpec secondTabSpec = tabHost.newTabSpec("tid1");
   TabHost.TabSpec thirdTabSpec = tabHost.newTabSpec("tid1");
   firstTabSpec.setIndicator("Inforamtion").setContent(new Intent(this, FirstTab.class));
   secondTabSpec
       .setIndicator("Query Form")
       .setContent(new Intent(this, AmcRequest1Activity.class));
   thirdTabSpec.setIndicator("Status").setContent(new Intent(this, ThirdTabAmc.class));
   tabHost.addTab(firstTabSpec);
   tabHost.addTab(secondTabSpec);
   tabHost.addTab(thirdTabSpec);
 }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    _context = getApplicationContext();

    Resources res = getResources();
    articlesHelper = ArticleTableHelper.getInstance(_context, this);
    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec1 = tabHost.newTabSpec("all_post");
    TabHost.TabSpec spec2 = tabHost.newTabSpec("new_post");

    flushConfirmDialog =
        new AlertDialog.Builder(this)
            .setTitle(R.string.alert)
            .setMessage(R.string.flush_article_really)
            .setPositiveButton(R.string.yes, this)
            .setNegativeButton(R.string.no, this)
            .create();

    spec1
        .setIndicator(res.getString(R.string.all_post), res.getDrawable(R.drawable.all_post))
        .setContent(new Intent(_context, AllPostActivity.class));
    spec2
        .setIndicator(res.getString(R.string.new_post), res.getDrawable(R.drawable.new_post))
        .setContent(new Intent(_context, NewPostActivity.class));

    tabHost.addTab(spec1);
    tabHost.addTab(spec2);
    tabHost.setCurrentTab(0);
  }
Beispiel #3
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);
  }
 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);
   }
 }
  @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);
  }
  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);
  }
  @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")) {}
          }
        });
  }
Beispiel #8
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);
  }
  @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);
  }
Beispiel #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);
 }
 private void addTwitterTab()
 {
     android.widget.TabHost.TabSpec tabspec = mTabHost.newTabSpec("twitter");
     tabspec.setIndicator(getTabIndicator(0x7f0e0250, 0x7f09004c));
     Bundle bundle = new Bundle();
     bundle.putBoolean("from_sign_up", true);
     bundle.putInt("empty_desc", 0x7f0e00ef);
     mTabsAdapter.addTab(tabspec, co/vine/android/FindFriendsTwitterFragment, bundle);
 }
  @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);
  }
Beispiel #14
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);
  }
 private void addContactsTab()
 {
     android.widget.TabHost.TabSpec tabspec = mTabHost.newTabSpec("address");
     tabspec.setIndicator(getTabIndicator(0x7f0e008f, 0x7f09004a));
     Bundle bundle = new Bundle();
     if (mIsTwitterReg)
     {
         bundle.putBoolean("take_focus", false);
     }
     bundle.putInt("empty_desc", 0x7f0e00e1);
     mTabsAdapter.addTab(tabspec, co/vine/android/FindFriendsNUXAddressFragment, bundle);
 }
  @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);
  }
Beispiel #17
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);
  }
  @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);
  }
Beispiel #19
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //  1 初始化
    tabhost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    tabhost.setup(this, getSupportFragmentManager(), R.id.activity_home_container);

    // 2 新建 TabSpec
    TabHost.TabSpec spec = tabhost.newTabSpec(TAG_CHAT);
    spec.setIndicator("消息");

    // 3 添加 TabSpec
    tabhost.addTab(spec, MyFragment.class, null);
  }
  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);
  }
  @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);
  }
Beispiel #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);
  }
Beispiel #23
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);
  }
  @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);
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.user_friends_fragment_tabs, container, false);
    // +++++++++++++++++++++++++++++++
    tHost = (TabHost) rootView.findViewById(android.R.id.tabhost);
    tHost.setup();

    /** Defining Tab Change Listener event. This is invoked when tab is changed */
    TabHost.OnTabChangeListener tabChangeListener =
        new TabHost.OnTabChangeListener() {

          @Override
          public void onTabChanged(String tabId) {
            android.support.v4.app.FragmentManager fm = getActivity().getSupportFragmentManager();
            ExistingFriendFragment existingFriendsFragment =
                (ExistingFriendFragment) fm.findFragmentByTag("android");
            InviteFriend_Fragment allFreindsFragment =
                (InviteFriend_Fragment) fm.findFragmentByTag("apple");
            android.support.v4.app.FragmentTransaction ft = fm.beginTransaction();

            /** Detaches the existingFriendsFragment if exists */
            if (existingFriendsFragment != null) ft.detach(existingFriendsFragment);

            /** Detaches the allFreindsFragment if exists */
            if (allFreindsFragment != null) ft.detach(allFreindsFragment);

            /** If current tab is android */
            if (tabId.equalsIgnoreCase("android")) {

              if (existingFriendsFragment == null) {
                /** Create AndroidFragment and adding to fragmenttransaction */
                ft.add(R.id.realtabcontent, new ExistingFriendFragment(), "android");
              } else {
                /** Bring to the front, if already exists in the fragmenttransaction */
                ft.attach(existingFriendsFragment);
              }

            } else {
                /** If current tab is apple */
              if (allFreindsFragment == null) {
                /** Create ALLFreind and adding to fragmenttransaction */
                ft.add(R.id.realtabcontent, new InviteFriend_Fragment(), "apple");
              } else {
                /** Bring to the front, if already exists in the fragmenttransaction */
                ft.attach(allFreindsFragment);
              }
            }
            ft.commit();
          }
        };

    /** Setting tabchangelistener for the tab */
    tHost.setOnTabChangedListener(tabChangeListener);

    /** Defining tab builder for FBoard Friends tab */
    TabHost.TabSpec tSpecAndroid = tHost.newTabSpec("android");
    tSpecAndroid.setIndicator(
        "FBoard Friends", getResources().getDrawable(R.drawable.friends_icon));
    tSpecAndroid.setContent(new DummyTabContent(getActivity().getBaseContext()));
    tHost.addTab(tSpecAndroid);

    /** Defining tab builder for All Freinds tab */
    TabHost.TabSpec tSpecApple = tHost.newTabSpec("apple");
    tSpecApple.setIndicator("All Freinds", getResources().getDrawable(R.drawable.invite_friend));
    tSpecApple.setContent(new DummyTabContent(getActivity().getBaseContext()));
    tHost.addTab(tSpecApple);

    for (int i = 0; i < tHost.getTabWidget().getChildCount(); i++) {
      /*View v = tHost.getTabWidget().getChildAt(i);
      			v.setBackgroundColor(getActivity().getResources().getColor(R.color.white));
      */
      TextView tv = (TextView) tHost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
      tv.setTextColor(getActivity().getResources().getColor(R.color.black));
    }

    return rootView;
  }
  @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;
  }
Beispiel #27
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 void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_post);

    if (Build.VERSION.SDK_INT >= 21) {
      getWindow().setStatusBarColor(Color.rgb(255, 168, 0));
    }
    networkService = AppController.getNetworkService(this);
    TextView ti = (TextView) findViewById(R.id.ti);
    ti.setText("게시글");
    ti.setPaintFlags(ti.getPaintFlags() | Paint.FAKE_BOLD_TEXT_FLAG);
    Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Cocogoose_trial.otf");
    ti.setTypeface(face);

    TabHost tabHost = (TabHost) findViewById(R.id.tab_host);
    tabHost.setup();
    final ArticlesAdapter adapter = new ArticlesAdapter();
    // Tab1 Setting
    TabHost.TabSpec tabSpec1 = tabHost.newTabSpec("Tab1");
    tabSpec1.setIndicator("관심게시물"); // Tab Subject
    tabSpec1.setContent(R.id.tab_view1); // Tab Content
    tabHost.addTab(tabSpec1);

    fv_post = (ListView) findViewById(R.id.fv_post);
    final Call<List<Article>> favorite_articles = networkService.favorite_articles();
    favorite_articles.enqueue(
        new Callback<List<Article>>() {
          @Override
          public void onResponse(Call<List<Article>> call, Response<List<Article>> response) {
            if (response.isSuccessful()) {
              List<Article> articles_temp = response.body();
              for (final Article article : articles_temp) {
                adapter.addItem(
                    article.getId(),
                    true,
                    article.getPhoto(),
                    article.getName(),
                    Integer.toString(article.getPrice()));
                fv_post.setAdapter(adapter);
              }
            }
          }

          @Override
          public void onFailure(Call<List<Article>> call, Throwable t) {
            Log.i("MyTag", "서버 onFailure 에러내용 : " + t.getMessage());
          }
        });
    // Tab2 Setting
    TabHost.TabSpec tabSpec2 = tabHost.newTabSpec("Tab2");
    tabSpec2.setIndicator("내 게시물"); // Tab Subject
    tabSpec2.setContent(R.id.tab_view2); // Tab Content
    tabHost.addTab(tabSpec2);
    my_post = (ListView) findViewById(R.id.my_post);
    // for(int i = 0; i < tabHost.getTabWidget().getChildCount(); i++){
    //    tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#FFC107"));
    // }

    // show First Tab Content
    tabHost.setCurrentTab(0);
  }
Beispiel #29
0
  @Override
  public void onCreate(Bundle saved) {
    super.onCreate(saved);
    setContentView(R.layout.layout_person_info);
    searcher = new TmdbQuery(getBaseContext());

    picture = (ImageView) findViewById(R.id.image_person_info);
    name = (TextView) findViewById(R.id.text_person_name);
    birth = (TextView) findViewById(R.id.text_person_birth);
    death = (TextView) findViewById(R.id.text_person_death);
    bio = (TextView) findViewById(R.id.text_person_bio);
    appearsIn = (ListView) findViewById(R.id.listview_credits);

    Bundle extras = getIntent().getExtras();
    personId = extras.getInt("id");
    person = searcher.getPersonById(personId);
    picture.setTag(person.getIdTag());
    ImageGetter imgGetter = new ImageGetter(getBaseContext());
    try {
      String url =
          getString(R.string.baseurl_images)
              + person.getMediumImage(getResources())
              + person.getImagePath();
      imgGetter.DisplayImage(url, picture, 1.2f);
    } catch (RejectedExecutionException e) {
      Log.d(tag, "async task queue full at the moment, imgGet rejected");
    }

    name.setText(person.getName());
    birth.setText(
        Html.fromHtml(
            "born: " + person.getBirthday() + "<br><i>in</i>: " + person.getBirthPlace()));
    String deathString = person.getDeathday();
    if (deathString.equals("")) ((ViewManager) death.getParent()).removeView(death);
    else {
      death.setText("died: " + deathString);
    }
    bio.setText(person.getBiography());

    TabHost creditTabHost = (TabHost) findViewById(R.id.tabhost_credits);
    creditTabHost.setup();

    TabHost.TabSpec appearsSpec = creditTabHost.newTabSpec(APPEARS_TAB);
    appearsSpec.setContent(appearsIn.getId());
    appearsSpec.setIndicator("appears in");

    TabHost.TabSpec directedSpec = creditTabHost.newTabSpec(DIRECTED_TAB);
    directedSpec.setContent(appearsIn.getId());
    directedSpec.setIndicator("directed");

    TabHost.TabSpec wroteSpec = creditTabHost.newTabSpec(WROTE_TAB);
    wroteSpec.setContent(appearsIn.getId());
    wroteSpec.setIndicator("wrote");

    TabHost.TabSpec producedSpec = creditTabHost.newTabSpec(PRODUCED_TAB);
    producedSpec.setContent(appearsIn.getId());
    producedSpec.setIndicator("produced");

    List<CastCredit> castCredits = searcher.getCastCreditsByPersonId(personId);
    appearsIn.setAdapter(
        new ResultListAdapter(
            getBaseContext(), R.layout.list_item_movie_with_picture, castCredits));

    creditTabHost.addTab(appearsSpec);
    creditTabHost.addTab(directedSpec);
    creditTabHost.addTab(wroteSpec);
    creditTabHost.addTab(producedSpec);

    //        List<CrewCredit> crewCredits = searcher.getCrewCreditsByPersonId(personId);
    //
    //        List<CrewCredit> directed = new ArrayList<CrewCredit>();
    //        List<CrewCredit> wrote = new ArrayList<CrewCredit>();
    //        List<CrewCredit> produced = new ArrayList<CrewCredit>();
    //        for (CrewCredit credit : crewCredits) {
    //            if (credit.getDepartment().equals("Directing"))
    //                directed.add(credit);
    //            else if (credit.getDepartment().equals("Writing"))
    //                wrote.add(credit);
    //            else if (credit.getDepartment().equals("Production"))
    //                produced.add(credit);
    //        }
    appearsIn.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            Intent infoActivity = new Intent(getBaseContext(), MovieInfoActivity.class);
            infoActivity.putExtra("id", (Integer) view.getTag());
            infoActivity.putExtra("listItemId", R.layout.list_item_movie_with_picture);
            infoActivity.putExtra("infoClass", MovieInfoActivity.class);
            startActivity(infoActivity);
          }
        });
    creditTabHost.setOnTabChangedListener(
        new TabHost.OnTabChangeListener() {
          @Override
          public void onTabChanged(String s) {
            if (s.equals(APPEARS_TAB)) {
              List<CastCredit> castCredits = searcher.getCastCreditsByPersonId(personId);
              appearsIn.setAdapter(
                  new ResultListAdapter(
                      getBaseContext(), R.layout.list_item_movie_with_picture, castCredits));
            } else if (s.equals(DIRECTED_TAB)) {
              List<CrewCredit> crewCredits = searcher.getCrewCreditsByPersonId(personId);

              List<CrewCredit> directed = new ArrayList<CrewCredit>();
              for (CrewCredit credit : crewCredits) {
                if (credit.getDepartment().equals("Directing")) directed.add(credit);
              }
              appearsIn.setAdapter(
                  new ResultListAdapter(
                      getBaseContext(), R.layout.list_item_movie_with_picture, directed));
            } else if (s.equals(WROTE_TAB)) {
              List<CrewCredit> crewCredits = searcher.getCrewCreditsByPersonId(personId);

              List<CrewCredit> wrote = new ArrayList<CrewCredit>();
              for (CrewCredit credit : crewCredits) {
                if (credit.getDepartment().equals("Writing")) wrote.add(credit);
              }
              appearsIn.setAdapter(
                  new ResultListAdapter(
                      getBaseContext(), R.layout.list_item_movie_with_picture, wrote));
            } else if (s.equals(PRODUCED_TAB)) {
              List<CrewCredit> crewCredits = searcher.getCrewCreditsByPersonId(personId);

              List<CrewCredit> produced = new ArrayList<CrewCredit>();
              for (CrewCredit credit : crewCredits) {
                if (credit.getDepartment().equals("Production")) produced.add(credit);
              }
              appearsIn.setAdapter(
                  new ResultListAdapter(
                      getBaseContext(), R.layout.list_item_movie_with_picture, produced));
            }
          }
        });
    creditTabHost.setCurrentTab(0);
  }
Beispiel #30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    nameTxt = (EditText) findViewById(R.id.txtName);
    phoneTxt = (EditText) findViewById(R.id.txtPhone);
    emailTxt = (EditText) findViewById(R.id.txtEmail);
    addressTxt = (EditText) findViewById(R.id.txtAddress);
    contactListView = (ListView) findViewById(R.id.listView);
    contactImageImgView = (ImageView) findViewById(R.id.imgViewContactImage);

    TabHost tabHost = (TabHost) findViewById(R.id.tabHost);

    tabHost.setup();

    TabHost.TabSpec tabSpec = tabHost.newTabSpec("creator");
    tabSpec.setContent(R.id.tabCreator);
    tabSpec.setIndicator("Creator");
    tabHost.addTab(tabSpec);

    tabSpec = tabHost.newTabSpec("list");
    tabSpec.setContent(R.id.tabContactList);
    tabSpec.setIndicator("List");
    tabHost.addTab(tabSpec);

    final Button addBtn = (Button) findViewById(R.id.btnAdd);
    addBtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Contacts.add(
                new Contact(
                    nameTxt.getText().toString(),
                    phoneTxt.getText().toString(),
                    emailTxt.getText().toString(),
                    addressTxt.getText().toString(),
                    imageURI));
            populateList();
            Toast.makeText(
                    getApplicationContext(),
                    nameTxt.getText().toString() + " has been added to your Contacts!",
                    Toast.LENGTH_SHORT)
                .show();
          }
        });

    nameTxt.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {}

          // habilitar o botao se o valor do campo for diferente de vazio
          @Override
          public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            addBtn.setEnabled(
                !nameTxt
                    .getText()
                    .toString()
                    .trim()
                    .isEmpty()); // trim para "cortar os espaços em branco"
          }

          @Override
          public void afterTextChanged(Editable editable) {}
        });

    contactImageImgView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            startActivityForResult(Intent.createChooser(intent, "Select Contact Image"), 1);
          }
        });

    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
    client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
    sharedPreferences = getPreferences(Context.MODE_PRIVATE);
  }