├── .gitignore ├── .idea ├── codeStyleSettings.xml └── libraries │ ├── com_android_support_appcompat_v7_23_1_1.xml │ ├── com_android_support_support_annotations_23_1_1_jar.xml │ ├── com_android_support_support_v4_23_1_1.xml │ └── org_apache_commons_commons_lang3_3_4_jar.xml ├── BeeCount2.iml ├── README.md ├── beecount ├── .gitignore ├── beecount.iml ├── build.gradle ├── lint.xml ├── proguard-rules.txt └── src │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ ├── com │ │ └── knirirr │ │ │ └── beecount │ │ │ ├── AutoFitText.java │ │ │ ├── BeeCountApplication.java │ │ │ ├── CalculateActivity.java │ │ │ ├── CountLogActivity.java │ │ │ ├── CountOptionsActivity.java │ │ │ ├── CountingActivity.java │ │ │ ├── EditProjectActivity.java │ │ │ ├── ListProjectActivity.java │ │ │ ├── NewCount.java │ │ │ ├── NewProjectActivity.java │ │ │ ├── ProjectListAdapter.java │ │ │ ├── SettingsActivity.java │ │ │ ├── WelcomeActivity.java │ │ │ ├── database │ │ │ ├── Alert.java │ │ │ ├── AlertDataSource.java │ │ │ ├── Count.java │ │ │ ├── CountDataSource.java │ │ │ ├── DbHelper.java │ │ │ ├── Link.java │ │ │ ├── LinkDataSource.java │ │ │ ├── Project.java │ │ │ └── ProjectDataSource.java │ │ │ └── widgets │ │ │ ├── AddAlertWidget.java │ │ │ ├── AlertCreateWidget.java │ │ │ ├── CountEditWidget.java │ │ │ ├── CountingWidget.java │ │ │ ├── EditTitleWidget.java │ │ │ ├── ExistingLinkWidget.java │ │ │ ├── LinkEditWidget.java │ │ │ ├── NotesWidget.java │ │ │ └── OptionsWidget.java │ └── sheetrock │ │ └── panda │ │ └── changelog │ │ └── ChangeLog.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-land-nodpi │ └── beecount_knitting.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-nodpi │ ├── beecount_knitting.png │ ├── minus.png │ └── plus.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── drawable-xxxhdpi │ └── ic_launcher.png │ ├── drawable │ ├── count_background.xml │ ├── list_background.xml │ └── rounded_corner.xml │ ├── layout-land │ ├── activity_calculate.xml │ ├── activity_count_options.xml │ ├── activity_counting.xml │ └── activity_edit_project.xml │ ├── layout-xlarge │ ├── activity_calculate.xml │ ├── activity_count_options.xml │ ├── activity_counting.xml │ └── activity_edit_project.xml │ ├── layout │ ├── activity_calculate.xml │ ├── activity_count_log.xml │ ├── activity_count_options.xml │ ├── activity_counting.xml │ ├── activity_edit_project.xml │ ├── activity_list_project.xml │ ├── activity_new_project.xml │ ├── activity_welcome.xml │ ├── custom_spinner.xml │ ├── listview_project_row.xml │ ├── widget_add_alert.xml │ ├── widget_alert_create.xml │ ├── widget_counting.xml │ ├── widget_edit_count.xml │ ├── widget_edit_title.xml │ ├── widget_existing_link.xml │ ├── widget_link_edit.xml │ ├── widget_notes.xml │ └── widget_options.xml │ ├── menu │ ├── count_options.xml │ ├── counting.xml │ ├── edit_project.xml │ ├── list_project.xml │ ├── new_project.xml │ └── welcome.xml │ ├── raw │ └── changelog.txt │ ├── values-de │ ├── arrays.xml │ └── strings.xml │ ├── values-fr │ ├── arrays.xml │ └── strings.xml │ ├── values-night │ ├── colors.xml │ ├── theme_overlays.xml │ └── themes.xml │ ├── values-w820dp │ └── dimens.xml │ ├── values │ ├── arrays.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ ├── styles.xml │ ├── theme_overlays.xml │ └── themes.xml │ └── xml │ └── preferences.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── metadata └── en-US │ ├── full_description.txt │ ├── images │ ├── icon.png │ └── phoneScreenshots │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ ├── 7.png │ │ ├── 8.png │ │ └── 9.png │ ├── short_description.txt │ └── title.txt └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | local.properties 3 | .idea/* 4 | .DS_Store 5 | beecount/build 6 | build 7 | beecount.db 8 | gradlew.bat 9 | tmp* 10 | beecount/libs/ 11 | beecount/manifest-merger-release-report.txt 12 | beecount/release/ 13 | beecount_orig.db 14 | gradlew.bat 15 | out 16 | projectFilesBackup/ 17 | -------------------------------------------------------------------------------- /.idea/libraries/com_android_support_appcompat_v7_23_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/com_android_support_support_annotations_23_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/com_android_support_support_v4_23_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/org_apache_commons_commons_lang3_3_4_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /BeeCount2.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Information 2 | 3 | This is the second version of BeeCount. The older, "classic" version can be found 4 | in [this repository](https://code.google.com/p/beecount/). This newer version has been 5 | considerably re-written so that the underlying data management and UI code is much easier to 6 | maintain and extend, and the UI has been modernised. 7 | 8 | More information can be found on the [BeeCount home page](http://knirirr.com/beecount). 9 | 10 | ## How to get BeeCount 11 | 12 | BeeCount will disappear from the Play Store on 13/4/25 due to Google's policies (I won't upload 13 | my official ID in order to keep distributing FOSS apps). When this happens BeeCount 14 | will still be accessible via this Github repo. Obtanium will allow you to keep it updated: 15 | 16 | https://obtainium.imranr.dev/ 17 | 18 | Give Obtanium this URL as the source: https://github.com/knirirr/BeeCount 19 | 20 | The version available here via Obtanium is signed with the same certificate as the Google Play 21 | version, so if you're coming from that then other than the minor inconvenience of setting up 22 | Obtanium then there should be no issues. 23 | 24 | Or, you can get BeeCount via Fdroid: 25 | 26 | 27 | Get it on F-Droid 28 | 29 | This is signed with Fdroid's certificate so if you switch to this source from Google Play you'll 30 | need to back up your database, remove BeeCount and reinstall from Fdroid, then restore your data. 31 | Some users are reporting issues with restoring data (I can't pin down which devices are affected) 32 | so it's safer to use Obtanium. 33 | 34 | ## Permissions 35 | 36 | Permission is requested to manage all files so that you can import beecount.db from your Download 37 | folder. BeeCount doesn't access any other files. 38 | 39 | To enable this, open the Permission Manager in your phone's settings and look for apps which 40 | are able to manage files (you may need to tap on a link to "see more apps that can access all 41 | files"). 42 | 43 | ## Help Wanted 44 | 45 | BeeCount has been slightly re-written recently. The main change you'll notice is that the background 46 | image has disappeared and the colour scheme has changed. This is to make maintenance easier as well 47 | as to bring the components up-to-date. 48 | 49 | Assistance is always welcome as I don't usually have much time free to devote to BeeCount work. 50 | Anyone who's willing to look into issues with dumping/restoring the database would be most welcome; 51 | it works for me but some users report problems and it's not clear which versions of Android are 52 | affected. 53 | 54 | ## Licence etc. 55 | 56 | Copyright 2018 Milo Thurston 57 | 58 | Licensed under the Apache License, Version 2.0 (the "License"); 59 | you may not use this file except in compliance with the License. 60 | You may obtain a copy of the License at 61 | 62 | http://www.apache.org/licenses/LICENSE-2.0 63 | 64 | Unless required by applicable law or agreed to in writing, software 65 | distributed under the License is distributed on an "AS IS" BASIS, 66 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 67 | See the License for the specific language governing permissions and 68 | limitations under the License. 69 | 70 | -------------------------------------------------------------------------------- /beecount/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | .DS_Store 3 | /.idea 4 | -------------------------------------------------------------------------------- /beecount/beecount.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /beecount/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | defaultConfig { 5 | minSdkVersion 21 6 | compileSdkVersion 35 7 | targetSdkVersion 35 8 | versionCode 137 9 | } 10 | compileOptions { 11 | sourceCompatibility = 1.8 12 | targetCompatibility = 1.8 13 | } 14 | namespace 'com.knirirr.beecount' 15 | } 16 | 17 | repositories { 18 | mavenCentral() 19 | maven { 20 | url 'https://maven.google.com/' 21 | name 'Google' 22 | } 23 | } 24 | 25 | dependencies { 26 | //compile fileTree(dir: 'libs', include: ['*.jar']) 27 | implementation('org.apache.commons:commons-lang3:3.7') 28 | implementation('androidx.appcompat:appcompat:1.7.0') 29 | implementation('androidx.legacy:legacy-support-v4:1.0.0') 30 | implementation 'com.google.android.material:material:1.12.0' 31 | } 32 | 33 | configurations.implementation { 34 | exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8' 35 | exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7' 36 | } -------------------------------------------------------------------------------- /beecount/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /beecount/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/milo/bin/android-sdk-mac_x86/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} -------------------------------------------------------------------------------- /beecount/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 13 | 17 | 18 | 19 | 20 | 22 | 23 | 31 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 48 | 51 | 52 | 56 | 59 | 60 | 65 | 68 | 69 | 74 | 77 | 78 | 83 | 86 | 87 | 92 | 95 | 96 | 100 | 101 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /beecount/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/BeeCountApplication.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount; 2 | 3 | import static android.app.UiModeManager.MODE_NIGHT_NO; 4 | import static android.app.UiModeManager.MODE_NIGHT_YES; 5 | 6 | import android.app.Application; 7 | import android.app.UiModeManager; 8 | import android.content.Context; 9 | import android.content.SharedPreferences; 10 | import android.graphics.Bitmap; 11 | import android.graphics.BitmapFactory; 12 | import android.graphics.Color; 13 | import android.graphics.Point; 14 | import android.graphics.drawable.BitmapDrawable; 15 | import android.os.Build; 16 | import android.preference.PreferenceManager; 17 | import android.util.Log; 18 | import android.view.Display; 19 | import android.view.WindowManager; 20 | import android.widget.Toast; 21 | 22 | import androidx.appcompat.app.AppCompatDelegate; 23 | 24 | import java.io.File; 25 | 26 | /** 27 | * Created by milo on 14/05/2014. 28 | */ 29 | public class BeeCountApplication extends Application 30 | { 31 | private static String TAG = "BeeCount"; 32 | public BitmapDrawable ob; 33 | private Bitmap bMap; 34 | private static SharedPreferences prefs; 35 | 36 | 37 | @Override 38 | public void onCreate() 39 | { 40 | super.onCreate(); 41 | ob = null; 42 | bMap = null; 43 | try 44 | { 45 | prefs = PreferenceManager.getDefaultSharedPreferences(this); 46 | /* 47 | boolean tastePref = prefs.getBoolean("pref_dark_theme", false); 48 | if (tastePref) { 49 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); 50 | } 51 | else { 52 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); 53 | } 54 | */ 55 | } 56 | catch (Exception e) 57 | { 58 | Log.e(TAG, e.toString()); 59 | } 60 | } 61 | 62 | /* 63 | * The idea here is to keep ob around as a pre-prepared bitmap, only setting it up 64 | * when the user's settings change or when the application starts up. 65 | */ 66 | 67 | public BitmapDrawable getBackground() 68 | { 69 | if (ob == null) 70 | { 71 | return setBackground(); 72 | } 73 | else 74 | { 75 | return ob; 76 | } 77 | } 78 | 79 | public BitmapDrawable setBackground() 80 | { 81 | ob = null; 82 | 83 | String backgroundPref = prefs.getString("pref_back", "default"); 84 | String pictPref = prefs.getString("imagePath", ""); 85 | 86 | Log.e(TAG, "PICTURE: " + pictPref); 87 | 88 | WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE); 89 | Display display = wm.getDefaultDisplay(); 90 | Point size = new Point(); 91 | display.getSize(size); 92 | int width = size.x; 93 | int height = size.y; 94 | 95 | 96 | if (backgroundPref.equals("none")) 97 | { 98 | // boring black screen 99 | bMap = null; 100 | bMap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); 101 | bMap.eraseColor(Color.BLACK); 102 | } 103 | else if (backgroundPref.equals("custom")) 104 | { 105 | if (!(pictPref.equals(""))) 106 | { 107 | if (new File(pictPref).isFile()) 108 | { 109 | /* 110 | * This should hopefully stop crashes caused by large image files. 111 | */ 112 | try 113 | { 114 | BitmapFactory.Options options = new BitmapFactory.Options(); 115 | options.inJustDecodeBounds = false; 116 | options.inPreferredConfig = Bitmap.Config.RGB_565; 117 | options.inDither = true; 118 | bMap = BitmapFactory.decodeFile(pictPref,options); 119 | } 120 | catch (OutOfMemoryError e) 121 | { 122 | Toast.makeText(this, getString(R.string.customTooBig), Toast.LENGTH_SHORT).show(); 123 | bMap = null; 124 | bMap = decodeBitmap(R.drawable.beecount_knitting, width, height); 125 | } 126 | } 127 | else 128 | { 129 | Toast.makeText(this, getString(R.string.customMissing), Toast.LENGTH_SHORT).show(); 130 | bMap = decodeBitmap(R.drawable.beecount_knitting, width, height); 131 | } 132 | } 133 | else 134 | { 135 | Toast.makeText(this,getString(R.string.customNotDefined),Toast.LENGTH_SHORT).show(); 136 | bMap = decodeBitmap(R.drawable.beecount_knitting, width, height); 137 | } 138 | } 139 | else if (backgroundPref.equals("default")) 140 | { 141 | //bMap = BitmapFactory.decodeResource(getResources(), R.drawable.beecount_knitting); 142 | bMap = decodeBitmap(R.drawable.beecount_knitting, width, height); 143 | } 144 | 145 | ob = new BitmapDrawable(bMap); 146 | bMap = null; 147 | return ob; 148 | } 149 | 150 | public static SharedPreferences getPrefs() 151 | { 152 | return prefs; 153 | } 154 | 155 | public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) 156 | { 157 | // Raw height and width of image 158 | final int height = options.outHeight; 159 | final int width = options.outWidth; 160 | int inSampleSize = 1; 161 | 162 | if (height > reqHeight || width > reqWidth) { 163 | 164 | final int halfHeight = height / 2; 165 | final int halfWidth = width / 2; 166 | 167 | // Calculate the largest inSampleSize value that is a power of 2 and keeps both 168 | // height and width larger than the requested height and width. 169 | while ((halfHeight / inSampleSize) > reqHeight 170 | && (halfWidth / inSampleSize) > reqWidth) { 171 | inSampleSize *= 2; 172 | } 173 | } 174 | 175 | return inSampleSize; 176 | } 177 | 178 | public Bitmap decodeBitmap(int resId, int reqWidth, int reqHeight) 179 | { 180 | // First decode with inJustDecodeBounds=true to check dimensions 181 | final BitmapFactory.Options options = new BitmapFactory.Options(); 182 | options.inJustDecodeBounds = true; 183 | BitmapFactory.decodeResource(getResources(), resId, options); 184 | 185 | // Calculate inSampleSize 186 | options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); 187 | 188 | // Decode bitmap with inSampleSize set 189 | options.inJustDecodeBounds = false; 190 | try 191 | { 192 | return BitmapFactory.decodeResource(getResources(), resId, options); 193 | } 194 | catch (OutOfMemoryError e) 195 | { 196 | Toast.makeText(getApplicationContext(), getString(R.string.customTooBig), Toast.LENGTH_SHORT).show(); 197 | return null; 198 | } 199 | } 200 | 201 | } 202 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/CalculateActivity.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount; 2 | 3 | import android.content.SharedPreferences; 4 | import android.os.Bundle; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import androidx.appcompat.app.AppCompatDelegate; 7 | 8 | import android.util.Log; 9 | import android.view.View; 10 | import android.widget.LinearLayout; 11 | import android.widget.ScrollView; 12 | import android.widget.TextView; 13 | import android.widget.Toast; 14 | 15 | import com.knirirr.beecount.database.Project; 16 | import com.knirirr.beecount.database.ProjectDataSource; 17 | import com.knirirr.beecount.widgets.OptionsWidget; 18 | 19 | import org.apache.commons.lang3.StringUtils; 20 | 21 | import java.util.Locale; 22 | 23 | /** 24 | * Created by milo on 25/08/2014. 25 | */ 26 | public class CalculateActivity extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener 27 | { 28 | public static String TAG = "BeeCountCalculateActivity"; 29 | ProjectDataSource projectDataSource; 30 | BeeCountApplication beeCount; 31 | SharedPreferences prefs; 32 | Long project_id; 33 | Project project; 34 | 35 | OptionsWidget spr_widget; // stitches per row 36 | OptionsWidget sti_widget; // stitches to increase 37 | LinearLayout calc_area; 38 | 39 | @Override 40 | protected void onCreate(Bundle savedInstanceState) 41 | { 42 | super.onCreate(savedInstanceState); 43 | setContentView(R.layout.activity_calculate); 44 | 45 | Bundle extras = getIntent().getExtras(); 46 | if(extras !=null) 47 | { 48 | project_id = extras.getLong("project_id"); 49 | } 50 | 51 | projectDataSource = new ProjectDataSource(this); 52 | projectDataSource.open(); 53 | project = projectDataSource.getProject(project_id); 54 | 55 | beeCount = (BeeCountApplication) getApplication(); 56 | //project_id = beeCount.project_id; 57 | prefs = BeeCountApplication.getPrefs(); 58 | prefs.registerOnSharedPreferenceChangeListener(this); 59 | 60 | ScrollView counting_screen = (ScrollView) findViewById(R.id.calcScreen); 61 | //counting_screen.setBackgroundDrawable(beeCount.getBackground()); 62 | 63 | calc_area = (LinearLayout) findViewById(R.id.calc_area); 64 | 65 | spr_widget = new OptionsWidget(this,null); 66 | spr_widget.setInstructions(getString(R.string.stitchTotal)); 67 | spr_widget.setSize(18); 68 | calc_area.addView(spr_widget); 69 | 70 | sti_widget = new OptionsWidget(this,null); 71 | sti_widget.setInstructions(getString(R.string.toIncrease)); 72 | sti_widget.setSize(18); 73 | calc_area.addView(sti_widget); 74 | 75 | } 76 | 77 | /* 78 | These methods respond do the four calculation buttons and insert the appropriate string into 79 | the results display box. 80 | */ 81 | public void performCalculation(View view) 82 | { 83 | TextView results = (TextView) findViewById(R.id.calcResults); 84 | int stitches = spr_widget.getParameterValue(); 85 | int rows = sti_widget.getParameterValue(); 86 | results.setText(""); 87 | String result_string = ""; 88 | 89 | if (stitches == 0 || rows == 0) 90 | { 91 | Toast.makeText(this,getString(R.string.dont_set_zero),Toast.LENGTH_SHORT).show(); 92 | return; 93 | } 94 | 95 | // if the calculation has succeeded... 96 | try 97 | { 98 | int times = stitches / rows; 99 | int remainder = stitches % rows; 100 | int bottom_no = rows - remainder; 101 | int top_no = times + 1; 102 | 103 | result_string += String.format(getString(R.string.increaseOutput),ordinal(times),bottom_no,ordinal(top_no),remainder); 104 | //"Increase every #{times}th stitch #{bottom_no} times, and every #{top_no}th stitch #{remainder} times." 105 | 106 | 107 | } 108 | catch (Exception e) 109 | { 110 | Log.e(TAG, "Calculation exception: " + e.toString()); 111 | result_string = getString(R.string.calcError); 112 | } 113 | 114 | // this should be set no matter what 115 | results.setText(result_string); 116 | 117 | } 118 | 119 | // from http://stackoverflow.com/questions/6810336/is-there-a-library-or-utility-in-java-to-convert-an-integer-to-its-ordinal 120 | public static String ordinal(int i) 121 | { 122 | String language = Locale.getDefault().getLanguage(); 123 | if (language == "fr") 124 | { 125 | return String.valueOf(i) + "e"; 126 | } 127 | else 128 | { 129 | return i % 100 == 11 || i % 100 == 12 || i % 100 == 13 ? i + "th" : i + new String[]{"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"}[i % 10]; 130 | } 131 | } 132 | 133 | // copy the contents of the results box to the project notes and exit this activity 134 | public void saveAndExit(View view) 135 | { 136 | TextView results = (TextView) findViewById(R.id.calcResults); 137 | String result_text = results.getText().toString(); 138 | if (StringUtils.isNotBlank(result_text)) 139 | { 140 | if (StringUtils.isNotBlank(project.notes)) 141 | { 142 | project.notes = project.notes + "\n\n" + result_text; 143 | } 144 | else 145 | { 146 | project.notes = result_text; 147 | } 148 | } 149 | projectDataSource.saveProject(project); 150 | Toast.makeText(this,getString(R.string.updating_with_calc),Toast.LENGTH_SHORT).show(); 151 | super.finish(); 152 | } 153 | 154 | @Override 155 | protected void onResume() 156 | { 157 | super.onResume(); 158 | if (projectDataSource == null) 159 | { 160 | projectDataSource.open(); 161 | } 162 | 163 | } 164 | 165 | @Override 166 | protected void onPause() 167 | { 168 | super.onPause(); 169 | projectDataSource.close(); 170 | } 171 | 172 | public void onSharedPreferenceChanged(SharedPreferences prefs, String key) 173 | { 174 | ScrollView calc_screen = (ScrollView) findViewById(R.id.calcScreen); 175 | calc_screen.setBackgroundDrawable(null); 176 | calc_screen.setBackgroundDrawable(beeCount.setBackground()); 177 | boolean tastePref = prefs.getBoolean("pref_dark_theme", false); 178 | if (tastePref) { 179 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); 180 | } 181 | else { 182 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); 183 | } 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/CountLogActivity.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount; 2 | 3 | import android.os.Bundle; 4 | import android.widget.ScrollView; 5 | import android.widget.TextView; 6 | import androidx.appcompat.app.AppCompatActivity; 7 | 8 | /** 9 | * This activity serves to show the actions performed while counting. Mostly, this was to mitigate possible erroneous 10 | * double-clicks and check the last counts done. 11 | */ 12 | public class CountLogActivity extends AppCompatActivity { 13 | 14 | String projectLogs; 15 | BeeCountApplication beeCount; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_count_log); 21 | 22 | Bundle extras = getIntent().getExtras(); 23 | if (extras != null) { 24 | projectLogs = extras.getString("project_logs"); 25 | } 26 | beeCount = (BeeCountApplication) getApplication(); 27 | ScrollView layout=(ScrollView) findViewById(R.id.countLogLayout); 28 | //layout.setBackground(beeCount.getBackground()); 29 | 30 | TextView countLogTextView = (TextView)findViewById(R.id.countLogTextView); 31 | countLogTextView.setText(projectLogs); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/ListProjectActivity.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount; 2 | 3 | import android.app.ListActivity; 4 | import android.content.Intent; 5 | import android.content.SharedPreferences; 6 | import android.os.Bundle; 7 | import androidx.appcompat.app.AppCompatActivity; 8 | import androidx.appcompat.app.AppCompatDelegate; 9 | 10 | import android.util.Log; 11 | import android.view.Menu; 12 | import android.view.MenuItem; 13 | import android.widget.LinearLayout; 14 | import android.widget.ListView; 15 | 16 | import com.knirirr.beecount.database.Project; 17 | import com.knirirr.beecount.database.ProjectDataSource; 18 | 19 | import java.util.List; 20 | 21 | 22 | public class ListProjectActivity extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener 23 | { 24 | private ProjectDataSource projectDataSource; 25 | private ProjectListAdapter adapter; 26 | private static String TAG = "BeeCountListProjectActivity"; 27 | BeeCountApplication beeCount; 28 | SharedPreferences prefs; 29 | List projects; 30 | ListView list; 31 | private Project p; // a project selected from the list 32 | 33 | /* 34 | * NEEDS LONG PRESS TO DELETE PROJECTS 35 | */ 36 | 37 | @Override 38 | protected void onCreate(Bundle savedInstanceState) 39 | { 40 | super.onCreate(savedInstanceState); 41 | setContentView(R.layout.activity_list_project); 42 | 43 | beeCount = (BeeCountApplication) getApplication(); 44 | prefs = BeeCountApplication.getPrefs(); 45 | prefs.registerOnSharedPreferenceChangeListener(this); 46 | 47 | LinearLayout list_view = (LinearLayout) findViewById(R.id.list_view); 48 | //list_view.setBackgroundDrawable(beeCount.getBackground()); 49 | list = (ListView) findViewById(android.R.id.list); 50 | getSupportActionBar().setTitle(R.string.your_projects); 51 | } 52 | 53 | public void deleteProject(Project p) 54 | { 55 | projectDataSource.deleteProject(p); 56 | showData(); 57 | list.invalidate(); 58 | } 59 | 60 | @Override 61 | protected void onResume() 62 | { 63 | super.onResume(); 64 | projectDataSource = new ProjectDataSource(this); 65 | projectDataSource.open(); 66 | showData(); 67 | } 68 | 69 | @Override 70 | protected void onPause() 71 | { 72 | super.onPause(); 73 | projectDataSource.close(); 74 | } 75 | 76 | private void showData() 77 | { 78 | projects = projectDataSource.getAllProjects(prefs); 79 | adapter = new ProjectListAdapter(this, R.layout.listview_project_row, projects); 80 | ListView lv = (ListView) findViewById(R.id.list); 81 | lv.setAdapter(adapter); 82 | //setListAdapter(adapter); 83 | } 84 | 85 | @Override 86 | public boolean onCreateOptionsMenu(Menu menu) 87 | { 88 | // Inflate the menu; this adds items to the action bar if it is present. 89 | getMenuInflater().inflate(R.menu.list_project, menu); 90 | return true; 91 | } 92 | 93 | @Override 94 | public boolean onOptionsItemSelected(MenuItem item) 95 | { 96 | // Handle action bar item clicks here. The action bar will 97 | // automatically handle clicks on the Home/Up button, so long 98 | // as you specify a parent activity in AndroidManifest.xml. 99 | int id = item.getItemId(); 100 | if (id == R.id.action_settings) 101 | { 102 | startActivity(new Intent(this, SettingsActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); 103 | return true; 104 | } 105 | else if (id == R.id.newProj) 106 | { 107 | startActivity(new Intent(this, NewProjectActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); 108 | return true; 109 | } 110 | return super.onOptionsItemSelected(item); 111 | } 112 | 113 | public void onSharedPreferenceChanged(SharedPreferences prefs, String key) 114 | { 115 | LinearLayout list_view = (LinearLayout) findViewById(R.id.list_view); 116 | //list_view.setBackgroundDrawable(null); 117 | //list_view.setBackgroundDrawable(beeCount.setBackground()); 118 | prefs = BeeCountApplication.getPrefs(); 119 | boolean tastePref = prefs.getBoolean("pref_dark_theme", false); 120 | if (tastePref) { 121 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); 122 | } 123 | else { 124 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/NewCount.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.EditText; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * Created by milo on 12/08/2014. 11 | */ 12 | public class NewCount extends EditText implements Serializable 13 | { 14 | public NewCount(Context context) { 15 | super(context); 16 | } 17 | 18 | public NewCount(Context context, AttributeSet attrs) { 19 | super(context, attrs); 20 | } 21 | 22 | public NewCount(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/ProjectListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount; 2 | 3 | import java.util.List; 4 | 5 | import android.app.Activity; 6 | import android.app.AlertDialog; 7 | import android.content.Context; 8 | import android.content.DialogInterface; 9 | import android.content.Intent; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | import android.widget.ArrayAdapter; 14 | import android.widget.ImageButton; 15 | import android.widget.TextView; 16 | 17 | import com.knirirr.beecount.database.Project; 18 | 19 | public class ProjectListAdapter extends ArrayAdapter 20 | { 21 | private static final String TAG = "BeeCountProjectListAdapter"; 22 | Context context; 23 | int layoutResourceId; 24 | List projects = null; 25 | private Context mContext; 26 | private BeeCountApplication beeCount; 27 | private Project p; 28 | 29 | 30 | // Constructor 31 | public ProjectListAdapter(Context context, int layoutResourceId, List projects) 32 | { 33 | super(context, layoutResourceId, projects); 34 | this.layoutResourceId = layoutResourceId; 35 | this.context = context; 36 | this.projects = projects; 37 | mContext = context; 38 | beeCount = (BeeCountApplication) context.getApplicationContext(); 39 | } 40 | 41 | static class ProjectHolder 42 | { 43 | TextView txtTitle; 44 | TextView txtDate; 45 | ImageButton deleteProject; 46 | } 47 | 48 | @Override 49 | public View getView(int position, View convertView, ViewGroup parent) 50 | { 51 | View row = convertView; 52 | ProjectHolder holder = null; 53 | 54 | if(row == null) 55 | { 56 | LayoutInflater inflater = ((Activity)context).getLayoutInflater(); 57 | row = inflater.inflate(layoutResourceId, parent, false); 58 | 59 | holder = new ProjectHolder(); 60 | holder.txtTitle = (TextView) row.findViewById(R.id.txtTitle); 61 | holder.txtDate = (TextView) row.findViewById(R.id.txtDate); 62 | holder.deleteProject = (ImageButton) row.findViewById(R.id.deleteProject); 63 | 64 | holder.txtTitle.setOnClickListener(mOnTitleClickListener); 65 | holder.txtDate.setOnClickListener(mOnDateClickListener); 66 | holder.deleteProject.setOnClickListener(mOnDeleteClickListener); 67 | 68 | 69 | row.setTag(holder); 70 | } 71 | else 72 | { 73 | holder = (ProjectHolder)row.getTag(); 74 | } 75 | 76 | Project project = projects.get(position); 77 | holder.txtTitle.setTag(project); 78 | holder.txtDate.setTag(project); 79 | holder.deleteProject.setTag(project); 80 | holder.txtTitle.setText(project.name); 81 | holder.txtDate.setText(project.getDate()); 82 | 83 | return row; 84 | } 85 | 86 | /* 87 | * Start counting by clicking on date or title, delete by clicking on button. 88 | */ 89 | 90 | private View.OnClickListener mOnTitleClickListener = new View.OnClickListener() { 91 | @Override 92 | public void onClick(View v) 93 | { 94 | p = (Project) v.getTag(); 95 | Intent intent = new Intent(getContext(), CountingActivity.class); 96 | intent.putExtra("project_id",p.id); 97 | //beeCount.project_id = p.id; 98 | mContext.startActivity(intent); 99 | } 100 | }; 101 | 102 | private View.OnClickListener mOnDateClickListener = new View.OnClickListener() { 103 | @Override 104 | public void onClick(View v) 105 | { 106 | p = (Project) v.getTag(); 107 | Intent intent = new Intent(getContext(), CountingActivity.class); 108 | intent.putExtra("project_id",p.id); 109 | //beeCount.project_id = p.id; 110 | mContext.startActivity(intent); 111 | } 112 | }; 113 | 114 | private View.OnClickListener mOnDeleteClickListener = new View.OnClickListener() { 115 | @Override 116 | public void onClick(View v) 117 | { 118 | p = (Project) v.getTag(); 119 | // http://developer.android.com/guide/topics/ui/dialogs.html#AlertDialog 120 | // could make the dialog central in the popup - to do later 121 | AlertDialog.Builder builder = new AlertDialog.Builder(mContext); 122 | builder.setIcon(android.R.drawable.ic_dialog_alert); 123 | builder.setMessage(p.name + ": " + mContext.getString(R.string.confirmDelete)).setCancelable(false).setPositiveButton(R.string.deleteButton, new DialogInterface.OnClickListener() 124 | { 125 | public void onClick(DialogInterface dialog, int id) 126 | { 127 | // perform the deleting in the activity 128 | ((ListProjectActivity) mContext).deleteProject(p); 129 | } 130 | }).setNegativeButton(R.string.cancelButton, new DialogInterface.OnClickListener() 131 | { 132 | public void onClick(DialogInterface dialog, int id) 133 | { 134 | dialog.cancel(); 135 | } 136 | }); 137 | AlertDialog alert = builder.create(); 138 | alert.show(); 139 | } 140 | }; 141 | } 142 | 143 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/SettingsActivity.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount; 2 | 3 | 4 | import android.Manifest; 5 | import android.annotation.SuppressLint; 6 | import android.app.Activity; 7 | import android.content.pm.PackageManager; 8 | import android.media.RingtoneManager; 9 | import android.os.Build; 10 | import android.util.Log; 11 | import android.os.Bundle; 12 | import android.preference.Preference; 13 | import android.preference.PreferenceActivity; 14 | import android.preference.PreferenceManager; 15 | import android.content.Intent; 16 | import android.net.Uri; 17 | import android.database.Cursor; 18 | import android.content.SharedPreferences; 19 | import android.view.MenuItem; 20 | import android.view.View; 21 | import android.view.ViewGroup; 22 | import android.widget.Toast; 23 | 24 | 25 | public class SettingsActivity extends PreferenceActivity 26 | { 27 | private static String TAG = "BeeCountPreference"; 28 | private static final int SELECT_PICTURE = 1; 29 | String imageFilePath; 30 | SharedPreferences prefs; 31 | SharedPreferences.Editor editor; 32 | Uri alert_uri; 33 | Uri alert_button_uri; 34 | Uri alert_button_down_uri; 35 | final private int REQUEST_CODE_ASK_PERMISSIONS = 123; 36 | 37 | @Override 38 | @SuppressLint("CommitPrefEdits") 39 | @SuppressWarnings("deprecation") 40 | public void onCreate(Bundle savedInstanceState) 41 | { 42 | super.onCreate(savedInstanceState); 43 | addPreferencesFromResource(R.xml.preferences); 44 | View view = getListView(); 45 | view.setFitsSystemWindows(true); 46 | 47 | /* 48 | Preference button = (Preference) findPreference("pref_sort"); 49 | button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() 50 | { 51 | @Override 52 | public boolean onPreferenceClick(Preference arg0) 53 | { 54 | getImage(); 55 | return true; 56 | } 57 | }); 58 | */ 59 | 60 | prefs = PreferenceManager.getDefaultSharedPreferences(this); 61 | 62 | // Sound for alerts 63 | String strRingtonePreference = prefs.getString("alert_sound", "DEFAULT_SOUND"); 64 | alert_uri = Uri.parse(strRingtonePreference); 65 | //Log.i(TAG,"ALERT_URI: " + String.valueOf(alert_uri)); 66 | 67 | Preference alert_sound = (Preference) findPreference("alert_sound"); 68 | alert_sound.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() 69 | { 70 | @Override 71 | public boolean onPreferenceClick(Preference arg0) 72 | { 73 | getSound(alert_uri,5); 74 | return true; 75 | } 76 | }); 77 | 78 | // Sound for keypresses 79 | String strButtonSoundPreference = prefs.getString("alert_button_sound", "DEFAULT_SOUND"); 80 | alert_button_uri = Uri.parse(strButtonSoundPreference); 81 | 82 | Preference alert_button_sound = (Preference) findPreference("alert_button_sound"); 83 | alert_button_sound.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() 84 | { 85 | @Override 86 | public boolean onPreferenceClick(Preference arg0) 87 | { 88 | getSound(alert_button_uri,10); 89 | return true; 90 | } 91 | }); 92 | 93 | String strButtonSoundDownPreference = prefs.getString("alert_button_down_sound", "DEFAULT_SOUND"); 94 | alert_button_down_uri = Uri.parse(strButtonSoundDownPreference); 95 | 96 | Preference alert_button_down_sound = (Preference) findPreference("alert_button_down_sound"); 97 | alert_button_down_sound.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() 98 | { 99 | @Override 100 | public boolean onPreferenceClick(Preference arg0) 101 | { 102 | getSound(alert_button_down_uri,15); 103 | return true; 104 | } 105 | }); 106 | 107 | editor = prefs.edit(); // will be committed on pause 108 | 109 | // permission to read db 110 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) 111 | { 112 | int hasReadStoragePermission = checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE); 113 | if (hasReadStoragePermission != PackageManager.PERMISSION_GRANTED) 114 | { 115 | requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_CODE_ASK_PERMISSIONS); 116 | } 117 | } 118 | 119 | } 120 | 121 | @Override 122 | protected void onResume() 123 | { 124 | super.onResume(); 125 | String strRingtonePreference = prefs.getString("alert_sound", "DEFAULT_SOUND"); 126 | alert_uri = Uri.parse(strRingtonePreference); 127 | } 128 | 129 | @Override 130 | protected void onPause() 131 | { 132 | super.onPause(); 133 | editor.commit(); 134 | } 135 | 136 | /* 137 | public void getImage() 138 | { 139 | Intent pickIntent = new Intent(); 140 | pickIntent.setType("image/*"); 141 | pickIntent.setAction(Intent.ACTION_GET_CONTENT); 142 | startActivityForResult(pickIntent, SELECT_PICTURE); 143 | } 144 | */ 145 | 146 | public void getSound(Uri tmp_alert_uri, int requestCode) 147 | { 148 | Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); 149 | intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION); 150 | intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.pref_sound)); 151 | intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) tmp_alert_uri); 152 | this.startActivityForResult(intent, requestCode); 153 | } 154 | 155 | 156 | @Override 157 | @SuppressLint("CommitPrefEdits") 158 | protected void onActivityResult(int requestCode, int resultCode, Intent data) 159 | { 160 | if(requestCode == SELECT_PICTURE && data != null && data.getData() != null) 161 | { 162 | Uri _uri = Uri.parse(data.getDataString()); 163 | 164 | if (_uri != null) 165 | { 166 | //User did pick an image. 167 | /* 168 | * The try is here because this action fails if the user uses a file manager; the gallery 169 | * seems to work nicely, though. 170 | */ 171 | Cursor cursor = null; 172 | try 173 | { 174 | cursor = getContentResolver().query(_uri, new String[]{android.provider.MediaStore.Images.ImageColumns.DATA}, null, null, null); 175 | } 176 | catch (java.lang.SecurityException e) 177 | { 178 | Toast.makeText(this, getString(R.string.permission_please), Toast.LENGTH_SHORT).show(); 179 | return; 180 | } 181 | try 182 | { 183 | cursor.moveToFirst(); // blows up here if file manager used 184 | } 185 | catch (Exception e) 186 | { 187 | Log.e(TAG, "Failed to select image: " + e.toString()); 188 | Toast.makeText(this, getString(R.string.image_error), Toast.LENGTH_SHORT).show(); 189 | return; 190 | } 191 | 192 | //Link to the image 193 | imageFilePath = cursor.getString(0); 194 | cursor.close(); 195 | 196 | // save the image path 197 | editor.putString("imagePath", imageFilePath); 198 | //editor.commit(); 199 | try 200 | { 201 | Log.i(TAG, "IMAGE (in Settings): " + imageFilePath); 202 | } 203 | catch(Exception e) 204 | { 205 | Log.e(TAG, "Failed to upload image: " + e.toString()); 206 | Toast.makeText(this, getString(R.string.image_error), Toast.LENGTH_SHORT).show(); 207 | } 208 | } 209 | } 210 | else if (resultCode == Activity.RESULT_OK) 211 | { 212 | Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); 213 | String ringtone = null; 214 | if (uri != null) 215 | { 216 | ringtone = uri.toString(); 217 | if (requestCode == 5) 218 | { 219 | editor.putString("alert_sound", ringtone); 220 | } 221 | else if (requestCode == 10) 222 | { 223 | editor.putString("alert_button_sound", ringtone); 224 | } 225 | else if (requestCode == 15) 226 | { 227 | editor.putString("alert_button_down_sound", ringtone); 228 | } 229 | } 230 | } 231 | 232 | 233 | super.onActivityResult(requestCode, resultCode, data); 234 | } 235 | 236 | 237 | @Override 238 | public boolean onOptionsItemSelected(MenuItem item) 239 | { 240 | switch (item.getItemId()) 241 | { 242 | case android.R.id.home: 243 | startActivity(new Intent(this, WelcomeActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); 244 | break; 245 | default: 246 | return super.onOptionsItemSelected(item); 247 | } 248 | return true; 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/database/Alert.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.database; 2 | 3 | 4 | 5 | /** 6 | * Created by milo on 05/05/2014. 7 | */ 8 | public class Alert 9 | { 10 | public long id; 11 | public long count_id; 12 | public int alert; 13 | public String alert_text; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/database/AlertDataSource.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.database; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import android.content.ContentValues; 7 | import android.content.Context; 8 | import android.database.Cursor; 9 | import android.database.SQLException; 10 | import android.database.sqlite.SQLiteDatabase; 11 | 12 | /** 13 | * Created by milo on 05/05/2014. 14 | */ 15 | public class AlertDataSource 16 | { 17 | // Database fields 18 | private SQLiteDatabase database; 19 | private DbHelper dbHelper; 20 | private String[] allColumns = { 21 | DbHelper.A_ID, 22 | DbHelper.A_COUNT_ID, 23 | DbHelper.A_ALERT, 24 | DbHelper.A_ALERT_TEXT 25 | }; 26 | 27 | public AlertDataSource(Context context) 28 | { 29 | dbHelper = new DbHelper(context); 30 | } 31 | 32 | public void open() throws SQLException 33 | { 34 | database = dbHelper.getWritableDatabase(); 35 | } 36 | 37 | public void close() 38 | { 39 | dbHelper.close(); 40 | } 41 | 42 | public Alert createAlert(long count_id, int alert_value, String alert_text) 43 | { 44 | ContentValues values = new ContentValues(); 45 | values.put(DbHelper.A_COUNT_ID, count_id); 46 | values.put(DbHelper.A_ALERT, alert_value); 47 | values.put(DbHelper.A_ALERT_TEXT, alert_text); 48 | 49 | long insertId = database.insert(DbHelper.ALERT_TABLE, null, values); 50 | Cursor cursor = database.query(DbHelper.ALERT_TABLE, 51 | allColumns, DbHelper.A_ID + " = " + insertId, null, 52 | null, null, null); 53 | cursor.moveToFirst(); 54 | Alert newAlert = cursorToAlert(cursor); 55 | cursor.close(); 56 | return newAlert; 57 | } 58 | 59 | private Alert cursorToAlert(Cursor cursor) 60 | { 61 | Alert newalert = new Alert(); 62 | newalert.id = cursor.getLong(cursor.getColumnIndex(DbHelper.A_ID)); 63 | newalert.count_id = cursor.getLong(cursor.getColumnIndex(DbHelper.A_COUNT_ID)); 64 | newalert.alert = cursor.getInt(cursor.getColumnIndex(DbHelper.A_ALERT)); 65 | newalert.alert_text = cursor.getString(cursor.getColumnIndex(DbHelper.A_ALERT_TEXT)); 66 | return newalert; 67 | } 68 | 69 | public void deleteAlert(Alert alert) 70 | { 71 | long id = alert.id; 72 | System.out.println("Alert deleted with id: " + id); 73 | database.delete(DbHelper.ALERT_TABLE, DbHelper.A_ID + " = " + id, null); 74 | } 75 | 76 | public void deleteAlertById(long id) 77 | { 78 | System.out.println("Alert deleted with id: " + id); 79 | database.delete(DbHelper.ALERT_TABLE, DbHelper.A_ID + " = " + id, null); 80 | } 81 | 82 | public void saveAlert(long alert_id, int alert_value, String alert_text) 83 | { 84 | ContentValues dataToInsert = new ContentValues(); 85 | dataToInsert.put(DbHelper.A_ALERT, alert_value); 86 | dataToInsert.put(DbHelper.A_ALERT_TEXT, alert_text); 87 | String where = DbHelper.A_ID + " = ?"; 88 | String[] whereArgs = {String.valueOf(alert_id)}; 89 | database.update(DbHelper.ALERT_TABLE, dataToInsert, where, whereArgs); 90 | } 91 | 92 | public List getAllAlertsForCount(long count_id) 93 | { 94 | List alerts = new ArrayList(); 95 | 96 | Cursor cursor = database.query(DbHelper.ALERT_TABLE, allColumns, 97 | DbHelper.A_COUNT_ID + " = " + count_id, null, null, null, null); 98 | 99 | cursor.moveToFirst(); 100 | while (!cursor.isAfterLast()) 101 | { 102 | Alert alert = cursorToAlert(cursor); 103 | alerts.add(alert); 104 | cursor.moveToNext(); 105 | } 106 | // Make sure to close the cursor 107 | cursor.close(); 108 | return alerts; 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/database/Count.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.database; 2 | 3 | /** 4 | * Created by milo on 05/05/2014. 5 | */ 6 | public class Count 7 | { 8 | public long id; 9 | public long project_id; 10 | public int count; 11 | public String name; 12 | public int auto_reset; 13 | public int reset_level; 14 | public String notes; 15 | public int multiplier; 16 | 17 | public int increase() 18 | { 19 | count = count + 1; 20 | return count; 21 | } 22 | 23 | public int decrease() 24 | { 25 | //if (count > 0) 26 | //{ 27 | count = count - 1; 28 | //} 29 | return count; 30 | } 31 | 32 | public int safe_decrease() 33 | { 34 | if (count > 0) 35 | { 36 | count = count - 1; 37 | } 38 | return count; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/database/CountDataSource.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.database; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import android.content.ContentValues; 7 | import android.content.Context; 8 | import android.database.Cursor; 9 | import android.database.SQLException; 10 | import android.database.sqlite.SQLiteDatabase; 11 | 12 | /** 13 | * Created by milo on 05/05/2014. 14 | */ 15 | public class CountDataSource 16 | { 17 | // Database fields 18 | private SQLiteDatabase database; 19 | private DbHelper dbHelper; 20 | private String[] allColumns = { 21 | DbHelper.C_ID, 22 | DbHelper.C_PROJECT_ID, 23 | DbHelper.C_COUNT, 24 | DbHelper.C_NAME, 25 | DbHelper.C_AUTO_RESET, 26 | DbHelper.C_RESET_LEVEL, 27 | DbHelper.C_NOTES, 28 | DbHelper.C_MULTIPLIER 29 | }; 30 | 31 | public CountDataSource(Context context) 32 | { 33 | dbHelper = new DbHelper(context); 34 | } 35 | 36 | public void open() throws SQLException 37 | { 38 | database = dbHelper.getWritableDatabase(); 39 | } 40 | 41 | public void close() 42 | { 43 | dbHelper.close(); 44 | } 45 | 46 | public Count createCount(long project_id, String name) 47 | { 48 | ContentValues values = new ContentValues(); 49 | values.put(DbHelper.C_NAME, name); 50 | values.put(DbHelper.C_PROJECT_ID, project_id); 51 | values.put(DbHelper.C_COUNT, 0); 52 | values.put(DbHelper.C_AUTO_RESET, 0); 53 | values.put(DbHelper.C_RESET_LEVEL, 0); 54 | values.put(DbHelper.C_MULTIPLIER, 1); 55 | // notes should be default null and so isn't created here 56 | 57 | long insertId = database.insert(DbHelper.COUNT_TABLE, null, values); 58 | Cursor cursor = database.query(DbHelper.COUNT_TABLE, 59 | allColumns, DbHelper.C_ID + " = " + insertId, null, null, null, null); 60 | cursor.moveToFirst(); 61 | Count newCount = cursorToCount(cursor); 62 | cursor.close(); 63 | return newCount; 64 | } 65 | 66 | private Count cursorToCount(Cursor cursor) 67 | { 68 | Count newcount = new Count(); 69 | newcount.id = cursor.getLong(cursor.getColumnIndex(DbHelper.C_ID)); 70 | newcount.name = cursor.getString(cursor.getColumnIndex(DbHelper.C_NAME)); 71 | newcount.project_id = cursor.getLong(cursor.getColumnIndex(DbHelper.C_PROJECT_ID)); 72 | newcount.count = cursor.getInt(cursor.getColumnIndex(DbHelper.C_COUNT)); 73 | newcount.auto_reset = cursor.getInt(cursor.getColumnIndex(DbHelper.C_AUTO_RESET)); 74 | newcount.reset_level = cursor.getInt(cursor.getColumnIndex(DbHelper.C_RESET_LEVEL)); 75 | newcount.notes = cursor.getString(cursor.getColumnIndex(DbHelper.C_NOTES)); 76 | newcount.multiplier = cursor.getInt(cursor.getColumnIndex(DbHelper.C_MULTIPLIER)); 77 | return newcount; 78 | } 79 | 80 | public void deleteCount(Count count) 81 | { 82 | long id = count.id; 83 | System.out.println("Count deleted with id: " + id); 84 | database.delete(DbHelper.COUNT_TABLE, DbHelper.C_ID + " = " + id, null); 85 | 86 | // delete associated alerts 87 | database.delete(DbHelper.ALERT_TABLE, DbHelper.A_COUNT_ID + " = " + id, null); 88 | } 89 | 90 | public void deleteCountById(long id) 91 | { 92 | System.out.println("Count deleted with id: " + id); 93 | database.delete(DbHelper.COUNT_TABLE, DbHelper.C_ID + " = " + id, null); 94 | 95 | // delete associated alerts 96 | database.delete(DbHelper.ALERT_TABLE, DbHelper.A_COUNT_ID + " = " + id, null); 97 | } 98 | 99 | public void saveCount(Count count) 100 | { 101 | ContentValues dataToInsert = new ContentValues(); 102 | dataToInsert.put(DbHelper.C_COUNT, count.count); 103 | dataToInsert.put(DbHelper.C_NAME, count.name); 104 | dataToInsert.put(DbHelper.C_AUTO_RESET, count.auto_reset); 105 | dataToInsert.put(DbHelper.C_RESET_LEVEL, count.reset_level); 106 | dataToInsert.put(DbHelper.C_NOTES, count.notes); 107 | dataToInsert.put(DbHelper.C_MULTIPLIER, count.multiplier); 108 | String where = DbHelper.C_ID + " = ?"; 109 | String[] whereArgs = {String.valueOf(count.id)}; 110 | database.update(DbHelper.COUNT_TABLE, dataToInsert, where, whereArgs); 111 | } 112 | 113 | public void updateCountName(long id, String name) 114 | { 115 | ContentValues dataToInsert = new ContentValues(); 116 | dataToInsert.put(DbHelper.C_NAME, name); 117 | String where = DbHelper.C_ID + " = ?"; 118 | String[] whereArgs = {String.valueOf(id)}; 119 | database.update(DbHelper.COUNT_TABLE, dataToInsert, where, whereArgs); 120 | } 121 | 122 | public List getAllCountsForProject(long project_id) 123 | { 124 | List counts = new ArrayList(); 125 | 126 | Cursor cursor = database.query(DbHelper.COUNT_TABLE, allColumns, 127 | DbHelper.C_PROJECT_ID + " = " + project_id, null, null, null, null); 128 | 129 | cursor.moveToFirst(); 130 | while (!cursor.isAfterLast()) 131 | { 132 | Count count = cursorToCount(cursor); 133 | counts.add(count); 134 | cursor.moveToNext(); 135 | } 136 | // Make sure to close the cursor 137 | cursor.close(); 138 | return counts; 139 | } 140 | 141 | public Count getCountById(long count_id) 142 | { 143 | Cursor cursor = database.query(DbHelper.COUNT_TABLE, allColumns, 144 | DbHelper.C_ID + " = " + count_id, null, null, null, null); 145 | 146 | cursor.moveToFirst(); 147 | Count count = cursorToCount(cursor); 148 | cursor.close(); 149 | return count; 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/database/Link.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.database; 2 | 3 | /** 4 | * Created by milo on 05/05/2014. 5 | */ 6 | public class Link 7 | { 8 | public long id; 9 | public long project_id; 10 | public long master_id; 11 | public long slave_id; 12 | public int increment; 13 | public int type; 14 | 15 | /* 16 | * Type is: 17 | * 0: reset 18 | * 1: increase 19 | * 2: decrease 20 | */ 21 | 22 | } 23 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/database/LinkDataSource.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.database; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import android.content.ContentValues; 7 | import android.content.Context; 8 | import android.database.Cursor; 9 | import android.database.SQLException; 10 | import android.database.sqlite.SQLiteDatabase; 11 | 12 | /** 13 | * Created by milo on 05/05/2014. 14 | */ 15 | public class LinkDataSource 16 | { 17 | private SQLiteDatabase database; 18 | private DbHelper dbHelper; 19 | private String[] allColumns = { 20 | DbHelper.L_ID, 21 | DbHelper.L_PROJECT_ID, 22 | DbHelper.L_MASTER_ID, 23 | DbHelper.L_SLAVE_ID, 24 | DbHelper.L_INCREMENT, 25 | DbHelper.L_TYPE 26 | }; 27 | 28 | public LinkDataSource(Context context) 29 | { 30 | dbHelper = new DbHelper(context); 31 | } 32 | 33 | public void open() throws SQLException 34 | { 35 | database = dbHelper.getWritableDatabase(); 36 | } 37 | 38 | public void close() 39 | { 40 | dbHelper.close(); 41 | } 42 | 43 | public Link createLink(long project_id, long master_id, long slave_id, int increment, int type) 44 | { 45 | ContentValues values = new ContentValues(); 46 | values.put(DbHelper.L_PROJECT_ID, project_id); 47 | values.put(DbHelper.L_MASTER_ID, master_id); 48 | values.put(DbHelper.L_SLAVE_ID, slave_id); 49 | values.put(DbHelper.L_INCREMENT, increment); 50 | values.put(DbHelper.L_TYPE, type); 51 | 52 | long insertId = database.insert(DbHelper.LINK_TABLE, null, values); 53 | Cursor cursor = database.query(DbHelper.LINK_TABLE, 54 | allColumns, DbHelper.L_ID + " = " + insertId, null, null, null, null); 55 | cursor.moveToFirst(); 56 | Link newLink = cursorToLink(cursor); 57 | cursor.close(); 58 | return newLink; 59 | } 60 | 61 | private Link cursorToLink(Cursor cursor) 62 | { 63 | Link newlink = new Link(); 64 | newlink.id = cursor.getLong(cursor.getColumnIndex(DbHelper.L_ID)); 65 | newlink.project_id = cursor.getLong(cursor.getColumnIndex(DbHelper.L_PROJECT_ID)); 66 | newlink.master_id = cursor.getLong(cursor.getColumnIndex(DbHelper.L_MASTER_ID)); 67 | newlink.slave_id = cursor.getLong(cursor.getColumnIndex(DbHelper.L_SLAVE_ID)); 68 | newlink.increment = cursor.getInt(cursor.getColumnIndex(DbHelper.L_INCREMENT)); 69 | newlink.type = cursor.getInt(cursor.getColumnIndex(DbHelper.L_TYPE)); 70 | return newlink; 71 | } 72 | 73 | 74 | public void deleteLink(Link link) 75 | { 76 | long id = link.id; 77 | database.delete(DbHelper.LINK_TABLE, DbHelper.L_ID + " = " + id, null); 78 | System.out.println("Link deleted with id: " + id); 79 | } 80 | 81 | public void deleteLinkById(long id) 82 | { 83 | database.delete(DbHelper.LINK_TABLE, DbHelper.L_ID + " = " + id, null); 84 | System.out.println("Link deleted with id: " + id); 85 | } 86 | 87 | public List getAllLinksForProject(long project_id) 88 | { 89 | List links = new ArrayList(); 90 | 91 | Cursor cursor = database.query(DbHelper.LINK_TABLE, allColumns, 92 | DbHelper.L_PROJECT_ID + " = " + project_id, null, null, null, null); 93 | 94 | cursor.moveToFirst(); 95 | while (!cursor.isAfterLast()) 96 | { 97 | Link link = cursorToLink(cursor); 98 | links.add(link); 99 | cursor.moveToNext(); 100 | } 101 | // Make sure to close the cursor 102 | cursor.close(); 103 | return links; 104 | } 105 | 106 | public Link getLinkByMasterId(long master_id) 107 | { 108 | Cursor cursor = database.query(DbHelper.LINK_TABLE, allColumns, 109 | DbHelper.L_MASTER_ID + " = " + master_id, null, null, null, null); 110 | 111 | cursor.moveToFirst(); 112 | Link link = cursorToLink(cursor); 113 | cursor.close(); 114 | return link; 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/database/Project.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.database; 2 | 3 | import java.text.DateFormat; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | 7 | /** 8 | * Created by milo on 05/05/2014. 9 | */ 10 | public class Project 11 | { 12 | public long id; 13 | public long created_at; 14 | public String name; 15 | public String notes; 16 | public String logs; 17 | 18 | public String getDate() 19 | { 20 | Date date = new Date(created_at); 21 | DateFormat df = SimpleDateFormat.getDateInstance(); 22 | return df.format(date); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/database/ProjectDataSource.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.database; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import android.content.ContentValues; 8 | import android.content.Context; 9 | import android.content.SharedPreferences; 10 | import android.database.Cursor; 11 | import android.database.SQLException; 12 | import android.database.sqlite.SQLiteDatabase; 13 | 14 | 15 | /** 16 | * Created by milo on 05/05/2014. 17 | */ 18 | public class ProjectDataSource 19 | { 20 | // Database fields 21 | private SQLiteDatabase database; 22 | private DbHelper dbHelper; 23 | private String[] allColumns = { 24 | DbHelper.P_ID, 25 | DbHelper.P_CREATED_AT, 26 | DbHelper.P_LOGS, 27 | DbHelper.P_NAME, 28 | DbHelper.P_NOTES 29 | }; 30 | 31 | public ProjectDataSource(Context context) 32 | { 33 | dbHelper = new DbHelper(context); 34 | } 35 | 36 | public void open() throws SQLException 37 | { 38 | database = dbHelper.getWritableDatabase(); 39 | } 40 | 41 | public void close() 42 | { 43 | dbHelper.close(); 44 | } 45 | 46 | public Project createProject(String name) 47 | { 48 | Date date = new Date(); 49 | long timeMilliseconds = date.getTime(); 50 | ContentValues values = new ContentValues(); 51 | values.put(DbHelper.P_NAME, name); 52 | values.put(DbHelper.P_CREATED_AT, timeMilliseconds); 53 | 54 | long insertId = database.insert(DbHelper.PROJ_TABLE, null, values); 55 | Cursor cursor = database.query(DbHelper.PROJ_TABLE, 56 | allColumns, DbHelper.P_ID + " = " + insertId, null, 57 | null, null, null); 58 | cursor.moveToFirst(); 59 | Project newProject = cursorToProject(cursor); 60 | cursor.close(); 61 | return newProject; 62 | } 63 | 64 | private Project cursorToProject(Cursor cursor) 65 | { 66 | Project project = new Project(); 67 | project.id = cursor.getLong(cursor.getColumnIndex(DbHelper.P_ID)); 68 | project.created_at = cursor.getLong(cursor.getColumnIndex(DbHelper.P_CREATED_AT)); 69 | project.name = cursor.getString(cursor.getColumnIndex(DbHelper.P_NAME)); 70 | project.notes = cursor.getString(cursor.getColumnIndex(DbHelper.P_NOTES)); 71 | project.logs = cursor.getString(cursor.getColumnIndex(DbHelper.P_LOGS)); 72 | return project; 73 | } 74 | 75 | public void deleteProject(Project project) 76 | { 77 | long id = project.id; 78 | System.out.println("Project deleted with id: " + id); 79 | database.delete(DbHelper.PROJ_TABLE, DbHelper.P_ID + " = " + id, null); 80 | 81 | /* 82 | Get the id of all associated counts here; alerts are the only things which can't 83 | be removed directly as the project_id is not stored in them. A join is therefore required. 84 | */ 85 | // delete associated links and counts 86 | String sql = "DELETE FROM " + DbHelper.ALERT_TABLE + " WHERE " + DbHelper.A_COUNT_ID + " IN " 87 | + "(SELECT " + DbHelper.C_ID + " FROM " + DbHelper.COUNT_TABLE + " WHERE " 88 | + DbHelper.C_PROJECT_ID + " = " + id + ")"; 89 | database.execSQL(sql); 90 | database.delete(DbHelper.LINK_TABLE, DbHelper.L_PROJECT_ID + " = " + id, null); 91 | database.delete(DbHelper.COUNT_TABLE, DbHelper.C_PROJECT_ID + " = " + id, null); 92 | 93 | } 94 | 95 | public void saveProject(Project project) 96 | { 97 | ContentValues dataToInsert = new ContentValues(); 98 | dataToInsert.put(DbHelper.P_NAME, project.name); 99 | dataToInsert.put(DbHelper.P_NOTES, project.notes); 100 | dataToInsert.put(DbHelper.P_LOGS, project.logs); 101 | String where = DbHelper.P_ID + " = ?"; 102 | String[] whereArgs = {String.valueOf(project.id)}; 103 | database.update(DbHelper.PROJ_TABLE, dataToInsert, where, whereArgs); 104 | } 105 | 106 | public List getAllProjects(SharedPreferences prefs) 107 | { 108 | List projects = new ArrayList(); 109 | 110 | String orderBy = DbHelper.P_CREATED_AT + " DESC"; 111 | String sortString = prefs.getString("pref_sort", "date_desc"); 112 | if (sortString.equals("date_asc")) 113 | { 114 | orderBy = DbHelper.P_CREATED_AT + " ASC"; 115 | } 116 | else if (sortString.equals("name_asc")) 117 | { 118 | orderBy = DbHelper.P_NAME + " ASC"; 119 | } 120 | else if (sortString.equals("name_desc")) 121 | { 122 | orderBy = DbHelper.P_NAME + " DESC"; 123 | } 124 | Cursor cursor = database.query(DbHelper.PROJ_TABLE, allColumns, null, null, null, null, orderBy); 125 | 126 | cursor.moveToFirst(); 127 | while (!cursor.isAfterLast()) 128 | { 129 | Project project = cursorToProject(cursor); 130 | projects.add(project); 131 | cursor.moveToNext(); 132 | } 133 | // Make sure to close the cursor 134 | cursor.close(); 135 | return projects; 136 | } 137 | 138 | public List getAllProjects() 139 | { 140 | List projects = new ArrayList(); 141 | 142 | Cursor cursor = database.query(DbHelper.PROJ_TABLE, allColumns, null, null, null, null, null); 143 | 144 | cursor.moveToFirst(); 145 | while (!cursor.isAfterLast()) 146 | { 147 | Project project = cursorToProject(cursor); 148 | projects.add(project); 149 | cursor.moveToNext(); 150 | } 151 | // Make sure to close the cursor 152 | cursor.close(); 153 | return projects; 154 | } 155 | 156 | public Project getProject(long project_id) 157 | { 158 | Project project = null; 159 | Cursor cursor = database.query(DbHelper.PROJ_TABLE, allColumns, DbHelper.P_ID + " = ?", new String[] { String.valueOf(project_id) }, null, null, null); 160 | cursor.moveToFirst(); 161 | project = cursorToProject(cursor); 162 | // Make sure to close the cursor 163 | cursor.close(); 164 | return project; 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/widgets/AddAlertWidget.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.widgets; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.widget.LinearLayout; 7 | import android.widget.TextView; 8 | 9 | import com.knirirr.beecount.R; 10 | 11 | /** 12 | * Created by milo on 01/06/2014. 13 | */ 14 | public class AddAlertWidget extends LinearLayout 15 | { 16 | private TextView textView; 17 | 18 | public AddAlertWidget(Context context, AttributeSet attrs) 19 | { 20 | super(context, attrs); 21 | 22 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 23 | inflater.inflate(R.layout.widget_add_alert, this, true); 24 | textView = (TextView) findViewById(R.id.add_alert_text); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/widgets/AlertCreateWidget.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.widgets; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.widget.EditText; 7 | import android.widget.ImageButton; 8 | import android.widget.LinearLayout; 9 | 10 | import com.knirirr.beecount.R; 11 | 12 | import org.apache.commons.lang3.StringUtils; 13 | 14 | import java.io.Serializable; 15 | 16 | /** 17 | * Created by milo on 02/06/2014. 18 | * This is the widget for creating an alert in the CountOptionsActivity. 19 | */ 20 | public class AlertCreateWidget extends LinearLayout implements Serializable 21 | { 22 | EditText alert_name; 23 | EditText alert_value; 24 | long alert_id; 25 | ImageButton deleteButton; 26 | 27 | public AlertCreateWidget(Context context, AttributeSet attrs) 28 | { 29 | super(context, attrs); 30 | 31 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 32 | inflater.inflate(R.layout.widget_alert_create, this, true); 33 | alert_name = (EditText) findViewById(R.id.alert_name); 34 | alert_value = (EditText) findViewById(R.id.alert_value); 35 | alert_id = 0; 36 | deleteButton = (ImageButton) findViewById(R.id.delete_button); 37 | deleteButton.setTag(Long.valueOf(0)); 38 | } 39 | 40 | public String getAlertName() 41 | { 42 | return alert_name.getText().toString(); 43 | } 44 | 45 | // this is set to return 0 if it can't parse a value from the box in order 46 | // that BeeCount doesn't crash 47 | public int getAlertValue() 48 | { 49 | String text = alert_value.getText().toString(); 50 | if (StringUtils.isEmpty(text)) 51 | { 52 | return Integer.valueOf(0); 53 | } 54 | else 55 | { 56 | return Integer.parseInt(text); 57 | } 58 | } 59 | 60 | public long getAlertId() 61 | { 62 | return alert_id; 63 | } 64 | 65 | public void setAlertName(String name) 66 | { 67 | alert_name.setText(name); 68 | } 69 | 70 | public void setAlertValue(int value) 71 | { 72 | alert_value.setText(String.valueOf(value)); 73 | } 74 | 75 | public void setAlertId(long id) 76 | { 77 | alert_id = id; 78 | deleteButton.setTag(Long.valueOf(id)); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/widgets/CountEditWidget.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.widgets; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.widget.EditText; 7 | import android.widget.ImageButton; 8 | import android.widget.LinearLayout; 9 | 10 | import com.knirirr.beecount.R; 11 | 12 | import java.io.Serializable; 13 | 14 | /** 15 | * Created by milo on 04/06/2014. 16 | */ 17 | public class CountEditWidget extends LinearLayout implements Serializable 18 | { 19 | private transient EditText countName; 20 | private ImageButton deleteButton; 21 | public long countId; 22 | 23 | public CountEditWidget(Context context, AttributeSet attrs) 24 | { 25 | super(context, attrs); 26 | 27 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 28 | inflater.inflate(R.layout.widget_edit_count, this, true); 29 | countName = (EditText) findViewById(R.id.countName); 30 | deleteButton = (ImageButton) findViewById(R.id.deleteCount); 31 | deleteButton.setTag(Long.valueOf(0)); 32 | } 33 | 34 | public String getCountName() 35 | { 36 | return countName.getText().toString(); 37 | } 38 | 39 | public void setCountName(String name) 40 | { 41 | countName.setText(name); 42 | } 43 | 44 | public void setCountId(long id) 45 | { 46 | countId = id; 47 | deleteButton.setTag(Long.valueOf(id)); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/widgets/CountingWidget.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.widgets; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.graphics.Rect; 6 | import android.util.AttributeSet; 7 | import android.view.LayoutInflater; 8 | import android.widget.Button; 9 | import android.widget.ImageButton; 10 | import android.widget.RelativeLayout; 11 | import android.widget.TextView; 12 | 13 | import com.knirirr.beecount.AutoFitText; 14 | import com.knirirr.beecount.CountingActivity; 15 | import com.knirirr.beecount.R; 16 | import com.knirirr.beecount.database.Count; 17 | 18 | /** 19 | * Created by milo on 25/05/2014. 20 | */ 21 | public class CountingWidget extends RelativeLayout 22 | { 23 | public static String TAG = "BeeCountCountingWidget"; 24 | 25 | private TextView countName; 26 | private AutoFitText countCount; 27 | 28 | public Count count; 29 | 30 | public CountingWidget(Context context, AttributeSet attrs) 31 | { 32 | super(context, attrs); 33 | 34 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 35 | inflater.inflate(R.layout.widget_counting, this, true); 36 | countCount = (AutoFitText) findViewById(R.id.countCount); 37 | countName = (TextView) findViewById(R.id.countName); 38 | 39 | } 40 | 41 | public void setCount(Count newcount) 42 | { 43 | count = newcount; 44 | countCount.setText(String.valueOf(count.count * count.multiplier)); 45 | //setFont(); 46 | countName.setText(count.name); 47 | ImageButton countUpButton = (ImageButton) findViewById(R.id.buttonUp); 48 | countUpButton.setTag(count.id); 49 | ImageButton countDownButton = (ImageButton) findViewById(R.id.buttonDown); 50 | countDownButton.setTag(count.id); 51 | ImageButton editButton = (ImageButton) findViewById(R.id.buttonEdit); 52 | editButton.setTag(count.id); 53 | } 54 | 55 | public void countUp() 56 | { 57 | count.increase(); 58 | countCount.setText(String.valueOf(count.count * count.multiplier)); 59 | //setFont(); 60 | } 61 | 62 | public void countDown() 63 | { 64 | if (((CountingActivity) getContext()).getNegPref()) 65 | { 66 | count.decrease(); 67 | } 68 | else 69 | { 70 | count.safe_decrease(); 71 | } 72 | countCount.setText(String.valueOf(count.count * count.multiplier)); 73 | //setFont(); 74 | } 75 | 76 | // sets to the reset level 77 | public void resetZero() 78 | { 79 | count.count = count.reset_level; 80 | countCount.setText(String.valueOf(count.count * count.multiplier)); 81 | //setFont(); 82 | } 83 | 84 | /* 85 | * The purpose of this function is to flip out and change the font size for the count box depending on how many 86 | * digits are in it, in order that the count doesn't wrap when going over 100. 87 | */ 88 | public void setFont() 89 | { 90 | String currCount = countCount.getText().toString(); 91 | if (currCount.length() <= 2) 92 | { 93 | countCount.setTextSize(38); 94 | } 95 | else if (currCount.length() == 3) 96 | { 97 | countCount.setTextSize(28); 98 | } 99 | else if (currCount.length() >= 4) 100 | { 101 | countCount.setTextSize(12); 102 | } 103 | } 104 | 105 | /* 106 | * Saving the counts should perhaps go in this widget? 107 | */ 108 | 109 | 110 | 111 | 112 | } 113 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/widgets/EditTitleWidget.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.widgets; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.widget.EditText; 7 | import android.widget.LinearLayout; 8 | import android.widget.TextView; 9 | 10 | import com.knirirr.beecount.R; 11 | 12 | /** 13 | * Created by milo on 03/06/2014. 14 | */ 15 | public class EditTitleWidget extends LinearLayout 16 | { 17 | TextView widget_title; 18 | EditText project_name; 19 | 20 | public EditTitleWidget(Context context, AttributeSet attrs) 21 | { 22 | super(context, attrs); 23 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 24 | inflater.inflate(R.layout.widget_edit_title, this, true); 25 | widget_title = (TextView) findViewById(R.id.widgetTitle); 26 | project_name = (EditText) findViewById(R.id.projectName); 27 | } 28 | 29 | public void setProjectName(String name) 30 | { 31 | project_name.setText(name); 32 | } 33 | 34 | public String getProjectName() 35 | { 36 | return project_name.getText().toString(); 37 | } 38 | 39 | public void setWidgetTitle(String title) 40 | { 41 | widget_title.setText(title); 42 | } 43 | 44 | public void setHint(String hint) 45 | { 46 | project_name.setHint(hint); 47 | } 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/widgets/ExistingLinkWidget.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.widgets; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.widget.ImageButton; 7 | import android.widget.LinearLayout; 8 | import android.widget.TextView; 9 | 10 | import com.knirirr.beecount.R; 11 | 12 | /** 13 | * Created by milo on 06/06/2014. 14 | */ 15 | public class ExistingLinkWidget extends LinearLayout 16 | { 17 | public long masterId; 18 | public long slaveId; 19 | public long linkId; 20 | 21 | TextView linkDescription; 22 | ImageButton deleteLinkButton; 23 | 24 | public ExistingLinkWidget(Context context, AttributeSet attrs) 25 | { 26 | super(context, attrs); 27 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 28 | inflater.inflate(R.layout.widget_existing_link, this, true); 29 | linkDescription = (TextView) findViewById(R.id.linkDescription); 30 | deleteLinkButton = (ImageButton) findViewById(R.id.deleteLinkButton); 31 | deleteLinkButton.setTag(Long.valueOf(0)); 32 | } 33 | 34 | public void setLinkId(long id) 35 | { 36 | linkId = id; 37 | deleteLinkButton.setTag(id); 38 | } 39 | 40 | public void setInfo(String master, String slave, int type, int increment) 41 | { 42 | String typestring = ""; 43 | if (type == 0) 44 | { 45 | typestring = getContext().getString(R.string.incr_reset); 46 | } 47 | else if (type == 1) 48 | { 49 | typestring = getContext().getString(R.string.incr_up); 50 | } 51 | else if (type == 2) 52 | { 53 | typestring = getContext().getString(R.string.incr_down); 54 | } 55 | linkDescription.setText(String.format(getContext().getString(R.string.xWillYZ),master,typestring,slave,increment)); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/widgets/LinkEditWidget.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.widgets; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.graphics.Color; 6 | import android.util.AttributeSet; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.ArrayAdapter; 11 | import android.widget.EditText; 12 | import android.widget.ImageButton; 13 | import android.widget.LinearLayout; 14 | import android.widget.Spinner; 15 | import android.widget.TextView; 16 | 17 | import com.knirirr.beecount.R; 18 | 19 | import java.io.Serializable; 20 | import java.util.ArrayList; 21 | import java.util.Arrays; 22 | import java.util.Collections; 23 | import java.util.List; 24 | import java.util.Locale; 25 | 26 | /** 27 | * Created by milo on 04/06/2014. 28 | */ 29 | public class LinkEditWidget extends LinearLayout implements Serializable 30 | { 31 | Spinner masterSpinner; 32 | Spinner slaveSpinner; 33 | Spinner choiceSpinner; 34 | EditText linkIncrement; 35 | ImageButton deleteLink; 36 | 37 | public long linkId; 38 | public ArrayList countNames; 39 | public ArrayList countIds; 40 | 41 | 42 | public LinkEditWidget(Context context, AttributeSet attrs) 43 | { 44 | super(context, attrs); 45 | 46 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 47 | inflater.inflate(R.layout.widget_link_edit, this, true); 48 | masterSpinner = (Spinner) findViewById(R.id.masterSpinner); 49 | slaveSpinner = (Spinner) findViewById(R.id.slaveSpinner); 50 | choiceSpinner = (Spinner) findViewById(R.id.choiceSpinner); 51 | linkIncrement = (EditText) findViewById(R.id.linkIncrement); 52 | deleteLink = (ImageButton) findViewById(R.id.deleteLink); 53 | deleteLink.setTag(Long.valueOf(0)); 54 | 55 | /* 56 | * Some sort of static array would be better here, and should be added when a cunning idea for how 57 | * to do it springs to mind. 58 | */ 59 | ArrayList choices = new ArrayList(); 60 | choices.add(getResources().getString(R.string.incr_reset)); 61 | choices.add(getResources().getString(R.string.incr_up)); 62 | choices.add(getResources().getString(R.string.incr_down)); 63 | 64 | setSpinnerAdapter("choice", choices); 65 | 66 | ArrayList countNames = new ArrayList(); 67 | ArrayList countIds = new ArrayList(); 68 | 69 | } 70 | 71 | public void setLinkId(long id) 72 | { 73 | linkId = id; 74 | deleteLink.setTag(id); 75 | } 76 | 77 | public void setCountNames(ArrayList names) 78 | { 79 | countNames = names; 80 | setSpinnerAdapter("master", names); 81 | setSpinnerAdapter("slave", names); 82 | } 83 | 84 | public void setCountIds(ArrayList ids) 85 | { 86 | countIds = ids; 87 | } 88 | 89 | private void setSpinnerAdapter(String spinner, ArrayList array) 90 | { 91 | int master_position = masterSpinner.getSelectedItemPosition(); 92 | int slave_position = slaveSpinner.getSelectedItemPosition(); 93 | int choice_position = choiceSpinner.getSelectedItemPosition(); 94 | ArrayAdapter adapter = new ArrayAdapter(getContext(), R.layout.custom_spinner, array) 95 | { 96 | public View getView(int position, View convertView, ViewGroup parent) 97 | { 98 | View v = super.getView(position, convertView, parent); 99 | ((TextView) v).setTextColor(Color.WHITE); 100 | return v; 101 | } 102 | 103 | public View getDropDownView(int position, View convertView, ViewGroup parent) 104 | { 105 | View v = super.getDropDownView(position, convertView, parent); 106 | ((TextView) v).setTextColor(Color.WHITE); 107 | return v; 108 | } 109 | }; 110 | int maxlen = adapter.getCount(); 111 | if (spinner.equals("master")) 112 | { 113 | masterSpinner.setAdapter(adapter); 114 | if (master_position < maxlen) 115 | { 116 | masterSpinner.setSelection(master_position); 117 | } 118 | } else if (spinner.equals("slave")) 119 | { 120 | slaveSpinner.setAdapter(adapter); 121 | if (slave_position < maxlen) 122 | { 123 | slaveSpinner.setSelection(slave_position); 124 | } 125 | } else if (spinner.equals("choice")) 126 | { 127 | choiceSpinner.setAdapter(adapter); 128 | if (choice_position < maxlen) 129 | { 130 | choiceSpinner.setSelection(choice_position); 131 | } 132 | } 133 | 134 | } 135 | 136 | public long getMasterId() 137 | { 138 | return countIds.get(masterSpinner.getSelectedItemPosition()); 139 | } 140 | 141 | public long getSlaveId() 142 | { 143 | return countIds.get(slaveSpinner.getSelectedItemPosition()); 144 | } 145 | 146 | public int getChoice() 147 | { 148 | return choiceSpinner.getSelectedItemPosition(); 149 | } 150 | 151 | public int getLinkIncrement() 152 | { 153 | try 154 | { 155 | return Integer.valueOf(linkIncrement.getText().toString()); 156 | } 157 | catch (NumberFormatException e) 158 | { 159 | return 0; 160 | } 161 | } 162 | 163 | public String getMasterName() 164 | { 165 | return masterSpinner.getSelectedItem().toString(); 166 | } 167 | 168 | public String getSlaveName() 169 | { 170 | return slaveSpinner.getSelectedItem().toString(); 171 | } 172 | 173 | } 174 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/widgets/NotesWidget.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.widgets; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.util.Log; 6 | import android.view.LayoutInflater; 7 | import android.widget.LinearLayout; 8 | import android.widget.TextView; 9 | 10 | import com.knirirr.beecount.R; 11 | 12 | /** 13 | * Created by milo on 26/05/2014. 14 | */ 15 | public class NotesWidget extends LinearLayout 16 | { 17 | public static String TAG = "Beecount NotesWidget"; 18 | public String project_notes; 19 | private TextView textView; 20 | 21 | public NotesWidget(Context context, AttributeSet attrs) 22 | { 23 | super(context, attrs); 24 | 25 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 26 | inflater.inflate(R.layout.widget_notes, this, true); 27 | textView = (TextView) findViewById(R.id.notes_text); 28 | } 29 | 30 | public void setNotes(String notes) 31 | { 32 | project_notes = notes; 33 | textView.setText(project_notes); 34 | } 35 | 36 | public void setFont(Boolean large) 37 | { 38 | if (large) 39 | { 40 | Log.i(TAG, "Setting LARGE text size."); 41 | textView.setTextSize(22); 42 | } 43 | else 44 | { 45 | Log.i(TAG, "Setting small text size."); 46 | textView.setTextSize(14); 47 | } 48 | } 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /beecount/src/main/java/com/knirirr/beecount/widgets/OptionsWidget.java: -------------------------------------------------------------------------------- 1 | package com.knirirr.beecount.widgets; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.widget.EditText; 7 | import android.widget.LinearLayout; 8 | import android.widget.TextView; 9 | 10 | import com.knirirr.beecount.R; 11 | 12 | import org.apache.commons.lang3.StringUtils; 13 | 14 | /** 15 | * Created by milo on 27/05/2014. 16 | */ 17 | public class OptionsWidget extends LinearLayout 18 | { 19 | private TextView instructions; 20 | private TextView number; 21 | 22 | public OptionsWidget(Context context, AttributeSet attrs) 23 | { 24 | super(context, attrs); 25 | 26 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 27 | inflater.inflate(R.layout.widget_options, this, true); 28 | instructions = (TextView) findViewById(R.id.help_text); 29 | number = (EditText) findViewById(R.id.count_parameter_edit); 30 | } 31 | 32 | public void setInstructions(String i) 33 | { 34 | instructions.setText(i); 35 | } 36 | 37 | public void setParameterValue(int i) 38 | { 39 | number.setText(String.valueOf(i)); 40 | } 41 | 42 | public void setSize(int i) 43 | { 44 | instructions.setTextSize(i); 45 | } 46 | 47 | // this is set to return 0 if it can't parse a value from the box in order 48 | // that BeeCount doesn't crash 49 | public int getParameterValue() 50 | { 51 | String text = number.getText().toString(); 52 | try { 53 | return Integer.parseInt(text); 54 | } catch (Exception ignore) { 55 | return 0; 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /beecount/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /beecount/src/main/res/drawable-land-nodpi/beecount_knitting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/res/drawable-land-nodpi/beecount_knitting.png -------------------------------------------------------------------------------- /beecount/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /beecount/src/main/res/drawable-nodpi/beecount_knitting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/res/drawable-nodpi/beecount_knitting.png -------------------------------------------------------------------------------- /beecount/src/main/res/drawable-nodpi/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/res/drawable-nodpi/minus.png -------------------------------------------------------------------------------- /beecount/src/main/res/drawable-nodpi/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/res/drawable-nodpi/plus.png -------------------------------------------------------------------------------- /beecount/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /beecount/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /beecount/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knirirr/BeeCount/5a7e9424a8682eed1ff54a9f7b373bef1ddc3abd/beecount/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /beecount/src/main/res/drawable/count_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /beecount/src/main/res/drawable/list_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /beecount/src/main/res/drawable/rounded_corner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout-land/activity_calculate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 15 | 16 | 21 | 22 | 27 | 28 | 29 | 30 | 41 | 42 | 55 | 56 | 57 | 58 | 59 | 60 | 65 | 66 | 67 | 68 | 75 | 76 | 85 | 86 | 95 | 96 | 97 | 98 | 99 | 100 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout-land/activity_count_options.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 16 | 17 | 18 | 23 | 28 | 29 | 30 | 31 | 36 | 40 | 41 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout-land/activity_counting.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 16 | 17 | 18 | 23 | 24 | 29 | 30 | 31 | 32 | 37 | 41 | 42 | 51 | 60 | 61 | 62 | 63 | 64 | 69 | 75 | 76 | 77 | 83 | 84 | 85 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout-xlarge/activity_calculate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 15 | 16 | 21 | 22 | 27 | 28 | 29 | 30 | 41 | 42 | 55 | 56 | 57 | 58 | 59 | 60 | 65 | 66 | 67 | 68 | 75 | 76 | 85 | 86 | 95 | 96 | 97 | 98 | 99 | 100 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout-xlarge/activity_count_options.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout-xlarge/activity_counting.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 16 | 17 | 18 | 24 | 25 | 30 | 31 | 32 | 33 | 38 | 42 | 42 | 51 | 60 | 61 | 62 | 63 | 64 | 69 | 75 | 76 | 77 | 83 | 84 | 85 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout/activity_calculate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | 19 | 20 | 21 | 22 | 33 | 34 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 70 | 81 | 82 | 83 | 84 | 85 | 86 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout/activity_count_log.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout/activity_count_options.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 16 | 17 | 18 | 23 | 24 | 25 | 32 | 33 | 37 | 38 | 47 | 48 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout/activity_counting.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 18 | 19 | 20 | 26 | 27 | 28 | 33 | 34 | 38 | 39 | 61 | 72 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout/activity_list_project.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout/activity_new_project.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 21 | 22 | 23 | 33 | 34 | 35 | 42 | 53 | 64 | 75 | 76 | 77 | 81 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /beecount/src/main/res/layout/activity_welcome.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 25 | 26 | 27 | 40 | 41 | 47 | 48 |