@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_thread_list);

    // Setup toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null && toolbar != null) {
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      toolbar.setNavigationOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              finish();
            }
          });
    }

    // Error Layout
    mErrorLayout = (RelativeLayout) findViewById(R.id.error_layout);
    if (mErrorLayout != null) {
      mErrorLayout.setVisibility(View.GONE);
    }
    mTvErrorMessage = (TextView) findViewById(R.id.error_message);
    mTvAction = (TextView) findViewById(R.id.action_text);
    if (mTvAction != null) {
      mTvAction.setVisibility(View.GONE);
    }

    // Get Extra information from intent
    getExtra();

    // UI references
    mRecyclerView = (RecyclerView) findViewById(R.id.detail_recycler_view);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.home_swipe_refresh_layout);
    if (toolbar != null) {
      toolbar.setOnClickListener(CustomOnClickListener.doubleClickToListTop(this, mRecyclerView));
    }
    setupRecyclerView();
    setupSwipeRefreshLayout();

    // FAB
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    if (fab != null) {
      fab.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              Intent intent = new Intent(ThreadListActivity.this, NewPostActivity.class);
              intent.putExtra(NewPostActivity.ACTION_TAG, NewPostActivity.ACTION_NEW_THREAD);
              intent.putExtra(NewPostActivity.NEW_THREAD_FID_TAG, mFid);
              startActivityForResult(intent, PostListActivity.REQUEST_NEW_REPLY);
            }
          });
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    if (Intent.ACTION_VIEW.equals(getIntent().getAction())
        || Intent.ACTION_SEND.equals(getIntent().getAction())
        || Intent.ACTION_SENDTO.equals(getIntent().getAction())
        || Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) {
      ActivityManager.getInstance().startNewTask(this);
    }
    super.onCreate(savedInstanceState);

    if (isFinishing()) {
      return;
    }

    setContentView(R.layout.contact_list);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setOnClickListener(this);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerToggle =
        new ActionBarDrawerToggle(
            this,
            drawerLayout,
            toolbar,
            R.string.application_title_short,
            R.string.application_title_short);
    drawerLayout.setDrawerListener(drawerToggle);

    toolbar.inflateMenu(R.menu.contact_list);
    optionsMenu = toolbar.getMenu();
    setUpSearchView(optionsMenu);
    toolbar.setOnMenuItemClickListener(this);

    barPainter = new BarPainter(this, toolbar);
    barPainter.setDefaultColor();

    toolbar.setTitle(R.string.application_title_full);

    if (savedInstanceState != null) {
      sendText = savedInstanceState.getString(SAVED_SEND_TEXT);
      action = savedInstanceState.getString(SAVED_ACTION);
    } else {
      getSupportFragmentManager()
          .beginTransaction()
          .add(R.id.container, new ContactListFragment(), CONTACT_LIST_TAG)
          .commit();

      sendText = null;
      action = getIntent().getAction();
    }
    getIntent().setAction(null);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
    setContentView(R.layout.motion_triggered_gloveset);

    color_presets = new ColorPresets(this);
    listview = (ListView) findViewById(R.id.preset_list);
    feedback = (TextView) findViewById(R.id.feedback);
    sensitivity = (SeekBar) findViewById(R.id.sensitivity_bar);
    sensitivity_feedback = (TextView) findViewById(R.id.sensitivity_feedback);
    sensitivity.setMax(250);
    sensitivity.setOnSeekBarChangeListener(
        new SeekBar.OnSeekBarChangeListener() {
          @Override
          public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            value = min - (i * step);
            sensitivity_feedback.setText(String.valueOf(value));
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {}
        });

    Intent intent = getIntent();
    hand = intent.getStringExtra("hand");

    presets = color_presets.getPresets();
    list_adapter = new PresetsListAdapter(this, presets);
    listview.setAdapter(list_adapter);
    clickListeners();

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i3 = new Intent(MotionTriggeredGlovesetActivity.this, MainActivity.class);
            startActivity(i3);
          }
        });
    setSupportActionBar(mToolbar);
  }
Пример #4
0
 public void setOnTitleClickListener(boolean enable) {
   if (enable) toolbar.setOnClickListener(noteTitleChangeOrFolderNameListener());
   else toolbar.setOnClickListener(null);
 }
Пример #5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_question);
    MobclickAgent.onEvent(this, Mob.Event_Open_Question);
    loadingView = (LoadingView) findViewById(R.id.question_progress_loading);
    loadingView.setReloadListener(this);
    progressBar = (ProgressBar) findViewById(R.id.question_loading);
    Toolbar toolbar = (Toolbar) findViewById(R.id.action_bar);
    setSupportActionBar(toolbar);
    toolbar.setOnClickListener(
        new View.OnClickListener() {

          boolean preparingToScrollToHead = false;

          @Override
          public void onClick(View v) {
            if (preparingToScrollToHead) {
              listView.setSelection(0);
            } else {
              preparingToScrollToHead = true;
              new Handler()
                  .postDelayed(
                      new Runnable() {
                        @Override
                        public void run() {
                          preparingToScrollToHead = false;
                        }
                      },
                      200);
            }
          }
        });
    View headView = findViewById(R.id.head_view);
    question = (Question) getIntent().getSerializableExtra(Consts.Extra_Question);
    notice_id = getIntent().getStringExtra(Consts.Extra_Notice_Id);
    listView = (LListView) findViewById(R.id.list_detail);
    adapter = new QuestionDetailAdapter(this);
    listView.setAdapter(adapter);

    listView.setCanPullToLoadMore(false);
    listView.setOnRefreshListener(this);
    listView.setOnItemClickListener(onItemClickListener);

    floatingActionsMenu = (FloatingActionsMenu) findViewById(R.id.layout_operation);
    FloatingActionButton replyButton = (FloatingActionButton) findViewById(R.id.button_reply);
    FloatingActionButton recomButton = (FloatingActionButton) findViewById(R.id.button_recommend);
    FloatingActionButton favorButton = (FloatingActionButton) findViewById(R.id.button_favor);

    replyButton.setOnClickListener(this);
    recomButton.setOnClickListener(this);
    favorButton.setOnClickListener(this);

    AutoHideUtil.applyListViewAutoHide(
        this,
        listView,
        headView,
        floatingActionsMenu,
        (int) getResources().getDimension(R.dimen.abc_action_bar_default_height_material));
    floatingActionsMenu.setVisibility(View.GONE);
    loadData(-1);
  }
Пример #6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getSupportActionBar().hide();

    setContentView(R.layout.activity_breeds_list);

    toolbarPanelLayout = (ToolbarPanelLayout) findViewById(R.id.sliding_down_toolbar_layout);

    final ImageButton menu_button = (ImageButton) findViewById(R.id.imageButton);
    final ImageButton home_button = (ImageButton) findViewById(R.id.homeButton);
    ImageButton searchButton = (ImageButton) findViewById(R.id.searchButton);
    final Toolbar toolbarView = (Toolbar) findViewById(R.id.toolbar);
    findViewById(R.id.panel)
        .setY(
            (float)
                getResources()
                    .getDimensionPixelSize(R.dimen.abc_action_bar_default_height_material));

    Category_name = getIntent().getExtras().getString("Category");
    final List<String> categories = getIntent().getStringArrayListExtra("Category_list");
    ListView Cat_list = (ListView) findViewById(R.id.cat_list);

    set_category_list(categories, Cat_list);

    Typeface font = Typeface.createFromAsset(getAssets(), "raleway.ttf");
    cat_tag = (TextView) findViewById(R.id.cat_tag);
    cat_tag.setText(Category_name);
    cat_tag.setTypeface(font);

    breeds_list = (ParallaxListView) findViewById(R.id.breed_list);
    breeds = getBreedsFromDb(Category_name);
    breeds_adapter = new breed_list_view_adapter(this);
    breeds_adapter.addAll(breeds);
    breeds_list.setAdapter(breeds_adapter);

    assert searchButton != null;
    searchButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent toSearch = new Intent(Breeds_list.this, search.class);
            startActivity(toSearch);
            overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
          }
        });

    breeds_list.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            Intent intent = new Intent(Breeds_list.this, CardsActivity.class);
            intent.putExtra("Category", Category_name);
            intent.putExtra("Breed", breeds_adapter.getItem(position));

            ActivityOptionsCompat options =
                ActivityOptionsCompat.makeSceneTransitionAnimation(
                    // the context of the activity
                    Breeds_list.this,
                    new Pair<View, String>(
                        view.findViewById(R.id.img), getString(R.string.transition_name_image)));

            ActivityCompat.startActivity(Breeds_list.this, intent, options.toBundle());
          }
        });

    assert home_button != null;
    home_button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(Breeds_list.this, Home_Activity.class);
            i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(i);
          }
        });

    assert Cat_list != null;
    Cat_list.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            if (cat_adapter.getItem(position).equals("Diet")) {
              Intent i = new Intent(Breeds_list.this, CardsActivity.class);
              i.putExtra("Category", cat_adapter.getItem(position));
              i.putExtra("Breed", cat_adapter.getItem(position));
              startActivity(i);
            } else {
              breeds.clear();
              breeds_adapter.clear();
              breeds = getBreedsFromDb(cat_adapter.getItem(position));
              breeds_adapter.addAll(breeds);

              Category_name = cat_adapter.getItem(position);
              breeds_list.setAdapter(breeds_adapter);

              toolbarPanelLayout.closePanel();
            }
          }
        });

    assert toolbarView != null;
    toolbarView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            if (isPanelOpen) toolbarPanelLayout.closePanel();
            if (!isPanelOpen) toolbarPanelLayout.openPanel();
          }
        });

    assert menu_button != null;
    menu_button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (isPanelOpen) toolbarPanelLayout.closePanel();
            if (!isPanelOpen) toolbarPanelLayout.openPanel();
          }
        });

    assert toolbarPanelLayout != null;
    toolbarPanelLayout.setToolbarPanelListener(
        new ToolbarPanelListener() {
          @Override
          public void onPanelOpened(Toolbar toolbar, View panelView) {

            cat_tag.setText("Categories");
            isPanelOpen = true;
          }

          @Override
          public void onPanelSlide(Toolbar toolbar, View panelView, float slideOffset) {

            toolbar.setY((float) 0.0);

            findViewById(R.id.cat_list).setAlpha(slideOffset);

            if (slideOffset < 0.5) {
              cat_tag.setText(Category_name);
              cat_tag.setAlpha(1 - slideOffset);
            }

            if (slideOffset >= 0.5) {
              cat_tag.setText("Categories");
              cat_tag.setAlpha(slideOffset);
            }

            if (slideOffset > 0.3 && !isPanelOpen) {
              menu_button_state = false;
              menu_button.setBackgroundResource(R.drawable.menu_to_arrow);
              ((AnimationDrawable) menu_button.getBackground()).start();
            }

            if (slideOffset < 0.7 && isPanelOpen) {
              menu_button_state = true;
              menu_button.setBackgroundResource(R.drawable.arrow_to_menu);
              ((AnimationDrawable) menu_button.getBackground()).start();
            }

            if (slideOffset == 0.0) onPanelClosed(toolbar, panelView);

            if (slideOffset == 1.0) onPanelOpened(toolbar, panelView);
          }

          @Override
          public void onPanelClosed(Toolbar toolbar, View panelView) {

            if (!menu_button_state) {
              menu_button.setBackgroundResource(R.drawable.arrow_to_menu);
              ((AnimationDrawable) menu_button.getBackground()).start();
              menu_button_state = true;
            }

            panelView.setY((float) -(panelView.getHeight() - toolbarView.getHeight()));
            cat_tag.setText(Category_name);
            cat_tag.setAlpha((float) 1.0);
            isPanelOpen = false;
          }
        });
  }