Example usage for android.view Display getWidth

List of usage examples for android.view Display getWidth

Introduction

In this page you can find the example usage for android.view Display getWidth.

Prototype

@Deprecated
public int getWidth() 

Source Link

Usage

From source file:com.farmerbb.taskbar.service.StartMenuService.java

@SuppressWarnings("deprecation")
private void openContextMenu(final int[] location) {
    LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.HIDE_START_MENU"));

    new Handler().postDelayed(() -> {
        SharedPreferences pref = U.getSharedPreferences(StartMenuService.this);
        Intent intent = null;//from w  w w  .  j  a  va 2s .  com

        switch (pref.getString("theme", "light")) {
        case "light":
            intent = new Intent(StartMenuService.this, ContextMenuActivity.class);
            break;
        case "dark":
            intent = new Intent(StartMenuService.this, ContextMenuActivityDark.class);
            break;
        }

        if (intent != null) {
            intent.putExtra("launched_from_start_menu", true);
            intent.putExtra("is_overflow_menu", true);
            intent.putExtra("x", location[0]);
            intent.putExtra("y", location[1]);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
                && FreeformHackHelper.getInstance().isInFreeformWorkspace()) {
            DisplayManager dm = (DisplayManager) getSystemService(DISPLAY_SERVICE);
            Display display = dm.getDisplay(Display.DEFAULT_DISPLAY);

            if (intent != null && U.isOPreview())
                intent.putExtra("context_menu_fix", true);

            startActivity(intent, U.getActivityOptions(ApplicationType.CONTEXT_MENU)
                    .setLaunchBounds(new Rect(0, 0, display.getWidth(), display.getHeight())).toBundle());
        } else
            startActivity(intent);
    }, shouldDelay() ? 100 : 0);
}

From source file:com.bitants.wally.activities.ImageDetailsActivity.java

private Size fitToWidthAndKeepRatio(int width, int height) {
    WindowManager win = getWindowManager();
    Display d = win.getDefaultDisplay();
    int displayWidth = d.getWidth(); // Width of the actual device

    int fittedHeight = height;
    int fittedWidth = width;

    fittedHeight = displayWidth * fittedHeight / fittedWidth;
    fittedWidth = displayWidth;/*  w  w  w  . ja v a2 s .c  o  m*/

    return new Size(fittedWidth, fittedHeight);
}

From source file:hr.foicore.varazdinlandmarksdemo.POIMapActivity.java

@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void lockOrientation() {
    Display display = POIMapActivity.this.getWindowManager().getDefaultDisplay();
    int rotation = display.getRotation();
    int height;//from  w  ww.j a  v  a  2 s . c  om
    int width;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) {
        height = display.getHeight();
        width = display.getWidth();
    } else {
        Point size = new Point();
        display.getSize(size);
        height = size.y;
        width = size.x;
    }
    switch (rotation) {
    case Surface.ROTATION_90:
        if (width > height)
            POIMapActivity.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        else
            POIMapActivity.this.setRequestedOrientation(9/* reversePortait */);
        break;
    case Surface.ROTATION_180:
        if (height > width)
            POIMapActivity.this.setRequestedOrientation(9/* reversePortait */);
        else
            POIMapActivity.this.setRequestedOrientation(8/* reverseLandscape */);
        break;
    case Surface.ROTATION_270:
        if (width > height)
            POIMapActivity.this.setRequestedOrientation(8/* reverseLandscape */);
        else
            POIMapActivity.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;
    default:
        if (height > width)
            POIMapActivity.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        else
            POIMapActivity.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }
}

From source file:com.facebook.android.friendsmash.GameFragment.java

@SuppressWarnings({ "deprecation" })
@TargetApi(13)/*  w w w . j  a v a 2  s  . c om*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.fragment_game, parent, false);

    gameFrame = (FrameLayout) v.findViewById(R.id.gameFrame);
    progressContainer = (FrameLayout) v.findViewById(R.id.progressContainer);
    smashPlayerNameTextView = (TextView) v.findViewById(R.id.smashPlayerNameTextView);
    scoreTextView = (TextView) v.findViewById(R.id.scoreTextView);
    livesContainer = (LinearLayout) v.findViewById(R.id.livesContainer);

    // Set the progressContainer as invisible by default
    progressContainer.setVisibility(View.INVISIBLE);

    // Set the icon width (for the images to be smashed)
    setIconWidth(getResources().getDimensionPixelSize(R.dimen.icon_width));

    // Set the screen dimensions
    WindowManager wm = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    if (Build.VERSION.SDK_INT >= 13) {
        Point size = new Point();
        display.getSize(size);
        setScreenWidth(size.x);
        setScreenHeight(size.y);
    } else {
        setScreenWidth(display.getWidth());
        setScreenHeight(display.getHeight());
    }

    // Always keep the Action Bar hidden
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getActivity().getActionBar().hide();
    }

    // Instantiate the fireImageTask for future fired images
    fireImageTask = new Runnable() {
        public void run() {
            spawnImage(false);
        }
    };

    // Refresh the score board
    setScore(getScore());

    // Refresh the lives
    setLives(getLives());

    // Note: Images will start firing in the onResume method below

    return v;
}

From source file:com.mobilyzer.util.PhoneUtils.java

/**
 * Returns true if the phone is in landscape mode.
 *///from  ww  w  .  j  av  a2 s. c o m
public boolean isLandscape() {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    return display.getWidth() > display.getHeight();
}

From source file:org.navitproject.navit.Navit.java

/** Called when the activity is first created. */
@Override/* ww  w  . ja v a 2s  .  com*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    else
        this.getActionBar().hide();

    dialogs = new NavitDialogs(this);

    NavitResources = getResources();

    // only take arguments here, onResume gets called all the time (e.g. when screenblanks, etc.)
    Navit.startup_intent = this.getIntent();
    // hack! Remember time stamps, and only allow 4 secs. later in onResume to set target!
    Navit.startup_intent_timestamp = System.currentTimeMillis();
    Log.e("Navit", "**1**A " + startup_intent.getAction());
    Log.e("Navit", "**1**D " + startup_intent.getDataString());

    // init translated text
    NavitTextTranslations.init();

    // NOTIFICATION
    // Setup the status bar notification      
    // This notification is removed in the exit() function
    NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
    Notification NavitNotification = new Notification(R.drawable.ic_notify,
            getString(R.string.notification_ticker), System.currentTimeMillis()); // Create a new notification, with the text string to show when the notification first appears
    PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);
    //      FIXME : needs a fix for sdk 23
    //      NavitNotification.setLatestEventInfo(getApplicationContext(), "Navit", getString(R.string.notification_event_default), appIntent);   // Set the text in the notification
    //      NavitNotification.flags|=Notification.FLAG_ONGOING_EVENT;   // Ensure that the notification appears in Ongoing
    //      nm.notify(R.string.app_name, NavitNotification);   // Set the notification

    // Status and navigation bar sizes
    // These are platform defaults and do not change with rotation, but we have to figure out which ones apply
    // (is the navigation bar visible? on the side or at the bottom?)
    Resources resources = getResources();
    int shid = resources.getIdentifier("status_bar_height", "dimen", "android");
    int adhid = resources.getIdentifier("action_bar_default_height", "dimen", "android");
    int nhid = resources.getIdentifier("navigation_bar_height", "dimen", "android");
    int nhlid = resources.getIdentifier("navigation_bar_height_landscape", "dimen", "android");
    int nwid = resources.getIdentifier("navigation_bar_width", "dimen", "android");
    status_bar_height = (shid > 0) ? resources.getDimensionPixelSize(shid) : 0;
    action_bar_default_height = (adhid > 0) ? resources.getDimensionPixelSize(adhid) : 0;
    navigation_bar_height = (nhid > 0) ? resources.getDimensionPixelSize(nhid) : 0;
    navigation_bar_height_landscape = (nhlid > 0) ? resources.getDimensionPixelSize(nhlid) : 0;
    navigation_bar_width = (nwid > 0) ? resources.getDimensionPixelSize(nwid) : 0;
    Log.d(TAG, String.format(
            "status_bar_height=%d, action_bar_default_height=%d, navigation_bar_height=%d, navigation_bar_height_landscape=%d, navigation_bar_width=%d",
            status_bar_height, action_bar_default_height, navigation_bar_height,
            navigation_bar_height_landscape, navigation_bar_width));
    if ((ContextCompat.checkSelfPermission(this,
            Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
            || (ContextCompat.checkSelfPermission(this,
                    Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
        Log.d(TAG, "ask for permission(s)");
        ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE,
                Manifest.permission.ACCESS_FINE_LOCATION }, MY_PERMISSIONS_REQUEST_ALL);
    }
    // get the local language -------------
    Locale locale = java.util.Locale.getDefault();
    String lang = locale.getLanguage();
    String langu = lang;
    String langc = lang;
    Log.e("Navit", "lang=" + lang);
    int pos = langu.indexOf('_');
    if (pos != -1) {
        langc = langu.substring(0, pos);
        NavitLanguage = langc + langu.substring(pos).toUpperCase(locale);
        Log.e("Navit", "substring lang " + NavitLanguage.substring(pos).toUpperCase(locale));
        // set lang. for translation
        NavitTextTranslations.main_language = langc;
        NavitTextTranslations.sub_language = NavitLanguage.substring(pos).toUpperCase(locale);
    } else {
        String country = locale.getCountry();
        Log.e("Navit", "Country1 " + country);
        Log.e("Navit", "Country2 " + country.toUpperCase(locale));
        NavitLanguage = langc + "_" + country.toUpperCase(locale);
        // set lang. for translation
        NavitTextTranslations.main_language = langc;
        NavitTextTranslations.sub_language = country.toUpperCase(locale);
    }
    Log.e("Navit", "Language " + lang);

    SharedPreferences prefs = getSharedPreferences(NAVIT_PREFS, MODE_PRIVATE);
    map_filename_path = prefs.getString("filenamePath",
            Environment.getExternalStorageDirectory().getPath() + "/navit/");

    // make sure the new path for the navitmap.bin file(s) exist!!
    File navit_maps_dir = new File(map_filename_path);
    navit_maps_dir.mkdirs();

    // make sure the share dir exists
    File navit_data_share_dir = new File(NAVIT_DATA_SHARE_DIR);
    navit_data_share_dir.mkdirs();

    Display display_ = getWindowManager().getDefaultDisplay();
    int width_ = display_.getWidth();
    int height_ = display_.getHeight();
    metrics = new DisplayMetrics();
    display_.getMetrics(Navit.metrics);
    int densityDpi = (int) ((Navit.metrics.density * 160) - .5f);
    Log.e("Navit", "Navit -> pixels x=" + width_ + " pixels y=" + height_);
    Log.e("Navit", "Navit -> dpi=" + densityDpi);
    Log.e("Navit", "Navit -> density=" + Navit.metrics.density);
    Log.e("Navit", "Navit -> scaledDensity=" + Navit.metrics.scaledDensity);

    ActivityResults = new NavitActivityResult[16];
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "NavitDoNotDimScreen");

    if (!extractRes(langc, NAVIT_DATA_DIR + "/locale/" + langc + "/LC_MESSAGES/navit.mo")) {
        Log.e("Navit", "Failed to extract language resource " + langc);
    }

    if (densityDpi <= 120) {
        my_display_density = "ldpi";
    } else if (densityDpi <= 160) {
        my_display_density = "mdpi";
    } else if (densityDpi < 240) {
        my_display_density = "hdpi";
    } else if (densityDpi < 320) {
        my_display_density = "xhdpi";
    } else if (densityDpi < 480) {
        my_display_density = "xxhdpi";
    } else if (densityDpi < 640) {
        my_display_density = "xxxhdpi";
    } else {
        Log.e("Navit", "found device of very high density (" + densityDpi + ")");
        Log.e("Navit", "using xxxhdpi values");
        my_display_density = "xxxhdpi";
    }

    if (!extractRes("navit" + my_display_density, NAVIT_DATA_DIR + "/share/navit.xml")) {
        Log.e("Navit", "Failed to extract navit.xml for " + my_display_density);
    }

    // --> dont use android.os.Build.VERSION.SDK_INT, needs API >= 4
    Log.e("Navit", "android.os.Build.VERSION.SDK_INT=" + Integer.valueOf(android.os.Build.VERSION.SDK));
    NavitMain(this, NavitLanguage, Integer.valueOf(android.os.Build.VERSION.SDK), my_display_density,
            NAVIT_DATA_DIR + "/bin/navit", map_filename_path);

    showInfos();

    Navit.mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
}

From source file:com.google.android.apps.mytracks.TrackListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
    setContentView(R.layout.track_list);

    AnalyticsUtils.sendPageViews(this, this.getLocalClassName() + "/create");

    ApiAdapterFactory.getApiAdapter().hideActionBar(this);

    Display display = getWindowManager().getDefaultDisplay();
    boolean devicesZ = display.getWidth() > 720 || display.getHeight() > 720;
    if (devicesZ) {
        // Disable the Keyboard help link
        View v = findViewById(R.id.help_keyboard_q);
        if (v != null)
            v.setVisibility(View.GONE);
        v = findViewById(R.id.help_keyboard_a);
        if (v != null)
            v.setVisibility(View.GONE);
    }//from www .  ja  v a2  s.  c  o m
    trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, bindChangedCallback);

    SharedPreferences sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
    sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
    sharedPreferenceChangeListener.onSharedPreferenceChanged(sharedPreferences, null);

    trackController = new TrackController(this, trackRecordingServiceConnection, true, recordListener,
            stopListener);

    // START MOD
    ImageButton helpButton = (ImageButton) findViewById(R.id.listBtnBarHelp);
    if (helpButton != null)
        helpButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = IntentUtils.newIntent(TrackListActivity.this, HelpActivity.class);
                startActivity(intent);
            }
        });
    /*
     * Record = Pause and Stop managed by track controller ImageButton
     * recordButton = (ImageButton) findViewById(R.id.listBtnBarRecord);
     * recordButton.setOnClickListener(recordListener); ImageButton stopButton =
     * (ImageButton) findViewById(R.id.listBtnBarStop);
     * stopButton.setOnClickListener(stopListener);
     */
    ImageButton searchButton = (ImageButton) findViewById(R.id.listBtnBarSearch);
    if (searchButton != null)
        searchButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {

                onSearchRequested();
            }
        });
    ImageButton settingsButton = (ImageButton) findViewById(R.id.listBtnBarSettings);
    if (settingsButton != null)
        settingsButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = IntentUtils.newIntent(TrackListActivity.this, SettingsActivity.class);
                startActivity(intent);
            }
        });

    // END MOD
    listView = (ListView) findViewById(R.id.track_list);
    listView.setEmptyView(findViewById(R.id.track_list_empty_view));
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = IntentUtils.newIntent(TrackListActivity.this, TrackDetailActivity.class)
                    .putExtra(TrackDetailActivity.EXTRA_TRACK_ID, id);
            startActivity(intent);
        }
    });
    resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.list_item, null, 0) {
        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            int idIndex = cursor.getColumnIndex(TracksColumns._ID);
            int iconIndex = cursor.getColumnIndex(TracksColumns.ICON);
            int nameIndex = cursor.getColumnIndex(TracksColumns.NAME);
            int categoryIndex = cursor.getColumnIndex(TracksColumns.CATEGORY);
            int totalTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALTIME);
            int totalDistanceIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALDISTANCE);
            int startTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.STARTTIME);
            int descriptionIndex = cursor.getColumnIndex(TracksColumns.DESCRIPTION);

            boolean isRecording = cursor.getLong(idIndex) == recordingTrackId;
            int iconId = TrackIconUtils.getIconDrawable(cursor.getString(iconIndex));
            String name = cursor.getString(nameIndex);
            String totalTime = StringUtils.formatElapsedTime(cursor.getLong(totalTimeIndex));
            String totalDistance = StringUtils.formatDistance(TrackListActivity.this,
                    cursor.getDouble(totalDistanceIndex), metricUnits);
            long startTime = cursor.getLong(startTimeIndex);
            String startTimeDisplay = StringUtils.formatDateTime(context, startTime).equals(name) ? null
                    : StringUtils.formatRelativeDateTime(context, startTime);

            ListItemUtils.setListItem(TrackListActivity.this, view, isRecording, recordingTrackPaused, iconId,
                    R.string.icon_track, name, cursor.getString(categoryIndex), totalTime, totalDistance,
                    startTimeDisplay, cursor.getString(descriptionIndex));
        }
    };
    listView.setAdapter(resourceCursorAdapter);
    ApiAdapterFactory.getApiAdapter().configureListViewContextualMenu(this, listView,
            contextualActionModeCallback);

    getSupportLoaderManager().initLoader(0, null, new LoaderCallbacks<Cursor>() {
        @Override
        public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
            return new CursorLoader(TrackListActivity.this, TracksColumns.CONTENT_URI, PROJECTION, null, null,
                    TracksColumns._ID + " DESC");
        }

        @Override
        public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
            resourceCursorAdapter.swapCursor(cursor);
        }

        @Override
        public void onLoaderReset(Loader<Cursor> loader) {
            resourceCursorAdapter.swapCursor(null);
        }
    });
    trackDataHub = TrackDataHub.newInstance(this);
    if (savedInstanceState != null) {
        startGps = savedInstanceState.getBoolean(START_GPS_KEY);
    } // Test repeated messaging
    if (!started)
        showStartupDialogs();
}

From source file:com.jp.miaulavirtual.DisplayMessageActivity.java

@SuppressWarnings("deprecation")
public void setRestrictedOrientation() {
    /* We don't want change screen orientation */
    //---get the current display info---
    WindowManager wm = getWindowManager();
    Display d = wm.getDefaultDisplay();
    if (d.getWidth() > d.getHeight()) {
        //---change to landscape mode---
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else {//from   w  w  w  .jav  a2 s . co m
        //---change to portrait mode---
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }
}

From source file:org.puder.trs80.EmulatorActivity.java

private void lockOrientation() {
    Display display = getWindowManager().getDefaultDisplay();
    rotation = display.getRotation();/*from   www  .j a  va 2s  .  co  m*/
    int height;
    int width;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) {
        height = display.getHeight();
        width = display.getWidth();
    } else {
        Point size = new Point();
        display.getSize(size);
        height = size.y;
        width = size.x;
    }
    switch (rotation) {
    case Surface.ROTATION_90:
        if (width > height) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        } else {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
        }
        break;
    case Surface.ROTATION_180:
        if (height > width) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
        } else {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
        }
        break;
    case Surface.ROTATION_270:
        if (width > height) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
        } else {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        }
        break;
    default:
        if (height > width) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        } else {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        }
    }
}

From source file:com.dwdesign.tweetings.fragment.StatusFragment.java

@SuppressWarnings("deprecation")
public void displayStatus(final ParcelableStatus status) {
    mStatus = null;// w w  w .jav a 2  s .c  o m
    mImagesPreviewFragment.clear();
    if (status == null || getActivity() == null)
        return;
    mStatus = status;

    final String buffer_authorised = mPreferences.getString(PREFERENCE_KEY_BUFFERAPP_ACCESS_TOKEN, null);

    mMenuBar.inflate(R.menu.menu_status);

    final MenuItem bufferView = mMenuBar.getMenu().findItem(MENU_ADD_TO_BUFFER);
    if (bufferView != null) {
        if (buffer_authorised != null && !buffer_authorised.equals("")) {
            bufferView.setVisible(true);
        } else {
            bufferView.setVisible(false);
        }
    }
    setMenuForStatus(getActivity(), mMenuBar.getMenu(), status);
    mMenuBar.show();

    final boolean is_multiple_account_enabled = getActivatedAccountIds(getActivity()).length > 1;

    updateUserColor();

    mContentScroller
            .setBackgroundResource(is_multiple_account_enabled ? R.drawable.ic_label_account_nopadding : 0);
    if (is_multiple_account_enabled) {
        final Drawable d = mContentScroller.getBackground();
        if (d != null) {
            d.mutate().setColorFilter(getAccountColor(getActivity(), status.account_id),
                    PorterDuff.Mode.MULTIPLY);
            mContentScroller.invalidate();
        }
    }

    mNameView.setText(status.name);
    mScreenNameView.setText("@" + status.screen_name);
    mScreenNameView.setCompoundDrawablesWithIntrinsicBounds(
            getUserTypeIconRes(status.is_verified, status.is_protected), 0, 0, 0);
    mTextView.setText(status.text);

    final TwidereLinkify linkify = new TwidereLinkify(mTextView);
    linkify.setOnLinkClickListener(new OnLinkClickHandler(getActivity(), mAccountId));
    linkify.addAllLinks();
    final boolean is_reply = status.in_reply_to_status_id > 0;
    final String time = formatToLongTimeString(getActivity(), status.status_timestamp);
    final String strTime = "<a href=\"https://twitter.com/" + status.screen_name + "/status/"
            + String.valueOf(status.status_id) + "\">" + time + "</a>";
    final String source_html = status.source;
    if (!isNullOrEmpty(time) && !isNullOrEmpty(source_html)) {
        mTimeAndSourceView.setText(Html.fromHtml(getString(R.string.time_source, strTime, source_html)));
    } else if (isNullOrEmpty(time) && !isNullOrEmpty(source_html)) {
        mTimeAndSourceView.setText(Html.fromHtml(getString(R.string.source, source_html)));
    } else if (!isNullOrEmpty(time) && isNullOrEmpty(source_html)) {
        mTimeAndSourceView.setText(time);
    }
    mTimeAndSourceView.setMovementMethod(LinkMovementMethod.getInstance());
    mInReplyToView.setVisibility(is_reply ? View.VISIBLE : View.GONE);
    mConversationView.setVisibility(is_reply ? View.VISIBLE : View.GONE);
    if (is_reply) {
        mInReplyToView.setText(getString(R.string.in_reply_to, status.in_reply_to_screen_name));

        Display display = getActivity().getWindowManager().getDefaultDisplay();
        int width = display.getWidth(); // deprecated
        int height = display.getHeight(); // deprecated

        int heightOfConversation = (height / 2) - 48 - 44;
        ViewGroup.LayoutParams params = mConversationView.getLayoutParams();
        params.height = heightOfConversation;
        mConversationView.setLayoutParams(params);

        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction ft = null;

        ft = fragmentManager.beginTransaction();

        final Fragment fragment = new ConversationFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, mAccountId);
        args.putLong(INTENT_KEY_STATUS_ID, status.in_reply_to_status_id);
        fragment.setArguments(args);

        ft.replace(R.id.conversation, fragment, getString(R.string.view_conversation));

        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
        ft.commit();

    }
    if (status.play_package != null) {
        mMarketView.setVisibility(View.VISIBLE);
        mPlayInfoTask = new PlayStoreInfoTask();
        mPlayInfoTask.execute();
    } else {
        mMarketView.setVisibility(View.GONE);
    }

    final boolean hires_profile_image = getResources().getBoolean(R.bool.hires_profile_image);
    final String preview_image = hires_profile_image
            ? getBiggerTwitterProfileImage(status.profile_image_url_string)
            : status.profile_image_url_string;
    mLazyImageLoader.displayProfileImage(mProfileImageView, preview_image);
    final List<ImageSpec> images = getImagesInStatus(status.text_html);
    mImagesPreviewContainer.setVisibility(images.size() > 0 ? View.VISIBLE : View.GONE);
    mImagesPreviewFragment.addAll(images);
    mImagesPreviewFragment.update();
    if (mLoadMoreAutomatically == true) {
        mImagesPreviewFragment.show();
    }
    mRetweetedStatusView.setVisibility(status.is_protected ? View.GONE : View.VISIBLE);
    if (status.retweet_id > 0) {
        final boolean display_name = mPreferences.getBoolean(PREFERENCE_KEY_DISPLAY_NAME, false);
        final String retweeted_by = display_name ? status.retweeted_by_name : status.retweeted_by_screen_name;
        mRetweetedStatusView.setText(status.retweet_count > 1
                ? getString(R.string.retweeted_by_with_count, retweeted_by, status.retweet_count - 1)
                : getString(R.string.retweeted_by, retweeted_by));
        mRetweetedStatusView.setVisibility(View.VISIBLE);
    } else {
        mRetweetedStatusView.setVisibility(View.GONE);
        mRetweetedStatusView.setText(R.string.users_retweeted_this);
    }
    mLocationView.setVisibility(ParcelableLocation.isValidLocation(status.location) ? View.VISIBLE : View.GONE);

    if (mLoadMoreAutomatically) {
        showFollowInfo(true);
        showLocationInfo(true);
    } else {
        mFollowIndicator.setVisibility(View.GONE);
    }
}