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:Main.java

public static void setLayout(Activity context, int layout, int titleBar) {
    context.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    context.setContentView(layout);/*from   w ww. ja v a 2s  . c  om*/
    context.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, titleBar);
}

From source file:Main.java

public static void setTitle(Activity context, int reglayout) {
    context.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, reglayout);
}

From source file:com.koushikdutta.desktopsms.BuyActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    //requestWindowFeature(Window.FEATURE_NO_TITLE);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    super.onCreate(savedInstanceState);

    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.buy_title);
    TextView tv = (TextView) findViewById(R.id.title);
    tv.setText(R.string.desksms_one_year_license);

    final ClockworkModBillingClient client = ClockworkModBillingClient.getInstance();

    final JSONObject data = new JSONObject();
    try {/* ww  w  . j  a v a2 s .  co m*/
        data.put("device_id", Helper.getSafeDeviceId(this));
        data.put("account", mSettings.getString("account"));
    } catch (JSONException e) {
        e.printStackTrace();
    }

    ListItem status = addItem(R.string.account_status, new ListItem(this, R.string.account_status, 0));

    ListItem paypal = addItem(R.string.payment_options,
            new ListItem(this, R.string.paypal, 0, R.drawable.paypal) {
                @Override
                public void onClick(View view) {
                    super.onClick(view);
                    client.startPurchase(BuyActivity.this, "desksms.subscription0", mBuyerId,
                            mSettings.getString("account"), data.toString(), PurchaseType.PAYPAL,
                            BuyActivity.this);
                }
            });

    ListItem market = addItem(R.string.payment_options,
            new ListItem(this, R.string.android_market_inapp, 0, R.drawable.market) {
                @Override
                public void onClick(View view) {
                    super.onClick(view);
                    client.startPurchase(BuyActivity.this, "desksms.subscription0", mBuyerId,
                            mSettings.getString("account"), data.toString(), PurchaseType.MARKET_INAPP,
                            BuyActivity.this);
                }
            });

    ListItem redeem = addItem(R.string.payment_options,
            new ListItem(this, R.string.redeem_code, 0, R.drawable.icon) {
                @Override
                public void onClick(View view) {
                    super.onClick(view);
                    client.startPurchase(BuyActivity.this, "desksms.subscription0", mBuyerId,
                            mSettings.getString("account"), data.toString(), PurchaseType.REDEEM,
                            BuyActivity.this);
                }
            });

    JSONObject payload;
    try {
        payload = new JSONObject(getIntent().getStringExtra("payload"));
        mBuyerId = payload.getString("buyer_id");
        long expiration = payload.getLong("subscription_expiration");
        long daysLeft = (expiration - System.currentTimeMillis()) / 1000L / 60L / 60L / 24L;
        status.setTitle(getString(R.string.days_left, String.valueOf(daysLeft)));
    } catch (Exception ex) {
        ex.printStackTrace();
        finish();
    }
}

From source file:com.leo.runningman.ui.ImageGridActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    if (getSupportFragmentManager().findFragmentByTag(TAG) == null) {
        final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(android.R.id.content, new ImageGridFragment(), TAG);
        ft.commit();/*  www.j  a v a 2s. c  om*/
    }
}

From source file:com.oonusave.coupon.MyMap.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.map_view);/*  w w w . j  a  v a 2 s. c o  m*/
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_title);

    backButton = (ImageButton) findViewById(R.id.btnLeft);
    backButton.setVisibility(ImageButton.VISIBLE);
    //backButton.setBackgroundResource(R.drawable.back_button);
    backButton.setBackgroundResource(ImageUtils.getBackIamge());
    backButton.setOnClickListener(this);

    directionButton = (ImageButton) findViewById(R.id.btnRight);
    directionButton.setVisibility(ImageButton.VISIBLE);
    directionButton.setBackgroundResource(ImageUtils.getShowDirectionBtn());
    directionButton.setOnClickListener(this);

    titleBarTextView = (TextView) findViewById(R.id.titleBarTextView);
    titleBarTextView.setText(TitleTextUtils.getMapViewTitleText());

    coupon = (Coupon) getIntent().getSerializableExtra("coupon");
    //   mapView = (MapView) findViewById(R.id.mapview);

    ///   mapView.setBuiltInZoomControls(true);

    //   mapOverlays = mapView.getOverlays();

    // first overlay
    //      drawable = getResources().getDrawable(R.drawable.map);
    //      itemizedOverlay = new MyItemizedOverlay(drawable, mapView,false);
    //
    //      GeoPoint point1 = new GeoPoint((int)(coupon.getLati() * 1E6),(int)(coupon.getLongi() * 1E6));
    //      OverlayItem overlayItem = new OverlayItem(point1, coupon.getStoreName(), 
    //      coupon.getAddress1()+ " "+ coupon.getAddress2() + " " + coupon.getAddress3() + " " + coupon.getCountry());
    //      itemizedOverlay.addOverlay(overlayItem);
    //
    //      mapOverlays.add(itemizedOverlay);
    //
    //      drawable2 = getResources().getDrawable(R.drawable.marker2);
    //      itemizedOverlay2 = new MyItemizedOverlay(drawable2, mapView,false);
    //
    //      GeoPoint point2 = new GeoPoint((int)(Double.parseDouble(DataUtil.locationInfo.getLatitude()) * 1E6 ), (int)(Double.parseDouble(DataUtil.locationInfo.getLongitude()) * 1E6));
    //      OverlayItem overlayItem4 = new OverlayItem(point2, "Current Location", 
    //      "");      
    //      itemizedOverlay2.addOverlay(overlayItem4);

    //      mapOverlays.add(itemizedOverlay2);
    //       
    //
    //      final MapController mc = mapView.getController();
    //      mc.animateTo(point2);
    //      mc.setZoom(9);
}

From source file:com.login.home.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    getExpandableListView().setOnChildClickListener(this);

    // retrieve children
    SharedPreferences settings = getSharedPreferences("pref_meetmethere", 0);
    ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
    String log = settings.getString("login", "error");
    String pass = settings.getString("password", "error");
    postParameters.add(new BasicNameValuePair("login", log));
    postParameters.add(new BasicNameValuePair("password", pass));
    String xml = XMLfunctions.getXML("http://antoines.goldzoneweb.info/xml_home.php", postParameters);
    Document doc = XMLfunctions.XMLfromString(xml);

    // get invitations
    HashMap<String, String> map = new HashMap<String, String>();
    NodeList nodes = doc.getElementsByTagName("invitation");
    for (int i = 0; i < nodes.getLength(); i++) {
        map = new HashMap<String, String>();
        Element e = (Element) nodes.item(i);
        map.put("willAttend", XMLfunctions.getValue(e, "willAttend"));
        map.put("latitude", XMLfunctions.getValue(e, "latitude"));
        map.put("address", XMLfunctions.getValue(e, "address"));
        map.put("longitude", XMLfunctions.getValue(e, "longitude"));
        map.put("title", XMLfunctions.getValue(e, "title"));
        map.put("id", XMLfunctions.getValue(e, "id"));
        map.put("description", XMLfunctions.getValue(e, "description"));
        map.put("startdate", XMLfunctions.getValue(e, "startdate"));
        map.put("enddate", XMLfunctions.getValue(e, "enddate"));
        invitations.add(map);//  ww w .  j  ava2s.  c  o  m
    }

    // get contact requests
    nodes = doc.getElementsByTagName("contactrequest");
    for (int i = 0; i < nodes.getLength(); i++) {
        map = new HashMap<String, String>();
        Element e = (Element) nodes.item(i);
        map.put("id", XMLfunctions.getValue(e, "id"));
        map.put("yourrequest", XMLfunctions.getValue(e, "yourrequest"));
        map.put("login", XMLfunctions.getValue(e, "login"));
        map.put("title", XMLfunctions.getValue(e, "fullname"));
        contactrequests.add(map);
    }

    // get events
    nodes = doc.getElementsByTagName("event");
    for (int i = 0; i < nodes.getLength(); i++) {
        map = new HashMap<String, String>();
        Element e = (Element) nodes.item(i);
        map.put("willAttend", XMLfunctions.getValue(e, "willAttend"));
        map.put("latitude", XMLfunctions.getValue(e, "latitude"));
        map.put("longitude", XMLfunctions.getValue(e, "longitude"));
        map.put("title", XMLfunctions.getValue(e, "title"));
        map.put("startdate", XMLfunctions.getValue(e, "startdate"));
        map.put("enddate", XMLfunctions.getValue(e, "enddate"));
        map.put("address", XMLfunctions.getValue(e, "address"));

        map.put("id", XMLfunctions.getValue(e, "id"));
        map.put("description", XMLfunctions.getValue(e, "description"));
        map.put("startdate", XMLfunctions.getValue(e, "startdate"));
        map.put("enddate", XMLfunctions.getValue(e, "enddate"));

        events.add(map);
    }

    // Set up our adapter
    mAdapter = new MyExpandableListAdapter(invitations, contactrequests, events);
    setListAdapter(mAdapter);
    registerForContextMenu(getExpandableListView());

    // Makes the list load with the groups expanded
    int count = mAdapter.getGroupCount();
    for (int i = 0; i < count; i++) {
        this.getExpandableListView().expandGroup(i);
    }

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

    this.getExpandableListView().setOnItemClickListener(null);
    this.getExpandableListView().setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition,
                long id) {
            return parent.showContextMenuForChild(v);
        }
    });
}

From source file:com.svpino.longhorn.activities.DashboardActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (Extensions.isPriorHoneycomb()) {
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    }//from  w  ww  .  j a  v a2  s .  c  om

    setContentView(R.layout.activity_dashboard);

    if (Extensions.isPriorHoneycomb()) {
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
    }

    DataProvider.initialize(getApplicationContext());
    DataProvider.registerObserver(this);

    initializeActionBar();

    this.backStack = new BackStack(savedInstanceState);
    this.stockListFragment = (StockListFragment) getSupportFragmentManager()
            .findFragmentById(R.id.stockListFragment);

    displayTermsAndConditions();

    handleIntent(getIntent());
}

From source file:com.janacare.walkmeter.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    vPref = getApplicationContext().getSharedPreferences(ActivityUtils.SHARED_PREFERENCES,
            Context.MODE_PRIVATE);

    // Set the main layout

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.pedometer);//from www.  ja  va  2s.co  m

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

    showStepsToday = (TextView) findViewById(R.id.tvStepsToday);
    showStepsYesterday = (TextView) findViewById(R.id.tvStepsYesterday);
    showStepsHighest = (TextView) findViewById(R.id.tvStepsHighest);
    btnCount = (Button) findViewById(R.id.btnCount);
    tvwindow_title = (TextView) findViewById(R.id.tvwindow_tite);
    tvtodayAfter = (TextView) findViewById(R.id.tvStepsTodayAfter);
    headToday = (TextView) findViewById(R.id.tvStepsToday1);
    headYesterday = (TextView) findViewById(R.id.tvStepsYesterday2);
    headHighest = (TextView) findViewById(R.id.tvStepsHighest3);

    Typeface regular = Typeface.createFromAsset(getAssets(), "Roboto-Regular.ttf");
    Typeface thin = Typeface.createFromAsset(getAssets(), "Roboto-Thin.ttf");

    tvwindow_title.setTypeface(regular);
    showStepsToday.setTypeface(thin);
    showStepsYesterday.setTypeface(thin);
    showStepsHighest.setTypeface(thin);

    tvtodayAfter.setTypeface(regular);
    headToday.setTypeface(regular);
    headYesterday.setTypeface(regular);
    headHighest.setTypeface(regular);
    btnCount.setTypeface(regular);

    int i = vPref.getInt(Constants.KEY_STEPS_TODAY, 0);
    int j = vPref.getInt("steps_yesterday", 0);
    int k = vPref.getInt("minutes_highest", i);
    Log.d("step  in", Long.toString(i));
    Log.d("show steps", "showStepsToday: " + showStepsToday);

    showStepsToday.setText(Integer.toString(i));
    showStepsYesterday.setText(Integer.toString(j));
    showStepsHighest.setText(Integer.toString(k));

    mBroadcastManager = LocalBroadcastManager.getInstance(this);

    // Create a new Intent filter for the broadcast receiver
    mBroadcastFilter = new IntentFilter(ActivityUtils.ACTION_REFRESH_STATUS_LIST);
    mBroadcastFilter.addCategory(ActivityUtils.CATEGORY_LOCATION_SERVICES);

    // Get detection requester and remover objects
    mDetectionRequester = new DetectionRequester(this);
    mDetectionRemover = new DetectionRemover(this);

    // Create a new LogFile object
    mLogFile = LogFile.getInstance(this);

    btnCount.setOnClickListener(new View.OnClickListener() {

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

            Log.d(TAG, "before btn action" + vPref.getBoolean("btnFlag", false));

            Editor editor = vPref.edit();

            if (!vPref.getBoolean("btnFlag", false)) {

                Log.d(TAG, "first time btn pressed");
                if (!servicesConnected()) {
                    return;
                }
                mRequestType = ActivityUtils.REQUEST_TYPE.ADD;
                mDetectionRequester.requestUpdates();
                btnCount.setText("Stop Counting");

                editor.putBoolean("btnFlag", true);
                editor.commit();

                Log.d(TAG, "" + vPref.getBoolean("btnFlag", false));
            } else {

                Log.d(TAG, "in onClick after btn shows stop counting");
                if (!servicesConnected()) {

                    return;
                }

                mRequestType = ActivityUtils.REQUEST_TYPE.REMOVE;
                PendingIntent pendingIntent = mDetectionRequester.getRequestPendingIntent();

                if (pendingIntent == null) {
                    Intent intent = new Intent(getApplicationContext(), ActivityRecognitionIntentService.class);
                    pendingIntent = PendingIntent.getService(getApplicationContext(), 0, intent,
                            PendingIntent.FLAG_UPDATE_CURRENT);
                }

                if (pendingIntent != null) {
                    // Pass the remove request to the remover object
                    mDetectionRemover.removeUpdates(pendingIntent);
                    pendingIntent.cancel();
                }

                editor.putBoolean("btnFlag", false);
                editor.commit();
                btnCount.setText("Start Counting!");
            }

        }
    });

}

From source file:com.oonusave.coupon.MyMapStore.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.store_map_view);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_title);
    mActivity = this;
    settings = getSharedPreferences(PREFS_NAME, 0);

    backButton = (ImageButton) findViewById(R.id.btnLeft);
    backButton.setVisibility(ImageButton.INVISIBLE);
    //backButton.setBackgroundResource(R.drawable.back_button);
    backButton.setBackgroundResource(ImageUtils.getBackIamge());
    backButton.setOnClickListener(this);

    titleBarTextView = (TextView) findViewById(R.id.titleBarTextView);
    titleBarTextView.setText(TitleTextUtils.getMapViewTitleText());
    ((ImageButton) findViewById(R.id.btnRight)).setVisibility(ImageButton.INVISIBLE);
    //      mapView = (MapView) findViewById(R.id.mapview);
    //      mapView.setBuiltInZoomControls(true);
    //      mapOverlays = mapView.getOverlays();

    // first overlay
    //      drawable = getResources().getDrawable(R.drawable.map);
    //      itemizedOverlay = new MyItemizedOverlay(drawable, mapView,true);
    ////  w ww.  j a  va 2  s. co m
    //
    //      //mapOverlays.add(itemizedOverlay);
    //      drawable2 = getResources().getDrawable(R.drawable.marker2);
    //      itemizedOverlay2 = new MyItemizedOverlay(drawable2, mapView,false);
    //      GeoPoint point2 = new GeoPoint((int)(Double.parseDouble(DataUtil.locationInfo.getLatitude()) * 1E6 ), (int)(Double.parseDouble(DataUtil.locationInfo.getLongitude()) * 1E6));
    //      OverlayItem overlayItem4 = new OverlayItem(point2, "Current Location", 
    //            "");      
    //      itemizedOverlay2.addOverlay(overlayItem4);

    //      mapOverlays.add(itemizedOverlay2);
    //
    //
    //      final MapController mc = mapView.getController();
    //      mc.animateTo(point2);
    //      mc.setZoom(9);
    //
    //      DataUtil.mapScreen = true;
    //      loadStores();

    // Get the location manager
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    // Define the criteria how to select the locatioin provider -> use
    // default
    Criteria criteria = new Criteria();
    Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

    // Initialize the location fields
    if (location != null) {
        System.out.println("Provider " + provider + " has been selected.");
        processOnLocationChanged(location);
    } else {
        //         latituteField.setText("Location not available");
        //         longitudeField.setText("Location not available");
    }
}

From source file:com.casin.activity.HomeDrawerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

    setContentView(R.layout.homedrawer);

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

    name = getIntent().getStringExtra("name");
    role = getIntent().getStringExtra("role");
    loginCount = getIntent().getIntExtra("loginCount", -1);

    // mPlanetTitles = getResources().getStringArray(R.array.planets_array);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);

    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    String[] arrayPerRole;/*  ww w.j  a v a  2  s .  c  o  m*/
    int[] drawablePerRole;

    if (role.equalsIgnoreCase("broker")) {
        arrayPerRole = arrayBrokerData;
        drawablePerRole = brokerDrawableIcons;
    } else if (role.equalsIgnoreCase("admin")) {
        arrayPerRole = arrayAdminData;
        drawablePerRole = brokerDrawableIcons;
    } else {
        //      if(userRole.equalsIgnoreCase("user"))
        arrayPerRole = arrayUserData;
        drawablePerRole = userDrawableIcons;
    }

    // set up the drawer's list view with items and click listener
    mDrawerList.setAdapter(
            new HomeListAdapter(this, R.layout.drawer_list_item, role, arrayPerRole, drawablePerRole));
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    // enable ActionBar app icon to behave as action to toggle nav drawer
    // getActionBar().setHomeButtonEnabled(true);
    /*        getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); 
            getActionBar().setCustomView(R.layout.header_title);
    */ //  getActionBar().setHomeAsUpIndicator(R.drawable.nlogo4);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.game_btn_coin, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */
    ) {
        public void onDrawerClosed(View view) {
            // getActionBar().setTitle(mTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            /*                getActionBar().setTitle(mDrawerTitle);
            */ //  invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    if (savedInstanceState == null) {
        if (role.equalsIgnoreCase("user")) {
            selectItem(0, "Select Game");
        } else {
            selectItem(0, "Profile");
        }
    }

    //check if first login
    if (loginCount < 1) {
        selectItem(1, "Change Password");
        alert("Attention", "Please change your password first.", null, null);
    }
    //initHomeViews();
    initHeaderLayout(name, String.valueOf(BetUtility.getInstance().getBalanceAmount()));

}