Added the TimerService and the remade the activity for viewing the timer.
1
.idea/.name
generated
|
|
@ -1 +0,0 @@
|
|||
Privacy Friendly Break Reminder
|
||||
7
.idea/gradle.xml
generated
|
|
@ -12,12 +12,7 @@
|
|||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="myModules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
|
|
|||
1
.idea/modules.xml
generated
|
|
@ -4,6 +4,7 @@
|
|||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/PrivacyFriendlyBreakReminder.iml" filepath="$PROJECT_DIR$/PrivacyFriendlyBreakReminder.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/privacy-friendly-break-reminder.iml" filepath="$PROJECT_DIR$/privacy-friendly-break-reminder.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.3"
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder"
|
||||
applicationId "org.secuso.privacyfriendlybreakreminder"
|
||||
minSdkVersion 17
|
||||
targetSdkVersion 23
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
targetSdkVersion 24
|
||||
versionCode 2
|
||||
versionName "2.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
@ -21,9 +21,11 @@ android {
|
|||
|
||||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
compile 'com.android.support:design:25.3.1'
|
||||
compile 'com.android.support:support-v4:25.3.1'
|
||||
compile 'com.android.support:support-annotations:25.3.1'
|
||||
compile 'com.android.support:cardview-v7:25.3.1'
|
||||
compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||
compile 'com.android.support:design:23.4.0'
|
||||
compile 'com.android.support:support-v4:23.4.0'
|
||||
compile 'com.android.support:support-annotations:23.4.0'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
|
@ -1,52 +1,57 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder">
|
||||
package="org.secuso.privacyfriendlybreakreminder">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<application
|
||||
android:screenOrientation="portrait"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:screenOrientation="portrait"
|
||||
android:name=".BreakReminder"
|
||||
android:name=".activities.BreakReminder"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:screenOrientation="portrait"
|
||||
android:name=".SettingsActivity"
|
||||
android:name=".activities.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:parentActivityName=".BreakReminder">
|
||||
android:parentActivityName=".activities.BreakReminder"
|
||||
android:screenOrientation="portrait">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.BreakReminder" />
|
||||
android:value="org.secuso.privacyfriendlybreakreminder.activities.BreakReminder" />
|
||||
</activity>
|
||||
<activity android:name=".BreakDeciderActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".BreakActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".ProfileActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".ExerciseTypeActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".AboutActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".HelpActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name=".activities.BreakDeciderActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.BreakActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.ProfileActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.ExerciseTypeActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.AboutActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.HelpActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<receiver
|
||||
android:name=".AppWidget"
|
||||
android:name=".widget.AppWidget"
|
||||
android:label="Resizable Widget">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
|
|
@ -55,9 +60,24 @@
|
|||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/app_widget2x1_info" />
|
||||
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name=".activities.TimerActivity"
|
||||
android:launchMode="singleInstance">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".service.TimerService"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
|
|
@ -8,6 +8,8 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
public class AboutActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
|
|
@ -1,14 +1,7 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
|
@ -19,6 +12,10 @@ import android.widget.Button;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.database.DBHandler;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.*;
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
|
||||
|
|
@ -256,7 +253,7 @@ public class BreakActivity extends AppCompatActivity implements View.OnClickList
|
|||
while (notFoundYet) {
|
||||
currentExerciseSection = random.nextInt(exercises.length);
|
||||
if (!usedSectionsString.contains(exercises[currentExerciseSection])) {
|
||||
List<Exercise> list = dbHandler.getExercisesFromSection(exercises[currentExerciseSection]);
|
||||
List<Exercise> list = dbHandler.getExercisesFromSection("de",exercises[currentExerciseSection]);
|
||||
allAvailableExercises.add(list);
|
||||
usedSectionsString += exercises[currentExerciseSection] + ".";
|
||||
editor.putString("currently_done_exercises", usedSectionsString);
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.HorizontalScrollView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
public class BreakDeciderActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
|
|
@ -18,8 +19,6 @@ public class BreakDeciderActivity extends AppCompatActivity implements View.OnCl
|
|||
skipButton.setOnClickListener(this);
|
||||
Button breakButton = (Button)findViewById(R.id.button_break);
|
||||
breakButton.setOnClickListener(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
|
|
@ -36,6 +36,9 @@ import android.widget.Button;
|
|||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.widget.*;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
|
|
@ -533,7 +536,7 @@ public class BreakReminder extends AppCompatActivity
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
||||
builder.setView(i.inflate(R.layout.first_dialog, null));
|
||||
builder.setIcon(R.mipmap.ic_launcher);
|
||||
builder.setIcon(R.mipmap.ic_drawer_logo);
|
||||
builder.setTitle(getActivity().getString(R.string.app_name_long));
|
||||
|
||||
builder.setPositiveButton(getActivity().getString(R.string.dialog_positive), null);
|
||||
|
|
@ -1,24 +1,23 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.Adapter;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ExerciseTypeActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
|
||||
Spinner typeSpinner;
|
||||
ListView listView;
|
||||
ArrayList<String> adapter;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
|
@ -6,6 +6,8 @@ import android.support.v7.app.ActionBar;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
|
||||
public class HelpActivity extends AppCompatActivity {
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
|
|
@ -14,6 +14,8 @@ import android.widget.SeekBar;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
public class ProfileActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private SeekBar interval_seekbar, break_seekbar;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
|
|
@ -24,6 +24,12 @@ import android.view.MenuItem;
|
|||
import android.support.v4.app.NavUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.helper.AppCompatPreferenceActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.preferences.DynamicListPreference;
|
||||
import org.secuso.privacyfriendlybreakreminder.preferences.ExerciseListPreference;
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.preferences.SeekBarPreference;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.service.TimerService;
|
||||
|
||||
public class TimerActivity extends AppCompatActivity {
|
||||
|
||||
// UI
|
||||
private ProgressBar progressBar;
|
||||
private TextView timerText;
|
||||
|
||||
// Service
|
||||
private TimerService mTimerService = null;
|
||||
|
||||
private final ServiceConnection mServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
TimerService.TimerServiceBinder binder = (TimerService.TimerServiceBinder) service;
|
||||
mTimerService = binder.getService();
|
||||
|
||||
TimerActivity.this.onServiceConnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
mTimerService = null;
|
||||
}
|
||||
};
|
||||
|
||||
private void onServiceConnected() {
|
||||
if(mTimerService.isRunning()) {
|
||||
progressBar.setMax((int) mTimerService.getInitialDuration());
|
||||
}
|
||||
}
|
||||
|
||||
private final BroadcastReceiver timerReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
long millisUntilDone = intent.getLongExtra("onTickMillis", -1L);
|
||||
|
||||
updateProgress(millisUntilDone);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_timer);
|
||||
|
||||
initResources();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
|
||||
shutdownServiceBinding();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
unregisterReceiver(timerReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
TimerService.startService(this);
|
||||
registerReceiver(timerReceiver, new IntentFilter(TimerService.TIMER_BROADCAST));
|
||||
|
||||
if(mTimerService != null && !mTimerService.isRunning()) {
|
||||
updateProgress(mTimerService.getInitialDuration());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
initServiceBinding();
|
||||
}
|
||||
|
||||
private void initServiceBinding() {
|
||||
Intent intent = new Intent(this, TimerService.class);
|
||||
bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
|
||||
}
|
||||
|
||||
private void shutdownServiceBinding() {
|
||||
if (mTimerService != null) {
|
||||
unbindService(mServiceConnection);
|
||||
}
|
||||
}
|
||||
|
||||
private void initResources() {
|
||||
progressBar = (ProgressBar) findViewById(R.id.progressBar);
|
||||
timerText = (TextView) findViewById(R.id.timerText);
|
||||
|
||||
timerText.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int duration = 1000 * 60 * 1; // 1 minutes
|
||||
if(mTimerService != null) {
|
||||
mTimerService.startTimer(duration);
|
||||
progressBar.setMax(duration);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateProgress(long millisUntilFinished) {
|
||||
progressBar.setProgress(progressBar.getMax() - (int) millisUntilFinished);
|
||||
|
||||
int secondsUntilFinished = (int) Math.ceil(millisUntilFinished / 1000.0);
|
||||
int minutesUntilFinished = secondsUntilFinished / 60;
|
||||
int hours = minutesUntilFinished / 60;
|
||||
int seconds = secondsUntilFinished % 60;
|
||||
int minutes = minutesUntilFinished % 60;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if(hours > 0) sb.append(hours).append(":");
|
||||
if(minutes < 10) sb.append(0);
|
||||
sb.append(minutes).append(":");
|
||||
if(seconds < 10) sb.append(0);
|
||||
sb.append(seconds);
|
||||
|
||||
timerText.setText(sb.toString());
|
||||
|
||||
//progressBar.setMax(1000);
|
||||
//ObjectAnimator animation = ObjectAnimator.ofInt(progressBar, "progress", 0, 1000 * percentFinished); // see this max value coming back here, we animale towards that value
|
||||
|
||||
//animation.setDuration(5000); //in milliseconds
|
||||
//animation.setInterpolator(new LinearInterpolator());
|
||||
//animation.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities.helper;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.database;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.util.Log;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.Exercise;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.columns.ExerciseColumns;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.columns.ExercisesLocalColumns;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DBHandler extends SQLiteOpenHelper {
|
||||
|
||||
private SQLiteDatabase dataBase;
|
||||
private static final String DATABASE_NAME = "exercises.sqlite";
|
||||
private static final String DATABASE_PATH = "/data/data/org.secuso.privacyfriendlybreakreminder/databases/";
|
||||
private static final int DATABASE_VERSION = 3;
|
||||
|
||||
private static final String[] deleteQueryList = {
|
||||
ExerciseColumns.SQL_DELETE_ENTRIES,
|
||||
ExercisesLocalColumns.SQL_DELETE_ENTRIES};
|
||||
|
||||
public DBHandler(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
|
||||
//Check if database exists
|
||||
File databaseFile = context.getDatabasePath(DATABASE_NAME);
|
||||
if (!databaseFile.exists()) {
|
||||
this.getReadableDatabase();
|
||||
try {
|
||||
copyDataBase(context);
|
||||
this.close();
|
||||
} catch (Exception e) {
|
||||
Log.v("db log", "Copying data didn´t work!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
|
||||
}
|
||||
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
execSQLList(db, deleteQueryList);
|
||||
}
|
||||
|
||||
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
onUpgrade(db, oldVersion, newVersion);
|
||||
}
|
||||
|
||||
private void execSQLList(SQLiteDatabase db, String[] queryList) {
|
||||
for (String query : queryList) {
|
||||
db.execSQL(query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Cursor getExerciseCursor(String language) {
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
|
||||
return database.rawQuery(buildQuery(false), new String[]{language});
|
||||
}
|
||||
|
||||
public List<Exercise> getExerciseList(String language) {
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
|
||||
Cursor c = database.rawQuery(buildQuery(false), new String[]{language});
|
||||
|
||||
List<Exercise> result = new ArrayList<>();
|
||||
|
||||
if(c != null) {
|
||||
|
||||
while(!c.isAfterLast()) {
|
||||
result.add(ExerciseColumns.getExercise(c));
|
||||
c.moveToNext();
|
||||
}
|
||||
|
||||
c.close();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* SELECT
|
||||
* E._id,
|
||||
* E.section,
|
||||
* E.image_id,
|
||||
* L.local_id,
|
||||
* L.language,
|
||||
* L.exercise_id,
|
||||
* L.name,
|
||||
* L.description,
|
||||
* L.execution
|
||||
* FROM exercises E LEFT OUTER JOIN exercises_local L
|
||||
* ON E._id = L.exercise_id
|
||||
* WHERE L.language = "de" [AND E.section LIKE %?%]
|
||||
* ORDER BY E._id ASC
|
||||
*
|
||||
* @return the sql query without the ; at the end.
|
||||
*/
|
||||
private String buildQuery(boolean addSectionCheck) {
|
||||
StringBuilder sqlQuery = new StringBuilder();
|
||||
|
||||
sqlQuery.append("SELECT ");
|
||||
|
||||
for(String field : ExerciseColumns.PROJECTION) {
|
||||
sqlQuery.append("E.").append(field).append(", ");
|
||||
}
|
||||
for(String field : ExercisesLocalColumns.PROJECTION) {
|
||||
sqlQuery.append("L.").append(field).append(", ");
|
||||
}
|
||||
// delete the last comma
|
||||
sqlQuery.setLength(sqlQuery.length()-2);
|
||||
|
||||
sqlQuery.append(" FROM ");
|
||||
sqlQuery.append(ExerciseColumns.TABLE_NAME);
|
||||
sqlQuery.append(" E LEFT OUTER JOIN ");
|
||||
sqlQuery.append(ExercisesLocalColumns.TABLE_NAME);
|
||||
sqlQuery.append(" L");
|
||||
|
||||
sqlQuery.append("ON E.");
|
||||
sqlQuery.append(ExerciseColumns._ID);
|
||||
sqlQuery.append(" = L.");
|
||||
sqlQuery.append(ExercisesLocalColumns.EXERCISE_ID);
|
||||
|
||||
sqlQuery.append("WHERE ");
|
||||
sqlQuery.append("L.");
|
||||
sqlQuery.append(ExercisesLocalColumns.LANGUAGE);
|
||||
sqlQuery.append("= ? ");
|
||||
|
||||
if(addSectionCheck) {
|
||||
sqlQuery.append("AND E.");
|
||||
sqlQuery.append(ExerciseColumns.SECTION);
|
||||
sqlQuery.append("LIKE ? ");
|
||||
}
|
||||
|
||||
sqlQuery.append("ORDER BY E.");
|
||||
sqlQuery.append(ExerciseColumns._ID);
|
||||
sqlQuery.append(" ASC");
|
||||
|
||||
return sqlQuery.toString();
|
||||
}
|
||||
|
||||
|
||||
public List<Exercise> getExercisesFromSection(String language, String section) {
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
|
||||
Cursor c = database.rawQuery(buildQuery(true), new String[]{language, "%"+section+"%"});
|
||||
|
||||
List<Exercise> result = new ArrayList<>();
|
||||
|
||||
if(c != null) {
|
||||
|
||||
while(!c.isAfterLast()) {
|
||||
result.add(ExerciseColumns.getExercise(c));
|
||||
c.moveToNext();
|
||||
}
|
||||
|
||||
c.close();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void copyDataBase(Context context) throws IOException {
|
||||
InputStream myInput = context.getAssets().open(DATABASE_NAME);
|
||||
String outFileName = DATABASE_PATH + DATABASE_NAME;
|
||||
OutputStream myOutput = new FileOutputStream(outFileName);
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = myInput.read(buffer)) > 0) {
|
||||
myOutput.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
myOutput.flush();
|
||||
myOutput.close();
|
||||
myInput.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.database.columns;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.provider.BaseColumns;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.Exercise;
|
||||
|
||||
/**
|
||||
* Created by Christopher Beckmann on 23.08.2017.
|
||||
*/
|
||||
|
||||
public class ExerciseColumns implements BaseColumns {
|
||||
|
||||
public static final String TABLE_NAME = "exercises";
|
||||
|
||||
public static final String SECTION = "section";
|
||||
public static final String IMAGE_ID = "image_id";
|
||||
|
||||
public static final String[] PROJECTION = {
|
||||
_ID,
|
||||
SECTION,
|
||||
IMAGE_ID,
|
||||
};
|
||||
public static final String SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS " + TABLE_NAME;
|
||||
|
||||
public static Exercise getExercise(Cursor c) {
|
||||
Exercise e = ExercisesLocalColumns.getExercise(c);
|
||||
|
||||
e.setId(c.getInt(c.getColumnIndexOrThrow(ExerciseColumns._ID)));
|
||||
e.setSection(c.getString(c.getColumnIndexOrThrow(ExerciseColumns.SECTION)));
|
||||
e.setImageID(c.getString(c.getColumnIndexOrThrow(ExerciseColumns.IMAGE_ID)));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
public static ContentValues getValues(Exercise record) {
|
||||
ContentValues values = new ContentValues();
|
||||
if(record.getId() != -1) {
|
||||
values.put(ExerciseColumns._ID, record.getId());
|
||||
}
|
||||
values.put(ExerciseColumns.SECTION, record.getSection());
|
||||
values.put(ExerciseColumns.IMAGE_ID, record.getImageID());
|
||||
|
||||
values.putAll(ExercisesLocalColumns.getValues(record));
|
||||
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.database.columns;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.provider.BaseColumns;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.Exercise;
|
||||
|
||||
/**
|
||||
* Created by Christopher Beckmann on 25.08.2017.
|
||||
*/
|
||||
|
||||
public class ExercisesLocalColumns implements BaseColumns {
|
||||
|
||||
public static final String TABLE_NAME = "exercises_local";
|
||||
|
||||
public static final String _ID = "local_id";
|
||||
public static final String LANGUAGE = "language";
|
||||
public static final String EXERCISE_ID = "exercise_id";
|
||||
public static final String DESCRIPTION = "description";
|
||||
public static final String EXECUTION = "execution";
|
||||
public static final String NAME = "name";
|
||||
|
||||
public static final String[] PROJECTION = {
|
||||
_ID,
|
||||
LANGUAGE,
|
||||
EXERCISE_ID,
|
||||
DESCRIPTION,
|
||||
EXECUTION,
|
||||
NAME
|
||||
};
|
||||
public static final String SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS " + TABLE_NAME;
|
||||
|
||||
public static Exercise getExercise(Cursor c) {
|
||||
Exercise e = new Exercise();
|
||||
|
||||
e.setLocalId(c.getInt(c.getColumnIndexOrThrow(ExercisesLocalColumns._ID)));
|
||||
e.setLanguage(c.getString(c.getColumnIndexOrThrow(ExercisesLocalColumns.LANGUAGE)));
|
||||
e.setDescription(c.getString(c.getColumnIndexOrThrow(ExercisesLocalColumns.DESCRIPTION)));
|
||||
e.setExecution(c.getString(c.getColumnIndexOrThrow(ExercisesLocalColumns.EXECUTION)));
|
||||
e.setName(c.getString(c.getColumnIndexOrThrow(ExercisesLocalColumns.NAME)));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
public static ContentValues getValues(Exercise record) {
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
if(record.getLocalId() != -1) {
|
||||
values.put(ExercisesLocalColumns._ID, record.getLocalId());
|
||||
}
|
||||
values.put(ExercisesLocalColumns.LANGUAGE, record.getLanguage());
|
||||
values.put(ExercisesLocalColumns.DESCRIPTION, record.getDescription());
|
||||
values.put(ExercisesLocalColumns.EXECUTION, record.getExecution());
|
||||
values.put(ExercisesLocalColumns.NAME, record.getName());
|
||||
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +1,41 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.database.data;
|
||||
|
||||
|
||||
public class Exercise {
|
||||
private int id;
|
||||
private String section, execution, description, imageID;
|
||||
private int localId;
|
||||
private String section;
|
||||
private String execution;
|
||||
private String description;
|
||||
private String name;
|
||||
private String imageID;
|
||||
private String language;
|
||||
|
||||
public Exercise(int id, String description, String section, String imageID, String execution) {
|
||||
this.id = id;
|
||||
this.imageID = imageID;
|
||||
this.section = section;
|
||||
this.execution = execution;
|
||||
this.description = description;
|
||||
public Exercise() {
|
||||
this.localId = -1;
|
||||
this.id = -1;
|
||||
this.imageID = "-1";
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getLocalId() { return localId; }
|
||||
public void setLocalId(int exercise_id) { this.localId = exercise_id; }
|
||||
|
||||
public String getLanguage() { return language; }
|
||||
public void setLanguage(String language) { this.language = language; }
|
||||
|
||||
public String getName() { return name; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
public String getExecution() {
|
||||
return execution;
|
||||
}
|
||||
|
||||
public void setExecution(String execution) {
|
||||
this.execution = execution;
|
||||
}
|
||||
|
|
@ -33,7 +43,6 @@ public class Exercise {
|
|||
public String getImageID() {
|
||||
return imageID;
|
||||
}
|
||||
|
||||
public void setImageID(String imageID) {
|
||||
this.imageID = imageID;
|
||||
}
|
||||
|
|
@ -41,7 +50,6 @@ public class Exercise {
|
|||
public String getSection() {
|
||||
return section;
|
||||
}
|
||||
|
||||
public void setSection(String section) {
|
||||
this.section = section;
|
||||
}
|
||||
|
|
@ -49,7 +57,6 @@ public class Exercise {
|
|||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
|
@ -1,20 +1,17 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.preferences;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
|
||||
public class DynamicListPreference extends ListPreference implements DialogInterface.OnClickListener {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.preferences;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.preferences;
|
||||
|
||||
/**
|
||||
* Created by badri_000 on 29.05.2016.
|
||||
|
|
@ -17,6 +17,8 @@ import android.widget.LinearLayout;
|
|||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
|
||||
public class SeekBarPreference extends DialogPreference implements SeekBar.OnSeekBarChangeListener, OnClickListener {
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.service;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Binder;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.IBinder;
|
||||
import android.os.IInterface;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.TimerActivity;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.util.Timer;
|
||||
|
||||
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
|
||||
|
||||
public class TimerService extends Service {
|
||||
public static final String TAG = TimerService.class.getSimpleName();
|
||||
public static final String NOTIFICATION_BROADCAST = TAG + ".NOTIFICATION_BROADCAST";
|
||||
public static final String TIMER_BROADCAST = TAG + ".TIMER_BROADCAST";
|
||||
|
||||
private TimerServiceBinder mBinder = new TimerServiceBinder();
|
||||
private CountDownTimer mTimer;
|
||||
|
||||
private boolean isRunning = false;
|
||||
private long remainingDuration = 0;
|
||||
private long initialDuration = 0;
|
||||
|
||||
private BroadcastReceiver timerReceiver = new BroadcastReceiver() {
|
||||
int lastTime = 0;
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if((int) remainingDuration / 1000 != lastTime) {
|
||||
lastTime = (int) remainingDuration / 1000;
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
if(intent.getBooleanExtra("done" ,false)) {
|
||||
updateNotification();
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
registerReceiver(timerReceiver, new IntentFilter(TIMER_BROADCAST));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
unregisterReceiver(timerReceiver);
|
||||
}
|
||||
|
||||
public synchronized void startTimer(long duration) {
|
||||
if(!isRunning) {
|
||||
initialDuration = duration;
|
||||
mTimer = createTimer(duration);
|
||||
mTimer.start();
|
||||
isRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void pauseTimer() {
|
||||
if(isRunning) {
|
||||
mTimer.cancel();
|
||||
isRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void resumeTimer() {
|
||||
if(!isRunning & remainingDuration > 0) {
|
||||
mTimer = createTimer(remainingDuration);
|
||||
mTimer.start();
|
||||
isRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void resetTimer() {
|
||||
if(isRunning) {
|
||||
mTimer.cancel();
|
||||
isRunning = false;
|
||||
remainingDuration = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean isRunning() {
|
||||
return isRunning;
|
||||
}
|
||||
|
||||
private CountDownTimer createTimer(long duration) {
|
||||
remainingDuration = duration;
|
||||
|
||||
return new CountDownTimer(duration, 10) {
|
||||
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
int secondsUntilFinished = (int) Math.ceil(millisUntilFinished / 1000.0);
|
||||
|
||||
remainingDuration = millisUntilFinished;
|
||||
|
||||
Intent broadcast = new Intent(TIMER_BROADCAST);
|
||||
broadcast.putExtra("onTickMillis", millisUntilFinished);
|
||||
broadcast.putExtra("countdown_seconds", secondsUntilFinished);
|
||||
sendBroadcast(broadcast);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
// TODO: finish broadcast
|
||||
Intent broadcast = new Intent(TIMER_BROADCAST);
|
||||
broadcast.putExtra("done", true);
|
||||
broadcast.putExtra("onTickMillis", 0);
|
||||
broadcast.putExtra("countdown_seconds", 0);
|
||||
sendBroadcast(broadcast);
|
||||
resetTimer();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
super.onStartCommand(intent, flags, startId);
|
||||
|
||||
setAsForegroundService();
|
||||
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void setAsForegroundService() {
|
||||
startForeground(31337, buildNotification());
|
||||
}
|
||||
|
||||
private Notification buildNotification() {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
|
||||
builder.setContentTitle(getString(R.string.app_name));
|
||||
|
||||
int secondsUntilFinished = (int) Math.ceil(remainingDuration / 1000.0);
|
||||
int minutesUntilFinished = secondsUntilFinished / 60;
|
||||
int hours = minutesUntilFinished / 60;
|
||||
int seconds = secondsUntilFinished % 60;
|
||||
int minutes = minutesUntilFinished % 60;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if(hours > 0) sb.append(hours).append(":");
|
||||
if(minutes < 10) sb.append(0);
|
||||
sb.append(minutes).append(":");
|
||||
if(seconds < 10) sb.append(0);
|
||||
sb.append(seconds);
|
||||
|
||||
builder.setContentText(sb.toString());
|
||||
builder.setContentIntent(PendingIntent.getActivity(this, 0, new Intent(this, TimerActivity.class), FLAG_UPDATE_CURRENT));
|
||||
builder.setColor(ContextCompat.getColor(this, R.color.colorAccent));
|
||||
builder.setPriority(NotificationCompat.PRIORITY_HIGH);
|
||||
builder.setWhen(0);
|
||||
builder.setSmallIcon(R.mipmap.ic_launcher);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private void updateNotification() {
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(31337, buildNotification());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
public static void startService(Context context) {
|
||||
context.startService(new Intent(context.getApplicationContext(), TimerService.class));
|
||||
}
|
||||
|
||||
public class TimerServiceBinder extends Binder {
|
||||
public TimerService getService() {
|
||||
return TimerService.this;
|
||||
}
|
||||
}
|
||||
|
||||
public long getInitialDuration() {
|
||||
return initialDuration;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder.widget;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
|
|
@ -8,9 +8,11 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.BreakReminder;
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
/**
|
||||
* Implementation of App Widget functionality.
|
||||
*/
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.SQLException;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class DBHandler extends SQLiteOpenHelper {
|
||||
|
||||
private Context mContext;
|
||||
private SQLiteDatabase dataBase;
|
||||
private static final String DATABASE_NAME = "exercises.sqlite";
|
||||
private static final String DATABASE_PATH = "/data/data/orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder/databases/";
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
|
||||
private static String DEVICE_LANGUAGE = "";
|
||||
public static final String EXERCISES_ID = "id";
|
||||
public static final String EXERCISES_IMAGE_ID = "imageID";
|
||||
public static final String EXERCISES_SECTION = "section";
|
||||
public static final String EXERCISES_DESCRIPTION = "description";
|
||||
public static final String EXERCISES_EXECUTION = "execution";
|
||||
|
||||
public DBHandler(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
mContext = context;
|
||||
|
||||
|
||||
DEVICE_LANGUAGE = Locale.getDefault().getLanguage();
|
||||
if(!DEVICE_LANGUAGE.equals("de") && !DEVICE_LANGUAGE.equals("fr") && !DEVICE_LANGUAGE.equals("ru"))
|
||||
DEVICE_LANGUAGE = "en";
|
||||
System.out.println("Current Language: " + DEVICE_LANGUAGE);
|
||||
|
||||
//Check if database exists
|
||||
File databaseFile = mContext.getDatabasePath(DATABASE_NAME);
|
||||
if (false == databaseFile.exists()) {
|
||||
this.getReadableDatabase();
|
||||
try {
|
||||
copyDataBase();
|
||||
this.close();
|
||||
} catch (Exception e) {
|
||||
Log.v("db log", "Copying data didn´t work!!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
}
|
||||
|
||||
public List<Exercise> getExercises() {
|
||||
Exercise exercise;
|
||||
List<Exercise> exerciseList = new ArrayList<>();
|
||||
dataBase = this.getReadableDatabase();
|
||||
Cursor res = dataBase.rawQuery("SELECT * FROM EXERCISES_" + DEVICE_LANGUAGE, null);
|
||||
res.moveToFirst();
|
||||
while (!res.isAfterLast()) {
|
||||
exercise = new Exercise(res.getInt(0), res.getString(1), res.getString(2), res.getString(3), res.getString(4));
|
||||
exerciseList.add(exercise);
|
||||
res.moveToNext();
|
||||
}
|
||||
|
||||
res.close();
|
||||
return exerciseList;
|
||||
}
|
||||
|
||||
|
||||
public List<Exercise> getExercisesFromSection(String section) {
|
||||
Exercise exercise;
|
||||
List<Exercise> exerciseList = new ArrayList<>();
|
||||
dataBase = this.getReadableDatabase();
|
||||
|
||||
String table = "";
|
||||
if(!DEVICE_LANGUAGE.equals("fr") && !DEVICE_LANGUAGE.equals("de") && !DEVICE_LANGUAGE.equals("ru"))
|
||||
table = "en";
|
||||
else
|
||||
table = DEVICE_LANGUAGE;
|
||||
|
||||
Cursor res = dataBase.rawQuery("SELECT * FROM EXERCISES_" + table + " WHERE " + EXERCISES_SECTION + " LIKE " + "\"%" + section + "%\"", null);
|
||||
res.moveToFirst();
|
||||
while (!res.isAfterLast()) {
|
||||
exercise = new Exercise(res.getInt(0), res.getString(1), section, res.getString(3), res.getString(4));
|
||||
exerciseList.add(exercise);
|
||||
res.moveToNext();
|
||||
}
|
||||
|
||||
res.close();
|
||||
return exerciseList;
|
||||
}
|
||||
|
||||
private void copyDataBase() throws IOException {
|
||||
InputStream myInput = mContext.getAssets().open(DATABASE_NAME);
|
||||
String outFileName = DATABASE_PATH + DATABASE_NAME;
|
||||
OutputStream myOutput = new FileOutputStream(outFileName);
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = myInput.read(buffer)) > 0) {
|
||||
myOutput.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
myOutput.flush();
|
||||
myOutput.close();
|
||||
myInput.close();
|
||||
}
|
||||
}
|
||||
BIN
app/src/main/res/drawable-hdpi/ic_add_black_48dp.png
Normal file
|
After Width: | Height: | Size: 114 B |
BIN
app/src/main/res/drawable-hdpi/ic_create_black_48dp.png
Normal file
|
After Width: | Height: | Size: 269 B |
BIN
app/src/main/res/drawable-hdpi/ic_home_black_48dp.png
Normal file
|
After Width: | Height: | Size: 303 B |
BIN
app/src/main/res/drawable-hdpi/ic_pause_black_48dp.png
Normal file
|
After Width: | Height: | Size: 109 B |
BIN
app/src/main/res/drawable-hdpi/ic_pause_white_24dp.png
Normal file
|
After Width: | Height: | Size: 105 B |
BIN
app/src/main/res/drawable-hdpi/ic_play_arrow_white_24dp.png
Normal file
|
After Width: | Height: | Size: 195 B |
|
After Width: | Height: | Size: 358 B |
|
After Width: | Height: | Size: 1,005 B |
|
After Width: | Height: | Size: 500 B |
BIN
app/src/main/res/drawable-hdpi/ic_replay_black_48dp.png
Normal file
|
After Width: | Height: | Size: 647 B |
BIN
app/src/main/res/drawable-hdpi/ic_replay_white_24dp.png
Normal file
|
After Width: | Height: | Size: 391 B |
BIN
app/src/main/res/drawable-hdpi/ic_settings_black_48dp.png
Normal file
|
After Width: | Height: | Size: 827 B |
BIN
app/src/main/res/drawable-hdpi/ic_skip_next_black_48dp.png
Normal file
|
After Width: | Height: | Size: 284 B |
BIN
app/src/main/res/drawable-hdpi/ic_skip_next_white_24dp.png
Normal file
|
After Width: | Height: | Size: 187 B |
BIN
app/src/main/res/drawable-hdpi/ic_skip_previous_black_48dp.png
Normal file
|
After Width: | Height: | Size: 295 B |
BIN
app/src/main/res/drawable-hdpi/ic_skip_previous_white_24dp.png
Normal file
|
After Width: | Height: | Size: 201 B |
BIN
app/src/main/res/drawable-mdpi/ic_add_black_48dp.png
Normal file
|
After Width: | Height: | Size: 108 B |
BIN
app/src/main/res/drawable-mdpi/ic_create_black_48dp.png
Normal file
|
After Width: | Height: | Size: 222 B |
BIN
app/src/main/res/drawable-mdpi/ic_home_black_48dp.png
Normal file
|
After Width: | Height: | Size: 239 B |
BIN
app/src/main/res/drawable-mdpi/ic_pause_black_48dp.png
Normal file
|
After Width: | Height: | Size: 101 B |
BIN
app/src/main/res/drawable-mdpi/ic_pause_white_24dp.png
Normal file
|
After Width: | Height: | Size: 83 B |
BIN
app/src/main/res/drawable-mdpi/ic_play_arrow_white_24dp.png
Normal file
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 680 B |
|
After Width: | Height: | Size: 351 B |
BIN
app/src/main/res/drawable-mdpi/ic_replay_black_48dp.png
Normal file
|
After Width: | Height: | Size: 437 B |
BIN
app/src/main/res/drawable-mdpi/ic_replay_white_24dp.png
Normal file
|
After Width: | Height: | Size: 244 B |
BIN
app/src/main/res/drawable-mdpi/ic_settings_black_48dp.png
Normal file
|
After Width: | Height: | Size: 557 B |
BIN
app/src/main/res/drawable-mdpi/ic_skip_next_black_48dp.png
Normal file
|
After Width: | Height: | Size: 225 B |
BIN
app/src/main/res/drawable-mdpi/ic_skip_next_white_24dp.png
Normal file
|
After Width: | Height: | Size: 147 B |
BIN
app/src/main/res/drawable-mdpi/ic_skip_previous_black_48dp.png
Normal file
|
After Width: | Height: | Size: 233 B |
BIN
app/src/main/res/drawable-mdpi/ic_skip_previous_white_24dp.png
Normal file
|
After Width: | Height: | Size: 152 B |
BIN
app/src/main/res/drawable-xhdpi/ic_add_black_48dp.png
Normal file
|
After Width: | Height: | Size: 119 B |
BIN
app/src/main/res/drawable-xhdpi/ic_create_black_48dp.png
Normal file
|
After Width: | Height: | Size: 319 B |
BIN
app/src/main/res/drawable-xhdpi/ic_home_black_48dp.png
Normal file
|
After Width: | Height: | Size: 356 B |
BIN
app/src/main/res/drawable-xhdpi/ic_pause_black_48dp.png
Normal file
|
After Width: | Height: | Size: 111 B |
BIN
app/src/main/res/drawable-xhdpi/ic_pause_white_24dp.png
Normal file
|
After Width: | Height: | Size: 90 B |
BIN
app/src/main/res/drawable-xhdpi/ic_play_arrow_white_24dp.png
Normal file
|
After Width: | Height: | Size: 220 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 699 B |
BIN
app/src/main/res/drawable-xhdpi/ic_replay_black_48dp.png
Normal file
|
After Width: | Height: | Size: 866 B |
BIN
app/src/main/res/drawable-xhdpi/ic_replay_white_24dp.png
Normal file
|
After Width: | Height: | Size: 457 B |
BIN
app/src/main/res/drawable-xhdpi/ic_settings_black_48dp.png
Normal file
|
After Width: | Height: | Size: 1 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_skip_next_black_48dp.png
Normal file
|
After Width: | Height: | Size: 340 B |
BIN
app/src/main/res/drawable-xhdpi/ic_skip_next_white_24dp.png
Normal file
|
After Width: | Height: | Size: 222 B |
BIN
app/src/main/res/drawable-xhdpi/ic_skip_previous_black_48dp.png
Normal file
|
After Width: | Height: | Size: 354 B |
BIN
app/src/main/res/drawable-xhdpi/ic_skip_previous_white_24dp.png
Normal file
|
After Width: | Height: | Size: 242 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_add_black_48dp.png
Normal file
|
After Width: | Height: | Size: 130 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_create_black_48dp.png
Normal file
|
After Width: | Height: | Size: 433 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_home_black_48dp.png
Normal file
|
After Width: | Height: | Size: 485 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_pause_black_48dp.png
Normal file
|
After Width: | Height: | Size: 127 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_pause_white_24dp.png
Normal file
|
After Width: | Height: | Size: 92 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_play_arrow_white_24dp.png
Normal file
|
After Width: | Height: | Size: 283 B |
|
After Width: | Height: | Size: 666 B |
|
After Width: | Height: | Size: 2 KiB |
|
After Width: | Height: | Size: 1,023 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_replay_black_48dp.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_replay_white_24dp.png
Normal file
|
After Width: | Height: | Size: 675 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_settings_black_48dp.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_skip_next_black_48dp.png
Normal file
|
After Width: | Height: | Size: 437 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_skip_next_white_24dp.png
Normal file
|
After Width: | Height: | Size: 292 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_skip_previous_black_48dp.png
Normal file
|
After Width: | Height: | Size: 441 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_skip_previous_white_24dp.png
Normal file
|
After Width: | Height: | Size: 309 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_add_black_48dp.png
Normal file
|
After Width: | Height: | Size: 133 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_create_black_48dp.png
Normal file
|
After Width: | Height: | Size: 578 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_home_black_48dp.png
Normal file
|
After Width: | Height: | Size: 589 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_pause_black_48dp.png
Normal file
|
After Width: | Height: | Size: 128 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_pause_white_24dp.png
Normal file
|
After Width: | Height: | Size: 94 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_play_arrow_white_24dp.png
Normal file
|
After Width: | Height: | Size: 343 B |
|
After Width: | Height: | Size: 883 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_replay_black_48dp.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_replay_white_24dp.png
Normal file
|
After Width: | Height: | Size: 908 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_settings_black_48dp.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_skip_next_black_48dp.png
Normal file
|
After Width: | Height: | Size: 563 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_skip_next_white_24dp.png
Normal file
|
After Width: | Height: | Size: 357 B |
|
After Width: | Height: | Size: 564 B |
|
After Width: | Height: | Size: 372 B |
22
app/src/main/res/drawable/circular.xml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape
|
||||
android:innerRadiusRatio="4"
|
||||
android:shape="ring"
|
||||
android:useLevel="false"
|
||||
android:thicknessRatio="12">
|
||||
<solid android:color="@color/middlegrey"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<shape
|
||||
android:innerRadiusRatio="4"
|
||||
android:useLevel="true"
|
||||
android:shape="ring"
|
||||
android:thicknessRatio="12">
|
||||
<solid android:color="@color/lightblue"/>
|
||||
<corners android:radius="2dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:weightSum="1"
|
||||
tools:context=".AboutActivity">
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.AboutActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="15dp"
|
||||
tools:context="orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.BreakActivity">
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.BreakActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/break_exercise_type"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
tools:context=".BreakDeciderActivity">
|
||||
tools:context=".activities.BreakDeciderActivity">
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@
|
|||
android:background="@color/white"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
tools:context=".HelpActivity"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.HelpActivity"
|
||||
android:weightSum="1">
|
||||
<fragment android:name="orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.HelpActivity$HelpFragment"
|
||||
<fragment android:name="org.secuso.privacyfriendlybreakreminder.activities.HelpActivity$HelpFragment"
|
||||
android:id="@+id/help_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
|
|
|||
82
app/src/main/res/layout/activity_timer.xml
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/activity_horizontal_margin"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.TimerActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:id="@+id/relativeLayout"
|
||||
android:layout_marginEnd="8dp">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:progressDrawable="@drawable/circular"
|
||||
android:rotation="270"
|
||||
android:max="100"
|
||||
android:progress="66"
|
||||
android:layout_alignTop="@+id/timerText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:text="00:00"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@color/colorPrimaryDark"
|
||||
android:textSize="40sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/ic_replay_black_48dp"
|
||||
android:hapticFeedbackEnabled="true"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/relativeLayout"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintRight_toRightOf="@+id/relativeLayout"
|
||||
android:layout_marginLeft="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/relativeLayout"
|
||||
app:layout_constraintHorizontal_bias="0.33" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:hapticFeedbackEnabled="true"
|
||||
android:scaleType="fitXY"
|
||||
app:srcCompat="@drawable/ic_play_arrow_black_48dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintRight_toRightOf="@+id/relativeLayout"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/relativeLayout"
|
||||
android:layout_marginLeft="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/relativeLayout"
|
||||
app:layout_constraintHorizontal_bias="0.66" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.BreakReminder">
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.org.secuso.privacyfriendlybreakreminder.privacyfriendlybreakreminder.BreakReminder">
|
||||
|
||||
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.BreakReminder"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.BreakReminder"
|
||||
tools:showIn="@layout/app_bar_break_reminder">
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<resources>
|
||||
<color name="colorPrimary">#024265</color>
|
||||
<color name="colorPrimaryDark">#024265</color>
|
||||
<color name="colorAccent">#0274B2</color>
|
||||
<color name="colorAccent">#0274b2</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="white">#ffffff</color>
|
||||
<color name="black">#000000</color>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
|
||||
<!-- settings for BreakReminder -->
|
||||
<string name= "new_profile">New Profile...</string>
|
||||
<string name="new_profile">New Profile...</string>
|
||||
<string name="play_stop" translatable="false">Play/Stop</string>
|
||||
<string name="reset" translatable="false">Reset</string>
|
||||
<string name="break_reminder_time" translatable="false">30:00</string>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
|
||||
<orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.DynamicListPreference
|
||||
<org.secuso.privacyfriendlybreakreminder.preferences.DynamicListPreference
|
||||
android:defaultValue="@string/pref_current_profile_value"
|
||||
android:key="current_profile"
|
||||
android:title="@string/pref_current_profile" />
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
android:positiveButtonText="@string/dialog_positive"/>
|
||||
|
||||
|
||||
<orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.SeekBarPreference
|
||||
<org.secuso.privacyfriendlybreakreminder.preferences.SeekBarPreference
|
||||
android:defaultValue="50"
|
||||
android:dialogMessage="@string/settings_dialog_message"
|
||||
android:key="work_value"
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
android:text="@string/settings_unit"
|
||||
android:title="@string/settings_title" />
|
||||
|
||||
<orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.SeekBarPreference
|
||||
<org.secuso.privacyfriendlybreakreminder.preferences.SeekBarPreference
|
||||
android:defaultValue="10"
|
||||
android:dialogMessage="@string/settings_break_title"
|
||||
android:key="break_value"
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
android:key="cont_value"
|
||||
android:title="@string/new_profile_continuously" />
|
||||
|
||||
<orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.ExerciseListPreference
|
||||
<org.secuso.privacyfriendlybreakreminder.preferences.ExerciseListPreference
|
||||
android:defaultValue="1"
|
||||
android:summary="@string/settings_exercise_summary"
|
||||
android:entries="@array/type_spinner"
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
<!-- These settings headers are only used on tablets. -->
|
||||
|
||||
<header
|
||||
android:fragment="orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.SettingsActivity$GeneralPreferenceFragment"
|
||||
android:fragment="org.secuso.privacyfriendlybreakreminder.activities.SettingsActivity$GeneralPreferenceFragment"
|
||||
android:icon="@drawable/ic_info_black_24dp"
|
||||
android:title="@string/pref_header_general" />
|
||||
|
||||
<header
|
||||
android:fragment="orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.SettingsActivity$NotificationPreferenceFragment"
|
||||
android:fragment="org.secuso.privacyfriendlybreakreminder.activities.SettingsActivity$NotificationPreferenceFragment"
|
||||
android:icon="@drawable/ic_notifications_black_24dp"
|
||||
android:title="@string/pref_header_notifications" />
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
package org.secuso.privacyfriendlybreakreminder;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.2'
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
|
|||
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#Mon Dec 28 10:00:20 PST 2015
|
||||
#Sat Aug 12 14:48:24 CEST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
|
|
|
|||