Example usage for android.widget LinearLayout setVisibility

List of usage examples for android.widget LinearLayout setVisibility

Introduction

In this page you can find the example usage for android.widget LinearLayout setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:org.otempo.view.StationActivity.java

/**
 * Actualiza la parte del layout que visualiza predicciones
 *///from   ww w  .  ja  va2  s  .  c o m
private void updateLayout() {

    final LinearLayout scrolled = findViewById(R.id.scrolled);
    scrolled.removeAllViews();
    final LinearLayout predictedGroup = findViewById(R.id.predictedGroup);
    if (predictedGroup != null) { // en landscape no hay
        predictedGroup.setVisibility(LinearLayout.INVISIBLE);
    }
    final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutUtils.dips(75, this),
            LinearLayout.LayoutParams.WRAP_CONTENT);
    Station currentStation = _stationManager.getStation();
    if (currentStation == null) {
        // Si no hay estacin elegida, nada ms que hacer...
        return;
    }
    final int currentStationId = currentStation.getId();
    if (currentStation.getPredictions().size() > 0) {
        removeDialog(DIALOG_LOADING_ID);
        if (predictedGroup != null) { // en landscape no hay
            final TextView predictionTime = findViewById(R.id.predictionTime);
            predictionTime.setText(getPredictionTimeString(currentStation.getLastCreationDate()));
            predictedGroup.setVisibility(LinearLayout.VISIBLE);
        }
        currentStation.acceptPredictionVisitor(new StationPredictionVisitor() {
            @Override
            public void apply(@NonNull StationShortTermPrediction shortPred, final int index) {
                Calendar predictionDate = shortPred.getDate();
                if (predictionDate == null || !DateUtils.isFromToday(predictionDate)) {
                    return;
                }
                LinearLayout day = new LinearLayout(StationActivity.this);
                day.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View arg0) {
                        showDialog(DIALOG_DAY_COMMENT_MASK + index + currentStationId * MAX_PREDICTED_DAYS);
                    }
                });
                day.setOrientation(LinearLayout.VERTICAL);
                TextView dayName = getDayName(shortPred.getDate());
                day.addView(dayName);
                ImageView morningIcon = new ImageView(StationActivity.this);
                morningIcon.setImageResource(ResourceUtils.getResource(shortPred.getSkyStateMorning(), true));
                day.addView(morningIcon);
                ImageView afternoonIcon = new ImageView(StationActivity.this);
                afternoonIcon
                        .setImageResource(ResourceUtils.getResource(shortPred.getSkyStateAfternoon(), true));
                day.addView(afternoonIcon);
                ImageView nightIcon = new ImageView(StationActivity.this);
                nightIcon.setImageResource(ResourceUtils.getResource(shortPred.getSkyStateNight(), false));
                day.addView(nightIcon);
                TextView temps = new TextView(StationActivity.this);
                temps.setText(shortPred.getMinTemp() + " - " + shortPred.getMaxTemp() + " C");
                temps.setGravity(Gravity.CENTER_HORIZONTAL);
                day.addView(temps);
                if (DateUtils.isToday(predictionDate)) {
                    day.setBackgroundResource(R.drawable.today_bg);
                    temps.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
                    dayName.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
                }
                scrolled.addView(day, params);
            }

            @Override
            public void apply(@NonNull StationMediumTermPrediction medPred, final int index) {
                Calendar predictionDate = medPred.getDate();
                if (predictionDate == null || !DateUtils.isFromToday(predictionDate)) {
                    return;
                }
                LinearLayout day = new LinearLayout(StationActivity.this);
                day.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View arg0) {
                        showDialog(DIALOG_DAY_COMMENT_MASK + index + currentStationId * MAX_PREDICTED_DAYS);
                    }
                });
                day.setOrientation(LinearLayout.VERTICAL);
                TextView dayName = getDayName(medPred.getDate());
                day.addView(dayName);
                ImageView morningIcon = new ImageView(StationActivity.this);
                morningIcon.setImageResource(ResourceUtils.getResource(medPred.getSkyState(), true));
                day.addView(morningIcon);
                TextView temps = new TextView(StationActivity.this);
                temps.setText(medPred.getMinTemp() + " - " + medPred.getMaxTemp() + " C");
                temps.setGravity(Gravity.CENTER_HORIZONTAL);
                temps.setTextColor(Color.WHITE);
                day.addView(temps);
                scrolled.addView(day, params);
            }
        });
    } else {
        // Ahora mostramos el dilogo si hace falta, y sino borramos la marca de skip
        if (_skipDialog) {
            _skipDialog = false;
        } else {
            if (!this.isFinishing()) {
                showDialog(DIALOG_LOADING_ID);
                fetchThenShow(currentStation, false);
            }
        }
    }
}

From source file:org.namelessrom.devicecontrol.appmanager.AppDetailsActivity.java

private void setupPermissionsView() {
    final LinearLayout permissionsView = (LinearLayout) findViewById(R.id.permissions_section);
    final boolean unsupported = Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN;
    if (unsupported) {
        permissionsView.setVisibility(View.GONE);
        return;//from  w  w  w. j  a  va 2s  .  c  o m
    }

    AppSecurityPermissions asp = new AppSecurityPermissions(this, mAppItem.getPackageName());
    // Make the security sections header visible
    LinearLayout securityList = (LinearLayout) findViewById(R.id.security_settings_list);
    securityList.removeAllViews();
    securityList.addView(asp.getPermissionsView());
    // If this app is running under a shared user ID with other apps,
    // update the description to explain this.
    String[] packages = mPm.getPackagesForUid(mAppItem.getApplicationInfo().uid);
    if (packages != null && packages.length > 1) {
        final ArrayList<CharSequence> pnames = new ArrayList<>();
        for (final String pkg : packages) {
            if (mAppItem.getPackageName().equals(pkg)) {
                continue;
            }
            try {
                ApplicationInfo ainfo = mPm.getApplicationInfo(pkg, 0);
                pnames.add(ainfo.loadLabel(mPm));
            } catch (PackageManager.NameNotFoundException ignored) {
            }
        }
        final int N = pnames.size();
        if (N > 0) {
            final Resources res = getResources();
            String appListStr;
            if (N == 1) {
                appListStr = pnames.get(0).toString();
            } else if (N == 2) {
                appListStr = res.getString(R.string.join_two_items, pnames.get(0), pnames.get(1));
            } else {
                appListStr = pnames.get(N - 2).toString();
                for (int i = N - 3; i >= 0; i--) {
                    appListStr = res.getString(
                            i == 0 ? R.string.join_many_items_first : R.string.join_many_items_middle,
                            pnames.get(i), appListStr);
                }
                appListStr = res.getString(R.string.join_many_items_last, appListStr, pnames.get(N - 1));
            }
            final TextView descr = (TextView) findViewById(R.id.security_settings_desc);
            descr.setText(res.getString(R.string.security_settings_desc_multi,
                    mAppItem.getApplicationInfo().loadLabel(mPm), appListStr));
        }
    }

}

From source file:com.zhengde163.netguard.ActivityLog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    //        Util.setTheme(this);
    setTheme(R.style.AppThemeBlue);//ww w.  j  a  va 2s  .  c om
    super.onCreate(savedInstanceState);
    setContentView(R.layout.logging);
    running = true;

    // Action bar
    View actionView = getLayoutInflater().inflate(R.layout.actionlog, null, false);
    //        SwitchCompat swEnabled = (SwitchCompat) actionView.findViewById(R.id.swEnabled);
    ImageView ivEnabled = (ImageView) actionView.findViewById(R.id.ivEnabled);

    getSupportActionBar().setDisplayShowCustomEnabled(true);
    getSupportActionBar().setCustomView(actionView);

    getSupportActionBar().setTitle(R.string.menu_log);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // Get settings
    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    resolve = prefs.getBoolean("resolve", false);
    organization = prefs.getBoolean("organization", false);
    log = prefs.getBoolean("log", false);

    // Show disabled message
    //        TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
    //        tvDisabled.setVisibility(log ? View.GONE : View.VISIBLE);
    final LinearLayout ly = (LinearLayout) findViewById(R.id.lldisable);
    ly.setVisibility(log ? View.GONE : View.VISIBLE);

    ImageView ivClose = (ImageView) findViewById(R.id.ivClose);
    ivClose.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ly.setVisibility(View.GONE);
        }
    });
    // Set enabled switch
    //        swEnabled.setChecked(log);
    if (ivEnabled != null) {
        if (log) {
            ivEnabled.setImageResource(R.drawable.on);
        } else {
            ivEnabled.setImageResource(R.drawable.off);
        }
        ivEnabled.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                log = !log;
                boolean isChecked = log;
                prefs.edit().putBoolean("log", isChecked).apply();

            }
        });
    }
    //        swEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    //            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    //                prefs.edit().putBoolean("log", isChecked).apply();
    //            }
    //        });

    // Listen for preference changes
    prefs.registerOnSharedPreferenceChangeListener(this);

    lvLog = (ListView) findViewById(R.id.lvLog);

    boolean udp = prefs.getBoolean("proto_udp", true);
    boolean tcp = prefs.getBoolean("proto_tcp", true);
    boolean other = prefs.getBoolean("proto_other", true);
    boolean allowed = prefs.getBoolean("traffic_allowed", true);
    boolean blocked = prefs.getBoolean("traffic_blocked", true);

    adapter = new AdapterLog(this, DatabaseHelper.getInstance(this).getLog(udp, tcp, other, allowed, blocked),
            resolve, organization);
    adapter.setFilterQueryProvider(new FilterQueryProvider() {
        public Cursor runQuery(CharSequence constraint) {
            return DatabaseHelper.getInstance(ActivityLog.this).searchLog(constraint.toString());
        }
    });

    lvLog.setAdapter(adapter);

    try {
        vpn4 = InetAddress.getByName(prefs.getString("vpn4", "10.1.10.1"));
        vpn6 = InetAddress.getByName(prefs.getString("vpn6", "fd00:1:fd00:1:fd00:1:fd00:1"));
    } catch (UnknownHostException ex) {
        Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
    }

    lvLog.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            PackageManager pm = getPackageManager();
            Cursor cursor = (Cursor) adapter.getItem(position);
            long time = cursor.getLong(cursor.getColumnIndex("time"));
            int version = cursor.getInt(cursor.getColumnIndex("version"));
            int protocol = cursor.getInt(cursor.getColumnIndex("protocol"));
            final String saddr = cursor.getString(cursor.getColumnIndex("saddr"));
            final int sport = (cursor.isNull(cursor.getColumnIndex("sport")) ? -1
                    : cursor.getInt(cursor.getColumnIndex("sport")));
            final String daddr = cursor.getString(cursor.getColumnIndex("daddr"));
            final int dport = (cursor.isNull(cursor.getColumnIndex("dport")) ? -1
                    : cursor.getInt(cursor.getColumnIndex("dport")));
            final String dname = cursor.getString(cursor.getColumnIndex("dname"));
            final int uid = (cursor.isNull(cursor.getColumnIndex("uid")) ? -1
                    : cursor.getInt(cursor.getColumnIndex("uid")));
            int allowed = (cursor.isNull(cursor.getColumnIndex("allowed")) ? -1
                    : cursor.getInt(cursor.getColumnIndex("allowed")));

            // Get external address
            InetAddress addr = null;
            try {
                addr = InetAddress.getByName(daddr);
            } catch (UnknownHostException ex) {
                Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
            }

            String ip;
            int port;
            if (addr.equals(vpn4) || addr.equals(vpn6)) {
                ip = saddr;
                port = sport;
            } else {
                ip = daddr;
                port = dport;
            }

            // Build popup menu
            PopupMenu popup = new PopupMenu(ActivityLog.this, findViewById(R.id.vwPopupAnchor));
            popup.inflate(R.menu.log);

            // Application name
            if (uid >= 0)
                popup.getMenu().findItem(R.id.menu_application)
                        .setTitle(TextUtils.join(", ", Util.getApplicationNames(uid, ActivityLog.this)));
            else
                popup.getMenu().removeItem(R.id.menu_application);

            // Destination IP
            popup.getMenu().findItem(R.id.menu_protocol)
                    .setTitle(Util.getProtocolName(protocol, version, false));

            // Whois
            final Intent lookupIP = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://www.tcpiputils.com/whois-lookup/" + ip));
            if (pm.resolveActivity(lookupIP, 0) == null)
                popup.getMenu().removeItem(R.id.menu_whois);
            else
                popup.getMenu().findItem(R.id.menu_whois).setTitle(getString(R.string.title_log_whois, ip));

            // Lookup port
            final Intent lookupPort = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://www.speedguide.net/port.php?port=" + port));
            if (port <= 0 || pm.resolveActivity(lookupPort, 0) == null)
                popup.getMenu().removeItem(R.id.menu_port);
            else
                popup.getMenu().findItem(R.id.menu_port).setTitle(getString(R.string.title_log_port, port));

            if (!prefs.getBoolean("filter", false)) {
                popup.getMenu().removeItem(R.id.menu_allow);
                popup.getMenu().removeItem(R.id.menu_block);
            }

            final Packet packet = new Packet();
            packet.version = version;
            packet.protocol = protocol;
            packet.daddr = daddr;
            packet.dport = dport;
            packet.time = time;
            packet.uid = uid;
            packet.allowed = (allowed > 0);

            // Time
            popup.getMenu().findItem(R.id.menu_time)
                    .setTitle(SimpleDateFormat.getDateTimeInstance().format(time));

            // Handle click
            popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem menuItem) {
                    switch (menuItem.getItemId()) {
                    case R.id.menu_application: {
                        Intent main = new Intent(ActivityLog.this, ActivityMain.class);
                        main.putExtra(ActivityMain.EXTRA_SEARCH, Integer.toString(uid));
                        startActivity(main);
                        return true;
                    }

                    case R.id.menu_whois:
                        startActivity(lookupIP);
                        return true;

                    case R.id.menu_port:
                        startActivity(lookupPort);
                        return true;

                    case R.id.menu_allow:
                        DatabaseHelper.getInstance(ActivityLog.this).updateAccess(packet, dname, 0);
                        ServiceSinkhole.reload("allow host", ActivityLog.this);
                        Intent main = new Intent(ActivityLog.this, ActivityMain.class);
                        main.putExtra(ActivityMain.EXTRA_SEARCH, Integer.toString(uid));
                        startActivity(main);
                        return true;

                    case R.id.menu_block:
                        DatabaseHelper.getInstance(ActivityLog.this).updateAccess(packet, dname, 1);
                        ServiceSinkhole.reload("block host", ActivityLog.this);
                        Intent main1 = new Intent(ActivityLog.this, ActivityMain.class);
                        main1.putExtra(ActivityMain.EXTRA_SEARCH, Integer.toString(uid));
                        startActivity(main1);
                        return true;

                    default:
                        return false;
                    }
                }
            });

            // Show
            popup.show();
        }
    });

    live = true;
}

From source file:com.lloydtorres.stately.nation.OverviewSubFragment.java

/**
 * Sets up colours, etc. for the WA voting indicators, which are identical in all but name.
 * @param holder// w ww  .j a  v  a2 s. c o  m
 * @param content
 * @param vote
 * @param councilId
 */
private void setAssemblyVoteState(LinearLayout holder, TextView content, String vote, int councilId) {
    // Intent to open the ResolutionActivity
    Intent resolutionActivityLaunch = new Intent(getContext(), ResolutionActivity.class);
    resolutionActivityLaunch.putExtra(ResolutionActivity.TARGET_COUNCIL_ID, councilId);
    final Intent fResolution = resolutionActivityLaunch;

    // Colour of the indicator as well as the assembly name
    int stateColour;
    String assemblyName;

    holder.setVisibility(View.VISIBLE);

    switch (councilId) {
    case Assembly.GENERAL_ASSEMBLY:
        assemblyName = getString(R.string.wa_general_assembly);
        break;
    case Assembly.SECURITY_COUNCIL:
        assemblyName = getString(R.string.wa_security_council);
        break;
    default:
        assemblyName = "";
        break;
    }

    // If voting FOR the resolution
    if (getString(R.string.wa_vote_state_for).equals(vote)) {
        stateColour = SparkleHelper.waColours[0];
        content.setText(String.format(getString(R.string.card_overview_wa_vote), assemblyName, vote));
    }
    // If voting AGAINST the resolution
    else if (getString(R.string.wa_vote_state_against).equals(vote)) {
        stateColour = SparkleHelper.waColours[1];
        content.setText(String.format(getString(R.string.card_overview_wa_vote), assemblyName, vote));
    }
    // If no vote yet
    else {
        stateColour = SparkleHelper.waColours[2];
        content.setText(String.format(getString(R.string.card_overview_wa_novote), assemblyName));
    }

    holder.setBackgroundColor(ContextCompat.getColor(getContext(), stateColour));
    holder.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(fResolution);
        }
    });
}

From source file:org.botlibre.sdk.activity.MicConfiguration.java

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

    //set up the view
    setContentView(R.layout.activity_mic_configuration);
    btn = (Button) findViewById(R.id.btnNextTest);
    txt = (TextView) findViewById(R.id.txtMicSt);
    editTextForGoogle = (EditText) findViewById(R.id.googleText);
    editTextSpeech = (EditText) findViewById(R.id.txtSpeech);
    spinOption = (Spinner) findViewById(R.id.spinOptions);
    play = (Button) findViewById(R.id.btnPlayBack);
    micButton = (ImageButton) findViewById(R.id.micButton);
    ckOfflineSpeech = (CheckBox) findViewById(R.id.ckOfflineSpeech);
    ckDebug = (CheckBox) findViewById(R.id.ckDebug);

    //Load data//from ww  w  .j a va 2  s  . c  o m
    ckOfflineSpeech.setChecked(MainActivity.offlineSpeech);
    ckDebug.setChecked(ChatActivity.DEBUG);

    //disabling buttons for recording sound
    play.setEnabled(false);
    //file saved
    outputFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/myrec.3gp";

    //setting the adapter for the dropdown menu
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item,
            new String[] { "Hands Free", "Google", "Test Mic" });
    spinOption.setAdapter(adapter);

    //Creating Speech (Hands Free)
    speech = SpeechRecognizer.createSpeechRecognizer(this);
    speech.setRecognitionListener(this);

    spinOption.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> arg0, View arg1, int pos, long arg3) {
            txt.setText("Status: OFF");

            spinOption.setSelection(pos);
            LinearLayout test1 = (LinearLayout) findViewById(R.id.test1);
            LinearLayout test2 = (LinearLayout) findViewById(R.id.test2);
            LinearLayout test3 = (LinearLayout) findViewById(R.id.test3);
            switch (pos) {
            case 0:
                test1.setVisibility(View.VISIBLE);
                test2.setVisibility(View.GONE);
                test3.setVisibility(View.GONE);
                break;
            case 1:
                test1.setVisibility(View.GONE);
                test3.setVisibility(View.GONE);
                test2.setVisibility(View.VISIBLE);
                break;
            case 2:
                ActivityCompat.requestPermissions(MicConfiguration.this,
                        new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }, 2);
                test1.setVisibility(View.GONE);
                test3.setVisibility(View.VISIBLE);
                test2.setVisibility(View.GONE);
                break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {

        }
    });

    //CheckBox OfflineSpeech
    ckOfflineSpeech.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            SharedPreferences.Editor cookies = MainActivity.current.getPreferences(MODE_PRIVATE).edit();
            if (isChecked) {
                MainActivity.offlineSpeech = true;
                cookies.putBoolean("offlineSpeech", true);
                cookies.commit();
                return;
            }
            //else
            MainActivity.offlineSpeech = false;
            cookies.putBoolean("offlineSpeech", false);
            cookies.commit();
        }
    });
    //CheckBox Debugger
    ckDebug.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            SharedPreferences.Editor cookies = MainActivity.current.getPreferences(MODE_PRIVATE).edit();
            if (isChecked) {
                ChatActivity.DEBUG = true;
                cookies.putBoolean("debug", true);
                cookies.commit();
                return;
            }
            //else
            ChatActivity.DEBUG = false;
            cookies.putBoolean("debug", false);
            cookies.commit();
        }
    });
}

From source file:shetye.prathamesh.notifyme.Utilities.java

public void showView(LinearLayout lview) {
    // get the center for the clipping circle
    int cx = (lview.getLeft() + lview.getRight()) / 2;
    int cy = (lview.getTop() + lview.getBottom()) / 2;
    // get the final radius for the clipping circle
    int finalRadius = Math.max(lview.getWidth(), lview.getHeight());
    // create the animator for this view (the start radius is zero)
    Animator anim = ViewAnimationUtils.createCircularReveal(lview, cx, cy, 0, finalRadius);
    // make the view visible and start the animation
    lview.setVisibility(View.VISIBLE);
    anim.start();//  w ww.  j  a v a2  s .  c  o  m
}

From source file:com.dm.wallpaper.board.activities.WallpaperBoardActivity.java

private void initNavigationViewHeader() {
    String imageUrl = getResources().getString(R.string.navigation_view_header);
    String titleText = getResources().getString(R.string.navigation_view_header_title);
    View header = mNavigationView.getHeaderView(0);
    HeaderView image = ButterKnife.findById(header, R.id.header_image);
    LinearLayout container = ButterKnife.findById(header, R.id.header_title_container);
    TextView title = ButterKnife.findById(header, R.id.header_title);
    TextView version = ButterKnife.findById(header, R.id.header_version);

    Point point = getNavigationViewHeaderStyle(getResources().getString(R.string.navigation_view_header_style));
    image.setRatio(point.x, point.y);//from   ww  w  .  j av  a 2  s  .c o  m

    if (titleText.length() == 0) {
        container.setVisibility(View.GONE);
    } else {
        title.setText(titleText);
        try {
            String versionText = "v" + getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
            version.setText(versionText);
        } catch (Exception ignored) {
        }
    }

    if (ColorHelper.isValidColor(imageUrl)) {
        image.setBackgroundColor(Color.parseColor(imageUrl));
        return;
    }

    if (!URLUtil.isValidUrl(imageUrl)) {
        imageUrl = "drawable://" + DrawableHelper.getResourceId(this, imageUrl);
    }

    ImageLoader.getInstance().displayImage(imageUrl, new ImageViewAware(image),
            ImageConfig.getDefaultImageOptions(), new ImageSize(720, 720), null, null);
}

From source file:at.alladin.rmbt.android.adapter.result.RMBTResultPagerAdapter.java

/**
 * // ww  w.ja v  a2s  .c  o m
 * @param view
 */
private void displayResult(View view, LayoutInflater inflater, ViewGroup vg) {
    /*
     final Button shareButton = (Button) view.findViewById(R.id.resultButtonShare);
     if (shareButton != null)
    shareButton.setEnabled(false);
    */

    //final LinearLayout measurementLayout = (LinearLayout) view.findViewById(R.id.resultMeasurementList);
    measurementLayout = (LinearLayout) view.findViewById(R.id.resultMeasurementList);
    measurementLayout.setVisibility(View.GONE);

    final LinearLayout resultLayout = (LinearLayout) view.findViewById(R.id.result_layout);
    resultLayout.setVisibility(View.INVISIBLE);

    final LinearLayout netLayout = (LinearLayout) view.findViewById(R.id.resultNetList);
    netLayout.setVisibility(View.GONE);

    final TextView measurementHeader = (TextView) view.findViewById(R.id.resultMeasurement);
    measurementHeader.setVisibility(View.GONE);

    final TextView netHeader = (TextView) view.findViewById(R.id.resultNet);
    netHeader.setVisibility(View.GONE);

    final TextView emptyView = (TextView) view.findViewById(R.id.infoText);
    emptyView.setVisibility(View.GONE);
    final float scale = activity.getResources().getDisplayMetrics().density;

    final ProgressBar progessBar = (ProgressBar) view.findViewById(R.id.progressBar);

    if (testResult != null && testResult.length() > 0) {

        JSONObject resultListItem;

        try {
            resultListItem = testResult.getJSONObject(0);

            openTestUuid = resultListItem.optString("open_test_uuid");
            if (graphView != null) {
                graphView.setOpenTestUuid(openTestUuid);
                graphView.initialize(graphViewEndTaskListener);
            }

            JSONObject testResultItem;
            try {
                testResultItem = testResult.getJSONObject(0);
                if (testResultItem.has("geo_lat") && testResultItem.has("geo_long") && !hasMap) {
                    hasMap = true;
                    if (dataChangedListener != null) {
                        dataChangedListener.onChange(false, true, "HAS_MAP");
                    }
                    notifyDataSetChanged();
                } else if (!testResultItem.has("geo_lat") && !testResultItem.has("geo_long") && hasMap) {
                    System.out.println("hasMap = " + hasMap);
                    hasMap = false;
                    if (dataChangedListener != null) {
                        dataChangedListener.onChange(true, false, "HAS_MAP");
                    }
                    notifyDataSetChanged();
                }
            } catch (JSONException e) {
                hasMap = false;
                e.printStackTrace();
            }

            if (completeListener != null) {
                completeListener.onComplete(OnCompleteListener.DATA_LOADED, this);
            }

            final JSONArray measurementArray = resultListItem.getJSONArray("measurement");

            final JSONArray netArray = resultListItem.getJSONArray("net");

            final int leftRightDiv = Helperfunctions.dpToPx(0, scale);
            final int topBottomDiv = Helperfunctions.dpToPx(0, scale);
            final int heightDiv = Helperfunctions.dpToPx(1, scale);

            for (int i = 0; i < measurementArray.length(); i++) {

                final View measurementItemView = inflater.inflate(R.layout.classification_list_item, vg, false);

                final JSONObject singleItem = measurementArray.getJSONObject(i);

                final TextView itemTitle = (TextView) measurementItemView
                        .findViewById(R.id.classification_item_title);
                itemTitle.setText(singleItem.getString("title"));

                final ImageView itemClassification = (ImageView) measurementItemView
                        .findViewById(R.id.classification_item_color);
                itemClassification.setImageResource(
                        Helperfunctions.getClassificationColor(singleItem.getInt("classification")));

                itemClassification.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        activity.showHelp(R.string.url_help_result, false);
                    }
                });

                final TextView itemValue = (TextView) measurementItemView
                        .findViewById(R.id.classification_item_value);
                itemValue.setText(singleItem.getString("value"));

                measurementLayout.addView(measurementItemView);

                final View divider = new View(activity);
                divider.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv, 1));
                divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);

                divider.setBackgroundResource(R.drawable.bg_trans_light_10);

                measurementLayout.addView(divider);

                measurementLayout.invalidate();
            }

            for (int i = 0; i < netArray.length(); i++) {

                final JSONObject singleItem = netArray.getJSONObject(i);

                addResultListItem(singleItem.getString("title"), singleItem.optString("value", null),
                        netLayout);
            }

            addQoSResultItem();

        } catch (final JSONException e) {
            e.printStackTrace();
        }

        progessBar.setVisibility(View.GONE);
        emptyView.setVisibility(View.GONE);

        resultLayout.setVisibility(View.VISIBLE);
        measurementHeader.setVisibility(View.VISIBLE);
        netHeader.setVisibility(View.VISIBLE);

        measurementLayout.setVisibility(View.VISIBLE);
        netLayout.setVisibility(View.VISIBLE);

    } else {
        Log.i(DEBUG_TAG, "LEERE LISTE");
        progessBar.setVisibility(View.GONE);
        emptyView.setVisibility(View.VISIBLE);
        emptyView.setText(activity.getString(R.string.error_no_data));
        emptyView.invalidate();
    }
}

From source file:com.zainsoft.ramzantimetable.QiblaActivity.java

private void requestForValidationOfQibla() {
    // TextView textView = (TextView)
    // findViewById(R.id.location_text_line1);
    TextView textView2 = (TextView) findViewById(R.id.location_text_line2);
    ImageView arrow = ((ImageView) findViewById(R.id.arrowImage));
    ImageView compass = ((ImageView) findViewById(R.id.compassImage));
    ImageView frame = ((ImageView) findViewById(R.id.frameImage));
    FrameLayout qiblaFrame = ((FrameLayout) findViewById(R.id.qiblaLayout));
    LinearLayout noLocationLayout = ((LinearLayout) findViewById(R.id.noLocationLayout));

    if (faceUp && (gpsLocationFound || currentLocation != null)) {
        textView2.setVisibility(View.VISIBLE);
        textView2.setText(location_line2);
        ((LinearLayout) findViewById(R.id.textLayout)).setVisibility(View.VISIBLE);
        noLocationLayout.setVisibility(View.INVISIBLE);
        qiblaFrame.setVisibility(View.VISIBLE);
        arrow.setVisibility(View.VISIBLE);
        compass.setVisibility(View.VISIBLE);
        frame.setVisibility(View.VISIBLE);
    } else {//from  w ww .jav  a 2s. c o  m
        if (!faceUp) {
            onScreenDown();
        } else if (!(gpsLocationFound || currentLocation != null)) {
            onGPSOn();
        }
    }
}

From source file:cz.muni.fi.japanesedictionary.fragments.DisplayTranslation.java

public void displayNote(String note) {
    LinearLayout container = (LinearLayout) getActivity().findViewById(R.id.translation_note_container);
    if (container != null) {
        if (note == null || note.length() == 0) {
            container.setVisibility(View.GONE);
        } else {/*from  ww w.  j  a  va  2  s.  c  o m*/
            container.setVisibility(View.VISIBLE);
        }
        TextView textView = (TextView) getActivity().findViewById(R.id.translation_note_text);
        if (textView != null) {
            textView.setText(note);
        }
    }
}