diff --git a/app/build.gradle b/app/build.gradle index 7cbee1d..6d7ed83 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "com.odiousapps.weewxweather" minSdkVersion 16 targetSdkVersion 26 - versionCode 3002 - versionName "0.3.2" + versionCode 3004 + versionName "0.3.4" } buildTypes { release { diff --git a/app/src/main/java/com/odiousapps/weewxweather/About.java b/app/src/main/java/com/odiousapps/weewxweather/About.java deleted file mode 100644 index df49bc0..0000000 --- a/app/src/main/java/com/odiousapps/weewxweather/About.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.odiousapps.weewxweather; - -import android.text.Html; -import android.text.method.LinkMovementMethod; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -public class About -{ - View myAbout(LayoutInflater inflater, ViewGroup container) - { - View rootView = inflater.inflate(R.layout.fragment_about, container, false); - TextView tv = rootView.findViewById(R.id.about); - - String lines = "Big thanks to the weeWx project, as this app " + - "wouldn't be possible otherwise.

" + - "Weather Icons from FlatIcon and " + - "is licensed under CC 3.0 BY

" + - "Yahoo! Weather Forecast API

" + - "This app is by OdiousApps."; - - tv.setText(Html.fromHtml(lines)); - tv.setMovementMethod(LinkMovementMethod.getInstance()); - - return rootView; - } -} diff --git a/app/src/main/java/com/odiousapps/weewxweather/MainActivity.java b/app/src/main/java/com/odiousapps/weewxweather/MainActivity.java index e6a79c1..7425b55 100644 --- a/app/src/main/java/com/odiousapps/weewxweather/MainActivity.java +++ b/app/src/main/java/com/odiousapps/weewxweather/MainActivity.java @@ -24,6 +24,8 @@ import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.os.Bundle; +import android.text.Html; +import android.text.method.LinkMovementMethod; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -34,9 +36,11 @@ import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RemoteViews; import android.widget.Spinner; +import android.widget.TextView; import java.io.BufferedReader; import java.io.File; @@ -60,6 +64,8 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte private EditText et1; private Button b1; private Button b2; + private Button b3; + private boolean showSettings = true; private ProgressDialog dialog; @@ -144,6 +150,12 @@ public void onFocusChange(View v, boolean hasFocus) b1 = findViewById(R.id.button); b2 = findViewById(R.id.deleteData); + b3 = findViewById(R.id.aboutButton); + + LinearLayout settingsLayout = findViewById(R.id.settingsLayout); + settingsLayout.setVisibility(View.VISIBLE); + LinearLayout aboutLayout = findViewById(R.id.aboutLayout); + aboutLayout.setVisibility(View.GONE); b1.setOnClickListener(new View.OnClickListener() { @@ -170,6 +182,46 @@ public void onClick(View arg0) checkReally(); } }); + + b3.setOnClickListener(new View.OnClickListener() + { + public void onClick(View arg0) + { + if(showSettings) + { + showSettings = false; + b1.setVisibility(View.INVISIBLE); + b3.setText(R.string.settings2); + + LinearLayout settingsLayout = findViewById(R.id.settingsLayout); + settingsLayout.setVisibility(View.GONE); + LinearLayout aboutLayout = findViewById(R.id.aboutLayout); + aboutLayout.setVisibility(View.VISIBLE); + } else { + showSettings = true; + b1.setVisibility(View.VISIBLE); + b3.setText(R.string.about2); + + LinearLayout aboutLayout = findViewById(R.id.aboutLayout); + aboutLayout.setVisibility(View.GONE); + LinearLayout settingsLayout = findViewById(R.id.settingsLayout); + settingsLayout.setVisibility(View.VISIBLE); + } + + } + }); + + TextView tv = findViewById(R.id.aboutText); + + String lines = "Big thanks to the weeWx project, as this app " + + "wouldn't be possible otherwise.

" + + "Weather Icons from FlatIcon and " + + "is licensed under CC 3.0 BY

" + + "Yahoo! Weather Forecast API

" + + "This app is by OdiousApps."; + + tv.setText(Html.fromHtml(lines)); + tv.setMovementMethod(LinkMovementMethod.getInstance()); } private void hideKeyboard(View view) @@ -212,6 +264,7 @@ public void onClick(DialogInterface dialoginterface, int i) common.RemovePref("LastDownload"); common.RemovePref("LastDownloadTime"); common.RemovePref("radarforecast"); + common.RemovePref("seekBar"); common.commit(); common.context.stopService(new Intent(common.context, myService.class)); @@ -828,7 +881,6 @@ public static class PlaceholderFragment extends Fragment private Forecast forecast; private Webcam webcam; private Custom custom; - private About about; public PlaceholderFragment() {} @@ -893,9 +945,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa } else if(getArguments().getInt(ARG_SECTION_NUMBER) == 5) { custom = new Custom(common); return custom.myCustom(inflater, container); - } else if(getArguments().getInt(ARG_SECTION_NUMBER) == 6) { - about = new About(); - return about.myAbout(inflater, container); } return null; @@ -918,7 +967,7 @@ public Fragment getItem(int position) @Override public int getCount() { - return 6; + return 5; } } } \ No newline at end of file diff --git a/app/src/main/java/com/odiousapps/weewxweather/Stats.java b/app/src/main/java/com/odiousapps/weewxweather/Stats.java index e621370..4600f90 100644 --- a/app/src/main/java/com/odiousapps/weewxweather/Stats.java +++ b/app/src/main/java/com/odiousapps/weewxweather/Stats.java @@ -12,8 +12,11 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.webkit.WebView; +import android.widget.SeekBar; import android.widget.TextView; +import java.text.DecimalFormat; +import java.text.NumberFormat; import java.util.Locale; public class Stats @@ -21,8 +24,9 @@ public class Stats private Common common; private View rootView; private WebView wv; + private SeekBar seekBar; - Stats(Common common) + Stats(Common common) { this.common = common; } @@ -84,6 +88,30 @@ public void onScrollChanged() { } }); + seekBar = rootView.findViewById(R.id.pageZoom); + seekBar.setProgress(common.GetIntPref("seekBar", 10)); + + seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() + { + @Override + public void onProgressChanged(SeekBar seekBar, int i, boolean b) + { + updateFields(); + if(b) + common.SetIntPref("seekBar", i); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) + { + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) + { + } + }); + updateFields(); IntentFilter filter = new IntentFilter(); @@ -212,10 +240,14 @@ private void updateFields() checkFields((TextView)rootView.findViewById(R.id.textView), bits[56]); checkFields((TextView)rootView.findViewById(R.id.textView2), bits[54] + " " + bits[55]); + double percent = (seekBar.getProgress() + 90) / 100.00; + NumberFormat formatter = new DecimalFormat("#0.00"); + String p = formatter.format(percent); + String stmp; StringBuilder sb = new StringBuilder(); - String header = ""; + String header = ""; String footer = ""; sb.append(header); @@ -239,7 +271,7 @@ private void updateFields() "" + convert(bits[42]) + "" + bits[41] + bits[63] + ""; sb.append(stmp); - stmp = "" + bits[25] + bits[61] + " " + bits[32] + " " + convert(bits[33]) + + stmp = "" + bits[19] + bits[61] + " " + bits[32] + " " + convert(bits[33]) + "" + bits[20] + bits[62] + ""; sb.append(stmp); diff --git a/app/src/main/java/com/odiousapps/weewxweather/Weather.java b/app/src/main/java/com/odiousapps/weewxweather/Weather.java index 153d784..d1290a4 100644 --- a/app/src/main/java/com/odiousapps/weewxweather/Weather.java +++ b/app/src/main/java/com/odiousapps/weewxweather/Weather.java @@ -344,8 +344,6 @@ public void run() } Common.LogMessage("done downloading, prompt handler to draw to movie"); - } catch (UnknownHostException e) { - e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 161fb0f..9b89a91 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -52,12 +52,6 @@ android:layout_height="wrap_content" android:text="@string/custom2"/> - - diff --git a/app/src/main/res/layout/fragment_stats.xml b/app/src/main/res/layout/fragment_stats.xml index e37140c..3dd84f9 100644 --- a/app/src/main/res/layout/fragment_stats.xml +++ b/app/src/main/res/layout/fragment_stats.xml @@ -23,6 +23,18 @@ android:layout_height="wrap_content" android:gravity="center"/> + + - + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/nav_header_height" + android:orientation="vertical"> - + android:orientation="vertical" + android:visibility="visible"> + -