/**
   * ***************************************************
   *
   * <p>Called with the current top-most fragment.
   *
   * <p>***************************************************
   */
  protected void onNotifyTop(AKiteFragment topFragment) {
    ActionBar actionBar = getActionBar();

    // Determine which fragment is top-most

    String tag = topFragment.getTag();

    if (tag != null && tag.equals(ChooseProductGroupFragment.TAG)) {
      ///// Home page /////

      // We only enable the menu on the home page
      mDrawerToggle.setDrawerIndicatorEnabled(true);
      mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);

      // We display the logo on the home page
      actionBar.setDisplayShowTitleEnabled(false);
      actionBar.setDisplayShowCustomEnabled(true);
    } else {
      mDrawerToggle.setDrawerIndicatorEnabled(false);
      mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

      // On other pages we show a title
      actionBar.setDisplayShowTitleEnabled(true);
      actionBar.setDisplayShowCustomEnabled(false);
    }

    super.onNotifyTop(topFragment);
  }
  public void onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(
        menu); // REMOVE THE THREE DOT ICON FROM THE ACTIONBAR, SINCE IT IS NOT NEEDED FOR NOW
    MenuItem item = menu.findItem(R.id.action_settings);
    item.setVisible(false);
    // INFLATE CUSTOM ACTIONBAR
    ActionBar ab = getActivity().getActionBar();
    ab.setDisplayShowTitleEnabled(false);
    ab.setDisplayShowCustomEnabled(true);
    ab.setDisplayShowHomeEnabled(false);
    View customActionView =
        getActivity().getLayoutInflater().inflate(R.layout.actionbar_custom_layout, null);
    ab.setCustomView(customActionView);

    // ADD A LISTENER TO THE VIEWS IN THE CUSTOM ACTION BAR LAYOUT
    acbar_cancel_button = (LinearLayout) customActionView.findViewById(R.id.custom_ab_cancel);
    acbar_save_button = (LinearLayout) customActionView.findViewById(R.id.custom_ab_done);

    acbar_cancel_button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            getActivity().onBackPressed();
          }
        });

    acbar_save_button.setOnClickListener(new SaveTaskListener());
  }
Exemplo n.º 3
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_layout_one, container, false);

    ActionBar actionBar = getActivity().getActionBar();

    // Screen handling while hiding ActionBar icon.
    actionBar.setDisplayShowHomeEnabled(true);

    // Screen handling while hiding Actionbar title.
    actionBar.setDisplayShowTitleEnabled(true);

    // Creating ActionBar tabs.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);

    ivIcon = (ImageView) view.findViewById(R.id.frag1_icon);
    tvItemName = (TextView) view.findViewById(R.id.frag1_text);

    tvItemName.setText(getArguments().getString(ITEM_NAME));
    ivIcon.setImageDrawable(
        view.getResources().getDrawable(getArguments().getInt(IMAGE_RESOURCE_ID)));
    return view;
  }
Exemplo n.º 4
0
  private void initActionBar() {
    bar.setTitle("Login");
    bar.setDisplayShowHomeEnabled(false);
    bar.setDisplayShowTitleEnabled(false);

    LayoutInflater mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View mCustomView = mInflater.inflate(R.layout.custom_action_bar, null);
    ActionBar.LayoutParams params =
        new ActionBar.LayoutParams(
            ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT);
    mCustomView.setLayoutParams(params);
    bar.setCustomView(mCustomView);

    actionBarText = (TextView) mCustomView.findViewById(R.id.nameOfScreen);

    actionBarText.setText("Login");

    back = (Button) mCustomView.findViewById(R.id.back); //
    back.setVisibility(View.INVISIBLE);
    back.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            /*Log.e("DEMO", "clicked");
            //removeCurrentFragment();

            actionBarText.setText("Login");
            //isSignUpEnabled = false;
            back.setVisibility(View.INVISIBLE);
            */
          }
        });
    bar.setDisplayShowCustomEnabled(true);
  }
Exemplo n.º 5
0
 private void setUpActionBar() {
   ActionBar actionBar = getActivity().getActionBar();
   previousActionBarTitle = ProjectManager.getInstance().getCurrentSprite().getName();
   actionBar.setDisplayShowTitleEnabled(true);
   actionBar.setDisplayHomeAsUpEnabled(true);
   actionBar.setTitle(R.string.formula_editor_title);
 }
Exemplo n.º 6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar ab = getActionBar();
    ab.setDisplayUseLogoEnabled(true);
    ab.setDisplayShowTitleEnabled(false);
    setContentView(R.layout.activity_main);

    table = Table.getInstance(this);
    List<User> users = (List<User>) table.users.select("usr_logged_in='1'");
    if (users.isEmpty()) {
      Intent intent = new Intent(this, AccountManagement.class);
      startActivity(intent);
    }

    user = users.get(0);

    tasks = table.tasks.select("task_username='******'");
    listView = (ListView) findViewById(R.id.list_view_tasks);

    taskArrayAdapter = new TaskArrayAdapter(this, R.layout.task, tasks);

    // listView.setClickable(true);
    // listView.setItemsCanFocus(true);
    // listView.setOnItemClickListener(clickOnTask);
    // listTasks.setOnItemLongClickListener(editOnTask);
    listView.setAdapter(taskArrayAdapter);

    taskArrayAdapter.notifyDataSetChanged();
  }
Exemplo n.º 7
0
  private void intiActionTab() {
    actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    tab_top = actionBar.newTab().setText("头条");
    tab_cyclopedia = actionBar.newTab().setText("百科");
    tab_message = actionBar.newTab().setText("资讯");
    tab_manage = actionBar.newTab().setText("经营");
    tab_data = actionBar.newTab().setText("数据");

    tab_top.setTabListener(this);
    tab_cyclopedia.setTabListener(this);
    tab_message.setTabListener(this);
    tab_manage.setTabListener(this);
    tab_data.setTabListener(this);

    actionBar.addTab(tab_top);
    actionBar.addTab(tab_cyclopedia);
    actionBar.addTab(tab_message);
    actionBar.addTab(tab_manage);
    actionBar.addTab(tab_data);
  }
Exemplo n.º 8
0
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    that = this;

    final ActionBar actionBar = getActionBar();
    actionBar.setCustomView(R.layout.actionbar_profiler_audio);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.color.black));

    if (savedInstanceState == null) {
      Bundle extras = getIntent().getExtras();
      imageUrl = extras.getString("image_url");
      profileName = extras.getString("profile_name");
      identityProfileId = extras.getString("identity_profile_id");
      firstName = extras.getString("first_name");
      lastName = extras.getString("last_name");
      userIdentityProfileId = extras.getString("user_identity_profile_id");
      useDefault = extras.getBoolean("use_default");
    }

    Bundle extras = getIntent().getExtras();
    audioFileName = extras.getStringArray("audio_file_name");
    fileName = extras.getStringArray("file_name");
    fileLocation = extras.getStringArray("file_location");
    audioDescription = extras.getStringArray("audio_description");

    setListAdapter(new ProfilerAudioAdapter(this, audioFileName, fileName, audioDescription));
  }
Exemplo n.º 9
0
 public void restoreActionBar() {
   ActionBar actionBar = getActionBar();
   actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
   actionBar.setDisplayShowTitleEnabled(true);
   actionBar.setDisplayShowCustomEnabled(false);
   actionBar.setTitle(mTitle);
 }
Exemplo n.º 10
0
  private void setupActionBar() {
    ActionBar actionBar = getActionBar();

    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setHomeButtonEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(false);

    LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View actionBarCustomView = inflator.inflate(R.layout.white_action_bar, null);
    actionBarCustomView.findViewById(R.id.home_icon_container).setVisibility(View.VISIBLE);
    actionBar.setCustomView(actionBarCustomView);

    SpannableString s = new SpannableString(getString(R.string.redeem));
    s.setSpan(
        new TypefaceSpan(
            getApplicationContext(),
            CommonLib.BOLD_FONT_FILENAME,
            getResources().getColor(R.color.white),
            getResources().getDimension(R.dimen.size16)),
        0,
        s.length(),
        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    TextView title = (TextView) actionBarCustomView.findViewById(R.id.title);

    ((RelativeLayout.LayoutParams)
            actionBarCustomView.findViewById(R.id.back_icon).getLayoutParams())
        .setMargins(width / 40, 0, 0, 0);
    actionBarCustomView.findViewById(R.id.title).setPadding(width / 20, 0, width / 40, 0);
    title.setText(s);
  }
Exemplo n.º 11
0
 public void restoreActionBar() {
   ActionBar actionBar = getActionBar();
   actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
   actionBar.setDisplayShowTitleEnabled(true);
   actionBar.setTitle(mTitle);
   actionBar.setIcon(R.drawable.actionbar_logo);
 }
Exemplo n.º 12
0
 private void customizeActionbar() {
   mActionBar = getActionBar();
   if (mActionBar != null) {
     mActionBarView =
         (FrameLayout) getLayoutInflater().inflate(R.layout.base_actionbar_view, null);
     mActionBarView
         .findViewById(R.id.ic_back)
         .setOnClickListener(
             new View.OnClickListener() {
               @Override
               public void onClick(View arg0) {
                 onBackPressed();
               }
             });
     TextView title = (TextView) mActionBarView.findViewById(R.id.ab_title);
     title.setText("基本设置");
     mActionBar.setCustomView(
         mActionBarView,
         new ActionBar.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
     mActionBar.setDisplayShowCustomEnabled(true);
     mActionBar.setDisplayShowHomeEnabled(false);
     mActionBar.setDisplayShowTitleEnabled(false);
   }
 }
Exemplo n.º 13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the action bar to show a dropdown list.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    final String[] dropdownValues = getResources().getStringArray(R.array.dropdown);

    // Specify a SpinnerAdapter to populate the dropdown list.
    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(
            actionBar.getThemedContext(),
            android.R.layout.simple_spinner_item,
            android.R.id.text1,
            dropdownValues);

    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    // Set up the dropdown list navigation in the action bar.
    actionBar.setListNavigationCallbacks(adapter, this);

    // use getActionBar().getThemedContext() to ensure
    // that the text color is always appropriate for the action bar
    // background rather than the activity background.
  }
Exemplo n.º 14
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    overridePendingTransition(R.anim.fadein, R.anim.fadeout);

    // ....................................
    // Load state of filter from Bundle
    if (savedInstanceState != null) {
      mSeriesFilter = savedInstanceState.getString("mSeriesFilter");
      mFilterMode = savedInstanceState.getInt("mFilterMode");
      if (mSeriesFilter == null) mSeriesFilter = ""; // if no filter found
    } else {
      // if no state, load in default pref.
      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
      String tmp = prefs.getString("libraryFilter", "0");
      this.mFilterMode = Integer.parseInt(tmp);
    } // if

    // ....................................
    mThumbPath =
        Environment.getExternalStorageDirectory().getAbsolutePath() + "/OpenComicReader/thumbs/";
    mSpinAdapter =
        new ArrayAdapter<String>(
            this,
            android.R.layout.simple_spinner_dropdown_item,
            this.getResources().getStringArray(R.array.libraryFilter));

    // ....................................
    // Setup Actionbar
    ActionBar mActionBar = this.getActionBar();
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    mActionBar.setDisplayShowTitleEnabled(false);
    mActionBar.setListNavigationCallbacks(mSpinAdapter, this);
    mActionBar.setSelectedNavigationItem(mFilterMode);
    mActionBar.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_HOME);
    mActionBar.setCustomView(R.layout.activity_main_actionbar);
    mCountLbl = (TextView) mActionBar.getCustomView().findViewById(R.id.lblCount);
    mSeriesLbl = (TextView) mActionBar.getCustomView().findViewById(R.id.lblSeries);

    // ....................................
    // Setup Main View Area
    mAdapter = new SqlCursorAdapter(this);
    mAdapter.setItemLayout(R.layout.listitem_main);

    mGridView = (GridView) findViewById(R.id.lvMain);
    mGridView.setAdapter(mAdapter);
    mGridView.setOnItemClickListener(this);

    registerForContextMenu(mGridView); // Route event from Activity to View

    // ....................................
    // Start DB and Data Loader
    mDb = new Sqlite(this);
    mDb.openRead();

    getSupportLoaderManager().initLoader(0, null, this);
  } // func
Exemplo n.º 15
0
 private void handleSetTitle(String title) {
   if (actionBar != null) {
     actionBar.setDisplayShowTitleEnabled(true);
     actionBar.setTitle(title);
   } else {
     Log.w(TAG, "ActionBar is not enabled");
   }
 }
Exemplo n.º 16
0
 private void initActionBar() {
   actionBar = getActionBar();
   actionBar.setDisplayHomeAsUpEnabled(true);
   actionBar.setDisplayShowHomeEnabled(false);
   actionBar.setDisplayShowTitleEnabled(true);
   actionBar.setDisplayShowCustomEnabled(false);
   actionBar.setTitle(getString(R.string.save));
 }
Exemplo n.º 17
0
 public void restoreActionBar() {
   mNavigationDrawerFragment.setUp(
       R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout_like));
   ActionBar actionBar = getActionBar();
   actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
   actionBar.setDisplayShowTitleEnabled(true);
   actionBar.setTitle(mTitle);
 }
Exemplo n.º 18
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_food);
   ActionBar actionbar = getActionBar();
   actionbar.setTitle("返回");
   actionbar.setDisplayShowTitleEnabled(true);
   actionbar.setDisplayHomeAsUpEnabled(true);
   init();
 }
Exemplo n.º 19
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.darkastle);
    setUpMapIfNeeded();

    ActionBar actionbar = getActionBar();
    actionbar.setDisplayShowTitleEnabled(false);
    actionbar.setDisplayHomeAsUpEnabled(true);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getActivity().getActionBar();
    LayoutInflater mInflater = LayoutInflater.from(getActivity());
    View mCustomView = mInflater.inflate(R.layout.custom_action_bar, null);

    TextView textTile = (TextView) mCustomView.findViewById(R.id.textTitle);

    imageIcon = (ImageView) mCustomView.findViewById(R.id.imageIcon);
    imageIcon.setVisibility(View.GONE);
    btnBack = (ImageView) mCustomView.findViewById(R.id.btnBack);
    btnGallery = (ImageView) mCustomView.findViewById(R.id.picture_icon);
    textTile.setText("Bali");
    actionBar.setCustomView(mCustomView);
    btnGallery.setVisibility(View.VISIBLE);
    btnBack.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            // onBackPressed();
            listener.onItemAttractionListMapPage(R.id.btnBack);
          }
        });
    btnGallery.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            if (maps) {
              btnGallery.setImageResource(R.drawable.pin_icon);
              maps = false;
              listView.setVisibility(View.VISIBLE);
              layoutMap.setVisibility(View.GONE);
              arcMenu.setVisibility(View.VISIBLE);
            } else {
              btnGallery.setImageResource(R.drawable.picture_icon);
              maps = true;
              listView.setVisibility(View.GONE);
              layoutMap.setVisibility(View.VISIBLE);
              arcMenu.setVisibility(View.GONE);
            }
          }
        });

    // actionBar.setBackgroundDrawable(new ColorDrawable(0x0065b3));
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
  }
Exemplo n.º 21
0
 protected void setupActionBar() {
   final ActionBar actionBar = getActionBar();
   if (actionBar == null) return;
   actionBar.setDisplayShowTitleEnabled(true);
   actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
   actionBar.setDisplayUseLogoEnabled(true);
   actionBar.setLogo(R.drawable.icon);
   actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg));
   actionBar.setDisplayHomeAsUpEnabled(true);
   actionBar.setHomeButtonEnabled(true);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (WordPress.wpDB == null) {
      Toast.makeText(this, R.string.fatal_db_error, Toast.LENGTH_LONG).show();
      finish();
      return;
    }

    if (savedInstanceState == null) {
      AnalyticsTracker.track(AnalyticsTracker.Stat.THEMES_ACCESSED_THEMES_BROWSER);
    }

    setTitle(R.string.themes);

    createMenuDrawer(R.layout.theme_browser_activity);

    mThemePagerAdapter = new ThemePagerAdapter(getSupportFragmentManager());

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
      actionBar.setDisplayShowTitleEnabled(true);
      actionBar.setHomeButtonEnabled(true);
    }

    mViewPager = (ViewPager) findViewById(R.id.theme_browser_pager);
    mViewPager.setAdapter(mThemePagerAdapter);
    mViewPager.setOnPageChangeListener(
        new ViewPager.SimpleOnPageChangeListener() {
          @Override
          public void onPageSelected(int position) {
            mTabView.setSelectedTab(position);
          }
        });

    mTabView = (HorizontalTabView) findViewById(R.id.horizontalTabView1);
    mTabView.setTabListener(this);

    int count = ThemeSortType.values().length;
    for (int i = 0; i < count; i++) {
      String title = ThemeSortType.values()[i].getTitle();

      mTabView.addTab(mTabView.newTab().setText(title));
    }
    mTabView.setSelectedTab(0);

    FragmentManager fm = getSupportFragmentManager();
    fm.addOnBackStackChangedListener(mOnBackStackChangedListener);
    setupBaseLayout();
    mPreviewFragment = (ThemePreviewFragment) fm.findFragmentByTag(ThemePreviewFragment.TAG);
    mDetailsFragment = (ThemeDetailsFragment) fm.findFragmentByTag(ThemeDetailsFragment.TAG);
    mSearchFragment = (ThemeSearchFragment) fm.findFragmentByTag(ThemeSearchFragment.TAG);
  }
Exemplo n.º 23
0
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   actionBar = getActionBar();
   actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
   actionBar.setDisplayShowTitleEnabled(false);
   initCartoDB();
   initTabs();
   initLocation();
 }
Exemplo n.º 24
0
 public static void setActionBarLayout(ActionBar actionBar, Context context, int layoutId) {
   if (null != actionBar) {
     actionBar.setDisplayShowHomeEnabled(false);
     actionBar.setDisplayShowCustomEnabled(true);
     actionBar.setDisplayShowTitleEnabled(false);
     LayoutInflater inflator = LayoutInflater.from(context);
     View v = inflator.inflate(layoutId, null);
     ActionBar.LayoutParams layout =
         new ActionBar.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
     actionBar.setCustomView(v, layout);
   }
 }
Exemplo n.º 25
0
 private void initActionBar() {
   actionBar = getActionBar();
   actionBar.setDisplayHomeAsUpEnabled(true);
   actionBar.setDisplayShowHomeEnabled(true);
   actionBar.setHomeButtonEnabled(true);
   actionBar.setDisplayShowTitleEnabled(false);
   actionBar.setDisplayShowCustomEnabled(true);
   View view = View.inflate(this, R.layout.actionbar_title, null);
   mActionBarTitle = (ShimmerTextView) view.findViewById(R.id.tv_shimmer);
   new Shimmer().start(mActionBarTitle);
   actionBar.setCustomView(view);
 }
Exemplo n.º 26
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    // initialize action bar
    actionBar = getActionBar();
    actionBar.setTitle("Login");
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayUseLogoEnabled(false);

    // initialize views and variables
    emailEditText = (RobotoLightEditText) findViewById(R.id.email_edit_text);
    passwordEditText = (RobotoLightEditText) findViewById(R.id.password_edit_text);
    loginButton = (RobotoRegularButton) findViewById(R.id.login_button);

    // on login button click
    loginButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {

            email = emailEditText.getText().toString();
            password = passwordEditText.getText().toString();

            // validation of email
            if (!TextUtils.isEmpty(email) && CommonUtil.validateEmail(email)) {
              appController.getPreferences().setSurveyData("");

              if (NetworkUtil.iSConnected(getApplicationContext()) == NetworkUtil.TYPE_CONNECTED) {
                progressDialog = new ProgressDialog(LoginActivity.this);
                progressDialog.setCancelable(false);
                progressDialog.setIndeterminate(true);
                progressDialog.setMessage("Logging in");
                progressDialog.show();

                appController.getPreferences().setUsername(email);
                appController.getPreferences().setPassword(password);

                new Login().execute();

              } else {
                appController.showToast("Please check your internet connection");
              }

            } else {
              appController.showToast("Enter Valid Email ");
            }
          }
        });
  }
Exemplo n.º 27
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login);
    actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setLogo(getResources().getDrawable(R.drawable.ic_back));

    username = (EditText) findViewById(R.id.login_username_edit);
    passwd = (EditText) findViewById(R.id.login_passwd_edit);
  }
  private static View initView(ActionBar actionBar, int viewId, OnClickListener onDone) {

    // Inflate a custom view and set a Done handler
    actionBar.setCustomView(viewId);
    View view = actionBar.getCustomView();
    view.findViewById(R.id.actionbar_done).setOnClickListener(onDone);

    // Show the custom action bar view and hide the normal Home icon and title.
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowCustomEnabled(true);
    return view;
  }
Exemplo n.º 29
0
  /**
   * Override this callback to initialize the {@link ActionBar} associated with this {@link
   * Activity}.
   *
   * @param actionBar the {@link ActionBar} intance to be initialized
   * @since 1.1.0
   */
  protected void onInitActionBar(ActionBar actionBar) {

    if (actionBar != null) {

      View header = getLayoutInflater().inflate(R.layout.action_view_title, null);
      ((TextView) header.findViewById(R.id.title)).setText(onInitTitle());
      ((TextView) header.findViewById(R.id.subtitle)).setText(onInitSubtitle());

      actionBar.setDisplayShowTitleEnabled(false);
      actionBar.setDisplayShowCustomEnabled(true);
      actionBar.setCustomView(header);
    }
  }
Exemplo n.º 30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Initilization
    setContentView(R.layout.activity_charts);
    viewPager = (ViewPager) findViewById(R.id.pager);
    actionBar = getActionBar();
    mAdapter = new TabsPagerAdapter(getSupportFragmentManager(), this);
    viewPager.setAdapter(mAdapter);
    viewPager.setOffscreenPageLimit(2);
    actionBar.setHomeButtonEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
    Bundle bundle;
    bundle = getIntent().getExtras();
    tabs = bundle.getStringArrayList("tabs");
    Intent intent = new Intent(this, TabsPagerAdapter.class);
    intent.putExtras(bundle);
    try {
      ViewConfiguration config = ViewConfiguration.get(this);
      Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
      if (menuKeyField != null) {
        menuKeyField.setAccessible(true);
        menuKeyField.setBoolean(config, false);
      }
    } catch (Exception ex) {
      // Ignore
    }

    viewPager.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {

          @Override
          public void onPageSelected(int position) {
            // on changing the page
            // make respected tab selected
            // actionBar.setSelectedNavigationItem(position);
          }

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageScrollStateChanged(int arg0) {}
        });
    /*Intent recintent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "AndroidBite Voice Recognition...");
    startActivityForResult(recintent, 100);*/
  }