Merge branch 'new-ui--more-fixes' into 'master'
More misc UI fixes, mainly for older devices. Closes #906 and #866 See merge request !465
This commit is contained in:
commit
1054d57b02
@ -501,6 +501,8 @@
|
|||||||
android:value=".views.main.MainActivity" />
|
android:value=".views.main.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".AboutActivity" android:theme="@style/Theme.AppCompat.Light.Dialog" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
34
app/src/main/java/org/fdroid/fdroid/AboutActivity.java
Normal file
34
app/src/main/java/org/fdroid/fdroid/AboutActivity.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package org.fdroid.fdroid;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class AboutActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
setContentView(R.layout.about);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||||
|
setFinishOnTouchOutside(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
String versionName = Utils.getVersionName(this);
|
||||||
|
if (versionName != null) {
|
||||||
|
((TextView) findViewById(R.id.version)).setText(versionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
findViewById(R.id.ok_button).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -623,4 +623,19 @@ public final class Utils {
|
|||||||
Resources r = ctx.getResources();
|
Resources r = ctx.getResources();
|
||||||
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
|
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public static class Profiler {
|
||||||
|
public final long startTime = System.currentTimeMillis();
|
||||||
|
public final String logTag;
|
||||||
|
|
||||||
|
public Profiler(String logTag) {
|
||||||
|
this.logTag = logTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void log(String message) {
|
||||||
|
long duration = System.currentTimeMillis() - startTime;
|
||||||
|
Utils.debugLog(logTag, "[" + duration + "ms] " + message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,6 +207,13 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
*/
|
*/
|
||||||
private void initPrivilegedInstallerPreference() {
|
private void initPrivilegedInstallerPreference() {
|
||||||
final CheckBoxPreference pref = (CheckBoxPreference) findPreference(Preferences.PREF_PRIVILEGED_INSTALLER);
|
final CheckBoxPreference pref = (CheckBoxPreference) findPreference(Preferences.PREF_PRIVILEGED_INSTALLER);
|
||||||
|
|
||||||
|
// This code will be run each time the activity is resumed, and so we may have already removed
|
||||||
|
// this preference.
|
||||||
|
if (pref == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Preferences p = Preferences.get();
|
Preferences p = Preferences.get();
|
||||||
boolean enabled = p.isPrivilegedInstallerEnabled();
|
boolean enabled = p.isPrivilegedInstallerEnabled();
|
||||||
boolean installed = PrivilegedInstaller.isExtensionInstalledCorrectly(getActivity())
|
boolean installed = PrivilegedInstaller.isExtensionInstalledCorrectly(getActivity())
|
||||||
|
@ -53,19 +53,27 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new AppCardController(activity, activity.getLayoutInflater().inflate(layout, parent, false));
|
return new AppCardController(activity, activity.getLayoutInflater().inflate(layout, parent, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemViewType(int position) {
|
public int getItemViewType(int position) {
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
return R.id.whats_new_feature;
|
return R.id.whats_new_feature;
|
||||||
} else if (position <= 2) {
|
|
||||||
return R.id.whats_new_large_tile;
|
|
||||||
} else if (position <= 4) {
|
|
||||||
return R.id.whats_new_small_tile;
|
|
||||||
} else {
|
} else {
|
||||||
return R.id.whats_new_regular_list;
|
int relativePositionInCycle = position % 5;
|
||||||
|
switch (relativePositionInCycle) {
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
return R.id.whats_new_large_tile;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
return R.id.whats_new_small_tile;
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
return R.id.whats_new_regular_list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,17 +93,14 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
|||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Replace with https://github.com/lucasr/twoway-view which looks really really cool, but
|
|
||||||
// no longer under active development (despite heaps of forks/stars on github).
|
|
||||||
public static class SpanSizeLookup extends GridLayoutManager.SpanSizeLookup {
|
public static class SpanSizeLookup extends GridLayoutManager.SpanSizeLookup {
|
||||||
@Override
|
@Override
|
||||||
public int getSpanSize(int position) {
|
public int getSpanSize(int position) {
|
||||||
if (position == 0) {
|
int relativePositionInCycle = position % 5;
|
||||||
|
if (relativePositionInCycle == 0) {
|
||||||
return 2;
|
return 2;
|
||||||
} else if (position <= 4) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
} else {
|
||||||
return 2;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,18 +124,18 @@ public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
|
|||||||
int horizontalPadding = (int) context.getResources().getDimension(R.dimen.whats_new__padding__app_card__horizontal);
|
int horizontalPadding = (int) context.getResources().getDimension(R.dimen.whats_new__padding__app_card__horizontal);
|
||||||
int verticalPadding = (int) context.getResources().getDimension(R.dimen.whats_new__padding__app_card__vertical);
|
int verticalPadding = (int) context.getResources().getDimension(R.dimen.whats_new__padding__app_card__vertical);
|
||||||
|
|
||||||
|
int relativePositionInCycle = position % 5;
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
// Don't set any padding for the first item as the FeatureImage behind it needs to butt right
|
// Don't set any padding for the first item as the FeatureImage behind it needs to butt right
|
||||||
// up against the left/top/right of the screen.
|
// up against the left/top/right of the screen.
|
||||||
outRect.set(0, 0, 0, verticalPadding);
|
outRect.set(0, 0, 0, verticalPadding);
|
||||||
} else if (position <= 4) {
|
} else if (relativePositionInCycle != 0) {
|
||||||
// Odd items are on the left, even on the right.
|
|
||||||
// The item on the left will have both left and right padding. The item on the right
|
// The item on the left will have both left and right padding. The item on the right
|
||||||
// will only have padding on the right. This will allow the same amount of padding
|
// will only have padding on the right. This will allow the same amount of padding
|
||||||
// on the left, centre, and right of the grid, rather than double the padding in the
|
// on the left, centre, and right of the grid, rather than double the padding in the
|
||||||
// middle (which would happen if both left+right paddings were set for both items).
|
// middle (which would happen if both left+right paddings were set for both items).
|
||||||
boolean isLtr = ViewCompat.getLayoutDirection(parent) == ViewCompat.LAYOUT_DIRECTION_LTR;
|
boolean isLtr = ViewCompat.getLayoutDirection(parent) == ViewCompat.LAYOUT_DIRECTION_LTR;
|
||||||
boolean isAtStart = (position % 2) == 1;
|
boolean isAtStart = relativePositionInCycle == 1 || relativePositionInCycle == 3;
|
||||||
int paddingStart = isAtStart ? horizontalPadding : 0;
|
int paddingStart = isAtStart ? horizontalPadding : 0;
|
||||||
int paddingLeft = isLtr ? paddingStart : horizontalPadding;
|
int paddingLeft = isLtr ? paddingStart : horizontalPadding;
|
||||||
int paddingRight = isLtr ? horizontalPadding : paddingStart;
|
int paddingRight = isLtr ? horizontalPadding : paddingStart;
|
||||||
|
@ -50,6 +50,25 @@
|
|||||||
android:text="@string/license_gplv3_later"
|
android:text="@string/license_gplv3_later"
|
||||||
style="@style/BodyText" />
|
style="@style/BodyText" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:clipToPadding="false">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:minWidth="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/DetailsPrimaryButtonStyle"
|
||||||
|
android:id="@+id/ok_button"
|
||||||
|
android:text="@string/ok" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
<android.support.constraint.ConstraintLayout
|
<android.support.constraint.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:paddingStart="16dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:paddingEnd="16dp"
|
||||||
android:layout_marginRight="16dp">
|
android:paddingRight="16dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/back"
|
android:id="@+id/back"
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
<android.support.constraint.ConstraintLayout
|
<android.support.constraint.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="12dp">
|
android:padding="12dp">
|
||||||
|
|
||||||
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
||||||
when it will inevitably read out the name of the app straight after. -->
|
when it will inevitably read out the name of the app straight after. -->
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<android.support.constraint.ConstraintLayout
|
<android.support.constraint.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp">
|
android:padding="8dp">
|
||||||
|
|
||||||
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
||||||
when it will inevitably read out the name of the app straight after. -->
|
when it will inevitably read out the name of the app straight after. -->
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<android.support.constraint.ConstraintLayout
|
<android.support.constraint.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="8dp">
|
android:padding="8dp">
|
||||||
|
|
||||||
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
||||||
when it will inevitably read out the name of the app straight after. -->
|
when it will inevitably read out the name of the app straight after. -->
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<android.support.constraint.ConstraintLayout
|
<android.support.constraint.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="8dp">
|
android:padding="8dp">
|
||||||
|
|
||||||
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
||||||
when it will inevitably read out the name of the app straight after. -->
|
when it will inevitably read out the name of the app straight after. -->
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
|
android:gravity="center"
|
||||||
tools:text="F-Droid is created by F-Droid Limited and Contributors. Buy them a coffee!"
|
tools:text="F-Droid is created by F-Droid Limited and Contributors. Buy them a coffee!"
|
||||||
android:layout_marginBottom="12dp" />
|
android:layout_marginBottom="12dp" />
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
|
android:gravity="center"
|
||||||
android:textColor="#424242"
|
android:textColor="#424242"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:text="Tap and hold on an app for more options"
|
android:text="Tap and hold on an app for more options"
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
android:layout_marginTop="48dp"
|
android:layout_marginTop="48dp"
|
||||||
android:text="@string/nearby_splash__download_apps_from_people_nearby"
|
android:text="@string/nearby_splash__download_apps_from_people_nearby"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
|
android:gravity="center"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="#4a4a4a"
|
android:textColor="#4a4a4a"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
@ -42,6 +43,7 @@
|
|||||||
tools:text="@string/nearby_splash__both_parties_need_fdroid"
|
tools:text="@string/nearby_splash__both_parties_need_fdroid"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
|
android:gravity="center"
|
||||||
android:textColor="#5B5B5B"
|
android:textColor="#5B5B5B"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/button"
|
app:layout_constraintTop_toBottomOf="@+id/button"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
android:id="@+id/heading"
|
android:id="@+id/heading"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:padding="30dp"
|
android:padding="30dp"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
|
android:gravity="center"
|
||||||
tools:text="Connecting with Nexus 4"
|
tools:text="Connecting with Nexus 4"
|
||||||
tools:ignore="UnusedAttribute" />
|
tools:ignore="UnusedAttribute" />
|
||||||
|
|
||||||
@ -30,6 +30,7 @@
|
|||||||
android:id="@+id/error"
|
android:id="@+id/error"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
|
android:gravity="center"
|
||||||
android:text="@string/swap_connection_misc_error"
|
android:text="@string/swap_connection_misc_error"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:padding="30dp"
|
android:padding="30dp"
|
||||||
|
@ -15,19 +15,23 @@
|
|||||||
|
|
||||||
<style name="SwapTheme.AppList.SwapSuccess" parent="SwapTheme.AppList.SwapSuccessBase">
|
<style name="SwapTheme.AppList.SwapSuccess" parent="SwapTheme.AppList.SwapSuccessBase">
|
||||||
<item name="android:textAlignment">center</item>
|
<item name="android:textAlignment">center</item>
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
<item name="android:fontFamily">sans-serif-light</item>
|
<item name="android:fontFamily">sans-serif-light</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="SwapTheme.AppList.SwapSuccessDetails" parent="SwapTheme.AppList.SwapSuccessDetailsBase">
|
<style name="SwapTheme.AppList.SwapSuccessDetails" parent="SwapTheme.AppList.SwapSuccessDetailsBase">
|
||||||
<item name="android:textAlignment">center</item>
|
<item name="android:textAlignment">center</item>
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="SwapTheme.StartSwap.MainText" parent="SwapTheme.StartSwap.MainTextBase">
|
<style name="SwapTheme.StartSwap.MainText" parent="SwapTheme.StartSwap.MainTextBase">
|
||||||
<item name="android:textAlignment">center</item>
|
<item name="android:textAlignment">center</item>
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="SwapTheme.Wizard.Text" parent="SwapTheme.Wizard.TextBase">
|
<style name="SwapTheme.Wizard.Text" parent="SwapTheme.Wizard.TextBase">
|
||||||
<item name="android:textAlignment">center</item>
|
<item name="android:textAlignment">center</item>
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="SwapTheme.Wizard.MainText" parent="SwapTheme.Wizard.MainTextBase">
|
<style name="SwapTheme.Wizard.MainText" parent="SwapTheme.Wizard.MainTextBase">
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory android:title="@string/menu_about">
|
||||||
|
<PreferenceScreen android:title="@string/about_title">
|
||||||
|
<intent
|
||||||
|
android:action="android.intent.action.MAIN"
|
||||||
|
android:targetPackage="org.fdroid.fdroid"
|
||||||
|
android:targetClass="org.fdroid.fdroid.AboutActivity" />
|
||||||
|
</PreferenceScreen>
|
||||||
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/preference_category__my_apps">
|
<PreferenceCategory android:title="@string/preference_category__my_apps">
|
||||||
<PreferenceScreen android:title="@string/preference_manage_installed_apps">
|
<PreferenceScreen android:title="@string/preference_manage_installed_apps">
|
||||||
<intent
|
<intent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user