diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-02-26 15:51:23 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-02-26 15:51:23 +0100 |
| commit | 5bbd616843079bc7fd24a450a7eab0208845217d (patch) | |
| tree | 2e2e3748e5df2c81e46ff3fce2dd37beeb28d463 | |
| parent | d61479b5a366644d91aea7779e798e1c131f46ea (diff) | |
| download | cgeo-5bbd616843079bc7fd24a450a7eab0208845217d.zip cgeo-5bbd616843079bc7fd24a450a7eab0208845217d.tar.gz cgeo-5bbd616843079bc7fd24a450a7eab0208845217d.tar.bz2 | |
fix #1186: all popup dialog elements shown for all caches
| -rw-r--r-- | main/res/layout/popup.xml | 3 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeopopup.java | 111 |
2 files changed, 49 insertions, 65 deletions
diff --git a/main/res/layout/popup.xml b/main/res/layout/popup.xml index b8b5569..98bd7f9 100644 --- a/main/res/layout/popup.xml +++ b/main/res/layout/popup.xml @@ -20,7 +20,6 @@ android:onClick="goManual" /> </LinearLayout> <ScrollView android:id="@+id/details_list_box" - android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="4dip" @@ -35,7 +34,6 @@ android:orientation="vertical" > </LinearLayout> <LinearLayout android:id="@+id/more_details_box" - android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > @@ -44,7 +42,6 @@ android:text="@string/popup_more" /> </LinearLayout> <LinearLayout android:id="@+id/offline_box" - android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > diff --git a/main/src/cgeo/geocaching/cgeopopup.java b/main/src/cgeo/geocaching/cgeopopup.java index 4898a40..ce6c0ef 100644 --- a/main/src/cgeo/geocaching/cgeopopup.java +++ b/main/src/cgeo/geocaching/cgeopopup.java @@ -31,7 +31,6 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; -import android.widget.ScrollView; import android.widget.TextView; public class cgeopopup extends AbstractActivity { @@ -233,7 +232,6 @@ public class cgeopopup extends AbstractActivity { inflater = getLayoutInflater(); geocode = cache.getGeocode().toUpperCase(); - ((ScrollView) findViewById(R.id.details_list_box)).setVisibility(View.VISIBLE); LinearLayout detailsList = (LinearLayout) findViewById(R.id.details_list); detailsList.removeAllViews(); @@ -385,74 +383,63 @@ public class cgeopopup extends AbstractActivity { } } - final boolean moreDetails = cache.isDetailed(); // more details - if (moreDetails || cache.getType() == CacheType.GC_LIVE_MAP) { - ((LinearLayout) findViewById(R.id.more_details_box)).setVisibility(View.VISIBLE); + Button buttonMore = (Button) findViewById(R.id.more_details); + buttonMore.setOnClickListener(new OnClickListener() { - Button buttonMore = (Button) findViewById(R.id.more_details); - buttonMore.setOnClickListener(new OnClickListener() { + public void onClick(View arg0) { + Intent cachesIntent = new Intent(cgeopopup.this, CacheDetailActivity.class); + cachesIntent.putExtra("geocode", geocode.toUpperCase()); + startActivity(cachesIntent); - public void onClick(View arg0) { - Intent cachesIntent = new Intent(cgeopopup.this, CacheDetailActivity.class); - cachesIntent.putExtra("geocode", geocode.toUpperCase()); - startActivity(cachesIntent); - - finish(); - return; - } - }); - } else { - ((LinearLayout) findViewById(R.id.more_details_box)).setVisibility(View.GONE); - } - - if (moreDetails) { - ((LinearLayout) findViewById(R.id.offline_box)).setVisibility(View.VISIBLE); - - // offline use - final TextView offlineText = (TextView) findViewById(R.id.offline_text); - final Button offlineRefresh = (Button) findViewById(R.id.offline_refresh); - final Button offlineStore = (Button) findViewById(R.id.offline_store); - - if (cache.getListId() > 0) { - long diff = (System.currentTimeMillis() / (60 * 1000)) - (cache.getDetailedUpdate() / (60 * 1000)); // minutes - - String ago = ""; - if (diff < 15) { - ago = res.getString(R.string.cache_offline_time_mins_few); - } else if (diff < 50) { - ago = res.getString(R.string.cache_offline_time_about) + " " + diff + " " + res.getString(R.string.cache_offline_time_mins); - } else if (diff < 90) { - ago = res.getString(R.string.cache_offline_time_about) + " " + res.getString(R.string.cache_offline_time_hour); - } else if (diff < (48 * 60)) { - ago = res.getString(R.string.cache_offline_time_about) + " " + (diff / 60) + " " + res.getString(R.string.cache_offline_time_hours); - } else { - ago = res.getString(R.string.cache_offline_time_about) + " " + (diff / (24 * 60)) + " " + res.getString(R.string.cache_offline_time_days); - } + finish(); + return; + } + }); + + ((LinearLayout) findViewById(R.id.offline_box)).setVisibility(View.VISIBLE); + + // offline use + final TextView offlineText = (TextView) findViewById(R.id.offline_text); + final Button offlineRefresh = (Button) findViewById(R.id.offline_refresh); + final Button offlineStore = (Button) findViewById(R.id.offline_store); + + if (cache.getListId() > 0) { + long diff = (System.currentTimeMillis() / (60 * 1000)) - (cache.getDetailedUpdate() / (60 * 1000)); // minutes + + String ago = ""; + if (diff < 15) { + ago = res.getString(R.string.cache_offline_time_mins_few); + } else if (diff < 50) { + ago = res.getString(R.string.cache_offline_time_about) + " " + diff + " " + res.getString(R.string.cache_offline_time_mins); + } else if (diff < 90) { + ago = res.getString(R.string.cache_offline_time_about) + " " + res.getString(R.string.cache_offline_time_hour); + } else if (diff < (48 * 60)) { + ago = res.getString(R.string.cache_offline_time_about) + " " + (diff / 60) + " " + res.getString(R.string.cache_offline_time_hours); + } else { + ago = res.getString(R.string.cache_offline_time_about) + " " + (diff / (24 * 60)) + " " + res.getString(R.string.cache_offline_time_days); + } - offlineText.setText(res.getString(R.string.cache_offline_stored) + "\n" + ago); + offlineText.setText(res.getString(R.string.cache_offline_stored) + "\n" + ago); - offlineRefresh.setVisibility(View.VISIBLE); - offlineRefresh.setEnabled(true); - offlineRefresh.setOnClickListener(new storeCache()); + offlineRefresh.setVisibility(View.VISIBLE); + offlineRefresh.setEnabled(true); + offlineRefresh.setOnClickListener(new storeCache()); - offlineStore.setText(res.getString(R.string.cache_offline_drop)); - offlineStore.setEnabled(true); - offlineStore.setOnClickListener(new dropCache()); - } else { - offlineText.setText(res.getString(R.string.cache_offline_not_ready)); + offlineStore.setText(res.getString(R.string.cache_offline_drop)); + offlineStore.setEnabled(true); + offlineStore.setOnClickListener(new dropCache()); + } else { + offlineText.setText(res.getString(R.string.cache_offline_not_ready)); - offlineRefresh.setVisibility(View.GONE); - offlineRefresh.setEnabled(false); - offlineRefresh.setOnTouchListener(null); - offlineRefresh.setOnClickListener(null); + offlineRefresh.setVisibility(View.GONE); + offlineRefresh.setEnabled(false); + offlineRefresh.setOnTouchListener(null); + offlineRefresh.setOnClickListener(null); - offlineStore.setText(res.getString(R.string.cache_offline_store)); - offlineStore.setEnabled(true); - offlineStore.setOnClickListener(new storeCache()); - } - } else { - ((LinearLayout) findViewById(R.id.offline_box)).setVisibility(View.GONE); + offlineStore.setText(res.getString(R.string.cache_offline_store)); + offlineStore.setEnabled(true); + offlineStore.setOnClickListener(new storeCache()); } } catch (Exception e) { Log.e(Settings.tag, "cgeopopup.init: " + e.toString()); |
