mirror of https://codeberg.org/gitnex/GitNex.git
Fix link to APK builds, add search to repo watchers and stargazors
This commit is contained in:
parent
0b5a201530
commit
51b90310d7
|
@ -12,7 +12,7 @@ GitNex is licensed under the GPLv3 License. Please refer to the LICENSE file for
|
|||
|
||||
[<img alt='Get it on F-Droid' src='https://codeberg.org/gitnex/GitNex/raw/branch/main/assets/fdroid.png' height="80"/>](https://f-droid.org/en/packages/org.mian.gitnex/)
|
||||
[<img alt='Get it on Google Play' src='https://codeberg.org/gitnex/GitNex/raw/branch/main/assets/google-play.png' height="80"/>](https://play.google.com/store/apps/details?id=org.mian.gitnex.pro)
|
||||
[<img alt='Download builds and releases' src='https://codeberg.org/gitnex/GitNex/raw/branch/main/assets/apk-badge.png' height="82"/>](https://cloud.swatian.com/s/DN7E5xxtaw4fRbE)
|
||||
[<img alt='Download builds and releases' src='https://codeberg.org/gitnex/GitNex/raw/branch/main/assets/apk-badge.png' height="82"/>](https://cloud.swatian.com/s/WS4k3seXnmfQppo)
|
||||
|
||||
## Note about Forgejo and Gitea version
|
||||
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
package org.mian.gitnex.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.UserGridAdapter;
|
||||
import org.mian.gitnex.databinding.ActivityRepoStargazersBinding;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
||||
import org.mian.gitnex.viewmodels.RepoStargazersViewModel;
|
||||
|
||||
|
@ -18,37 +22,30 @@ import org.mian.gitnex.viewmodels.RepoStargazersViewModel;
|
|||
*/
|
||||
public class RepoStargazersActivity extends BaseActivity {
|
||||
|
||||
private TextView noDataStargazers;
|
||||
private View.OnClickListener onClickListener;
|
||||
private UserGridAdapter adapter;
|
||||
private GridView mGridView;
|
||||
private ProgressBar mProgressBar;
|
||||
|
||||
private Boolean searchFilter = false;
|
||||
private RepositoryContext repository;
|
||||
private ActivityRepoStargazersBinding activityRepoStargazersBinding;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ActivityRepoStargazersBinding activityRepoStargazersBinding =
|
||||
ActivityRepoStargazersBinding.inflate(getLayoutInflater());
|
||||
activityRepoStargazersBinding = ActivityRepoStargazersBinding.inflate(getLayoutInflater());
|
||||
setContentView(activityRepoStargazersBinding.getRoot());
|
||||
|
||||
ImageView closeActivity = activityRepoStargazersBinding.close;
|
||||
TextView toolbarTitle = activityRepoStargazersBinding.toolbarTitle;
|
||||
noDataStargazers = activityRepoStargazersBinding.noDataStargazers;
|
||||
mGridView = activityRepoStargazersBinding.gridView;
|
||||
mProgressBar = activityRepoStargazersBinding.progressBar;
|
||||
setSupportActionBar(activityRepoStargazersBinding.toolbar);
|
||||
|
||||
repository = RepositoryContext.fromIntent(getIntent());
|
||||
final String repoOwner = repository.getOwner();
|
||||
final String repoName = repository.getName();
|
||||
|
||||
initCloseListener();
|
||||
closeActivity.setOnClickListener(onClickListener);
|
||||
activityRepoStargazersBinding.close.setOnClickListener(onClickListener);
|
||||
|
||||
toolbarTitle.setText(R.string.repoStargazersInMenu);
|
||||
activityRepoStargazersBinding.toolbarTitle.setText(R.string.repoStargazersInMenu);
|
||||
|
||||
fetchDataAsync(repoOwner, repoName);
|
||||
}
|
||||
|
@ -67,16 +64,19 @@ public class RepoStargazersActivity extends BaseActivity {
|
|||
|
||||
if (adapter.getCount() > 0) {
|
||||
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataStargazers.setVisibility(View.GONE);
|
||||
activityRepoStargazersBinding.gridView.setAdapter(adapter);
|
||||
activityRepoStargazersBinding.noDataStargazers.setVisibility(
|
||||
View.GONE);
|
||||
searchFilter = true;
|
||||
} else {
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataStargazers.setVisibility(View.VISIBLE);
|
||||
activityRepoStargazersBinding.gridView.setAdapter(adapter);
|
||||
activityRepoStargazersBinding.noDataStargazers.setVisibility(
|
||||
View.VISIBLE);
|
||||
}
|
||||
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
activityRepoStargazersBinding.progressBar.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -90,4 +90,49 @@ public class RepoStargazersActivity extends BaseActivity {
|
|||
super.onResume();
|
||||
repository.checkAccountSwitch(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
|
||||
final MenuInflater inflater = getMenuInflater();
|
||||
|
||||
new Handler(Looper.getMainLooper())
|
||||
.postDelayed(
|
||||
() -> {
|
||||
if (searchFilter) {
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
||||
|
||||
inflater.inflate(R.menu.search_menu, menu);
|
||||
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
SearchView searchView = (SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
|
||||
if (!connToInternet) {
|
||||
return;
|
||||
}
|
||||
|
||||
searchView.setOnQueryTextListener(
|
||||
new androidx.appcompat.widget.SearchView
|
||||
.OnQueryTextListener() {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
|
||||
adapter.getFilter().filter(newText);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
500);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
package org.mian.gitnex.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.UserGridAdapter;
|
||||
import org.mian.gitnex.databinding.ActivityRepoWatchersBinding;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
||||
import org.mian.gitnex.viewmodels.RepoWatchersViewModel;
|
||||
|
||||
|
@ -18,12 +22,10 @@ import org.mian.gitnex.viewmodels.RepoWatchersViewModel;
|
|||
*/
|
||||
public class RepoWatchersActivity extends BaseActivity {
|
||||
|
||||
private TextView noDataWatchers;
|
||||
private View.OnClickListener onClickListener;
|
||||
private UserGridAdapter adapter;
|
||||
private GridView mGridView;
|
||||
private ProgressBar mProgressBar;
|
||||
|
||||
private Boolean searchFilter = false;
|
||||
private ActivityRepoWatchersBinding activityRepoWatchersBinding;
|
||||
private RepositoryContext repository;
|
||||
|
||||
@Override
|
||||
|
@ -31,24 +33,19 @@ public class RepoWatchersActivity extends BaseActivity {
|
|||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ActivityRepoWatchersBinding activityRepoWatchersBinding =
|
||||
ActivityRepoWatchersBinding.inflate(getLayoutInflater());
|
||||
activityRepoWatchersBinding = ActivityRepoWatchersBinding.inflate(getLayoutInflater());
|
||||
setContentView(activityRepoWatchersBinding.getRoot());
|
||||
|
||||
ImageView closeActivity = activityRepoWatchersBinding.close;
|
||||
TextView toolbarTitle = activityRepoWatchersBinding.toolbarTitle;
|
||||
noDataWatchers = activityRepoWatchersBinding.noDataWatchers;
|
||||
mGridView = activityRepoWatchersBinding.gridView;
|
||||
mProgressBar = activityRepoWatchersBinding.progressBar;
|
||||
setSupportActionBar(activityRepoWatchersBinding.toolbar);
|
||||
|
||||
repository = RepositoryContext.fromIntent(getIntent());
|
||||
final String repoOwner = repository.getOwner();
|
||||
final String repoName = repository.getName();
|
||||
|
||||
initCloseListener();
|
||||
closeActivity.setOnClickListener(onClickListener);
|
||||
activityRepoWatchersBinding.close.setOnClickListener(onClickListener);
|
||||
|
||||
toolbarTitle.setText(R.string.repoWatchersInMenu);
|
||||
activityRepoWatchersBinding.toolbarTitle.setText(R.string.repoWatchersInMenu);
|
||||
|
||||
fetchDataAsync(repoOwner, repoName);
|
||||
}
|
||||
|
@ -67,16 +64,18 @@ public class RepoWatchersActivity extends BaseActivity {
|
|||
|
||||
if (adapter.getCount() > 0) {
|
||||
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataWatchers.setVisibility(View.GONE);
|
||||
activityRepoWatchersBinding.gridView.setAdapter(adapter);
|
||||
activityRepoWatchersBinding.noDataWatchers.setVisibility(View.GONE);
|
||||
searchFilter = true;
|
||||
} else {
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataWatchers.setVisibility(View.VISIBLE);
|
||||
activityRepoWatchersBinding.gridView.setAdapter(adapter);
|
||||
activityRepoWatchersBinding.noDataWatchers.setVisibility(
|
||||
View.VISIBLE);
|
||||
}
|
||||
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
activityRepoWatchersBinding.progressBar.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -90,4 +89,49 @@ public class RepoWatchersActivity extends BaseActivity {
|
|||
super.onResume();
|
||||
repository.checkAccountSwitch(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
|
||||
final MenuInflater inflater = getMenuInflater();
|
||||
|
||||
new Handler(Looper.getMainLooper())
|
||||
.postDelayed(
|
||||
() -> {
|
||||
if (searchFilter) {
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
||||
|
||||
inflater.inflate(R.menu.search_menu, menu);
|
||||
|
||||
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||
SearchView searchView = (SearchView) searchItem.getActionView();
|
||||
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
|
||||
if (!connToInternet) {
|
||||
return;
|
||||
}
|
||||
|
||||
searchView.setOnQueryTextListener(
|
||||
new androidx.appcompat.widget.SearchView
|
||||
.OnQueryTextListener() {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
|
||||
adapter.getFilter().filter(newText);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
500);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,10 +298,10 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|||
context.getResources().getColor(R.color.colorWhite, null)));
|
||||
this.issuePrState.setBackgroundResource(R.drawable.shape_draft_release);
|
||||
this.issuePrState.setPadding(
|
||||
(int) context.getResources().getDimension(R.dimen.dimen8dp),
|
||||
(int) context.getResources().getDimension(R.dimen.dimen2dp),
|
||||
(int) context.getResources().getDimension(R.dimen.dimen8dp),
|
||||
(int) context.getResources().getDimension(R.dimen.dimen2dp));
|
||||
(int) context.getResources().getDimension(R.dimen.dimen4dp),
|
||||
(int) context.getResources().getDimension(R.dimen.dimen0dp),
|
||||
(int) context.getResources().getDimension(R.dimen.dimen4dp),
|
||||
(int) context.getResources().getDimension(R.dimen.dimen0dp));
|
||||
this.prTitle.setPadding(
|
||||
(int) context.getResources().getDimension(R.dimen.dimen16dp),
|
||||
(int) context.getResources().getDimension(R.dimen.dimen0dp),
|
||||
|
|
|
@ -62,12 +62,10 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/issuePrState"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/dimen26dp"
|
||||
android:layout_height="@dimen/dimen26dp"
|
||||
android:contentDescription="@string/generalImgContentText"
|
||||
android:paddingStart="@dimen/dimen0dp"
|
||||
android:paddingEnd="@dimen/dimen8dp"
|
||||
android:src="@drawable/ic_issue"
|
||||
android:src="@drawable/ic_draft"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
|
|
Loading…
Reference in New Issue