diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0fb64517..a3415c93 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -20,7 +20,7 @@
android:name=".activities.FileViewActivity"
android:theme="@style/AppTheme.NoActionBar" />
-
+
-
+
-
-
+
+
diff --git a/app/src/main/java/org/mian/gitnex/activities/NewFileActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java
similarity index 99%
rename from app/src/main/java/org/mian/gitnex/activities/NewFileActivity.java
rename to app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java
index 0bd99513..c810500c 100644
--- a/app/src/main/java/org/mian/gitnex/activities/NewFileActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java
@@ -32,7 +32,7 @@ import retrofit2.Callback;
* Author M M Arif
*/
-public class NewFileActivity extends BaseActivity {
+public class CreateFileActivity extends BaseActivity {
public ImageView closeActivity;
private View.OnClickListener onClickListener;
diff --git a/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java
similarity index 98%
rename from app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java
rename to app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java
index d7fda9da..c141668d 100644
--- a/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java
@@ -28,7 +28,7 @@ import java.util.Calendar;
* Author M M Arif
*/
-public class NewMilestoneActivity extends BaseActivity implements View.OnClickListener {
+public class CreateMilestoneActivity extends BaseActivity implements View.OnClickListener {
private EditText milestoneDueDate;
private View.OnClickListener onClickListener;
diff --git a/app/src/main/java/org/mian/gitnex/activities/NewOrganizationActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java
similarity index 99%
rename from app/src/main/java/org/mian/gitnex/activities/NewOrganizationActivity.java
rename to app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java
index 51229abc..fe43585f 100644
--- a/app/src/main/java/org/mian/gitnex/activities/NewOrganizationActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java
@@ -24,7 +24,7 @@ import retrofit2.Callback;
* Author M M Arif
*/
-public class NewOrganizationActivity extends BaseActivity {
+public class CreateOrganizationActivity extends BaseActivity {
public ImageView closeActivity;
private View.OnClickListener onClickListener;
diff --git a/app/src/main/java/org/mian/gitnex/activities/NewRepoActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java
similarity index 87%
rename from app/src/main/java/org/mian/gitnex/activities/NewRepoActivity.java
rename to app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java
index 7b1b43a0..c56916d5 100644
--- a/app/src/main/java/org/mian/gitnex/activities/NewRepoActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java
@@ -32,7 +32,7 @@ import retrofit2.Callback;
* Author M M Arif
*/
-public class NewRepoActivity extends BaseActivity {
+public class CreateRepoActivity extends BaseActivity {
public ImageView closeActivity;
private View.OnClickListener onClickListener;
@@ -43,7 +43,7 @@ public class NewRepoActivity extends BaseActivity {
private CheckBox repoAccess;
final Context ctx = this;
- List orgsList = new ArrayList<>();
+ List organizationsList = new ArrayList<>();
@Override
protected int getLayoutResourceId(){
@@ -72,7 +72,7 @@ public class NewRepoActivity extends BaseActivity {
spinner = findViewById(R.id.ownerSpinner);
spinner.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
- getOrgs(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), userLogin);
+ getOrganizations(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), userLogin);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView> parent, View view, int position, long id) {
@@ -225,7 +225,9 @@ public class NewRepoActivity extends BaseActivity {
}
- private void getOrgs(String instanceUrl, String instanceToken, final String userLogin) {
+ private void getOrganizations(String instanceUrl, String instanceToken, final String userLogin) {
+
+ TinyDB tinyDb = new TinyDB(getApplicationContext());
Call> call = RetrofitClient
.getInstance(instanceUrl, getApplicationContext())
@@ -240,26 +242,37 @@ public class NewRepoActivity extends BaseActivity {
if(response.isSuccessful()) {
if(response.code() == 200) {
- List orgsList_ = response.body();
+ int organizationId = 0;
- orgsList.add(new OrgOwner(userLogin));
- assert orgsList_ != null;
- if(orgsList_.size() > 0) {
- for (int i = 0; i < orgsList_.size(); i++) {
+ List organizationsList_ = response.body();
+ organizationsList.add(new OrgOwner(userLogin));
+ assert organizationsList_ != null;
+ if(organizationsList_.size() > 0) {
+ for (int i = 0; i < organizationsList_.size(); i++) {
+
+ if(Integer.parseInt(tinyDb.getString("organizationId")) == organizationsList_.get(i).getId()) {
+ organizationId = i + 1;
+ }
OrgOwner data = new OrgOwner(
- orgsList_.get(i).getUsername()
+ organizationsList_.get(i).getUsername()
);
- orgsList.add(data);
+ organizationsList.add(data);
}
}
ArrayAdapter adapter = new ArrayAdapter<>(getApplicationContext(),
- R.layout.spinner_item, orgsList);
+ R.layout.spinner_item, organizationsList);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spinner.setAdapter(adapter);
+
+ if (tinyDb.getBoolean("organizationAction")) {
+ spinner.setSelection(organizationId);
+ tinyDb.putBoolean("organizationAction", false);
+ }
+
enableProcessButton();
}
diff --git a/app/src/main/java/org/mian/gitnex/activities/OrgDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/OrganizationDetailActivity.java
similarity index 87%
rename from app/src/main/java/org/mian/gitnex/activities/OrgDetailActivity.java
rename to app/src/main/java/org/mian/gitnex/activities/OrganizationDetailActivity.java
index 7e82bed5..b41468e9 100644
--- a/app/src/main/java/org/mian/gitnex/activities/OrgDetailActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/OrganizationDetailActivity.java
@@ -29,7 +29,7 @@ import java.util.Objects;
* Author M M Arif
*/
-public class OrgDetailActivity extends BaseActivity implements BottomSheetOrganizationFragment.BottomSheetListener {
+public class OrganizationDetailActivity extends BaseActivity implements BottomSheetOrganizationFragment.BottomSheetListener {
@Override
protected int getLayoutResourceId(){
@@ -50,7 +50,7 @@ public class OrgDetailActivity extends BaseActivity implements BottomSheetOrgani
Objects.requireNonNull(getSupportActionBar()).setTitle(orgName);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- OrgDetailActivity.SectionsPagerAdapter mSectionsPagerAdapter = new OrgDetailActivity.SectionsPagerAdapter(getSupportFragmentManager());
+ OrganizationDetailActivity.SectionsPagerAdapter mSectionsPagerAdapter = new OrganizationDetailActivity.SectionsPagerAdapter(getSupportFragmentManager());
ViewPager mViewPager = findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
@@ -130,9 +130,15 @@ public class OrgDetailActivity extends BaseActivity implements BottomSheetOrgani
@Override
public void onButtonClicked(String text) {
+ TinyDB tinyDb = new TinyDB(getApplicationContext());
+
switch (text) {
+ case "repository":
+ tinyDb.putBoolean("organizationAction", true);
+ startActivity(new Intent(OrganizationDetailActivity.this, CreateRepoActivity.class));
+ break;
case "team":
- startActivity(new Intent(OrgDetailActivity.this, CreateTeamByOrgActivity.class));
+ startActivity(new Intent(OrganizationDetailActivity.this, CreateTeamByOrgActivity.class));
break;
}
//Log.i("clicked", text);
@@ -142,7 +148,7 @@ public class OrgDetailActivity extends BaseActivity implements BottomSheetOrgani
public class SectionsPagerAdapter extends FragmentPagerAdapter {
SectionsPagerAdapter(FragmentManager fm) {
- super(fm);
+ super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
}
@NonNull
@@ -151,7 +157,7 @@ public class OrgDetailActivity extends BaseActivity implements BottomSheetOrgani
TinyDB tinyDb = new TinyDB(getApplicationContext());
String orgName;
- if(getIntent().getStringExtra("orgName") != null || !getIntent().getStringExtra("orgName").equals("")) {
+ if(getIntent().getStringExtra("orgName") != null || !Objects.equals(getIntent().getStringExtra("orgName"), "")) {
orgName = getIntent().getStringExtra("orgName");
}
else {
diff --git a/app/src/main/java/org/mian/gitnex/activities/OrgTeamMembersActivity.java b/app/src/main/java/org/mian/gitnex/activities/OrganizationTeamMembersActivity.java
similarity index 98%
rename from app/src/main/java/org/mian/gitnex/activities/OrgTeamMembersActivity.java
rename to app/src/main/java/org/mian/gitnex/activities/OrganizationTeamMembersActivity.java
index 586b40c5..24b4078f 100644
--- a/app/src/main/java/org/mian/gitnex/activities/OrgTeamMembersActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/OrganizationTeamMembersActivity.java
@@ -21,7 +21,7 @@ import java.util.Objects;
* Author M M Arif
*/
-public class OrgTeamMembersActivity extends BaseActivity {
+public class OrganizationTeamMembersActivity extends BaseActivity {
private TextView noDataMembers;
private View.OnClickListener onClickListener;
diff --git a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java
index 6ed7a40e..3259bbbf 100644
--- a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java
@@ -213,7 +213,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
startActivity(new Intent(RepoDetailActivity.this, CreateIssueActivity.class));
break;
case "newMilestone":
- startActivity(new Intent(RepoDetailActivity.this, NewMilestoneActivity.class));
+ startActivity(new Intent(RepoDetailActivity.this, CreateMilestoneActivity.class));
break;
case "addCollaborator":
startActivity(new Intent(RepoDetailActivity.this, AddCollaboratorToRepositoryActivity.class));
@@ -233,7 +233,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
startActivity(Intent.createChooser(sharingIntent, url.toString()));
break;
case "newFile":
- startActivity(new Intent(RepoDetailActivity.this, NewFileActivity.class));
+ startActivity(new Intent(RepoDetailActivity.this, CreateFileActivity.class));
break;
}
diff --git a/app/src/main/java/org/mian/gitnex/adapters/OrganizationsListAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/OrganizationsListAdapter.java
index 36da0977..0aea0da4 100644
--- a/app/src/main/java/org/mian/gitnex/adapters/OrganizationsListAdapter.java
+++ b/app/src/main/java/org/mian/gitnex/adapters/OrganizationsListAdapter.java
@@ -2,6 +2,7 @@ package org.mian.gitnex.adapters;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
@@ -13,7 +14,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import org.mian.gitnex.R;
-import org.mian.gitnex.activities.OrgDetailActivity;
+import org.mian.gitnex.activities.OrganizationDetailActivity;
import org.mian.gitnex.models.UserOrganizations;
import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.util.TinyDB;
@@ -35,23 +36,27 @@ public class OrganizationsListAdapter extends RecyclerView.Adapter
+ tools:context=".activities.OrganizationDetailActivity">
+
+
+ tools:context=".activities.OrganizationDetailActivity">
+ tools:context=".activities.OrganizationDetailActivity">
+
+
Size
Share Issue
Share Repository
+ Create Repository