Merge branch 'add-sorting-redo' into 'master'
Add sorting redo fdroidclient!637
@ -158,6 +158,10 @@ public class FDroidApp extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAppThemeLight() {
|
||||
return curTheme == Theme.light;
|
||||
}
|
||||
|
||||
public void applyDialogTheme(Activity activity) {
|
||||
activity.setTheme(getCurDialogThemeResId());
|
||||
setSecureWindow(activity);
|
||||
|
@ -16,6 +16,7 @@ import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import org.fdroid.fdroid.FDroidApp;
|
||||
import org.fdroid.fdroid.R;
|
||||
@ -34,8 +35,16 @@ public class AppListActivity extends AppCompatActivity implements LoaderManager.
|
||||
private AppListAdapter appAdapter;
|
||||
private String category;
|
||||
private String searchTerms;
|
||||
private String sortClauseSelected = SortClause.LAST_UPDATED;
|
||||
private TextView emptyState;
|
||||
private EditText searchInput;
|
||||
private ImageView sortImage;
|
||||
|
||||
private interface SortClause {
|
||||
String NAME = Schema.AppMetadataTable.NAME + "." + Schema.AppMetadataTable.Cols.NAME + " asc";
|
||||
String LAST_UPDATED = Schema.AppMetadataTable.NAME + "."
|
||||
+ Schema.AppMetadataTable.Cols.LAST_UPDATED + " desc";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@ -62,6 +71,35 @@ public class AppListActivity extends AppCompatActivity implements LoaderManager.
|
||||
}
|
||||
});
|
||||
|
||||
sortImage = (ImageView) findViewById(R.id.sort);
|
||||
if (FDroidApp.isAppThemeLight()) {
|
||||
sortImage.setImageResource(R.drawable.ic_last_updated_black);
|
||||
} else {
|
||||
sortImage.setImageResource(R.drawable.ic_last_updated_white);
|
||||
}
|
||||
sortImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (sortClauseSelected.equalsIgnoreCase(SortClause.LAST_UPDATED)) {
|
||||
sortClauseSelected = SortClause.NAME;
|
||||
if (FDroidApp.isAppThemeLight()) {
|
||||
sortImage.setImageResource(R.drawable.ic_az_black);
|
||||
} else {
|
||||
sortImage.setImageResource(R.drawable.ic_az_white);
|
||||
}
|
||||
} else {
|
||||
sortClauseSelected = SortClause.LAST_UPDATED;
|
||||
if (FDroidApp.isAppThemeLight()) {
|
||||
sortImage.setImageResource(R.drawable.ic_last_updated_black);
|
||||
} else {
|
||||
sortImage.setImageResource(R.drawable.ic_last_updated_white);
|
||||
}
|
||||
}
|
||||
getSupportLoaderManager().restartLoader(0, null, AppListActivity.this);
|
||||
appView.scrollToPosition(0);
|
||||
}
|
||||
});
|
||||
|
||||
emptyState = (TextView) findViewById(R.id.empty_state);
|
||||
|
||||
View backButton = findViewById(R.id.back);
|
||||
@ -128,7 +166,7 @@ public class AppListActivity extends AppCompatActivity implements LoaderManager.
|
||||
Schema.AppMetadataTable.Cols.ALL,
|
||||
null,
|
||||
null,
|
||||
Schema.AppMetadataTable.Cols.NAME
|
||||
sortClauseSelected
|
||||
);
|
||||
}
|
||||
|
||||
|
BIN
app/src/main/res/drawable-hdpi/ic_az_black.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_az_white.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_last_updated_black.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_last_updated_white.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_az_black.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_az_white.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_last_updated_black.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_last_updated_white.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_az_black.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_az_white.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_last_updated_black.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_last_updated_white.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_az_black.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_az_white.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_last_updated_black.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_last_updated_white.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_az_black.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_az_white.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_last_updated_black.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_last_updated_white.png
Normal file
After Width: | Height: | Size: 10 KiB |
@ -10,59 +10,76 @@
|
||||
android:id="@+id/search_card"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_marginRight="0dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/sort"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingRight="16dp">
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingStart="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:contentDescription="@string/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:contentDescription="@string/back"
|
||||
android:src="@drawable/ic_back_black_24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:src="@drawable/ic_back_black_24dp" />
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/back"
|
||||
app:layout_constraintEnd_toStartOf="@+id/clear"
|
||||
android:padding="12dp"
|
||||
android:id="@+id/search"
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="@string/search_hint"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="text"
|
||||
android:hint="@string/search_hint"
|
||||
android:maxLines="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="18sp" />
|
||||
android:padding="12dp"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/clear"
|
||||
app:layout_constraintStart_toEndOf="@+id/back"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/clear"
|
||||
android:contentDescription="@string/clear_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:contentDescription="@string/clear_search"
|
||||
android:src="@drawable/ic_close_black_24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:src="@drawable/ic_close_black_24dp" />
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sort"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:contentDescription="@string/sort_search"
|
||||
app:layout_constraintTop_toTopOf="@id/search_card"
|
||||
app:layout_constraintBottom_toBottomOf="@id/search_card"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/search_card"/>
|
||||
|
||||
<!-- Don't center, only show it at the top because a keyboard will usually be shown at the bottom of the screen,
|
||||
covering most of this layout. -->
|
||||
<TextView
|
||||
|
@ -128,6 +128,7 @@ This often occurs with apps installed via Google Play or other sources, if they
|
||||
<string name="add_key">Add Key</string>
|
||||
<string name="overwrite">Overwrite</string>
|
||||
<string name="clear_search">Clear search</string>
|
||||
<string name="sort_search">Sort search</string>
|
||||
|
||||
<string name="bluetooth_activity_not_found">No Bluetooth send method found, choose one!</string>
|
||||
<string name="choose_bt_send">Choose Bluetooth send method</string>
|
||||
|