Example usage for android.support.v4.app BuildConfig DEBUG

List of usage examples for android.support.v4.app BuildConfig DEBUG

Introduction

In this page you can find the example usage for android.support.v4.app BuildConfig DEBUG.

Prototype

boolean DEBUG

To view the source code for android.support.v4.app BuildConfig DEBUG.

Click Source Link

Usage

From source file:com.scto.filerenamer.MainActivity.java

/** Called when the activity is first created. */
@Override/*from  ww  w.  j a va 2  s.  co  m*/
public void onCreate(Bundle savedInstanceState) {
    try {
        mSharedPreferences = Prefs.getSharedPreferences(this);
    } catch (NullPointerException e) {
        if (BuildConfig.DEBUG) {
            Log.w("[" + TAG + "]", "mSharedPreferences == NullPointerException :" + e.getMessage());
        }
    }

    mSharedPreferences.registerOnSharedPreferenceChangeListener(this);

    if (Prefs.getThemeType(this) == false) {
        mThemeId = R.style.AppTheme_Light;
        setTheme(mThemeId);
    } else {
        mThemeId = R.style.AppTheme_Dark;
        setTheme(mThemeId);
    }

    //Eula.showDisclaimer( this );
    Eula.showEula(this, getApplicationContext());

    mActionBar = getActionBar();
    if (mActionBar != null) {
        mActionBar.setDisplayHomeAsUpEnabled(false);
        mActionBar.setDisplayShowHomeEnabled(true);
        mActionBar.setDisplayShowTitleEnabled(true);
    } else {
        if (BuildConfig.DEBUG) {
            Log.w("[" + TAG + "]", "mActionBar == null");
        }
    }

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        this.setTitle(extras.getString("dir") + " :: " + getString(R.string.app_name));
    } else {
        this.setTitle(" :: " + getString(R.string.app_name));
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    tvDisplay = (TextView) findViewById(R.id.tvDisplay);

    bRename = (Button) findViewById(R.id.bRename);
    bSettings = (Button) findViewById(R.id.bSettings);
    bHelp = (Button) findViewById(R.id.bHelp);
    bExit = (Button) findViewById(R.id.bExit);

    bRename.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent openAndroidFileBrowser = new Intent("com.scto.filerenamer.ANDROIDFILEBROWSER");
            openAndroidFileBrowser.putExtra("what", "renamer");
            openAndroidFileBrowser.putExtra("theme", mThemeId);
            startActivity(openAndroidFileBrowser);
        }
    });

    bSettings.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent openPreferencesActivity = new Intent("com.scto.filerenamer.PREFERENCESACTIVITY");
            startActivity(openPreferencesActivity);
        }
    });

    bHelp.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            FragmentManager fm = getSupportFragmentManager();
            HelpDialog helpDialog = new HelpDialog();
            helpDialog.show(fm, "dlg_help");
        }
    });

    bExit.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            FragmentManager fm = getSupportFragmentManager();
            ExitDialog exitDialog = new ExitDialog();
            exitDialog.show(fm, "dlg_exit");
        }
    });

    /*
    ChangeLog cl = new ChangeLog( this );
    if( cl.firstRun() )
    {
       cl.getLogDialog().show();
    }
    */
    init();
}

From source file:com.mklodoss.SexyGirl.displayingbitmaps.ui.ImageDetailActivity.java

@TargetApi(VERSION_CODES.HONEYCOMB)
@Override/*from  w  ww  .  java2s . com*/
public void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        Utils.enableStrictMode();
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);
    mCollectHelper = CollectHelper.getInstance();

    // enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

    // Fetch screen height and width, to use as our max size when loading images as this
    // activity runs full screen
    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;

    // For this sample we'll use half of the longest width to resize our images. As the
    // image scaling ensures the image is larger than this, we should be left with a
    // resolution that is appropriate for both portrait and landscape. For best image quality
    // we shouldn't divide by 2, but this will use more memory and require a larger memory
    // cache.
    final int longest = (height > width ? height : width) / 2;

    ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR);
    cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory

    // The ImageFetcher takes care of loading images into our ImageView children asynchronously
    mImageFetcher = new ImageFetcher(this, longest);
    mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams);
    mImageFetcher.setImageFadeIn(false);

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), ImageGridFragment.list.size());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.horizontal_page_margin));
    mPager.setOffscreenPageLimit(2);

    // Set up activity to go full screen
    getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN);

    // Enable some additional newer visibility and ActionBar features to create a more
    // immersive photo viewing experience
    if (Utils.hasHoneycomb()) {
        /* final ActionBar actionBar = getActionBar();
                
         // Hide title text and set home as up
         actionBar.setDisplayShowTitleEnabled(false);
         actionBar.setDisplayHomeAsUpEnabled(true);*/

        // Hide and show the ActionBar as the visibility changes
        mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int vis) {
                if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
                    //actionBar.hide();
                } else {
                    //actionBar.show();
                }
            }
        });

        // Start low profile mode and hide ActionBar
        mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
        //actionBar.hide();
    }

    // Set the current item based on the extra passed in to this activity
    position = getIntent().getIntExtra(EXTRA_IMAGE, -1);
    category = getIntent().getIntExtra(EXTRA_CATEGORY, -100);
    Log.e("PPPP", "OO position:" + position);
    if (position != -1) {
        mPager.setCurrentItem(position);
    }
}

From source file:com.scto.filerenamer.MainActivity.java

@Override
public void onBackPressed() {
    if (BuildConfig.DEBUG) {
        Log.i("[" + TAG + "]", "onBackPressed() : Clicked");
    }//from   ww  w. j ava2s .c  om
}