Example usage for android.view Window FEATURE_CUSTOM_TITLE

List of usage examples for android.view Window FEATURE_CUSTOM_TITLE

Introduction

In this page you can find the example usage for android.view Window FEATURE_CUSTOM_TITLE.

Prototype

int FEATURE_CUSTOM_TITLE

To view the source code for android.view Window FEATURE_CUSTOM_TITLE.

Click Source Link

Document

Flag for custom title.

Usage

From source file:com.prevas.redmine.NewIssueActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

    //        mPriorityMap = new HashMap<String, Integer>();
    //        mPriorityMap.put("Low", 3);
    //        mPriorityMap.put("Normal", 4);
    //        mPriorityMap.put("High", 5);
    //        mPriorityMap.put("Urgent", 6);
    //        mPriorityMap.put("Immediate", 7);

    //        mPriorityMap.put("New", 1);
    //        mPriorityMap.put("In progress", 2);
    //        mPriorityMap.put("Invalid", 3);
    //        mPriorityMap.put("Review", 4);
    //        mPriorityMap.put("Closed", 5);
    //        mPriorityMap.put("Need more information", 7);
    //        mPriorityMap.put("Test", 8);
    //        mPriorityMap.put("Deferred", 10);

    new LoadViewTask().execute();
}

From source file:net.amdroid.metrosp.MetroSP.java

/** Called when the activity is first created. */
@Override// w  w w. ja  v a  2s  .  c o  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

    /* Select the configured Theme */
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    String themeStr = prefs.getString(Preferences.PREF_THEME, "White.Theme");
    int theme = getResources().getIdentifier(themeStr, "style", "net.amdroid.metrosp");
    setTheme(theme);

    setContentView(R.layout.main);

    AdView adView = new AdView(this, AdSize.BANNER, "a14d8821cfdf925");
    LinearLayout layout = (LinearLayout) findViewById(R.id.addsLayout);
    layout.addView(adView);
    AdRequest adrequest = new AdRequest();
    adView.loadAd(adrequest);

    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);

    metroLines = new ArrayList<MetroLine>();
    int resID = R.layout.list_item;
    adapter = new MetroLineAdapter(this, resID, metroLines);

    listview = (ListView) findViewById(R.id.metroList);
    title = (TextView) findViewById(R.id.app_title);
    refresh_btn = (Button) findViewById(R.id.refresh_button);
    listview.setAdapter(adapter);

    refresh_btn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.d("MetroSP", "Refresh");
            refreshData();
        }
    });

    /* Setup the viewFlipper to do the slidding tab */
    viewFlipper = (ViewFlipper) findViewById(R.id.flipper);
    slideLeftIn = AnimationUtils.loadAnimation(this, R.anim.slide_left_in);
    slideLeftOut = AnimationUtils.loadAnimation(this, R.anim.slide_left_out);
    slideRightIn = AnimationUtils.loadAnimation(this, R.anim.slide_right_in);
    slideRightOut = AnimationUtils.loadAnimation(this, R.anim.slide_right_out);
    firsttab = true;

    /* Set listview OnClick Handler to show package status */
    listview.setOnItemClickListener(listviewOnClick);

    refreshData();
}

From source file:com.wholegroup.rally.ScoreActivity.java

/** */
@Override/*from ww  w .j a  v a  2s .c  om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //  ?  ? ??
    m_sbNumber = new StringBuffer();

    // ?
    Resources m_res = getResources();

    String[] arrDefaultNames = m_res.getStringArray(R.array.names);
    int[] arrDefaultScores = m_res.getIntArray(R.array.scores);

    m_arrRecords = new ScoreRecord[RECORDCOUNT];

    for (int i = 0; i < RECORDCOUNT; i++) {
        if ((i < arrDefaultNames.length) && (i < arrDefaultScores.length)) {
            m_arrRecords[i] = new ScoreRecord(arrDefaultNames[i], arrDefaultScores[i], Rally.GAME_A);
        } else {
            m_arrRecords[i] = new ScoreRecord(getString(R.string.score_default_name), 0, Rally.GAME_A);
        }
    }

    m_strGameA = getString(R.string.rally_text_short_game_a);
    m_strGameB = getString(R.string.rally_text_short_game_b);

    //   
    Intent intent = getIntent();

    m_iScore = intent.getIntExtra(getString(R.string.score_parameter_score), 0);
    m_iType = intent.getIntExtra(getString(R.string.score_parameter_type), Rally.GAME_A);
    m_sName = getString(R.string.score_default_name);

    //   
    LoadScore();

    // ? ??
    Arrays.sort(m_arrRecords);

    // ?  ??
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.score);

    // ?  
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);

    ((TextView) findViewById(R.id.custom_title_left_text)).setText(R.string.score_activity_title);
    ((TextView) findViewById(R.id.custom_title_right_text)).setText(R.string.application_upper);

    // ?  ? ? ??
    setListAdapter(new ScoreAdapter());

    //     ?  
    if ((0 < m_iScore) && (m_iScore > m_arrRecords[RECORDCOUNT - 1].m_iScore)) {
        showDialog(0);
    }
}

From source file:net.line2soft.preambul.views.ExcursionInfoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    //Check if this version of Android allows to use custom title bars
    boolean feature = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    /** Set layout **/
    //Base layout
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_excursion_info);
    //set title bar
    if (feature) {
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.activity_title_bar);
        TextView myTitleText = (TextView) findViewById(R.id.textView0);
        myTitleText.setText(getString(R.string.title_activity_excursion_info));
    }//ww w .  j a va 2s  .c  o m

    //Get excursion ID
    int id = getIntent().getIntExtra(ExcursionListActivity.EXCURSION_ID, 0);
    if (id > 0) {
        //Set listener
        listener = new ExcursionInfoListener(this);
        //Set tabs

        TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
        tabHost.setup();

        TabSpec spec1 = tabHost.newTabSpec("Info");
        spec1.setContent(R.id.tab1);
        spec1.setIndicator("", getResources().getDrawable(R.drawable.description_tab));
        spec1.setContent(R.id.tab1);

        TabSpec spec2 = tabHost.newTabSpec("POI");
        spec2.setIndicator("", getResources().getDrawable(R.drawable.pois_tab));
        spec2.setContent(R.id.tab2);

        TabSpec spec3 = tabHost.newTabSpec("Instructions");
        spec3.setIndicator("", getResources().getDrawable(R.drawable.instruction_tab));
        spec3.setContent(R.id.tab3);

        TabSpec spec4 = tabHost.newTabSpec("Photos");
        spec4.setIndicator("", getResources().getDrawable(R.drawable.photos_tab));
        spec4.setContent(R.id.tab4);

        tabHost.addTab(spec1);
        tabHost.addTab(spec2);
        tabHost.addTab(spec3);
        tabHost.addTab(spec4);

        //set the info tab
        try {
            Excursion exc = MapController.getInstance(this).getCurrentLocation().getExcursions(this).get(id);
            //Display locomotions
            Locomotion[] locomotionsItems = exc.getLocomotions();
            LinearLayout locomotionsLayout = (LinearLayout) findViewById(R.id.locomotionsLayout);
            LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            for (int i = 0; i < locomotionsItems.length; i++) {
                if (locomotionsItems[i].getIcon() == null) {
                    //Define icon if undefined
                    int imageResource = getResources().getIdentifier(
                            "locomotion_" + locomotionsItems[i].getKey(), "drawable", getPackageName());
                    if (imageResource != 0) {
                        Drawable ic = getResources().getDrawable(imageResource);
                        locomotionsItems[i].setIcon(ic);
                    }
                }
                ImageView img = (ImageView) inflater.inflate(R.layout.locomotion_item, null);
                img.setImageDrawable(locomotionsItems[i].getIcon());
                locomotionsLayout.addView(img);
            }

            int value = exc.getDifficulty();
            if (value == Excursion.DIFFICULTY_NONE) {
                ImageView view = (ImageView) findViewById(R.id.ImageView2);
                view.setImageResource(R.drawable.difficulte1);
            } else if (value == Excursion.DIFFICULTY_EASY) {
                ImageView view = (ImageView) findViewById(R.id.ImageView2);
                view.setImageResource(R.drawable.difficulte2);

            } else if (value == Excursion.DIFFICULTY_MEDIUM) {
                ImageView view = (ImageView) findViewById(R.id.ImageView2);
                view.setImageResource(R.drawable.difficulte3);

            } else if (value == Excursion.DIFFICULTY_HARD) {
                ImageView view = (ImageView) findViewById(R.id.ImageView2);
                view.setImageResource(R.drawable.difficulte4);

            } else if (value == Excursion.DIFFICULTY_EXPERT) {
                ImageView view = (ImageView) findViewById(R.id.ImageView2);
                view.setImageResource(R.drawable.difficulte5);

            }
            String time = ExcursionAdapter.convertTime(exc.getTime());

            TextView view = (TextView) findViewById(R.id.textView1);
            view.setText(time);

            Double length = Double.valueOf(exc.getLength() / 1000);
            String lengthString = length.toString().substring(0, length.toString().lastIndexOf(".") + 2)
                    + " km";
            view = (TextView) findViewById(R.id.textView2);
            view.setText(lengthString);

            view = (TextView) findViewById(R.id.textView3);
            view.setText(exc.getDescription());

        } catch (Exception e) {
            e.printStackTrace();
            onBackPressed();
            displayInfo(getString(R.string.message_excursion_not_found));
        }
        MapController exc = MapController.getInstance(this);

        //set the POI tab
        try {
            PointOfInterest[] pois = exc.getCurrentLocation().getExcursions(this).get(id)
                    .getSurroundingPois(this);
            List<NamedPoint> itemsList = Arrays.asList(((NamedPoint[]) pois));
            Collections.sort(itemsList, new NamedPointComparator());
            pois = itemsList.toArray(new PointOfInterest[itemsList.size()]);
            if (pois.length > 0) {
                ListView listPoi = (ListView) findViewById(R.id.listView2);
                listPoi.setAdapter(new FavoriteAdapter(getLayoutInflater(), pois, this));
                listPoi.setOnItemClickListener(listener);
                listPoi.setVisibility(View.VISIBLE);
                findViewById(R.id.NoPOIs).setVisibility(View.GONE);
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.err.println("Couldn't fill POI tab");
        }

        //set the instruction tab
        ListView list = (ListView) findViewById(R.id.listView1);
        if (list != null) {
            try {
                NavigationInstruction[] instructions = exc.getCurrentLocation().getExcursions(this).get(id)
                        .getInstructions();
                if (instructions.length != 0) {
                    ((TextView) findViewById(R.id.NoInstructions)).setVisibility(View.GONE);
                }
                list.setAdapter(new ExcursionInfoInstructionAdapter(this, instructions));
                list.setOnItemClickListener(listener);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        //Set the picture tab
        String imagePath = Environment.getExternalStorageDirectory().getPath() + File.separator + "Android"
                + File.separator + "data" + File.separator + "net.line2soft.preambul" + File.separator + "files"
                + File.separator + MapController.getInstance(this).getCurrentLocation().getId() + File.separator
                + "excursions" + File.separator
                + getIntent().getIntExtra(ExcursionListActivity.EXCURSION_ID, 0);
        FileFilter filter = new FileFilter() {
            @Override
            public boolean accept(File file) {
                return file.getAbsolutePath().matches(".*\\.jpg");
            }
        };
        imagesFile = new File(imagePath).listFiles(filter);
        ((TextView) findViewById(R.id.NoPhotos)).setVisibility(View.VISIBLE);
        if (imagesFile != null) {
            if (imagesFile.length > 0) {
                ((TextView) findViewById(R.id.NoPhotos)).setVisibility(View.GONE);
                ImagePagerAdapter adapter = new ImagePagerAdapter(getSupportFragmentManager(), imagesFile,
                        this);
                ViewPager myPager = (ViewPager) findViewById(R.id.pager_images);
                myPager.setAdapter(adapter);
                myPager.setOnPageChangeListener(listener);

                //Set listener on right and left buttons in picture tab
                (findViewById(R.id.imageRight)).setOnClickListener(listener);
                (findViewById(R.id.imageLeft)).setOnClickListener(listener);
                //Change visibility of these buttons
                ImageView right = (ImageView) findViewById(R.id.imageRight);
                ImageView left = (ImageView) findViewById(R.id.imageLeft);
                left.setVisibility(View.INVISIBLE);
                right.setVisibility(View.INVISIBLE);
                int idPhoto = ((ViewPager) findViewById(R.id.pager_images)).getCurrentItem();
                int nbPhotos = getImagesFile().length;
                if (idPhoto != nbPhotos - 1) {
                    right.setVisibility(View.VISIBLE);
                }
            }
        }

        //Set listener on launch button
        Button launch = (Button) findViewById(R.id.button_load_excursion);
        launch.setOnClickListener(listener);

    } else {
        onBackPressed();
        displayInfo(getString(R.string.message_excursion_not_found));
    }
}

From source file:com.irccloud.android.activity.PreferencesActivity.java

@SuppressWarnings("deprecation")
@Override//  w w  w.  j a v a 2  s  .  c  o m
public void onCreate(Bundle icicle) {
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    super.onCreate(icicle);
    getDelegate().installViewFactory();
    getDelegate().onCreate(icicle);
    if (Build.VERSION.SDK_INT >= 21) {
        Bitmap cloud = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
        setTaskDescription(new ActivityManager.TaskDescription(getResources().getString(R.string.app_name),
                cloud, 0xFFF2F7FC));
        cloud.recycle();
    }
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.actionbar_prefs);

    Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar);
    toolbar.setTitle(getTitle());
    toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

    toolbar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar));

    if (Build.VERSION.SDK_INT >= 21)
        toolbar.setElevation(0);

    conn = NetworkConnection.getInstance();
    addPreferencesFromResource(R.xml.preferences_account);
    addPreferencesFromResource(R.xml.preferences_display);
    addPreferencesFromResource(R.xml.preferences_device);
    addPreferencesFromResource(R.xml.preferences_photos);
    addPreferencesFromResource(R.xml.preferences_notifications);
    addPreferencesFromResource(R.xml.preferences_dashclock);
    findPreference("dashclock_showmsgs").setOnPreferenceChangeListener(dashclocktoggle);
    try {
        int pebbleVersion = getPackageManager().getPackageInfo("com.getpebble.android", 0).versionCode;
        if (pebbleVersion < 553)
            addPreferencesFromResource(R.xml.preferences_pebble);
    } catch (Exception e) {
    }
    boolean foundSony = false;
    try {
        getPackageManager().getPackageInfo("com.sonyericsson.extras.liveware", 0);
        addPreferencesFromResource(R.xml.preferences_sony);
        foundSony = true;
    } catch (Exception e) {
    }
    if (!foundSony) {
        try {
            getPackageManager().getPackageInfo("com.sonyericsson.extras.smartwatch", 0);
            addPreferencesFromResource(R.xml.preferences_sony);
            foundSony = true;
        } catch (Exception e) {
        }
    }
    if (!foundSony) {
        try {
            getPackageManager().getPackageInfo("com.sonyericsson.extras.liveview", 0);
            addPreferencesFromResource(R.xml.preferences_sony);
            foundSony = true;
        } catch (Exception e) {
        }
    }
    if (foundSony)
        findPreference("notify_sony").setOnPreferenceChangeListener(sonytoggle);
    if (BuildConfig.DEBUG)
        addPreferencesFromResource(R.xml.preferences_debug);
    addPreferencesFromResource(R.xml.preferences_about);
    findPreference("name").setOnPreferenceChangeListener(settingstoggle);

    findPreference("autoaway").setOnPreferenceChangeListener(settingstoggle);
    findPreference("time-24hr").setOnPreferenceChangeListener(prefstoggle);
    findPreference("time-seconds").setOnPreferenceChangeListener(prefstoggle);
    findPreference("mode-showsymbol").setOnPreferenceChangeListener(prefstoggle);
    findPreference("pastebin-disableprompt").setOnPreferenceChangeListener(prefstoggle);
    if (findPreference("emoji-disableconvert") != null) {
        findPreference("emoji-disableconvert").setOnPreferenceChangeListener(prefstoggle);
        findPreference("emoji-disableconvert").setSummary(":thumbsup:  \uD83D\uDC4D");
    }
    findPreference("nick-colors").setOnPreferenceChangeListener(prefstoggle);
    findPreference("faq").setOnPreferenceClickListener(urlClick);
    findPreference("feedback").setOnPreferenceClickListener(urlClick);
    findPreference("licenses").setOnPreferenceClickListener(licensesClick);
    findPreference("imageviewer").setOnPreferenceChangeListener(imageviewertoggle);
    findPreference("imgur_account_username").setOnPreferenceClickListener(imgurClick);
    //findPreference("subscriptions").setOnPreferenceClickListener(urlClick);
    //findPreference("changes").setOnPreferenceClickListener(urlClick);
    findPreference("notify_type").setOnPreferenceChangeListener(notificationstoggle);
    findPreference("notify_led_color").setOnPreferenceChangeListener(ledtoggle);
    findPreference("photo_size").setOnPreferenceChangeListener(photosizetoggle);

    imgurPreference = findPreference("imgur_account_username");
    if (NetworkConnection.getInstance().uploadsAvailable()) {
        if (!PreferenceManager.getDefaultSharedPreferences(this).getString("image_service", "IRCCloud")
                .equals("imgur")) {
            PreferenceCategory c = (PreferenceCategory) findPreference("photos");
            c.removePreference(imgurPreference);
        }
        findPreference("image_service").setOnPreferenceChangeListener(imageservicetoggle);
    } else {
        PreferenceCategory c = (PreferenceCategory) findPreference("photos");
        c.removePreference(findPreference("image_service"));
    }

    try {
        final String version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
        findPreference("version").setSummary(version);
        findPreference("version").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                if (Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
                    android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(
                            CLIPBOARD_SERVICE);
                    clipboard.setText(version);
                } else {
                    @SuppressLint("ServiceCast")
                    android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(
                            CLIPBOARD_SERVICE);
                    android.content.ClipData clip = android.content.ClipData.newPlainText("IRCCloud Version",
                            version);
                    clipboard.setPrimaryClip(clip);
                }
                Toast.makeText(PreferencesActivity.this, "Version number copied to clipboard",
                        Toast.LENGTH_SHORT).show();
                return false;
            }
        });
    } catch (NameNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:com.TomatoSauceStudio.OnTimeBirthdayPost.OnTimeBirthdayPost.java

/** Called when the activity is first created. */
@Override/*  w w w  . j  a va  2s .c om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    /**
     * Request custom title-bar so we can display our own messages.
     */
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.main);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar);
    titleText = (TextView) findViewById(R.id.titlet);
    /**
     * Fix our orientation, the list looks best in Portrait and this way we
     * don't have to deal with orientation changes.
     */
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    /**
     * We will use this progress dialog throughout to display busy messages.
     */
    pdialog = new ProgressDialog(this);
    pdialog.setIndeterminate(true);
    /**
     * Init Facebook objects.
     */
    facebook = new Facebook(APP_SECRET);
    mAsyncRunner = new AsyncFacebookRunner(facebook);
    /**
     * Init DB.
     */
    mDbHelper = new BirthdaysDbAdapter(this);
    mDbHelper.open();
    /**
     * Init the geocoder that will help us map locations to longitude and thus approximate timezone.
     */
    geocoder = new Geocoder(this, Locale.getDefault());
    registerForContextMenu(getListView());
    /**
     * Get existing access_token if any and skip authorization if possible.
     */
    mPrefs = getPreferences(MODE_PRIVATE);
    String access_token = mPrefs.getString("access_token", null);
    long expires = mPrefs.getLong("access_expires", 0);
    if (access_token != null) {
        facebook.setAccessToken(access_token);
    }
    if (expires != 0) {
        facebook.setAccessExpires(expires);
    }

    /**
     * Request FB auth again only if current session is invalid, else proceed to
     * request info from FB.
     */
    if (!facebook.isSessionValid()) {
        //Log.d("OnTimeBirthdayPost","Facebook session not valid. Redoing auth.");
        fbAuthWrapper();
    } else {
        //Log.d("OnTimeBirthdayPost","Facebook session valid. Proceeding to requests");
        makeFBRequests();
    }
}

From source file:com.ideabytes.dgsms.ca.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.homeactivity);
    try {//from  w w  w .ja  va2 s .  co m
        // custom title bar
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_custom_title);
    } catch (Exception e) {
        e.printStackTrace();
    }
    //this context is used in diff classes(db classes)
    HomeActivity.context = getApplicationContext();
    // calling menu items,on clicking this navigation drawer will open
    Button btnOptions = (Button) findViewById(R.id.btn_options_menu);
    btnOptions.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onRight(v);
        }
    });

    //to close the application when user press exit button while license registration/
    //verification,don't remove return statement, otherwise it executes main activity again
    if (getIntent().getBooleanExtra("EXIT", false)) {
        HomeActivity.this.finish();
        return;
    }

    try {
        //when no license data detected call web view to registration or verification
        GetDBData get = new GetDBData(getApplicationContext());
        // JSONObject jObjectResponse = get.getPlacardingTypeTable();
        //  Log.v("Suman","placarding table data "+get.getPlacardingTypeTable());
        // get.getGroupCompatibility();
        //   get.getClass1Compatibility();
        // get.getUnNumberInfoData();
        // get.getTransactionDetails();
        // get.getUnClassesTableData();
        /// get.getSegragations();
        // System.out.println("debug size "+get.getLicenseData().size());
        //           startService(new Intent(HomeActivity.this, ServiceToVerifyLicense.class));

        if (get.getConfigData().size() <= 0) {
            if (NetworkUtil.getConnectivityStatus(getApplicationContext()) != 0) {
                //when app launching for first time, check device status, payment status and registration
                //with service,based on status drive the flow
                AsyncTaskCheckDevice asyncTaskCheckDevice = new AsyncTaskCheckDevice(getApplicationContext());
                JSONArray deviceStatus = asyncTaskCheckDevice
                        .execute(new Utils().getDeviceId(getApplicationContext())).get();
                Log.v(LOGTAG + "array", deviceStatus.toString());
                if (deviceStatus.length() > 0) {
                    //there is a entry with device id in server database
                    //read payment status and registration status, then drive flow
                    JSONObject status = deviceStatus.getJSONObject(0);
                    //rajesh
                    if (status.getInt(REG_STATUS) == 1 && status.getInt(PAYMENT_STATUS) == 1) {
                        //everything done, go to verification page
                        callWebPage(VERIFICATION);
                        //                              if (NetworkUtil.getConnectivityStatus(getApplicationContext()) != 0) {
                        //                                  AlertCouponCodes alertCouponCodes = new AlertCouponCodes(HomeActivity.this);
                        //                                  alertCouponCodes.showDialog("You need to buy license to use this app");
                        //                              } else {
                        //                                  DialogCheckNetConnectivity checkWifi = new DialogCheckNetConnectivity(HomeActivity.this);
                        //                                  checkWifi.showDialog();
                        //                              }
                    } else if (status.getInt(REG_STATUS) == 0 && status.getInt(PAYMENT_STATUS) == 1) {
                        //payment done but not registered, go to registration page
                        callWebPage(HOME);
                    } else if (status.getInt(REG_STATUS) == 0 && status.getInt(PAYMENT_STATUS) == 0) {
                        //this block is testing purpose, make staus changes in db then it comes here
                        //to test coupons flow and paymen as well
                        if (NetworkUtil.getConnectivityStatus(getApplicationContext()) != 0) {
                            AlertCouponCodes alertCouponCodes = new AlertCouponCodes(HomeActivity.this);
                            alertCouponCodes.showDialog(
                                    Utils.getResString(getApplicationContext(), R.string.alert_msg_buy_license),
                                    "payment");
                        } else {
                            DialogCheckNetConnectivity checkWifi = new DialogCheckNetConnectivity(
                                    HomeActivity.this);
                            checkWifi.showDialog();
                        }
                    } //else if
                } else {
                    if (NetworkUtil.getConnectivityStatus(getApplicationContext()) != 0) {
                        AlertCouponCodes alertCouponCodes = new AlertCouponCodes(HomeActivity.this);
                        alertCouponCodes.showDialog(
                                Utils.getResString(getApplicationContext(), R.string.alert_msg_buy_license),
                                "payment");
                    } else {
                        DialogCheckNetConnectivity checkWifi = new DialogCheckNetConnectivity(
                                HomeActivity.this);
                        checkWifi.showDialog();
                    }
                    //enable this to bypass payment and disable above lines
                    // callWebPage(HOME);
                } //inner else , check licensing and payment status
            } else {
                DialogCheckNetConnectivity checkWifi = new DialogCheckNetConnectivity(HomeActivity.this);
                checkWifi.showDialog();

            } //outer else to check n/w to check device status with server
        } else {
            loadNavigationDrawer(savedInstanceState);
            verifyLicense();
            checkApkUpdate();
        } //outer else, checking license status in local db

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.example.bluetooth_faster_connection.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (D)//from  w w  w  . j  a  v a  2s.  c om
        Log.e(TAG, "+++ ON CREATE +++");

    // Set up the window layout
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.main);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);

    // Set up the custom title
    mTitle = (TextView) findViewById(R.id.title_left_text);
    mTitle.setText(R.string.app_name);
    mTitle = (TextView) findViewById(R.id.title_right_text);
    mInfo = (TextView) findViewById(R.id.myText);

    Button mButton = (Button) findViewById(R.id.myButton);
    mButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            openOptionsMenu();
        }
    });

    // Get local Bluetooth adapter
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    // If the adapter is null, then Bluetooth is not supported
    if (mBluetoothAdapter == null) {
        Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
        finish();
        return;
    }

    // register for background service broadcast.
    IntentFilter ifilt = new IntentFilter(DeviceDicoverService.DEVICE_CONNECTION_ADDRESS);
    ifilt.addAction(DeviceDicoverService.DEVICE_CONNECTION_INFO);
    registerReceiver(mReceiver, ifilt);

    // just for test purpose, should be deleted if not in test procedure.
    Intent service = new Intent(this, DeviceDicoverService.class);
    startService(service);

    wifii = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    WifiInfo wInfo = wifii.getConnectionInfo();
}

From source file:com.example.hudpassthrough.BluetoothChat.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (D)//from w w w  . ja va 2s .  c  o  m
        Log.e(TAG, "+++ ON CREATE +++");

    // Set up the window layout
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.main);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);

    // Set up the custom title
    mTitle = (TextView) findViewById(R.id.title_left_text);
    mTitle.setText(R.string.app_name);
    mTitle = (TextView) findViewById(R.id.title_right_text);

    // Get local Bluetooth adapter
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    // If the adapter is null, then Bluetooth is not supported
    if (mBluetoothAdapter == null) {
        Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
        finish();
        return;
    }

    mCamera = Camera.open();
    if (mCamera == null)
        Log.e("Camera", "mCamera is null!");

    //mCamera.enableShutterSound(false); //Questionable Legality!

    CamPreview camPreview = new CamPreview(this, mCamera);
    camPreview.setSurfaceTextureListener(camPreview);
    FrameLayout preview = (FrameLayout) findViewById(R.id.cameraView);
    preview.addView(camPreview);
    CamCallback camCallback = new CamCallback();
    mCamera.setPreviewCallback(camCallback);

    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build());

    people = new PeopleDB();
}

From source file:com.prevas.redmine.NewIssueActivity.java

private void setCustomTitlebar() {
    Intent intent = getIntent();/*from w  ww  . jav a2s.c  om*/
    String projTitle = intent.getStringExtra(StringConsts.PROJECT_NAME);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.issue_save_title);
    TextView titleTextView = (TextView) findViewById(R.id.txt_title);
    if (null != titleTextView) {
        titleTextView.setText(projTitle);
    }
}