Minor Layout fixes

Widget reset fix
new profile layout tablet optimization
settings tablet bug fix
gradle Android version from 14 to 17
This commit is contained in:
Jannik 2016-08-26 11:47:26 +02:00
commit 5075b3db2b
6 changed files with 26 additions and 8 deletions

View file

@ -6,7 +6,7 @@ android {
defaultConfig {
applicationId "orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder"
minSdkVersion 14
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"

View file

@ -18,7 +18,6 @@ public class AppWidget extends AppWidgetProvider {
static String time = "";
static RemoteViews views = null;
//int[] appWidgetIds;
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
int appWidgetId) {
@ -36,7 +35,7 @@ public class AppWidget extends AppWidgetProvider {
// Construct the RemoteViews object
if (views == null)
views = new RemoteViews(context.getPackageName(), R.layout.app_widget2x1);
onAppWidgetOptionsReset(context,appWidgetManager,appWidgetId,appWidgetManager.getAppWidgetOptions(appWidgetId));
views.setTextViewText(R.id.appwidget_text, widgetText);
if (time.equals(""))
@ -58,7 +57,6 @@ public class AppWidget extends AppWidgetProvider {
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// There may be multiple widgets active, so update all of them
//this.appWidgetIds = appWidgetIds;
for (int appWidgetId : appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId);
@ -88,6 +86,21 @@ public class AppWidget extends AppWidgetProvider {
super.onReceive(context, intent);
}
public static void onAppWidgetOptionsReset(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions) {
System.out.println("Minimal width: " + newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH) + " minimal height: " + newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT));
// Get min width and height.
int minWidth = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
int minHeight = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT);
getRemoteViews(context, minWidth, minHeight);
}
@Override
public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions) {
@ -119,7 +132,7 @@ public class AppWidget extends AppWidgetProvider {
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions);
}
private RemoteViews getRemoteViews(Context context, int minWidth, int minHeight) {
private static RemoteViews getRemoteViews(Context context, int minWidth, int minHeight) {
// First find out rows and columns based on width provided.
int rows = getCellsForSize(minHeight);
int columns = getCellsForSize(minWidth);

View file

@ -107,7 +107,7 @@ public class SeekBarPreference extends DialogPreference implements SeekBar.OnSee
{
super.onSetInitialValue(restore, defaultValue);
if (restore)
mValue = shouldPersist() ? getPersistedInt(mDefault) : 0;
mValue = shouldPersist() ? getPersistedInt(mDefault) : 1;
else
mValue = (Integer)defaultValue;
}

View file

@ -140,6 +140,10 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
public boolean onMenuItemSelected(int featureId, MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
if(isXLargeTablet(this)) {
finish();
return true;
}
if (!super.onMenuItemSelected(featureId, item)) {
NavUtils.navigateUpFromSameTask(this);
}

View file

@ -31,7 +31,9 @@
android:textSize="25sp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
android:layout_alignParentEnd="true"
android:layout_toEndOf="@+id/textView6"
android:layout_marginLeft="15dp"/>
<SeekBar
android:id="@+id/new_profile_interval"

View file

@ -8,7 +8,6 @@
<string name="break_ex">Ausführung der Übung</string>
<string name="break_execution">Ausführung:</string>
<string name="break_explanation">Beschreibung der Übung:</string>
<string name="break_reminder_time" translatable="false"></string>
<string name="cancel">Abbrechen</string>
<string name="continuously">Falls gesetzt, gibt es keine Möglichkeit die Pause zu überspringen</string>
<string name="do_you_want_to_take_the_break">Möchten Sie die Pause nehmen?</string>