<commit_before>package org.fossasia.phimpme.base;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.internal.BottomNavigationItemView;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import org.fossasia.phimpme.R;
import org.fossasia.phimpme.accounts.AccountActivity;
import org.fossasia.phimpme.gallery.activities.LFMainActivity;
import org.fossasia.phimpme.gallery.util.PreferenceUtil;
import org.fossasia.phimpme.opencamera.Camera.CameraActivity;

import uk.co.deanwild.materialshowcaseview.MaterialShowcaseSequence;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;
import uk.co.deanwild.materialshowcaseview.ShowcaseConfig;

public abstract class BaseActivity extends AppCompatActivity implements BottomNavigationView.OnNavigationItemSelectedListener {

    protected BottomNavigationView navigationView;
    private static final String SHOWCASE_ID = "1";
    BottomNavigationItemView nav_home;
    BottomNavigationItemView nav_cam;
    BottomNavigationItemView nav_acc;
    private PreferenceUtil SP;
    private boolean isSWNavBarChecked;

    private int[][] states = new int[][] {
            new int[] {android.R.attr.state_checked}, // checked
            new int[] {-android.R.attr.state_checked}, // unchecked
    };

    private int[] colors = new int[] {
            Color.WHITE, // checked
            0 // unchecked set default in onCreate
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getContentViewId());
        colors[1]  = ContextCompat.getColor(this, R.color.bottom_navigation_tabs);
        ColorStateList myList = new ColorStateList(states, colors);
        navigationView = (BottomNavigationView) findViewById(R.id.bottombar);
        navigationView.setItemIconTintList(myList);
        navigationView.setItemTextColor(myList);
        navigationView.setOnNavigationItemSelectedListener(this);

         nav_home = (BottomNavigationItemView) findViewById(R.id.navigation_home);
         nav_cam = (BottomNavigationItemView) findViewById(R.id.navigation_camera);
         nav_acc = (BottomNavigationItemView) findViewById(R.id.navigation_accounts);

        int checkStoragePermission = ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
        if(checkStoragePermission  == PackageManager.PERMISSION_GRANTED)
            presentShowcaseSequence(); // one second delay

        SP = PreferenceUtil.getInstance(getApplicationContext());
    }

    @Override
    protected void onResume() {
        super.onResume();
        isSWNavBarChecked = SP.getBoolean(getString(R.string.preference_colored_nav_bar),true);
    }

    private void presentShowcaseSequence() {

        ShowcaseConfig config = new ShowcaseConfig();
        config.setDelay(4000); // half second between each showcase view
<commit_msg>Fixed  #1749 MaterialShowCase is now showing up immediately (#1808)<commit_after>package org.fossasia.phimpme.base;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.internal.BottomNavigationItemView;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import org.fossasia.phimpme.R;
import org.fossasia.phimpme.accounts.AccountActivity;
import org.fossasia.phimpme.gallery.activities.LFMainActivity;
import org.fossasia.phimpme.gallery.util.PreferenceUtil;
import org.fossasia.phimpme.opencamera.Camera.CameraActivity;

import uk.co.deanwild.materialshowcaseview.MaterialShowcaseSequence;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;
import uk.co.deanwild.materialshowcaseview.ShowcaseConfig;

public abstract class BaseActivity extends AppCompatActivity implements BottomNavigationView.OnNavigationItemSelectedListener {

    protected BottomNavigationView navigationView;
    private static final String SHOWCASE_ID = "1";
    BottomNavigationItemView nav_home;
    BottomNavigationItemView nav_cam;
    BottomNavigationItemView nav_acc;
    private PreferenceUtil SP;
    private boolean isSWNavBarChecked;

    private int[][] states = new int[][] {
            new int[] {android.R.attr.state_checked}, // checked
            new int[] {-android.R.attr.state_checked}, // unchecked
    };

    private int[] colors = new int[] {
            Color.WHITE, // checked
            0 // unchecked set default in onCreate
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getContentViewId());
        colors[1]  = ContextCompat.getColor(this, R.color.bottom_navigation_tabs);
        ColorStateList myList = new ColorStateList(states, colors);
        navigationView = (BottomNavigationView) findViewById(R.id.bottombar);
        navigationView.setItemIconTintList(myList);
        navigationView.setItemTextColor(myList);
        navigationView.setOnNavigationItemSelectedListener(this);

         nav_home = (BottomNavigationItemView) findViewById(R.id.navigation_home);
         nav_cam = (BottomNavigationItemView) findViewById(R.id.navigation_camera);
         nav_acc = (BottomNavigationItemView) findViewById(R.id.navigation_accounts);

        int checkStoragePermission = ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
        if(checkStoragePermission  == PackageManager.PERMISSION_GRANTED)
            presentShowcaseSequence(); // one second delay

        SP = PreferenceUtil.getInstance(getApplicationContext());
    }

    @Override
    protected void onResume() {
        super.onResume();
        isSWNavBarChecked = SP.getBoolean(getString(R.string.preference_colored_nav_bar),true);
    }

    private void presentShowcaseSequence() {

        ShowcaseConfig config = new ShowcaseConfig();
        config.setDelay(500); // half second between each showcase view

{'fraction_non_alphanumeric': 0.08770116639598405, 'fraction_numerical': 0.003691126531817511, 'mean_word_length': 4.454106280193237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2402497', 'n_tokens_mistral': 1885, 'n_tokens_neox': 1809, 'n_words': 340}