Tabnine Logo
CalcActivity
Code IndexAdd Tabnine to your IDE (free)

How to use
CalcActivity
in
com.llamacorp.equate.view

Best Java code snippets using com.llamacorp.equate.view.CalcActivity (Showing top 13 results out of 315)

origin: EvanRespaut/Equate

  public void onClick(DialogInterface dialog, int which) {
    // The 'which' argument contains the index position
    // of the selected item
    switch (which) {
      case 0:
        clearHistory();
        break;
      case 1:
        new AlertDialog.Builder(mAppContext)
             .setMessage(getText(R.string.reset_factory_msg))
             .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int which) {
                 resetCalculator();
               }})
             .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int which) {}})
             .show();
        break;
    }
  }
})
origin: EvanRespaut/Equate

/**
 * Grabs newest data from Calculator, updates the main display
 *
 * @param updateResult whether or not to update result
 */
public void updateScreen(boolean updateResult) {
  //no instant scroll for previous expression
  updateScreen(updateResult, false);
  //see if colored convert button should be not colored (if backspace or
  //clear were pressed, or if expression solved)
  if (!mCalc.isUnitSelected() && mUnitTypeViewPager != null)
    clearUnitSelection(mUnitTypeViewPager.getCurrentItem());
}
origin: EvanRespaut/Equate

       getString(R.string.find_unit),
       mIdlingResource,
       new AdapterView.OnItemClickListener() {
} else if (id == R.id.nav_settings){
  Intent intent = new Intent(mAppContext, SettingsActivity.class);
  startActivity(intent);
} else if (id == R.id.nav_about){
  PackageInfo pInfo;
  String version = "unknown";
  try {
    pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    version = pInfo.versionName;
  } catch (PackageManager.NameNotFoundException e) {
       .setTitle(getText(R.string.about_title))
       .setMessage(getText(R.string.about_version) + version +
             "\n\n" + getText(R.string.about_message))
       .setPositiveButton(android.R.string.yes, null)
       .show();
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
origin: EvanRespaut/Equate

private void setUnitViewVisibility(UnitVisibility uv) {
  final LinearLayout mUnitContain = (LinearLayout) findViewById(R.id.unit_container);
  if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
    if (uv == UnitVisibility.HIDDEN || mCalc.getUnitTypeSize() == 0 ||
         (uv == UnitVisibility.TOGGLE && mUnitContain.getVisibility() == LinearLayout.VISIBLE))
      mUnitContain.setVisibility(LinearLayout.GONE);
    else {
      mUnitContain.setVisibility(LinearLayout.VISIBLE);
      //update the screen to move result list up
      updateScreen(true, true);
    }
  }
}
origin: EvanRespaut/Equate

super.onCreate(savedInstanceState);
mAppContext = this;
setContentView(R.layout.drawer_layout);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
mDisplay = (EditTextDisplay) findViewById(R.id.textDisplay);
mResultPreview = (DynamicTextView) findViewById(R.id.resultPreview);
mDisplay.setCalc(mCalc);
mDisplay.disableSoftInputFromAppearing();
FragmentManager fm = getSupportFragmentManager();
mResultListFrag = (ResultListFragment) fm.findFragmentById(R.id.resultListFragmentContainer);
  final Button button = (Button) findViewById(id);
ImageButton backspaceButton = (ImageButton) findViewById(R.id.backspace_button);
backspaceButton.setOnTouchListener(new View.OnTouchListener() {
  private final int BACKSPACE_REPEAT = ViewUtils.getLongClickTimeout(mAppContext);
showWhatsNewDialog();
origin: EvanRespaut/Equate

/**
 * Helper function to create a show what's new dialog when user first opens
 * this version of the app
 */
private void showWhatsNewDialog() {
  SharedPreferences sharedPref = getSharedPreferences(PRIVATE_PREF, Context.MODE_PRIVATE);
  int currentVersionNumber = 0;
  int savedVersionNumber = sharedPref.getInt(VERSION_KEY, 0);
  try {
    PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0);
    currentVersionNumber = pi.versionCode;
  } catch (Exception e) {}
  if (currentVersionNumber > savedVersionNumber) {
    LayoutInflater inflater = LayoutInflater.from(this);
    View view = inflater.inflate(R.layout.dialog_whatsnew, null);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getText(R.string.whats_new))
         .setMessage(getText(R.string.version_description))
         .setPositiveButton("OK", new DialogInterface.OnClickListener() {
           @Override
           public void onClick(DialogInterface dialog, int which) {
             dialog.dismiss();
           }
         });
    builder.create().show();
    SharedPreferences.Editor editor = sharedPref.edit();
    editor.putInt(VERSION_KEY, currentVersionNumber);
    editor.apply();
  }
}
origin: EvanRespaut/Equate

private void setupUnitTypePager() {
    setUnitViewVisibility(UnitVisibility.HIDDEN);
    return;
  } else {
    setUnitViewVisibility(UnitVisibility.VISIBLE);
  FragmentManager fm = getSupportFragmentManager();
  mUnitTypeViewPager = (ViewPager) findViewById(R.id.unit_pager);
  mUnitTypeViewPager.setAdapter(new FragmentStatePagerAdapter(fm) {
    @Override
  TabPageIndicator mUnitTypeTabIndicator = (TabPageIndicator) findViewById(R.id.unit_type_titles);
  mUnitTypeTabIndicator.setViewPager(mUnitTypeViewPager);
  mUnitTypeTabIndicator.setVisibility(View.VISIBLE);
origin: EvanRespaut/Equate

/**
 * Helper function to build a list dialog box that has a search function
 * Dialog lists has a cancel button.
 *
 * @param hint              hint that displays in the EditText search box
 * @param itemClickListener OnClickListener for when the user selects one
 *                          of the units in the dialog list
 */
private void createSearchDialog(CharSequence hint,
                     AdapterView.OnItemClickListener itemClickListener) {
  Context context = getActivity();
  mSearchDialogBuilder = new UnitSearchDialogBuilder(mUnitType);
  CalcActivity ca = (CalcActivity) getActivity();
  //TODO not sure if the idleResource should be accessed this way...
  mSearchDialogBuilder.buildDialog(context, hint, ca.getIdlingResource(), itemClickListener);
}
origin: EvanRespaut/Equate

         (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.openDrawer(GravityCompat.START);
    break;
  numButtonPressed(buttonValue);
return true;
origin: EvanRespaut/Equate

  setupUnitTypePager();
  mUnitTypeViewPager.setCurrentItem(visibleUnitTypeIndex);
} else {
  ConvKeysFragment frag = getConvKeyFrag(mUnitTypeViewPager.getCurrentItem());
  if (frag != null) frag.selectUnitAtUnitArrayPos(unitPos);
origin: EvanRespaut/Equate

@Override
public void onBackPressed() {
  DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
  if (drawer.isDrawerOpen(GravityCompat.START)){
    drawer.closeDrawer(GravityCompat.START);
  } else {
    super.onBackPressed();
  }
}
origin: EvanRespaut/Equate

/**
 * Clear the unit selection for unit type fragment at position pos
 *
 * @param unitTypeFragPos the position of the desired unit type fragment
 *                        from which to clear selected units
 */
private void clearUnitSelection(int unitTypeFragPos) {
  ConvKeysFragment currFragAtPos = getConvKeyFrag(unitTypeFragPos);
  if (currFragAtPos != null)
    currFragAtPos.clearButtonSelection();
}
origin: EvanRespaut/Equate

@Before
public void setUpTest() {
  mPagerIdle = getPagerIdle(mActivityTestRule);
  mSimpleIdle = mActivityTestRule.getActivity().getIdlingResource();
  registerIdlingResources(mPagerIdle, mSimpleIdle);
}
com.llamacorp.equate.viewCalcActivity

Most used methods

  • getIdlingResource
    Only called from test, creates and returns a new SimpleIdlingResource.
  • clearHistory
    Clears the history, updates the screen, and toasts the user
  • clearUnitSelection
    Clear the unit selection for unit type fragment at position pos
  • findViewById
  • getConvKeyFrag
    Helper function to return the convert key fragment at position pos
  • getPackageManager
  • getPackageName
  • getResources
  • getSharedPreferences
  • getString
  • getSupportFragmentManager
  • getSystemService
  • getSupportFragmentManager,
  • getSystemService,
  • getText,
  • getWindow,
  • numButtonPressed,
  • selectUnitAtUnitArrayPos,
  • setContentView,
  • setUnitViewVisibility,
  • setupUnitTypePager,
  • showWhatsNewDialog

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • compareTo (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • ImageIO (javax.imageio)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now