The ExerciseSet can now be chosen in the TimerActivity. The splash screen as well as the tutorial have been built in. The navigation drawer is now functional. You can now create and delete exercise sets via the ManageExerciseSetsActivity. Started building the EditExerciseSetActivity, where should be able to edit an exercise set.
|
|
@ -10,6 +10,7 @@ android {
|
|||
targetSdkVersion 24
|
||||
versionCode 2
|
||||
versionName "2.0"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".activities.BreakReminder"
|
||||
android:name=".activities.old.BreakReminder"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait"
|
||||
|
|
@ -26,23 +26,23 @@
|
|||
<activity
|
||||
android:name=".activities.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:parentActivityName=".activities.BreakReminder"
|
||||
android:parentActivityName=".activities.old.BreakReminder"
|
||||
android:screenOrientation="portrait">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="org.secuso.privacyfriendlybreakreminder.activities.BreakReminder" />
|
||||
android:value="org.secuso.privacyfriendlybreakreminder.activities.old.BreakReminder" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activities.BreakDeciderActivity"
|
||||
android:name=".activities.old.BreakDeciderActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.BreakActivity"
|
||||
android:name=".activities.old.BreakActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.ProfileActivity"
|
||||
android:name=".activities.old.ProfileActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.ExerciseTypeActivity"
|
||||
android:name=".activities.old.ExerciseTypeActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activities.AboutActivity"
|
||||
|
|
@ -64,22 +64,58 @@
|
|||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name=".activities.TimerActivity"
|
||||
android:launchMode="singleInstance">
|
||||
android:name=".activities.SplashActivity"
|
||||
android:icon="@mipmap/splash_icon"
|
||||
android:theme="@style/SplashTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activities.tutorial.TutorialActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
|
||||
<service
|
||||
android:name=".service.TimerService"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
|
||||
<activity android:name=".activities.ExerciseSetOverviewActivity" />
|
||||
<activity android:name=".activities.ExerciseActivity"></activity>
|
||||
<activity
|
||||
android:name=".activities.TimerActivity"
|
||||
android:label="@string/activity_title_break_reminder"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.ManageExerciseSetsActivity"
|
||||
android:label="@string/activity_title_manage_exercise_sets"
|
||||
android:parentActivityName=".activities.TimerActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="org.secuso.privacyfriendlybreakreminder.activities.TimerActivity" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activities.ExerciseActivity"
|
||||
android:label="@string/activity_title_exercise"
|
||||
android:parentActivityName=".activities.TimerActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="org.secuso.privacyfriendlybreakreminder.activities.TimerActivity" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activities.EditExerciseSetActivity"
|
||||
android:label="@string/activity_title_edit_exercise_set"
|
||||
android:parentActivityName=".activities.ManageExerciseSetsActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="org.secuso.privacyfriendlybreakreminder.activities.ManageExerciseSetsActivity" />
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package org.secuso.privacyfriendlybreakreminder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* This class saves the available languages for the exercises.
|
||||
* @author Christopher Beckmann
|
||||
*/
|
||||
public class ExerciseLocale {
|
||||
|
||||
private static final HashSet<String> AVAILABLE_LOCALE = new HashSet<>();
|
||||
|
||||
static {
|
||||
AVAILABLE_LOCALE.addAll(
|
||||
Arrays.asList(
|
||||
"en", "de"
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return the available language. If the default language of the device is not available. {@code "en"} will be returned.
|
||||
*/
|
||||
public static String getLocale() {
|
||||
String locale = Locale.getDefault().getLanguage();
|
||||
return AVAILABLE_LOCALE.contains(locale) ? locale : "en";
|
||||
}
|
||||
}
|
||||
|
|
@ -17,12 +17,6 @@ public class AboutActivity extends AppCompatActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.about);
|
||||
|
||||
|
||||
ActionBar ab = getSupportActionBar();
|
||||
if(ab != null) {
|
||||
ab.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
View mainContent = findViewById(R.id.main_content);
|
||||
if (mainContent != null) {
|
||||
mainContent.setAlpha(0);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,218 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.ExerciseLocale;
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.adapter.ExerciseSetAdapter;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.SQLiteHelper;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.ExerciseSet;
|
||||
|
||||
public class EditExerciseSetActivity extends AppCompatActivity implements android.support.v4.app.LoaderManager.LoaderCallbacks<ExerciseSet> {
|
||||
|
||||
// extras
|
||||
public static final String EXTRA_EXERCISE_SET_ID = "EXTRA_EXERCISE_SET_ID";
|
||||
public static final String EXTRA_EXERCISE_SET_NAME = "EXTRA_EXERCISE_SET_NAME";
|
||||
|
||||
// UI
|
||||
private TextView exerciseSetNameText;
|
||||
private RecyclerView exerciseList;
|
||||
private ProgressBar loadingSpinner;
|
||||
|
||||
private ExerciseSetAdapter exerciseSetAdapter;
|
||||
private ActionBar actionBar;
|
||||
private Toolbar toolbar;
|
||||
|
||||
// exercise set information
|
||||
private long exerciseSetId = -1L;
|
||||
private String exerciseSetName = "";
|
||||
private boolean modificationsDone = false;
|
||||
|
||||
//methods
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_edit_exercise_set);
|
||||
|
||||
Intent i = getIntent();
|
||||
exerciseSetId = i.getLongExtra(EXTRA_EXERCISE_SET_ID, -1L);
|
||||
exerciseSetName = i.getStringExtra(EXTRA_EXERCISE_SET_NAME);
|
||||
|
||||
if(exerciseSetId < 0L || TextUtils.isEmpty(exerciseSetName)) {
|
||||
// no valid exercise
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
initResources();
|
||||
|
||||
getSupportLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
private void initResources() {
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
exerciseSetNameText = (TextView) findViewById(R.id.exercise_set_name);
|
||||
exerciseList = (RecyclerView) findViewById(R.id.exercise_list);
|
||||
exerciseSetAdapter = new ExerciseSetAdapter(this, null);
|
||||
exerciseList.setAdapter(exerciseSetAdapter);
|
||||
//exerciseList.setLayoutManager(new GridLayoutManager(this, 2));
|
||||
exerciseList.setLayoutManager(new LinearLayoutManager(this));
|
||||
loadingSpinner = (ProgressBar) findViewById(R.id.loading_spinner);
|
||||
|
||||
exerciseSetNameText.setText(exerciseSetName);
|
||||
exerciseSetNameText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
modificationsDone = true;
|
||||
}
|
||||
});
|
||||
|
||||
setupActionBar();
|
||||
}
|
||||
|
||||
private void setupActionBar() {
|
||||
if (getSupportActionBar() == null) {
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
actionBar = getSupportActionBar();
|
||||
|
||||
if(actionBar != null) {
|
||||
actionBar.setTitle(R.string.activity_title_edit_exercise_set);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setHomeAsUpIndicator(R.drawable.ic_close_white);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<ExerciseSet> onCreateLoader(int id, final Bundle args) {
|
||||
return new AsyncTaskLoader<ExerciseSet>(this) {
|
||||
@Override
|
||||
public ExerciseSet loadInBackground() {
|
||||
SQLiteHelper helper = new SQLiteHelper(getContext());
|
||||
|
||||
return helper.getExerciseListForSet((int)exerciseSetId, ExerciseLocale.getLocale());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStartLoading() {
|
||||
loadingSpinner.setVisibility(View.VISIBLE);
|
||||
forceLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReset() {}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<ExerciseSet> loader, ExerciseSet set) {
|
||||
loadingSpinner.animate().alpha(0.0f).setDuration(500).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
loadingSpinner.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
exerciseSetAdapter.updateData(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<ExerciseSet> loader) {}
|
||||
|
||||
// @Override
|
||||
// protected void onResume() {
|
||||
// super.onResume();
|
||||
//
|
||||
// getSupportLoaderManager().restartLoader(0, null, this);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if(modificationsDone) {
|
||||
showDiscardDialog();
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
return true;
|
||||
case R.id.save:
|
||||
saveChanges();
|
||||
super.onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void saveChanges() {
|
||||
ExerciseSet set = exerciseSetAdapter.getExerciseSet();
|
||||
|
||||
// TODO: save changes to database
|
||||
// man könnte den unterschied, der gespeichert werden muss rausfinden, indem man nur die änderungen speichert..
|
||||
// man könnte auch einfach alle dateneinträge zu dem set löschen und neu eintragen
|
||||
// man könnte das exerciseSet clonable machen und eine original kopie abspeichern und dann mit dem aus dem adapter vergleichen
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_edit_exercise_sets, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(modificationsDone) {
|
||||
showDiscardDialog();
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
private void showDiscardDialog() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setPositiveButton(R.string.keep_editing, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.discard, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
EditExerciseSetActivity.super.onBackPressed();
|
||||
}
|
||||
})
|
||||
.setMessage(R.string.dialog_discard_confirmation)
|
||||
.create().show();
|
||||
}
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ public class ExerciseActivity extends AppCompatActivity {
|
|||
if(isRunning) {
|
||||
playButton.setImageResource(R.drawable.ic_pause_black_48dp);
|
||||
} else {
|
||||
playButton.setImageResource(R.drawable.ic_play_arrow_black_48dp);
|
||||
playButton.setImageResource(R.drawable.ic_play_arrow_black);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.adapter.ExerciseAdapter;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.SQLiteHelper;
|
||||
|
||||
public class ExerciseSetOverviewActivity extends AppCompatActivity implements android.support.v4.app.LoaderManager.LoaderCallbacks<Cursor>{
|
||||
|
||||
private TextView exerciseSetName;
|
||||
private RecyclerView exerciseList;
|
||||
|
||||
private ExerciseAdapter exerciseAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_exercise_set);
|
||||
|
||||
initResources();
|
||||
}
|
||||
|
||||
private void initResources() {
|
||||
exerciseSetName = (TextView) findViewById(R.id.exercise_set_name);
|
||||
exerciseList = (RecyclerView) findViewById(R.id.exercise_list);
|
||||
exerciseAdapter = new ExerciseAdapter(this, null);
|
||||
exerciseList.setAdapter(exerciseAdapter);
|
||||
exerciseList.setLayoutManager(new GridLayoutManager(this, 2));
|
||||
|
||||
getSupportLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int id, final Bundle args) {
|
||||
return new AsyncTaskLoader<Cursor>(this) {
|
||||
@Override
|
||||
public Cursor loadInBackground() {
|
||||
SQLiteHelper helper = new SQLiteHelper(getContext());
|
||||
return helper.getExerciseCursorForSet(2, "de"); // TODO; get correct subset list
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStartLoading() {
|
||||
forceLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReset() {}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
||||
cursor.moveToFirst();
|
||||
exerciseAdapter.changeCursor(cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
((ExerciseAdapter) exerciseList.getAdapter()).changeCursor(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
getSupportLoaderManager().restartLoader(0, null, this);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,36 +7,21 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.view.MenuItem;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.helper.BaseActivity;
|
||||
|
||||
|
||||
public class HelpActivity extends AppCompatActivity {
|
||||
public class HelpActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_help);
|
||||
setupActionBar();
|
||||
}
|
||||
|
||||
private void setupActionBar() {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setTitle(R.string.help);
|
||||
if (actionBar != null) {
|
||||
// Show the Up button in the action bar.
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
// Respond to the action bar's Up/Home button
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
protected int getNavigationDrawerID() {
|
||||
return R.id.nav_help;
|
||||
}
|
||||
|
||||
public static class HelpFragment extends PreferenceFragment {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,352 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.TextInputEditText;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.ExerciseLocale;
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.adapter.ExerciseSetListAdapter;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.helper.BaseActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.SQLiteHelper;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.ExerciseSet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
public class ManageExerciseSetsActivity extends BaseActivity implements android.support.v4.app.LoaderManager.LoaderCallbacks<List<ExerciseSet>> {
|
||||
|
||||
private RecyclerView exerciseSetList;
|
||||
private ProgressBar loadingSpinner;
|
||||
private TextView noExerciseSetsText;
|
||||
private FloatingActionButton fabButton;
|
||||
private MenuItem toolbarDeleteIcon;
|
||||
|
||||
private ExerciseSetListAdapter exerciseSetAdapter;
|
||||
|
||||
private boolean deleteMode = false;
|
||||
private ColorStateList fabDefaultBackgroundTint;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_manage_exercise_set);
|
||||
|
||||
initResources();
|
||||
getSupportLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
private void initResources() {
|
||||
exerciseSetAdapter = new ExerciseSetListAdapter(this, null);
|
||||
exerciseSetList = (RecyclerView) findViewById(R.id.exercise_set_list);
|
||||
loadingSpinner = (ProgressBar) findViewById(R.id.loading_spinner);
|
||||
loadingSpinner.setAlpha(1.0f);
|
||||
noExerciseSetsText = (TextView) findViewById(R.id.no_exercise_sets_text);
|
||||
fabButton = (FloatingActionButton) findViewById(R.id.add_button);
|
||||
|
||||
fabDefaultBackgroundTint = fabButton.getBackgroundTintList();
|
||||
|
||||
exerciseSetList.setLayoutManager(new LinearLayoutManager(this));
|
||||
exerciseSetList.setAdapter(exerciseSetAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<List<ExerciseSet>> onCreateLoader(int id, final Bundle args) {
|
||||
return new AsyncTaskLoader<List<ExerciseSet>>(this) {
|
||||
@Override
|
||||
public List<ExerciseSet> loadInBackground() {
|
||||
SQLiteHelper helper = new SQLiteHelper(getContext());
|
||||
return helper.getExerciseSetsWithExercises(ExerciseLocale.getLocale());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStartLoading() {
|
||||
setLoading(true, false);
|
||||
forceLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReset() {}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<List<ExerciseSet>> loader, List<ExerciseSet> data) {
|
||||
|
||||
boolean hasElements = data.size() > 0;
|
||||
|
||||
setLoading(false, hasElements);
|
||||
|
||||
exerciseSetAdapter.setData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<List<ExerciseSet>> loader) {}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
getSupportLoaderManager().restartLoader(0, null, this);
|
||||
}
|
||||
|
||||
private void setLoading(boolean isLoading, boolean hasElements) {
|
||||
if(isLoading) {
|
||||
loadingSpinner.setVisibility(VISIBLE);
|
||||
loadingSpinner.animate().alpha(1.0f).setDuration(1000).start();
|
||||
|
||||
noExerciseSetsText.setVisibility(GONE);
|
||||
exerciseSetList.setVisibility(GONE);
|
||||
} else {
|
||||
loadingSpinner.animate().alpha(0.0f).setDuration(500).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
loadingSpinner.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
|
||||
if(hasElements) {
|
||||
noExerciseSetsText.setVisibility(GONE);
|
||||
exerciseSetList.setVisibility(VISIBLE);
|
||||
} else {
|
||||
noExerciseSetsText.setVisibility(VISIBLE);
|
||||
exerciseSetList.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
||||
mDrawerToggle.setToolbarNavigationClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(deleteMode)
|
||||
disableDeleteMode();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setDrawerEnabled(final boolean enabled) {
|
||||
|
||||
int lockMode = enabled ?
|
||||
DrawerLayout.LOCK_MODE_UNLOCKED :
|
||||
DrawerLayout.LOCK_MODE_LOCKED_CLOSED;
|
||||
|
||||
mDrawerLayout.setDrawerLockMode(lockMode);
|
||||
|
||||
mDrawerToggle.setDrawerIndicatorEnabled(enabled);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(!enabled);
|
||||
actionBar.setDefaultDisplayHomeAsUpEnabled(!enabled);
|
||||
actionBar.setDisplayShowHomeEnabled(enabled);
|
||||
actionBar.setHomeButtonEnabled(enabled);
|
||||
}
|
||||
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if(deleteMode)
|
||||
disableDeleteMode();
|
||||
else
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_delete:
|
||||
enableDeleteMode();
|
||||
return true;
|
||||
default:
|
||||
Toast.makeText(this, "option selected", Toast.LENGTH_SHORT).show();
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSupportNavigateUp() {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(deleteMode)
|
||||
disableDeleteMode();
|
||||
else
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getNavigationDrawerID() {
|
||||
return R.id.nav_manage_exercise_sets;
|
||||
}
|
||||
|
||||
public void onClick(View view) {
|
||||
switch(view.getId()) {
|
||||
case R.id.add_button:
|
||||
if(deleteMode) {
|
||||
SQLiteHelper helper = new SQLiteHelper(this);
|
||||
|
||||
List<Long> deleteIds = exerciseSetAdapter.getDeleteIdList();
|
||||
|
||||
if(deleteIds.size() == 0) {
|
||||
Toast.makeText(this, "Please select an item to delete.", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
for (Long l : deleteIds) {
|
||||
helper.deleteExerciseSet(l);
|
||||
}
|
||||
disableDeleteMode();
|
||||
getSupportLoaderManager().restartLoader(0, null, this);
|
||||
}
|
||||
|
||||
} else {
|
||||
AddExerciseSetDialogFragment dialog = new AddExerciseSetDialogFragment();
|
||||
dialog.show(this.getSupportFragmentManager(), AddExerciseSetDialogFragment.TAG);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void enableDeleteMode() {
|
||||
deleteMode = true;
|
||||
|
||||
setDrawerEnabled(false);
|
||||
|
||||
exerciseSetAdapter.enableDeleteMode();
|
||||
|
||||
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
||||
getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.middlegrey));
|
||||
}
|
||||
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ActivityCompat.getColor(this, R.color.middlegrey)));
|
||||
getSupportActionBar().setTitle(R.string.activity_title_manage_exercise_sets);
|
||||
|
||||
if(toolbarDeleteIcon != null) {
|
||||
toolbarDeleteIcon.setVisible(false);
|
||||
}
|
||||
|
||||
fabButton.setBackgroundTintList(ColorStateList.valueOf(ActivityCompat.getColor(this, R.color.red)));
|
||||
fabButton.setImageResource(R.drawable.ic_delete_white);
|
||||
}
|
||||
|
||||
public void disableDeleteMode() {
|
||||
deleteMode = false;
|
||||
|
||||
setDrawerEnabled(true);
|
||||
|
||||
exerciseSetAdapter.disableDeleteMode();
|
||||
|
||||
if(toolbarDeleteIcon != null) {
|
||||
toolbarDeleteIcon.setVisible(true);
|
||||
}
|
||||
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
||||
getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
|
||||
}
|
||||
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ActivityCompat.getColor(this, R.color.colorPrimary)));
|
||||
getSupportActionBar().setTitle(R.string.activity_title_manage_exercise_sets);
|
||||
|
||||
fabButton.setBackgroundTintList(fabDefaultBackgroundTint);
|
||||
fabButton.setImageResource(R.drawable.ic_add_white_24dp);
|
||||
}
|
||||
|
||||
public static class AddExerciseSetDialogFragment extends DialogFragment {
|
||||
|
||||
static final String TAG = AddExerciseSetDialogFragment.class.getSimpleName();
|
||||
|
||||
TextInputEditText exerciseSetName;
|
||||
ManageExerciseSetsActivity activity;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
activity = (ManageExerciseSetsActivity)context;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), 0);
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(FragmentActivity.LAYOUT_INFLATER_SERVICE);
|
||||
View v = inflater.inflate(R.layout.dialog_add_exercise_set, null);
|
||||
|
||||
exerciseSetName = (TextInputEditText) v.findViewById(R.id.dialog_add_exercise_set_name);
|
||||
|
||||
builder.setView(v);
|
||||
builder.setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
String text = exerciseSetName.getText().toString();
|
||||
|
||||
if(TextUtils.isEmpty(text)) {
|
||||
Toast.makeText(getActivity(), "Please specify a name.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
SQLiteHelper sqLiteHelper = new SQLiteHelper(getActivity());
|
||||
long id = sqLiteHelper.addExerciseSet(text);
|
||||
|
||||
Intent intent = new Intent(getActivity(), EditExerciseSetActivity.class);
|
||||
intent.putExtra(EditExerciseSetActivity.EXTRA_EXERCISE_SET_ID, id);
|
||||
intent.putExtra(EditExerciseSetActivity.EXTRA_EXERCISE_SET_NAME, text);
|
||||
startActivity(intent);
|
||||
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
builder.setTitle(R.string.dialog_add_exercise_set_title);
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_manage_exercise_sets, menu);
|
||||
toolbarDeleteIcon = menu.findItem(R.id.action_delete);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.tutorial.PrefManager;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.tutorial.TutorialActivity;
|
||||
|
||||
/**
|
||||
* Created by yonjuni on 22.10.16.
|
||||
*/
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Intent mainIntent = null;
|
||||
|
||||
PrefManager firstStartPref = new PrefManager(this);
|
||||
|
||||
if(firstStartPref.isFirstTimeLaunch()) {
|
||||
mainIntent = new Intent(this, TutorialActivity.class);
|
||||
} else {
|
||||
mainIntent = new Intent(this, TimerActivity.class);
|
||||
mainIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
}
|
||||
|
||||
SplashActivity.this.startActivity(mainIntent);
|
||||
SplashActivity.this.finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@ package org.secuso.privacyfriendlybreakreminder.activities;
|
|||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
|
|
@ -11,30 +10,39 @@ import android.content.IntentFilter;
|
|||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.NumberPicker;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.ExerciseLocale;
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.adapter.ExerciseSetSpinnerAdapter;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.helper.BaseActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.SQLiteHelper;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.ExerciseSet;
|
||||
import org.secuso.privacyfriendlybreakreminder.service.TimerService;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class TimerActivity extends AppCompatActivity {
|
||||
public class TimerActivity extends BaseActivity implements android.support.v4.app.LoaderManager.LoaderCallbacks<List<ExerciseSet>> {
|
||||
private static final String TAG = TimerActivity.class.getSimpleName();
|
||||
private static final String PREF_PICKER_SECONDS = TAG + ".PREF_PICKER_SECONDS";
|
||||
private static final String PREF_PICKER_MINUTES = TAG + ".PREF_PICKER_MINUTES";
|
||||
|
|
@ -49,6 +57,8 @@ public class TimerActivity extends AppCompatActivity {
|
|||
private NumberPicker minutesPicker;
|
||||
private NumberPicker hoursPicker;
|
||||
private LinearLayout pickerLayout;
|
||||
private Spinner exerciseSetSpinner;
|
||||
private ExerciseSetSpinnerAdapter exerciseSetAdapter;
|
||||
|
||||
// animation
|
||||
private int mShortAnimationDuration;
|
||||
|
|
@ -109,6 +119,12 @@ public class TimerActivity extends AppCompatActivity {
|
|||
setContentView(R.layout.activity_timer);
|
||||
|
||||
initResources();
|
||||
getSupportLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getNavigationDrawerID() {
|
||||
return R.id.nav_timer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -136,6 +152,8 @@ public class TimerActivity extends AppCompatActivity {
|
|||
updateProgress(mTimerService.getInitialDuration());
|
||||
}
|
||||
updateUI();
|
||||
|
||||
getSupportLoaderManager().restartLoader(0, null, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -160,15 +178,18 @@ public class TimerActivity extends AppCompatActivity {
|
|||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
|
||||
exerciseSetAdapter = new ExerciseSetSpinnerAdapter(this, R.layout.layout_exercise_set, new LinkedList<ExerciseSet>());
|
||||
|
||||
progressBar = (ProgressBar) findViewById(R.id.progressBar);
|
||||
timerText = (TextView) findViewById(R.id.timerText);
|
||||
playButton = (ImageButton) findViewById(R.id.button_playPause);
|
||||
resetButton = (ImageButton) findViewById(R.id.button_reset);
|
||||
|
||||
exerciseSetSpinner = (Spinner) findViewById(R.id.spinner_choose_exercise_set);
|
||||
exerciseSetSpinner.setAdapter(exerciseSetAdapter);
|
||||
secondsPicker = (NumberPicker) findViewById(R.id.seconds_picker);
|
||||
minutesPicker = (NumberPicker) findViewById(R.id.minutes_picker);
|
||||
hoursPicker = (NumberPicker) findViewById(R.id.hours_picker);
|
||||
pickerLayout = (LinearLayout) findViewById(R.id.picker_layout);
|
||||
|
||||
secondsPicker.setDisplayedValues(SECONDS_MINUTES);
|
||||
secondsPicker.setMinValue(0);
|
||||
|
|
@ -189,7 +210,6 @@ public class TimerActivity extends AppCompatActivity {
|
|||
setDividerColor(minutesPicker, R.color.transparent);
|
||||
setDividerColor(hoursPicker, R.color.transparent);
|
||||
|
||||
pickerLayout = (LinearLayout) findViewById(R.id.picker_layout);
|
||||
}
|
||||
|
||||
private void updateProgress(long millisUntilFinished) {
|
||||
|
|
@ -222,9 +242,9 @@ public class TimerActivity extends AppCompatActivity {
|
|||
case R.id.button_reset:
|
||||
mTimerService.stopAndResetTimer();
|
||||
break;
|
||||
case R.id.button_chooseExercise:
|
||||
startActivity(new Intent(this, ExerciseSetOverviewActivity.class));
|
||||
break;
|
||||
//case R.id.button_chooseExercise:
|
||||
// startActivity(new Intent(this, ManageExerciseSetsActivity.class));
|
||||
// break;
|
||||
}
|
||||
|
||||
updateUI();
|
||||
|
|
@ -338,7 +358,7 @@ public class TimerActivity extends AppCompatActivity {
|
|||
if(isRunning) {
|
||||
playButton.setImageResource(R.drawable.ic_pause_black_48dp);
|
||||
} else {
|
||||
playButton.setImageResource(R.drawable.ic_play_arrow_black_48dp);
|
||||
playButton.setImageResource(R.drawable.ic_play_arrow_black);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -357,4 +377,31 @@ public class TimerActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<List<ExerciseSet>> onCreateLoader(int id, final Bundle args) {
|
||||
return new AsyncTaskLoader<List<ExerciseSet>>(this) {
|
||||
@Override
|
||||
public List<ExerciseSet> loadInBackground() {
|
||||
SQLiteHelper helper = new SQLiteHelper(getContext());
|
||||
return helper.getExerciseSetsWithExercises(ExerciseLocale.getLocale());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStartLoading() {
|
||||
forceLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReset() {}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<List<ExerciseSet>> loader, List<ExerciseSet> data) {
|
||||
exerciseSetAdapter.updateData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<List<ExerciseSet>> loader) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.secuso.privacyfriendlybreakreminder.activities.adapter;
|
|||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
|
@ -10,18 +11,23 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.ManageExerciseSetsActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.helper.CursorRecyclerViewAdapter;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.columns.ExerciseColumns;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.Exercise;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.ExerciseSet;
|
||||
|
||||
/**
|
||||
* Created by Christopher Beckmann on 30.08.2017.
|
||||
*/
|
||||
public class ExerciseAdapter extends CursorRecyclerViewAdapter<ViewHolder> {
|
||||
public class ExerciseSetAdapter extends RecyclerView.Adapter<ViewHolder> {
|
||||
|
||||
private ExerciseSet set;
|
||||
private Context mContext;
|
||||
|
||||
public ExerciseAdapter(Context context, Cursor cursor) {
|
||||
super(context, cursor, ExerciseColumns._ID);
|
||||
public ExerciseSetAdapter(Context context, ExerciseSet set) {
|
||||
this.mContext = context;
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -31,10 +37,12 @@ public class ExerciseAdapter extends CursorRecyclerViewAdapter<ViewHolder> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder viewHolder, Cursor cursor) {
|
||||
final Exercise exercise = ExerciseColumns.fromCursor(cursor);
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
if(set == null) return;
|
||||
|
||||
ExerciseViewHolder vh = (ExerciseViewHolder) viewHolder;
|
||||
final Exercise exercise = set.get(position);
|
||||
|
||||
ExerciseViewHolder vh = (ExerciseViewHolder) holder;
|
||||
|
||||
String imageID = exercise.getImageID();
|
||||
String[] imageIDSplit = imageID.split(",");
|
||||
|
|
@ -54,6 +62,32 @@ public class ExerciseAdapter extends CursorRecyclerViewAdapter<ViewHolder> {
|
|||
vh.section.setText(exercise.getSection());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if(set != null)
|
||||
return set.size();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void updateData(ExerciseSet set) {
|
||||
this.set = set;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void add(Exercise e) {
|
||||
if(set.add(e)) notifyItemInserted(set.size()-1);
|
||||
}
|
||||
|
||||
public void remove(Exercise e) {
|
||||
int index = set.indexOf(e);
|
||||
if(set.remove(e)) notifyItemRemoved(index);
|
||||
}
|
||||
|
||||
public ExerciseSet getExerciseSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
public class ExerciseViewHolder extends ViewHolder {
|
||||
|
||||
ImageView image;
|
||||
|
|
@ -70,7 +104,6 @@ public class ExerciseAdapter extends CursorRecyclerViewAdapter<ViewHolder> {
|
|||
executionText = (TextView) itemView.findViewById(R.id.exercise_execution);
|
||||
descriptionText = (TextView) itemView.findViewById(R.id.exercise_description);
|
||||
section = (TextView) itemView.findViewById(R.id.exercise_section);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.adapter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.EditExerciseSetActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.ManageExerciseSetsActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.ExerciseSet;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Christopher Beckmann on 04.09.2017.
|
||||
*/
|
||||
|
||||
public class ExerciseSetListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
List<ExerciseSet> data = new LinkedList<ExerciseSet>();
|
||||
List<Long> deleteIds = new LinkedList<>();
|
||||
ManageExerciseSetsActivity mContext = null;
|
||||
|
||||
private boolean deleteMode = false;
|
||||
|
||||
public ExerciseSetListAdapter(ManageExerciseSetsActivity context, List<ExerciseSet> data) {
|
||||
if(context == null) throw new IllegalArgumentException("Context may not be null");
|
||||
|
||||
mContext = context;
|
||||
|
||||
if(data != null) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
setHasStableIds(true);
|
||||
}
|
||||
|
||||
public void setData(List<ExerciseSet> data) {
|
||||
if(data != null) {
|
||||
this.data = data;
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void enableDeleteMode() {
|
||||
deleteMode = true;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void disableDeleteMode() {
|
||||
deleteMode = false;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public List<Long> getDeleteIdList() {
|
||||
return deleteIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
final ExerciseSetViewHolder vh = (ExerciseSetViewHolder) holder;
|
||||
|
||||
final ExerciseSet set = data.get(position);
|
||||
|
||||
vh.deleteCheckBox.setVisibility(deleteMode ? View.VISIBLE : View.GONE);
|
||||
vh.deleteCheckBox.setChecked(false);
|
||||
|
||||
vh.name.setText(set.getName());
|
||||
vh.card.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(deleteMode) {
|
||||
|
||||
if(vh.deleteCheckBox.isChecked()) {
|
||||
deleteIds.remove(set.getId());
|
||||
vh.deleteCheckBox.setChecked(false);
|
||||
} else {
|
||||
if (!deleteIds.contains(set.getId())) deleteIds.add(set.getId());
|
||||
vh.deleteCheckBox.setChecked(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
Intent i = new Intent(mContext, EditExerciseSetActivity.class);
|
||||
i.putExtra(EditExerciseSetActivity.EXTRA_EXERCISE_SET_ID, set.getId());
|
||||
i.putExtra(EditExerciseSetActivity.EXTRA_EXERCISE_SET_NAME, set.getName());
|
||||
mContext.startActivity(i);
|
||||
}
|
||||
}
|
||||
});
|
||||
vh.card.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
if(deleteMode) {
|
||||
|
||||
if(vh.deleteCheckBox.isChecked()) {
|
||||
deleteIds.remove(set.getId());
|
||||
vh.deleteCheckBox.setChecked(false);
|
||||
} else {
|
||||
if (!deleteIds.contains(set.getId())) deleteIds.add(set.getId());
|
||||
vh.deleteCheckBox.setChecked(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
mContext.enableDeleteMode();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
vh.exerciseList.removeAllViews();
|
||||
|
||||
for(int i = 0; i < set.size(); ++i) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.layout_round_exercise_image, null, false);
|
||||
ImageView image = (ImageView) view.findViewById(R.id.exercise_image);
|
||||
|
||||
String imageID = set.get(i).getImageID();
|
||||
String[] imageIDSplit = imageID.split(",");
|
||||
|
||||
if(imageIDSplit.length > 1) {
|
||||
imageID = imageIDSplit[0]; // only take the first image as a display image
|
||||
}
|
||||
|
||||
int imageResID = mContext.getResources().getIdentifier(
|
||||
"exercise_" + imageID,
|
||||
"drawable",
|
||||
mContext.getPackageName());
|
||||
|
||||
image.setImageResource(imageResID);
|
||||
vh.exerciseList.addView(view);
|
||||
}
|
||||
|
||||
if(set.size() == 0) {
|
||||
vh.noExercisesText.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
vh.noExercisesText.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_exercise_set, parent, false);
|
||||
return new ExerciseSetViewHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
if(data != null) {
|
||||
return data.get(position).getId();
|
||||
}
|
||||
return super.getItemId(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if(data != null) {
|
||||
return data.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public class ExerciseSetViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
LinearLayout exerciseList;
|
||||
TextView name;
|
||||
CardView card;
|
||||
TextView noExercisesText;
|
||||
CheckBox deleteCheckBox;
|
||||
|
||||
public ExerciseSetViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
card = (CardView) itemView.findViewById(R.id.exercise_set_card);
|
||||
name = (TextView) itemView.findViewById(R.id.exercise_set_name);
|
||||
exerciseList = (LinearLayout) itemView.findViewById(R.id.exercise_list);
|
||||
noExercisesText = (TextView) itemView.findViewById(R.id.exercise_none_available);
|
||||
deleteCheckBox = (CheckBox) itemView.findViewById(R.id.delete_check_box);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.database.data.ExerciseSet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Christopher Beckmann on 05.09.2017.
|
||||
*/
|
||||
|
||||
public class ExerciseSetSpinnerAdapter extends ArrayAdapter<ExerciseSet> {
|
||||
|
||||
private int resource;
|
||||
private List<ExerciseSet> sets;
|
||||
|
||||
public ExerciseSetSpinnerAdapter(@NonNull Context context, @LayoutRes int resource, List<ExerciseSet> data) {
|
||||
super(context, resource, data);
|
||||
this.resource = resource;
|
||||
this.sets = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override @NonNull
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
private View getCustomView(int position, View cv, ViewGroup parent) {
|
||||
|
||||
final ExerciseSet set = sets.get(position);
|
||||
|
||||
View row = null;
|
||||
if(cv == null) {
|
||||
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
row = inflater.inflate(resource, parent, false);
|
||||
} else {
|
||||
row = cv;
|
||||
}
|
||||
|
||||
if(set == null) return row;
|
||||
|
||||
CardView card = (CardView) row.findViewById(R.id.exercise_set_card);
|
||||
TextView name = (TextView) row.findViewById(R.id.exercise_set_name);
|
||||
LinearLayout exerciseList = (LinearLayout) row.findViewById(R.id.exercise_list);
|
||||
TextView noExercisesText = (TextView) row.findViewById(R.id.exercise_none_available);
|
||||
|
||||
card.setClickable(false);
|
||||
card.setLongClickable(false);
|
||||
|
||||
name.setText(set.getName());
|
||||
|
||||
exerciseList.removeAllViews();
|
||||
|
||||
for(int i = 0; i < set.size(); ++i) {
|
||||
View view = LayoutInflater.from(getContext()).inflate(R.layout.layout_round_exercise_image, null, false);
|
||||
ImageView image = (ImageView) view.findViewById(R.id.exercise_image);
|
||||
|
||||
String imageID = set.get(i).getImageID();
|
||||
String[] imageIDSplit = imageID.split(",");
|
||||
|
||||
if(imageIDSplit.length > 1) {
|
||||
imageID = imageIDSplit[0]; // only take the first image as a display image
|
||||
}
|
||||
|
||||
int imageResID = getContext().getResources().getIdentifier(
|
||||
"exercise_" + imageID,
|
||||
"drawable",
|
||||
getContext().getPackageName());
|
||||
|
||||
image.setImageResource(imageResID);
|
||||
exerciseList.addView(view);
|
||||
}
|
||||
|
||||
if(set.size() == 0) {
|
||||
noExercisesText.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
noExercisesText.setVisibility(View.GONE);
|
||||
}
|
||||
//LayoutInflater inflater = (LayoutInflater) getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE);
|
||||
//View row = inflater.inflate(resource, parent, false);
|
||||
|
||||
// ImageView image = (ImageView) row.findViewById(R.id.browserIcon);
|
||||
// TextView label= (TextView) row.findViewById(R.id.browserName);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
public void updateData(@NonNull List<ExerciseSet> data) {
|
||||
this.sets = data;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return this.sets.size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ExerciseSet getItem(int location) {
|
||||
return this.sets.get(location);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return sets.get(position).getId();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.helper;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.design.widget.NavigationView.OnNavigationItemSelectedListener;
|
||||
import android.support.v4.app.TaskStackBuilder;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.AboutActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.HelpActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.ManageExerciseSetsActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.SettingsActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.TimerActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.tutorial.TutorialActivity;
|
||||
|
||||
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
|
||||
|
||||
/**
|
||||
* @author Chris
|
||||
* @version 20161225
|
||||
* This class is a parent class of all activities that can be accessed from the
|
||||
* Navigation Drawer (example see MainActivity.java)
|
||||
*/
|
||||
public abstract class BaseActivity extends AppCompatActivity implements OnNavigationItemSelectedListener {
|
||||
|
||||
// delay to launch nav drawer item, to allow close animation to play
|
||||
protected static final int NAVDRAWER_LAUNCH_DELAY = 250;
|
||||
// fade in and fade out durations for the main content when switching between
|
||||
// different Activities of the app through the Nav Drawer
|
||||
protected static final int MAIN_CONTENT_FADEOUT_DURATION = 150;
|
||||
protected static final int MAIN_CONTENT_FADEIN_DURATION = 250;
|
||||
|
||||
// Navigation drawer:
|
||||
protected DrawerLayout mDrawerLayout;
|
||||
private NavigationView mNavigationView;
|
||||
protected Toolbar toolbar;
|
||||
protected ActionBarDrawerToggle mDrawerToggle;
|
||||
|
||||
// Helper
|
||||
private Handler mHandler;
|
||||
protected SharedPreferences mSharedPreferences;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
mHandler = new Handler();
|
||||
|
||||
overridePendingTransition(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||
mDrawerLayout.closeDrawer(GravityCompat.START);
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract int getNavigationDrawerID();
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(MenuItem item) {
|
||||
final int itemId = item.getItemId();
|
||||
|
||||
return goToNavigationItem(itemId);
|
||||
}
|
||||
|
||||
protected boolean goToNavigationItem(final int itemId) {
|
||||
|
||||
if(itemId == getNavigationDrawerID()) {
|
||||
// just close drawer because we are already in this activity
|
||||
mDrawerLayout.closeDrawer(GravityCompat.START);
|
||||
return true;
|
||||
}
|
||||
|
||||
// delay transition so the drawer can close
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
callDrawerItem(itemId);
|
||||
}
|
||||
}, NAVDRAWER_LAUNCH_DELAY);
|
||||
|
||||
mDrawerLayout.closeDrawer(GravityCompat.START);
|
||||
|
||||
selectNavigationItem(itemId);
|
||||
|
||||
// fade out the active activity
|
||||
View mainContent = findViewById(R.id.main_content);
|
||||
if (mainContent != null) {
|
||||
mainContent.animate().alpha(0).setDuration(MAIN_CONTENT_FADEOUT_DURATION);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// set active navigation item
|
||||
private void selectNavigationItem(int itemId) {
|
||||
for(int i = 0 ; i < mNavigationView.getMenu().size(); i++) {
|
||||
boolean b = itemId == mNavigationView.getMenu().getItem(i).getItemId();
|
||||
mNavigationView.getMenu().getItem(i).setChecked(b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables back navigation for activities that are launched from the NavBar. See
|
||||
* {@code AndroidManifest.xml} to find out the parent activity names for each activity.
|
||||
* @param intent
|
||||
*/
|
||||
private void createBackStack(Intent intent) {
|
||||
TaskStackBuilder builder = TaskStackBuilder.create(this);
|
||||
builder.addNextIntentWithParentStack(intent);
|
||||
builder.startActivities();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method manages the behaviour of the navigation drawer
|
||||
* Add your menu items (ids) to res/menu/activity_main_drawer.xml
|
||||
* @param itemId Item that has been clicked by the user
|
||||
*/
|
||||
private void callDrawerItem(final int itemId) {
|
||||
|
||||
Intent intent;
|
||||
|
||||
switch(itemId) {
|
||||
case R.id.nav_timer:
|
||||
intent = new Intent(this, TimerActivity.class);
|
||||
intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case R.id.nav_manage_exercise_sets:
|
||||
intent = new Intent(this, ManageExerciseSetsActivity.class);
|
||||
createBackStack(intent);
|
||||
break;
|
||||
case R.id.nav_tutorial:
|
||||
intent = new Intent(this, TutorialActivity.class);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case R.id.nav_about:
|
||||
intent = new Intent(this, AboutActivity.class);
|
||||
createBackStack(intent);
|
||||
break;
|
||||
case R.id.nav_help:
|
||||
intent = new Intent(this, HelpActivity.class);
|
||||
createBackStack(intent);
|
||||
break;
|
||||
case R.id.nav_settings:
|
||||
intent = new Intent(this, SettingsActivity.class);
|
||||
intent.putExtra( PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.GeneralPreferenceFragment.class.getName() );
|
||||
intent.putExtra( PreferenceActivity.EXTRA_NO_HEADERS, true );
|
||||
createBackStack(intent);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
overridePendingTransition(0,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
if(getSupportActionBar() == null) {
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
mDrawerLayout.addDrawerListener(mDrawerToggle);
|
||||
mDrawerToggle.syncState();
|
||||
|
||||
mNavigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
mNavigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
showContent();
|
||||
}
|
||||
|
||||
private void showContent() {
|
||||
selectNavigationItem(getNavigationDrawerID());
|
||||
|
||||
View mainContent = findViewById(R.id.main_content);
|
||||
if (mainContent != null) {
|
||||
mainContent.setAlpha(0);
|
||||
mainContent.animate().alpha(1).setDuration(MAIN_CONTENT_FADEIN_DURATION);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
selectNavigationItem(getNavigationDrawerID());
|
||||
|
||||
View mainContent = findViewById(R.id.main_content);
|
||||
if (mainContent != null) {
|
||||
mainContent.setAlpha(0);
|
||||
mainContent.animate().alpha(1).setDuration(MAIN_CONTENT_FADEIN_DURATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.CountDownTimer;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
|
@ -7,6 +7,7 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.old.BreakActivity;
|
||||
|
||||
public class BreakDeciderActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
|
|
@ -37,6 +37,9 @@ import android.widget.Spinner;
|
|||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.AboutActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.HelpActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.SettingsActivity;
|
||||
import org.secuso.privacyfriendlybreakreminder.widget.*;
|
||||
|
||||
import java.util.Locale;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities;
|
||||
package org.secuso.privacyfriendlybreakreminder.activities.old;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
|
|
@ -15,6 +15,7 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.old.ExerciseTypeActivity;
|
||||
|
||||
public class ProfileActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.tutorial;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
/**
|
||||
* Class structure taken from tutorial at http://www.androidhive.info/2016/05/android-build-intro-slider-app/
|
||||
*/
|
||||
public class PrefManager {
|
||||
private SharedPreferences pref;
|
||||
|
||||
// Shared preferences file name
|
||||
private static final String PREF_NAME = "welcome";
|
||||
|
||||
private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch";
|
||||
|
||||
public PrefManager(Context context) {
|
||||
pref = context.getSharedPreferences(PREF_NAME, 0);
|
||||
}
|
||||
|
||||
public void setFirstTimeLaunch(boolean isFirstTime) {
|
||||
pref.edit().putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime).apply();
|
||||
}
|
||||
|
||||
public boolean isFirstTimeLaunch() {
|
||||
return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,219 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.activities.tutorial;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.TimerActivity;
|
||||
|
||||
/**
|
||||
* Class structure taken from tutorial at http://www.androidhive.info/2016/05/android-build-intro-slider-app/
|
||||
*
|
||||
* @author Karola Marky, Christopher Beckmann
|
||||
* @version 20161214
|
||||
*/
|
||||
|
||||
public class TutorialActivity extends AppCompatActivity {
|
||||
|
||||
private int[] layouts = new int[] {
|
||||
R.layout.tutorial_slide1,
|
||||
R.layout.tutorial_slide2,
|
||||
R.layout.tutorial_slide3,
|
||||
};
|
||||
|
||||
private ViewPager viewPager;
|
||||
private MyViewPagerAdapter myViewPagerAdapter;
|
||||
private LinearLayout dotsLayout;
|
||||
private TextView[] dots;
|
||||
private Button btnSkip, btnNext;
|
||||
private PrefManager prefManager;
|
||||
|
||||
private static final String TAG = TutorialActivity.class.getSimpleName();
|
||||
public static final String ACTION_SHOW_ANYWAYS = TAG + ".ACTION_SHOW_ANYWAYS";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Checking for first time launch - before calling setContentView()
|
||||
prefManager = new PrefManager(this);
|
||||
Intent i = getIntent();
|
||||
|
||||
// Making notification bar transparent
|
||||
if(Build.VERSION.SDK_INT >=21) {
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
|
||||
setContentView(R.layout.activity_tutorial);
|
||||
|
||||
viewPager = (ViewPager) findViewById(R.id.view_pager);
|
||||
dotsLayout = (LinearLayout) findViewById(R.id.layoutDots);
|
||||
btnSkip = (Button) findViewById(R.id.btn_skip);
|
||||
btnNext = (Button) findViewById(R.id.btn_next);
|
||||
|
||||
// adding bottom dots
|
||||
addBottomDots(0);
|
||||
|
||||
// making notification bar transparent
|
||||
changeStatusBarColor();
|
||||
|
||||
myViewPagerAdapter =new MyViewPagerAdapter();
|
||||
viewPager.setAdapter(myViewPagerAdapter);
|
||||
viewPager.addOnPageChangeListener(viewPagerPageChangeListener);
|
||||
|
||||
btnSkip.setOnClickListener(new View.OnClickListener()
|
||||
|
||||
{
|
||||
@Override
|
||||
public void onClick (View v){
|
||||
launchHomeScreen();
|
||||
}
|
||||
});
|
||||
|
||||
btnNext.setOnClickListener(new View.OnClickListener()
|
||||
|
||||
{
|
||||
@Override
|
||||
public void onClick (View v){
|
||||
// checking for last page
|
||||
// if last page home screen will be launched
|
||||
int current = getItem(+1);
|
||||
if (current < layouts.length) {
|
||||
// move to next screen
|
||||
viewPager.setCurrentItem(current);
|
||||
} else {
|
||||
launchHomeScreen();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addBottomDots(int currentPage) {
|
||||
dots = new TextView[layouts.length];
|
||||
|
||||
int activeColor = ContextCompat.getColor(this, R.color.dot_light_screen);
|
||||
int inactiveColor = ContextCompat.getColor(this, R.color.dot_dark_screen);
|
||||
|
||||
dotsLayout.removeAllViews();
|
||||
for (int i = 0; i < dots.length; i++) {
|
||||
dots[i] = new TextView(this);
|
||||
dots[i].setText(Html.fromHtml("•"));
|
||||
dots[i].setTextSize(35);
|
||||
dots[i].setTextColor(inactiveColor);
|
||||
dotsLayout.addView(dots[i]);
|
||||
}
|
||||
|
||||
if (dots.length > 0)
|
||||
dots[currentPage].setTextColor(activeColor);
|
||||
}
|
||||
|
||||
private int getItem(int i) {
|
||||
return viewPager.getCurrentItem() + i;
|
||||
}
|
||||
|
||||
private void launchHomeScreen() {
|
||||
|
||||
if(prefManager.isFirstTimeLaunch()) {
|
||||
Intent intent = new Intent(TutorialActivity.this, TimerActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
prefManager.setFirstTimeLaunch(false);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
// viewpager change listener
|
||||
ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
addBottomDots(position);
|
||||
|
||||
// changing the next button text 'NEXT' / 'GOT IT'
|
||||
if (position == layouts.length - 1) {
|
||||
// last page. make button text to GOT IT
|
||||
btnNext.setText(getString(R.string.okay));
|
||||
btnSkip.setVisibility(View.GONE);
|
||||
} else {
|
||||
// still pages are left
|
||||
btnNext.setText(getString(R.string.next));
|
||||
btnSkip.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int arg0, float arg1, int arg2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int arg0) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Making notification bar transparent
|
||||
*/
|
||||
private void changeStatusBarColor() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(Color.TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* View pager adapter
|
||||
*/
|
||||
public class MyViewPagerAdapter extends PagerAdapter {
|
||||
private LayoutInflater layoutInflater;
|
||||
|
||||
public MyViewPagerAdapter() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View instantiateItem(ViewGroup container, int position) {
|
||||
layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
View view = layoutInflater.inflate(layouts[position], container, false);
|
||||
container.addView(view);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return layouts.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object obj) {
|
||||
return view == obj;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
View view = (View) object;
|
||||
container.removeView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package org.secuso.privacyfriendlybreakreminder.database;
|
||||
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
|
@ -18,6 +19,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class SQLiteHelper extends SQLiteOpenHelper {
|
||||
|
|
@ -27,7 +29,7 @@ public class SQLiteHelper extends SQLiteOpenHelper {
|
|||
private Context mContext;
|
||||
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 = 4;
|
||||
private static final int DATABASE_VERSION = 2;
|
||||
|
||||
private static final String[] deleteQueryList = {
|
||||
ExerciseColumns.SQL_DELETE_ENTRIES,
|
||||
|
|
@ -64,6 +66,76 @@ public class SQLiteHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
|
||||
|
||||
public synchronized void deleteExerciseSet(long id) {
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
database.delete(ExerciseSetColumns.TABLE_NAME, ExerciseSetColumns._ID + " = ?", new String[]{String.valueOf(id)});
|
||||
database.close();
|
||||
}
|
||||
|
||||
public synchronized long addExerciseSet(String name) {
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
|
||||
ContentValues cv = new ContentValues();
|
||||
cv.put(ExerciseSetColumns.NAME, name);
|
||||
|
||||
return database.insert(ExerciseSetColumns.TABLE_NAME, null, cv);
|
||||
}
|
||||
|
||||
public synchronized void addExerciseToExerciseSet(int exerciseSetId, int exerciseId) {
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
|
||||
ContentValues cv = new ContentValues();
|
||||
cv.put(ExerciseSetColumns._ID, exerciseSetId);
|
||||
cv.put(ExerciseColumns._ID, exerciseId);
|
||||
|
||||
database.insert("exercise_set_exercises", null, cv);
|
||||
database.close();
|
||||
}
|
||||
|
||||
public synchronized Cursor getExerciseSetsCursor() {
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
|
||||
return database.query(
|
||||
ExerciseSetColumns.TABLE_NAME,
|
||||
ExerciseSetColumns.PROJECTION,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
}
|
||||
|
||||
public synchronized List<ExerciseSet> getExerciseSetsWithExercises(String language) {
|
||||
|
||||
List<ExerciseSet> result = new LinkedList<>();
|
||||
|
||||
Cursor c = getExerciseSetsCursor();
|
||||
|
||||
if(c != null) {
|
||||
c.moveToFirst();
|
||||
|
||||
while(!c.isAfterLast()) {
|
||||
|
||||
int id = c.getInt(c.getColumnIndex(ExerciseSetColumns._ID));
|
||||
|
||||
ExerciseSet set = getExerciseListForSet(id, language);
|
||||
|
||||
if(set != null) {
|
||||
result.add(set);
|
||||
|
||||
} else {
|
||||
ExerciseSet e = new ExerciseSet();
|
||||
e.setId(id);
|
||||
e.setName(c.getString(c.getColumnIndexOrThrow(ExerciseSetColumns.NAME)));
|
||||
result.add(e);
|
||||
}
|
||||
c.moveToNext();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public synchronized Cursor getExerciseCursor(String language) {
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
return database.rawQuery(buildQuery(false), new String[]{language});
|
||||
|
|
@ -78,27 +150,27 @@ public class SQLiteHelper extends SQLiteOpenHelper {
|
|||
SQLiteDatabase database = getReadableDatabase();
|
||||
|
||||
String sql = "SELECT *\n" +
|
||||
"FROM exercise_set ES LEFT OUTER JOIN exercise_set_exercises ESE\n" +
|
||||
"\tON ES.exercise_set_id = ESE.exercise_set_id\n" +
|
||||
"LEFT OUTER JOIN exercises E\n" +
|
||||
"\tON ESE.exercise_id = E.exercise_id\n" +
|
||||
"LEFT OUTER JOIN exercises_local L\n" +
|
||||
"\tON E.exercise_id = L.exercise_id\n" +
|
||||
"WHERE ES.exercise_set_id = ? AND L.language = ?\n" +
|
||||
"ORDER BY ESE.exercise_id ASC";
|
||||
"FROM "+ExerciseSetColumns.TABLE_NAME+" ES LEFT OUTER JOIN exercise_set_exercises ESE\n" +
|
||||
"\tON ES."+ExerciseSetColumns._ID+" = ESE."+ExerciseSetColumns._ID+"\n" +
|
||||
"LEFT OUTER JOIN "+ExerciseColumns.TABLE_NAME+" E\n" +
|
||||
"\tON ESE."+ExerciseColumns._ID+" = E."+ExerciseColumns._ID+"\n" +
|
||||
"LEFT OUTER JOIN "+ExerciseLocalColumns.TABLE_NAME+" L\n" +
|
||||
"\tON E."+ExerciseColumns._ID+" = L."+ExerciseLocalColumns.EXERCISE_ID+"\n" +
|
||||
"WHERE ES."+ExerciseSetColumns._ID+" = ? AND L."+ExerciseLocalColumns.LANGUAGE+" = ?\n" +
|
||||
"ORDER BY ESE."+ExerciseColumns._ID+" ASC";
|
||||
|
||||
String sql2 = "SELECT *\n" +
|
||||
"\tFROM (SELECT * \n" +
|
||||
"\t\t\tFROM (SELECT *\n" +
|
||||
"\t\t\t\tFROM "+ExerciseSetColumns.TABLE_NAME+" ES LEFT OUTER JOIN exercise_set_exercises ESE\n" +
|
||||
"\t\t\t\tON ES."+ExerciseSetColumns._ID+" = ESE."+ExerciseSetColumns._ID+"\n" +
|
||||
"\t\t\t\tWHERE ES."+ExerciseSetColumns._ID+" = ?\n" +
|
||||
"\t\t\t\tORDER BY ESE."+ExerciseColumns._ID+" ASC) ES_ESE \n" +
|
||||
"\t\t\tLEFT OUTER JOIN "+ExerciseColumns.TABLE_NAME+" E\n" +
|
||||
"\t\t\tON ES_ESE."+ExerciseColumns._ID+" = E."+ExerciseColumns._ID+") ES_ESE_E \n" +
|
||||
"\t\tLEFT OUTER JOIN "+ExerciseLocalColumns.TABLE_NAME+" L\n" +
|
||||
"\t\tON ES_ESE_E."+ExerciseColumns._ID+" = L."+ExerciseLocalColumns.EXERCISE_ID+"\n" +
|
||||
"\t\tWHERE L."+ExerciseLocalColumns.LANGUAGE+" = ?";
|
||||
// String sql2 = "SELECT *\n" +
|
||||
// "\tFROM (SELECT * \n" +
|
||||
// "\t\t\tFROM (SELECT *\n" +
|
||||
// "\t\t\t\tFROM "+ExerciseSetColumns.TABLE_NAME+" ES LEFT OUTER JOIN exercise_set_exercises ESE\n" +
|
||||
// "\t\t\t\tON ES."+ExerciseSetColumns._ID+" = ESE."+ExerciseSetColumns._ID+"\n" +
|
||||
// "\t\t\t\tWHERE ES."+ExerciseSetColumns._ID+" = ?\n" +
|
||||
// "\t\t\t\tORDER BY ESE."+ExerciseColumns._ID+" ASC) ES_ESE \n" +
|
||||
// "\t\t\tLEFT OUTER JOIN "+ExerciseColumns.TABLE_NAME+" E\n" +
|
||||
// "\t\t\tON ES_ESE."+ExerciseColumns._ID+" = E."+ExerciseColumns._ID+") ES_ESE_E \n" +
|
||||
// "\t\tLEFT OUTER JOIN "+ExerciseLocalColumns.TABLE_NAME+" L\n" +
|
||||
// "\t\tON ES_ESE_E."+ExerciseColumns._ID+" = L."+ExerciseLocalColumns.EXERCISE_ID+"\n" +
|
||||
// "\t\tWHERE L."+ExerciseLocalColumns.LANGUAGE+" = ?";
|
||||
|
||||
return database.rawQuery(sql, new String[]{String.valueOf(setId), language});
|
||||
}
|
||||
|
|
@ -112,7 +184,9 @@ public class SQLiteHelper extends SQLiteOpenHelper {
|
|||
|
||||
c.moveToFirst();
|
||||
|
||||
result = ExerciseSetColumns.fromCursor(c);
|
||||
if(!c.isAfterLast()) {
|
||||
result = ExerciseSetColumns.fromCursor(c);
|
||||
}
|
||||
|
||||
while(!c.isAfterLast()) {
|
||||
result.add(ExerciseColumns.fromCursor(c));
|
||||
|
|
@ -251,6 +325,8 @@ public class SQLiteHelper extends SQLiteOpenHelper {
|
|||
OutputStream myOutput = null;
|
||||
try {
|
||||
// Open db packaged as asset as the input stream
|
||||
mContext.deleteDatabase(DATABASE_NAME);
|
||||
|
||||
myInput = mContext.getAssets().open(DATABASE_NAME);
|
||||
|
||||
// Open the db in the application package context:
|
||||
|
|
@ -288,4 +364,5 @@ public class SQLiteHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public final class ExerciseSetColumns {
|
|||
public static final String TABLE_NAME = "exercise_set";
|
||||
|
||||
public static final String _ID = "exercise_set_id";
|
||||
public static final String NAME = "name";
|
||||
public static final String NAME = "exercise_set_name";
|
||||
|
||||
public static final String[] PROJECTION = {
|
||||
_ID,
|
||||
|
|
|
|||
|
|
@ -82,13 +82,13 @@ public class Exercise {
|
|||
if(!(object instanceof Exercise)) return false;
|
||||
Exercise other = (Exercise) object;
|
||||
|
||||
return this.id != other.id
|
||||
|| this.localId != other.localId
|
||||
|| !this.section.equals(other.section)
|
||||
|| !this.execution.equals(other.execution)
|
||||
|| !this.description.equals(other.description)
|
||||
|| !this.name.equals(other.name)
|
||||
|| !this.imageID.equals(other.imageID)
|
||||
|| !this.language.equals(other.language);
|
||||
return this.id == other.id
|
||||
&& this.localId == other.localId
|
||||
&& this.section.equals(other.section)
|
||||
&& this.execution.equals(other.execution)
|
||||
&& this.description.equals(other.description)
|
||||
&& this.name.equals(other.name)
|
||||
&& this.imageID.equals(other.imageID)
|
||||
&& this.language.equals(other.language);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
public class ExerciseSet {
|
||||
private int id = -1;
|
||||
private long id = -1L;
|
||||
private String name = null;
|
||||
private List<Exercise> exercises = new ArrayList<>();
|
||||
|
||||
public ExerciseSet() {}
|
||||
|
||||
public int getId() {
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
|
@ -30,20 +30,26 @@ public class ExerciseSet {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public void add(Exercise exercise) {
|
||||
public boolean add(Exercise exercise) {
|
||||
if(!exercises.contains(exercise)) {
|
||||
exercises.add(exercise);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void remove(Exercise exercise) {
|
||||
public boolean remove(Exercise exercise) {
|
||||
if(exercises.contains(exercise)) {
|
||||
exercises.remove(exercise);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void get(int index) {
|
||||
exercises.get(index);
|
||||
public int indexOf(Exercise e) { return exercises.indexOf(e); }
|
||||
|
||||
public Exercise get(int index) {
|
||||
return exercises.get(index);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import android.os.Bundle;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.BreakReminder;
|
||||
import org.secuso.privacyfriendlybreakreminder.activities.old.BreakReminder;
|
||||
import org.secuso.privacyfriendlybreakreminder.R;
|
||||
|
||||
/**
|
||||
|
|
|
|||
BIN
app/src/main/res/drawable-hdpi/ic_add_white_24dp.png
Normal file
|
After Width: | Height: | Size: 127 B |
BIN
app/src/main/res/drawable-hdpi/ic_delete_black_24dp.png
Normal file
|
After Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 303 B |
|
Before Width: | Height: | Size: 321 B |
BIN
app/src/main/res/drawable-hdpi/ic_list_white_24dp.png
Normal file
|
After Width: | Height: | Size: 116 B |
BIN
app/src/main/res/drawable-hdpi/ic_mode_edit_black_24dp.png
Normal file
|
After Width: | Height: | Size: 202 B |
|
Before Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 109 B |
|
Before Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 368 B |
BIN
app/src/main/res/drawable-mdpi/ic_add_white_24dp.png
Normal file
|
After Width: | Height: | Size: 88 B |
BIN
app/src/main/res/drawable-mdpi/ic_delete_black_24dp.png
Normal file
|
After Width: | Height: | Size: 111 B |
|
Before Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 222 B |
BIN
app/src/main/res/drawable-mdpi/ic_list_white_24dp.png
Normal file
|
After Width: | Height: | Size: 86 B |
BIN
app/src/main/res/drawable-mdpi/ic_mode_edit_black_24dp.png
Normal file
|
After Width: | Height: | Size: 160 B |
|
Before Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 101 B |
|
Before Width: | Height: | Size: 208 B |
|
Before Width: | Height: | Size: 250 B |
|
|
@ -1,9 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z" />
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png
Normal file
|
After Width: | Height: | Size: 97 B |
BIN
app/src/main/res/drawable-xhdpi/ic_delete_black_24dp.png
Normal file
|
After Width: | Height: | Size: 148 B |
|
Before Width: | Height: | Size: 356 B |
|
Before Width: | Height: | Size: 412 B |
BIN
app/src/main/res/drawable-xhdpi/ic_list_white_24dp.png
Normal file
|
After Width: | Height: | Size: 95 B |
|
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 222 B |
|
Before Width: | Height: | Size: 278 B |
|
Before Width: | Height: | Size: 111 B |
|
Before Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 467 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png
Normal file
|
After Width: | Height: | Size: 97 B |
|
Before Width: | Height: | Size: 433 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_delete_black_24dp.png
Normal file
|
After Width: | Height: | Size: 191 B |
|
Before Width: | Height: | Size: 485 B |
|
Before Width: | Height: | Size: 579 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_list_white_24dp.png
Normal file
|
After Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 269 B |
|
Before Width: | Height: | Size: 383 B |
|
Before Width: | Height: | Size: 127 B |
|
Before Width: | Height: | Size: 394 B |
|
Before Width: | Height: | Size: 669 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png
Normal file
|
After Width: | Height: | Size: 102 B |
|
Before Width: | Height: | Size: 578 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_delete_black_24dp.png
Normal file
|
After Width: | Height: | Size: 237 B |
|
Before Width: | Height: | Size: 589 B |
|
Before Width: | Height: | Size: 766 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_list_white_24dp.png
Normal file
|
After Width: | Height: | Size: 100 B |
|
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 497 B |
|
Before Width: | Height: | Size: 128 B |
|
Before Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 875 B |
11
app/src/main/res/drawable/bg_splash_screen.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@color/colorAccent"/>
|
||||
|
||||
<item>
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@mipmap/splash_icon"
|
||||
android:gravity="center"/>
|
||||
</item>
|
||||
</layer-list>
|
||||
9
app/src/main/res/drawable/ic_alarm_black.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:pathData="M22,5.72l-4.6,-3.86 -1.29,1.53 4.6,3.86L22,5.72zM7.88,3.39L6.6,1.86 2,5.71l1.29,1.53 4.59,-3.85zM12.5,8L11,8v6l4.75,2.85 0.75,-1.23 -4,-2.37L12.5,8zM12,4c-4.97,0 -9,4.03 -9,9s4.02,9 9,9c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,20c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_check_white.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_close_white.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
||||
</vector>
|
||||
4
app/src/main/res/drawable/ic_create_black.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<vector android:height="24dp" android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#000000" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_delete_white.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
||||
4
app/src/main/res/drawable/ic_home_black.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<vector android:height="24dp" android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#000000" android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/ic_list_black_24px.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#000000" android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_list_white_24px.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/ic_menu_tutorial.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M5,13.18v4L12,21l7,-3.82v-4L12,17l-7,-3.82zM12,3L1,9l11,6 9,-4.91V17h2V9L12,3z"/>
|
||||
</vector>
|
||||
4
app/src/main/res/drawable/ic_pause_black_48dp.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<vector android:height="48dp" android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"/>
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/ic_play_arrow_black.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:autoMirrored="true" android:height="48dp"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M8,5v14l11,-7z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_settings_black_24dp.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/ic_view_list_black_24px.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#000000" android:pathData="M4,14h4v-4L4,10v4zM4,19h4v-4L4,15v4zM4,9h4L8,5L4,5v4zM9,14h12v-4L9,10v4zM9,19h12v-4L9,15v4zM9,5v4h12L21,5L9,5z"/>
|
||||
</vector>
|
||||
22
app/src/main/res/drawable/progress_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>
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="15dp"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.BreakActivity">
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.old.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=".activities.BreakDeciderActivity">
|
||||
tools:context=".activities.old.BreakDeciderActivity">
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header_break_reminder"
|
||||
app:menu="@menu/activity_break_reminder_drawer" />
|
||||
app:headerLayout="@layout/nav_header"
|
||||
app:menu="@menu/nav_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
83
app/src/main/res/layout/activity_edit_exercise_set.xml
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
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.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay" >
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/exercise_set_name"
|
||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin"
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/activity_edit_exercise_set_name_hint"
|
||||
android:maxLines="1"
|
||||
android:inputType="textAutoCorrect"
|
||||
android:maxLength="40"
|
||||
android:background="@color/transparent" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.ManageExerciseSetsActivity">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/exercise_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_spinner"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:srcCompat="@drawable/ic_play_arrow_black_48dp" />
|
||||
app:srcCompat="@drawable/ic_play_arrow_black" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout"
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
android:max="100"
|
||||
android:padding="16dp"
|
||||
android:progress="66"
|
||||
android:progressDrawable="@drawable/circular_small"
|
||||
android:progressDrawable="@drawable/progress_circular_small"
|
||||
android:rotation="270" />
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
<?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"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.ExerciseSetOverviewActivity">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exercise_set_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="TextView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginStart="8dp" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/exercise_list"
|
||||
android:layout_width="368dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/exercise_set_name"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
@ -41,6 +41,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:menu="@menu/activity_break_reminder_drawer" />
|
||||
app:menu="@menu/nav_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
93
app/src/main/res/layout/activity_manage_exercise_set.xml
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
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:fitsSystemWindows="true"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.EditExerciseSetActivity">
|
||||
|
||||
<include layout="@layout/layout_toolbar"/>
|
||||
|
||||
<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"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:id="@+id/main_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/add_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:clickable="true"
|
||||
android:onClick="onClick"
|
||||
app:fabSize="normal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:srcCompat="@drawable/ic_add_white_24dp" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_spinner"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_exercise_sets_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_exercise_sets"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/exercise_set_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
tools:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header"
|
||||
app:menu="@menu/nav_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
|
|
@ -1,170 +1,226 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="0dp"
|
||||
android:layout_margin="0dp"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.TimerActivity">
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<include android:id="@+id/exercise" layout="@layout/layout_exercise_set"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5" />
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
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:fitsSystemWindows="true"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.EditExerciseSetActivity">
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/button_chooseExercise"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:clickable="true"
|
||||
app:fabSize="mini"
|
||||
android:onClick="onClick"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/exercise"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/relativeLayout"
|
||||
app:layout_constraintVertical_bias="0.25" />
|
||||
<include layout="@layout/layout_toolbar"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:id="@+id/relativeLayout"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
android:layout_marginTop="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/exercise">
|
||||
<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:padding="0dp"
|
||||
android:id="@+id/main_content"
|
||||
android:layout_margin="0dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.TimerActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/picker_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:divider="@color/colorAccent"
|
||||
android:dividerPadding="4dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
<!-- <include android:id="@+id/exercise" layout="@layout/layout_exercise_set"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5" /> -->
|
||||
<android.support.v7.widget.AppCompatSpinner
|
||||
android:id="@+id/spinner_choose_exercise_set"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="100dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_marginLeft="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp" />
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/hours_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="135dp"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
|
||||
<TextView
|
||||
<!-- <android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/button_chooseExercise"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=":"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:clickable="true"
|
||||
android:onClick="onClick"
|
||||
android:src="@drawable/ic_list_white_24dp"
|
||||
android:visibility="gone"
|
||||
app:fabSize="mini"
|
||||
app:layout_constraintBottom_toTopOf="@+id/relativeLayout"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/spinner_choose_exercise_set"
|
||||
app:layout_constraintVertical_bias="0.0" /> -->
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/minutes_picker"
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:id="@+id/relativeLayout"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/spinner_choose_exercise_set">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/picker_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:divider="@color/colorAccent"
|
||||
android:dividerPadding="4dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/hours_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="135dp"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=":"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/minutes_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="135dp"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=":"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/seconds_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="135dp"
|
||||
android:clipChildren="false"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:layout_alignTop="@+id/timerText"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:max="100"
|
||||
android:onClick="onClick"
|
||||
android:padding="16dp"
|
||||
android:progress="66"
|
||||
android:progressDrawable="@drawable/progress_circular"
|
||||
android:rotation="270"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<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:00"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@color/colorPrimaryDark"
|
||||
android:textSize="36sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button_reset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="135dp"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
android:onClick="onClick"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/ic_replay_black_48dp"
|
||||
android:hapticFeedbackEnabled="true"
|
||||
android:tint="@color/darkblue"
|
||||
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.332"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<TextView
|
||||
<ImageButton
|
||||
android:id="@+id/button_playPause"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=":"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
android:onClick="onClick"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:hapticFeedbackEnabled="true"
|
||||
android:scaleType="fitXY"
|
||||
android:tint="@color/darkblue"
|
||||
app:srcCompat="@drawable/ic_play_arrow_black"
|
||||
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.654"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/seconds_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="135dp"
|
||||
android:clipChildren="false"
|
||||
android:theme="@style/AppTheme.NumberPicker" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:layout_alignTop="@+id/timerText"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:max="100"
|
||||
android:onClick="onClick"
|
||||
android:padding="16dp"
|
||||
android:progress="66"
|
||||
android:progressDrawable="@drawable/circular"
|
||||
android:rotation="270"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<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:00"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:textColor="@color/colorPrimaryDark"
|
||||
android:textSize="36sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button_reset"
|
||||
<android.support.design.widget.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
tools:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:onClick="onClick"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/ic_replay_black_48dp"
|
||||
android:hapticFeedbackEnabled="true"
|
||||
android:tint="@color/darkblue"
|
||||
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"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp" />
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header"
|
||||
app:menu="@menu/nav_drawer" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button_playPause"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClick"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:hapticFeedbackEnabled="true"
|
||||
android:scaleType="fitXY"
|
||||
android:tint="@color/darkblue"
|
||||
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:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
|
|
|
|||
50
app/src/main/res/layout/activity_tutorial.xml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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"
|
||||
tools:showIn="@layout/activity_tutorial">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutDots"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dots_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/dots_margin_bottom"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:alpha=".5"
|
||||
android:layout_above="@id/layoutDots"
|
||||
android:background="@android:color/white" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_next"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@null"
|
||||
android:text="@string/next"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:background="@null"
|
||||
android:text="@string/skip"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
@ -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="org.secuso.privacyfriendlybreakreminder.activities.BreakReminder"
|
||||
tools:context="org.secuso.privacyfriendlybreakreminder.activities.old.BreakReminder"
|
||||
tools:showIn="@layout/app_bar_break_reminder">
|
||||
|
||||
|
||||
|
|
|
|||
30
app/src/main/res/layout/dialog_add_exercise_set.xml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?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.support.design.widget.TextInputLayout
|
||||
android:layout_width="336dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="8dp">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/dialog_add_exercise_set_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/dialog_add_exercise_set_name"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
@ -16,11 +16,11 @@
|
|||
android:text="Name"
|
||||
android:textAlignment="viewStart"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toRightOf="@+id/cardView2"
|
||||
app:layout_constraintTop_toTopOf="@+id/cardView2" />
|
||||
app:layout_constraintLeft_toRightOf="@+id/exercise_image_card"
|
||||
app:layout_constraintTop_toTopOf="@+id/exercise_image_card" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/cardView2"
|
||||
android:id="@+id/exercise_image_card"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
|
|
|
|||
|
|
@ -1,24 +1,26 @@
|
|||
<?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="132dp"
|
||||
android:padding="0dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_margin="0dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
android:padding="0dp">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/exercise_card"
|
||||
android:id="@+id/exercise_set_card"
|
||||
android:longClickable="true"
|
||||
android:clickable="true"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:padding="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="visible"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="4dp"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
|
@ -27,40 +29,77 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/delete_check_box"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/edit_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:hapticFeedbackEnabled="true"
|
||||
android:tint="@color/colorAccent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_mode_edit_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:id="@+id/exercise_set_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="TextView"
|
||||
app:layout_constraintLeft_toRightOf="@+id/cardView2"
|
||||
app:layout_constraintTop_toTopOf="@+id/cardView2" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/cardView2"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:innerRadius="0dp"
|
||||
android:shape="ring"
|
||||
android:thicknessRatio="1.9"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp"
|
||||
android:text="Exercise Set Name"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/exercise_image"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/exercise_0" />
|
||||
</android.support.v7.widget.CardView>
|
||||
<TextView
|
||||
android:id="@+id/exercise_none_available"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="This set contains no exercises."
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/exercise_set_name" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/exercise_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/exercise_set_name"
|
||||
app:layout_constraintRight_toLeftOf="@+id/delete_check_box"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintVertical_bias="0.521">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
|
|
|||
25
app/src/main/res/layout/layout_round_exercise_image.xml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/exercise_image_card"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:innerRadius="0dp"
|
||||
android:shape="ring"
|
||||
android:thicknessRatio="1.9"
|
||||
app:cardCornerRadius="24dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/exercise_image"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/exercise_0" />
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
16
app/src/main/res/layout/layout_toolbar.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:theme="@style/AppTheme.AppBarOverlay"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
|
@ -2,38 +2,39 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_header_height"
|
||||
android:background="@drawable/drawer_header"
|
||||
android:background="@color/colorAccent"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ffffff"
|
||||
android:paddingTop="7dp"
|
||||
android:paddingBottom="7dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:src="@mipmap/ic_drawer_logo" />
|
||||
android:src="@mipmap/ic_drawer_logo"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/imageView"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textColor="@color/darkblue"
|
||||
android:textSize="18sp" />
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/imageView" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
42
app/src/main/res/layout/tutorial_slide1.xml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorAccent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/slide1_heading"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/slide_title"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/img_width_height"
|
||||
android:layout_height="@dimen/img_width_height"
|
||||
android:background="@mipmap/splash_icon" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:paddingLeft="@dimen/desc_padding"
|
||||
android:paddingRight="@dimen/desc_padding"
|
||||
android:text="@string/slide1_text"
|
||||
android:textAlignment="center"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/slide_desc" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
44
app/src/main/res/layout/tutorial_slide2.xml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorAccent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/slide2_heading"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/slide_title"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/img_width_height"
|
||||
android:layout_height="@dimen/img_width_height"
|
||||
android:background="@mipmap/splash_icon"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/desc_padding"
|
||||
android:paddingRight="@dimen/desc_padding"
|
||||
android:text="@string/slide2_text"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/slide_desc" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
43
app/src/main/res/layout/tutorial_slide3.xml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorAccent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/slide3_heading"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/slide_title"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/img_width_height"
|
||||
android:layout_height="@dimen/img_width_height"
|
||||
android:background="@mipmap/splash_icon"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:paddingLeft="@dimen/desc_padding"
|
||||
android:paddingRight="@dimen/desc_padding"
|
||||
android:text="@string/slide3_text"
|
||||
android:textAlignment="center"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/slide_desc" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group android:id="@+id/group1">
|
||||
<item
|
||||
android:id="@+id/nav_settings"
|
||||
android:icon="@drawable/ic_menu_manage"
|
||||
android:title="@string/title_activity_settings" />
|
||||
<item
|
||||
android:id="@+id/nav_help"
|
||||
android:icon="@drawable/ic_help"
|
||||
android:title="@string/help" />
|
||||
<item
|
||||
android:id="@+id/nav_about"
|
||||
android:icon="@drawable/ic_about"
|
||||
android:title="@string/about" />
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
10
app/src/main/res/menu/menu_edit_exercise_sets.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/save"
|
||||
android:title="@string/save"
|
||||
app:showAsAction="always" />
|
||||
|
||||
</menu>
|
||||
5
app/src/main/res/menu/menu_manage_exercise_sets.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:title="delete" android:id="@+id/action_delete" android:icon="@drawable/ic_delete_white" android:visible="true" app:showAsAction="always"/>
|
||||
</menu>
|
||||
35
app/src/main/res/menu/nav_drawer.xml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group android:id="@+id/group_main" android:checkableBehavior="all">
|
||||
<item
|
||||
android:id="@+id/nav_timer"
|
||||
android:icon="@drawable/ic_alarm_black"
|
||||
android:title="@string/activity_title_break_reminder" />
|
||||
<item
|
||||
android:id="@+id/nav_manage_exercise_sets"
|
||||
android:icon="@drawable/ic_list_black_24px"
|
||||
android:title="@string/activity_title_manage_exercise_sets" />
|
||||
|
||||
</group>
|
||||
|
||||
<group android:id="@+id/group1" android:checkableBehavior="all">
|
||||
<item
|
||||
android:id="@+id/nav_tutorial"
|
||||
android:icon="@drawable/ic_menu_tutorial"
|
||||
android:title="@string/title_activity_tutorial" />
|
||||
<item
|
||||
android:id="@+id/nav_settings"
|
||||
android:icon="@drawable/ic_settings_black_24dp"
|
||||
android:title="@string/title_activity_settings" />
|
||||
<item
|
||||
android:id="@+id/nav_help"
|
||||
android:icon="@drawable/ic_help"
|
||||
android:title="@string/help" />
|
||||
<item
|
||||
android:id="@+id/nav_about"
|
||||
android:icon="@drawable/ic_about"
|
||||
android:title="@string/about" />
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
BIN
app/src/main/res/mipmap-hdpi/splash_icon.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
app/src/main/res/mipmap-mdpi/splash_icon.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/splash_icon.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/splash_icon.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/splash_icon.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
|
|
@ -13,4 +13,9 @@
|
|||
<color name="yellow">#f6d126</color>
|
||||
<color name="red">#B71C1C</color>
|
||||
<color name="green">#388E3C</color>
|
||||
|
||||
<!-- dots inactive colors -->
|
||||
<color name="dot_dark_screen">#026499</color>
|
||||
<!-- dots active colors -->
|
||||
<color name="dot_light_screen">#448bb2</color>
|
||||
</resources>
|
||||
|
|
@ -13,4 +13,14 @@ Refer to App Widget Documentation for margin information
|
|||
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
|
||||
-->
|
||||
<dimen name="widget_margin">8dp</dimen>
|
||||
|
||||
<dimen name="dots_height">30dp</dimen>
|
||||
<dimen name="dots_margin_bottom">20dp</dimen>
|
||||
<dimen name="img_width_height">120dp</dimen>
|
||||
<dimen name="slide_title">30dp</dimen>
|
||||
<dimen name="slide_desc">16dp</dimen>
|
||||
<dimen name="slide_actions">20dp</dimen>
|
||||
<dimen name="desc_padding">40dp</dimen>
|
||||
<dimen name="app_bar_height">180dp</dimen>
|
||||
<dimen name="text_margin">16dp</dimen>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -174,5 +174,125 @@
|
|||
<string name="help_support_next">By clicking on the \'next\' button, the app will choose a new exercise in the current body region. At the same time the clock will be reset on the next full minute, so the time will be spend fully on the exercises.</string>
|
||||
<string name="help_support_title">Instruction manual</string>
|
||||
<string name="privacy_friendly">This application belongs to the group of Privacy Friendly Apps developed by Technische Universität Darmstadt. Sourcecode licensed under GPLv3. Images copyright TU Darmstadt and Google Inc.</string>
|
||||
<string name="no_exercise_sets">No exercise sets available. Please create a new one.</string>
|
||||
<string name="activity_title_manage_exercise_sets">Exercise Sets</string>
|
||||
<string name="activity_title_edit_exercise_set">Edit Exercise Set</string>
|
||||
<string name="activity_title_new_exercise_set">New Exercise Set</string>
|
||||
<string name="dialog_add_exercise_set_setname">exercise set name</string>
|
||||
<string name="dialog_add_exercise_set_title">Add New Exercise Set</string>
|
||||
<string name="activity_title_break_reminder">@string/app_name</string>
|
||||
<string name="dialog_add_exercise_set_name">Exercise Set Name</string>
|
||||
<string name="keep_editing">keep editing</string>
|
||||
<string name="discard">discard</string>
|
||||
<string name="dialog_discard_confirmation">Are you sure you want to discard the changes?</string>
|
||||
<string name="activity_title_exercise">Exercise</string>
|
||||
<string name="title_activity_tutorial">Tutorial</string>
|
||||
|
||||
<string name="okay">Okay</string>
|
||||
<string name="next">Next</string>
|
||||
<string name="skip">Skip</string>
|
||||
|
||||
<!-- ### TUTORIAL DIALOG ### -->
|
||||
<string name="slide1_heading">Welcome!</string>
|
||||
<string name="slide1_text">This App serves as a guideline to see the basic design of Privacy Friendly Apps. Here introduce your app in one or two sentences.</string>
|
||||
|
||||
<string name="slide2_heading">Key Elements</string>
|
||||
<string name="slide2_text">Introduce key elements of your app. Do not introduce too many details.</string>
|
||||
|
||||
<string name="slide3_heading">Github and Guide</string>
|
||||
<string name="slide3_text">The sourcecode of this app is available at GitHub. For further explanations have a look at the Privacy Friendly App Guide.</string>
|
||||
<string name="title_activity_edit_exercise_set">Edit Exercise Set</string>
|
||||
<string name="large_text">
|
||||
"Material is the metaphor.\n\n"
|
||||
|
||||
"A material metaphor is the unifying theory of a rationalized space and a system of motion."
|
||||
"The material is grounded in tactile reality, inspired by the study of paper and ink, yet "
|
||||
"technologically advanced and open to imagination and magic.\n"
|
||||
"Surfaces and edges of the material provide visual cues that are grounded in reality. The "
|
||||
"use of familiar tactile attributes helps users quickly understand affordances. Yet the "
|
||||
"flexibility of the material creates new affordances that supercede those in the physical "
|
||||
"world, without breaking the rules of physics.\n"
|
||||
"The fundamentals of light, surface, and movement are key to conveying how objects move, "
|
||||
"interact, and exist in space and in relation to each other. Realistic lighting shows "
|
||||
"seams, divides space, and indicates moving parts.\n\n"
|
||||
|
||||
"Bold, graphic, intentional.\n\n"
|
||||
|
||||
"The foundational elements of print based design typography, grids, space, scale, color, "
|
||||
"and use of imagery guide visual treatments. These elements do far more than please the "
|
||||
"eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge "
|
||||
"imagery, large scale typography, and intentional white space create a bold and graphic "
|
||||
"interface that immerse the user in the experience.\n"
|
||||
"An emphasis on user actions makes core functionality immediately apparent and provides "
|
||||
"waypoints for the user.\n\n"
|
||||
|
||||
"Motion provides meaning.\n\n"
|
||||
|
||||
"Motion respects and reinforces the user as the prime mover. Primary user actions are "
|
||||
"inflection points that initiate motion, transforming the whole design.\n"
|
||||
"All action takes place in a single environment. Objects are presented to the user without "
|
||||
"breaking the continuity of experience even as they transform and reorganize.\n"
|
||||
"Motion is meaningful and appropriate, serving to focus attention and maintain continuity. "
|
||||
"Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n"
|
||||
|
||||
"3D world.\n\n"
|
||||
|
||||
"The material environment is a 3D space, which means all objects have x, y, and z "
|
||||
"dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the "
|
||||
"positive z-axis extending towards the viewer. Every sheet of material occupies a single "
|
||||
"position along the z-axis and has a standard 1dp thickness.\n"
|
||||
"On the web, the z-axis is used for layering and not for perspective. The 3D world is "
|
||||
"emulated by manipulating the y-axis.\n\n"
|
||||
|
||||
"Light and shadow.\n\n"
|
||||
|
||||
"Within the material environment, virtual lights illuminate the scene. Key lights create "
|
||||
"directional shadows, while ambient light creates soft shadows from all angles.\n"
|
||||
"Shadows in the material environment are cast by these two light sources. In Android "
|
||||
"development, shadows occur when light sources are blocked by sheets of material at "
|
||||
"various positions along the z-axis. On the web, shadows are depicted by manipulating the "
|
||||
"y-axis only. The following example shows the card with a height of 6dp.\n\n"
|
||||
|
||||
"Resting elevation.\n\n"
|
||||
|
||||
"All material objects, regardless of size, have a resting elevation, or default elevation "
|
||||
"that does not change. If an object changes elevation, it should return to its resting "
|
||||
"elevation as soon as possible.\n\n"
|
||||
|
||||
"Component elevations.\n\n"
|
||||
|
||||
"The resting elevation for a component type is consistent across apps (e.g., FAB elevation "
|
||||
"does not vary from 6dp in one app to 16dp in another app).\n"
|
||||
"Components may have different resting elevations across platforms, depending on the depth "
|
||||
"of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n"
|
||||
|
||||
"Responsive elevation and dynamic elevation offsets.\n\n"
|
||||
|
||||
"Some component types have responsive elevation, meaning they change elevation in response "
|
||||
"to user input (e.g., normal, focused, and pressed) or system events. These elevation "
|
||||
"changes are consistently implemented using dynamic elevation offsets.\n"
|
||||
"Dynamic elevation offsets are the goal elevation that a component moves towards, relative "
|
||||
"to the component’s resting state. They ensure that elevation changes are consistent "
|
||||
"across actions and component types. For example, all components that lift on press have "
|
||||
"the same elevation change relative to their resting elevation.\n"
|
||||
"Once the input event is completed or cancelled, the component will return to its resting "
|
||||
"elevation.\n\n"
|
||||
|
||||
"Avoiding elevation interference.\n\n"
|
||||
|
||||
"Components with responsive elevations may encounter other components as they move between "
|
||||
"their resting elevations and dynamic elevation offsets. Because material cannot pass "
|
||||
"through other material, components avoid interfering with one another any number of ways, "
|
||||
"whether on a per component basis or using the entire app layout.\n"
|
||||
"On a component level, components can move or be removed before they cause interference. "
|
||||
"For example, a floating action button (FAB) can disappear or move off screen before a "
|
||||
"user picks up a card, or it can move if a snackbar appears.\n"
|
||||
"On the layout level, design your app layout to minimize opportunities for interference. "
|
||||
"For example, position the FAB to one side of stream of a cards so the FAB won’t interfere "
|
||||
"when a user tries to pick up one of cards.\n\n"
|
||||
</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="activity_edit_exercise_set_name_hint">Enter a name …</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -24,4 +24,9 @@
|
|||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
<style name="SplashTheme" parent="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<item name="android:windowBackground">@drawable/bg_splash_screen</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<header
|
||||
android:fragment="org.secuso.privacyfriendlybreakreminder.activities.SettingsActivity$GeneralPreferenceFragment"
|
||||
android:icon="@drawable/ic_info_black_24dp"
|
||||
android:icon="@drawable/ic_info_black"
|
||||
android:title="@string/pref_header_general" />
|
||||
|
||||
<header
|
||||
|
|
|
|||