add-sorting-redo
modified: app/src/main/java/org/fdroid/fdroid/views/apps/AppListActivity.java modified: app/src/main/res/layout/activity_app_list.xml modified: app/src/main/res/values/strings.xml app/src/main/res/drawable-hdpi/ic_az_black.png app/src/main/res/drawable-hdpi/ic_last_updated_black.png app/src/main/res/drawable-mdpi/ic_az_black.png app/src/main/res/drawable-mdpi/ic_last_updated_black.png app/src/main/res/drawable-xhdpi/ic_az_black.png app/src/main/res/drawable-xhdpi/ic_last_updated_black.png app/src/main/res/drawable-xxhdpi/ic_az_black.png app/src/main/res/drawable-xxhdpi/ic_last_updated_black.png app/src/main/res/drawable-xxxhdpi/ic_az_black.png app/src/main/res/drawable-xxxhdpi/ic_last_updated_black.png
This commit is contained in:
parent
3b65cd38e7
commit
b79c6a9780
@ -16,7 +16,9 @@ import android.view.View;
|
|||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.fdroid.fdroid.FDroidApp;
|
import org.fdroid.fdroid.FDroidApp;
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.data.AppProvider;
|
import org.fdroid.fdroid.data.AppProvider;
|
||||||
@ -34,8 +36,15 @@ public class AppListActivity extends AppCompatActivity implements LoaderManager.
|
|||||||
private AppListAdapter appAdapter;
|
private AppListAdapter appAdapter;
|
||||||
private String category;
|
private String category;
|
||||||
private String searchTerms;
|
private String searchTerms;
|
||||||
|
private String sortClauseSelected = SortClause.LAST_UPDATED;
|
||||||
private TextView emptyState;
|
private TextView emptyState;
|
||||||
private EditText searchInput;
|
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
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
@ -62,6 +71,22 @@ public class AppListActivity extends AppCompatActivity implements LoaderManager.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sortImage = (ImageView) findViewById(R.id.sort);
|
||||||
|
sortImage.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (sortClauseSelected.equalsIgnoreCase(SortClause.LAST_UPDATED)) {
|
||||||
|
sortClauseSelected = SortClause.NAME;
|
||||||
|
sortImage.setImageResource(R.drawable.ic_az_black);
|
||||||
|
} else {
|
||||||
|
sortClauseSelected = SortClause.LAST_UPDATED;
|
||||||
|
sortImage.setImageResource(R.drawable.ic_last_updated_black);
|
||||||
|
}
|
||||||
|
getSupportLoaderManager().restartLoader(0, null, AppListActivity.this );
|
||||||
|
appView.scrollToPosition(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
emptyState = (TextView) findViewById(R.id.empty_state);
|
emptyState = (TextView) findViewById(R.id.empty_state);
|
||||||
|
|
||||||
View backButton = findViewById(R.id.back);
|
View backButton = findViewById(R.id.back);
|
||||||
@ -128,7 +153,7 @@ public class AppListActivity extends AppCompatActivity implements LoaderManager.
|
|||||||
Schema.AppMetadataTable.Cols.ALL,
|
Schema.AppMetadataTable.Cols.ALL,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Schema.AppMetadataTable.Cols.NAME
|
sortClauseSelected
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,20 +18,21 @@
|
|||||||
<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:paddingStart="16dp"
|
android:paddingStart="8dp"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingEnd="16dp"
|
android:paddingEnd="8dp"
|
||||||
android:paddingRight="16dp">
|
android:paddingRight="8dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/back"
|
android:id="@+id/back"
|
||||||
android:contentDescription="@string/back"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="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_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/search"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:src="@drawable/ic_back_black_24dp" />
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@ -51,13 +52,29 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/clear"
|
android:id="@+id/clear"
|
||||||
android:contentDescription="@string/clear_search"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:contentDescription="@string/clear_search"
|
||||||
|
android:src="@drawable/ic_close_black_24dp"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/sort"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/search"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sort"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/sort_search"
|
||||||
|
android:src="@drawable/ic_last_updated_black"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:src="@drawable/ic_close_black_24dp" />
|
app:layout_constraintStart_toEndOf="@+id/clear"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
@ -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="add_key">Add Key</string>
|
||||||
<string name="overwrite">Overwrite</string>
|
<string name="overwrite">Overwrite</string>
|
||||||
<string name="clear_search">Clear search</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="bluetooth_activity_not_found">No Bluetooth send method found, choose one!</string>
|
||||||
<string name="choose_bt_send">Choose Bluetooth send method</string>
|
<string name="choose_bt_send">Choose Bluetooth send method</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user