Share feature and some refactor to easily manage source code files
This commit is contained in:
		@@ -59,7 +59,7 @@
 | 
			
		||||
            android:name=".activities.RepoDetailActivity"
 | 
			
		||||
            android:label="@string/title_activity_repo_detail"
 | 
			
		||||
            android:theme="@style/AppTheme.NoActionBar" />
 | 
			
		||||
        <activity android:name=".activities.MainActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
 | 
			
		||||
        <activity android:name=".activities.MainActivity" android:theme="@android:style/Theme.NoTitleBar">
 | 
			
		||||
            <intent-filter>
 | 
			
		||||
                <action android:name="android.intent.action.MAIN" />
 | 
			
		||||
 | 
			
		||||
@@ -68,7 +68,7 @@
 | 
			
		||||
        </activity>
 | 
			
		||||
        <activity
 | 
			
		||||
            android:name=".activities.LoginActivity"
 | 
			
		||||
            android:launchMode="singleTask" />
 | 
			
		||||
            android:launchMode="singleTask" android:theme="@android:style/Theme.NoTitleBar"/>
 | 
			
		||||
        <activity android:name=".activities.NewRepoActivity" />
 | 
			
		||||
        <activity android:name=".activities.NewOrganizationActivity" />
 | 
			
		||||
        <activity android:name=".activities.OpenRepoInBrowserActivity" />
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ import android.widget.ImageView;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
import org.mian.gitnex.R;
 | 
			
		||||
import org.mian.gitnex.adapters.AdminGetUsersAdapter;
 | 
			
		||||
import org.mian.gitnex.fragments.AdminUsersBottomSheetFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.BottomSheetAdminUsersFragment;
 | 
			
		||||
import org.mian.gitnex.helpers.Authorization;
 | 
			
		||||
import org.mian.gitnex.models.UserInfo;
 | 
			
		||||
import org.mian.gitnex.util.AppUtil;
 | 
			
		||||
@@ -34,7 +34,7 @@ import java.util.Objects;
 | 
			
		||||
 * Author M M Arif
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class AdminGetUsersActivity extends BaseActivity implements AdminUsersBottomSheetFragment.BottomSheetListener {
 | 
			
		||||
public class AdminGetUsersActivity extends BaseActivity implements BottomSheetAdminUsersFragment.BottomSheetListener {
 | 
			
		||||
 | 
			
		||||
    private View.OnClickListener onClickListener;
 | 
			
		||||
    final Context ctx = this;
 | 
			
		||||
@@ -171,7 +171,7 @@ public class AdminGetUsersActivity extends BaseActivity implements AdminUsersBot
 | 
			
		||||
                finish();
 | 
			
		||||
                return true;
 | 
			
		||||
            case R.id.genericMenu:
 | 
			
		||||
                AdminUsersBottomSheetFragment bottomSheet = new AdminUsersBottomSheetFragment();
 | 
			
		||||
                BottomSheetAdminUsersFragment bottomSheet = new BottomSheetAdminUsersFragment();
 | 
			
		||||
                bottomSheet.show(getSupportFragmentManager(), "usersBottomSheet");
 | 
			
		||||
                return true;
 | 
			
		||||
            default:
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import androidx.annotation.NonNull;
 | 
			
		||||
import androidx.annotation.Nullable;
 | 
			
		||||
import androidx.appcompat.widget.Toolbar;
 | 
			
		||||
import androidx.lifecycle.Observer;
 | 
			
		||||
import androidx.lifecycle.ViewModelProviders;
 | 
			
		||||
import androidx.lifecycle.ViewModelProvider;
 | 
			
		||||
import androidx.recyclerview.widget.DividerItemDecoration;
 | 
			
		||||
import androidx.recyclerview.widget.LinearLayoutManager;
 | 
			
		||||
import androidx.recyclerview.widget.RecyclerView;
 | 
			
		||||
@@ -55,7 +55,7 @@ import com.vdurmont.emoji.EmojiParser;
 | 
			
		||||
import org.mian.gitnex.R;
 | 
			
		||||
import org.mian.gitnex.adapters.IssueCommentsAdapter;
 | 
			
		||||
import org.mian.gitnex.clients.RetrofitClient;
 | 
			
		||||
import org.mian.gitnex.fragments.SingleIssueBottomSheetFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.BottomSheetSingleIssueFragment;
 | 
			
		||||
import org.mian.gitnex.helpers.AlertDialogs;
 | 
			
		||||
import org.mian.gitnex.helpers.Authorization;
 | 
			
		||||
import org.mian.gitnex.helpers.TimeHelper;
 | 
			
		||||
@@ -211,7 +211,7 @@ public class IssueDetailActivity extends BaseActivity {
 | 
			
		||||
                finish();
 | 
			
		||||
                return true;
 | 
			
		||||
            case R.id.genericMenu:
 | 
			
		||||
                SingleIssueBottomSheetFragment bottomSheet = new SingleIssueBottomSheetFragment();
 | 
			
		||||
                BottomSheetSingleIssueFragment bottomSheet = new BottomSheetSingleIssueFragment();
 | 
			
		||||
                bottomSheet.show(getSupportFragmentManager(), "singleIssueBottomSheet");
 | 
			
		||||
                return true;
 | 
			
		||||
            default:
 | 
			
		||||
@@ -293,7 +293,7 @@ public class IssueDetailActivity extends BaseActivity {
 | 
			
		||||
 | 
			
		||||
    private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo, int index, String loginUid) {
 | 
			
		||||
 | 
			
		||||
        IssueCommentsViewModel issueCommentsModel = ViewModelProviders.of(this).get(IssueCommentsViewModel.class);
 | 
			
		||||
        IssueCommentsViewModel issueCommentsModel = new ViewModelProvider(this).get(IssueCommentsViewModel.class);
 | 
			
		||||
 | 
			
		||||
        issueCommentsModel.getIssueCommentList(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), owner, repo, index, getApplicationContext()).observe(this, new Observer<List<IssueComments>>() {
 | 
			
		||||
            @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ import org.mian.gitnex.clients.RetrofitClient;
 | 
			
		||||
import org.mian.gitnex.fragments.AboutFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.ExploreRepositoriesFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.MyRepositoriesFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.NavSubMenuBottomSheetFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.BottomSheetNavSubMenuFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.OrganizationsFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.SettingsFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.StarredRepositoriesFragment;
 | 
			
		||||
@@ -161,7 +161,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
 | 
			
		||||
        ImageView navSubMenu = hView.findViewById(R.id.navSubMenu);
 | 
			
		||||
        navSubMenu.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
                NavSubMenuBottomSheetFragment bottomSheet = new NavSubMenuBottomSheetFragment();
 | 
			
		||||
                BottomSheetNavSubMenuFragment bottomSheet = new BottomSheetNavSubMenuFragment();
 | 
			
		||||
                bottomSheet.show(getSupportFragmentManager(), "adminMenuBottomSheet");
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ import android.view.ViewGroup;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
import org.mian.gitnex.R;
 | 
			
		||||
import org.mian.gitnex.fragments.MembersByOrgFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.OrgBottomSheetFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.BottomSheetOrganizationFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.OrganizationInfoFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.RepositoriesByOrgFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.TeamsByOrgFragment;
 | 
			
		||||
@@ -29,7 +29,7 @@ import java.util.Objects;
 | 
			
		||||
 * Author M M Arif
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class OrgDetailActivity extends BaseActivity implements OrgBottomSheetFragment.BottomSheetListener {
 | 
			
		||||
public class OrgDetailActivity extends BaseActivity implements BottomSheetOrganizationFragment.BottomSheetListener {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected int getLayoutResourceId(){
 | 
			
		||||
@@ -118,7 +118,7 @@ public class OrgDetailActivity extends BaseActivity implements OrgBottomSheetFra
 | 
			
		||||
                finish();
 | 
			
		||||
                return true;
 | 
			
		||||
            case R.id.repoMenu:
 | 
			
		||||
                OrgBottomSheetFragment bottomSheet = new OrgBottomSheetFragment();
 | 
			
		||||
                BottomSheetOrganizationFragment bottomSheet = new BottomSheetOrganizationFragment();
 | 
			
		||||
                bottomSheet.show(getSupportFragmentManager(), "orgBottomSheet");
 | 
			
		||||
                return true;
 | 
			
		||||
            default:
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,7 @@ import android.view.ViewGroup;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
import org.mian.gitnex.R;
 | 
			
		||||
import org.mian.gitnex.clients.RetrofitClient;
 | 
			
		||||
import org.mian.gitnex.fragments.BottomSheetRepoFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.BranchesFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.ClosedIssuesFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.CollaboratorsFragment;
 | 
			
		||||
@@ -34,7 +35,6 @@ import org.mian.gitnex.fragments.LabelsFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.MilestonesFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.PullRequestsFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.ReleasesFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.RepoBottomSheetFragment;
 | 
			
		||||
import org.mian.gitnex.fragments.RepoInfoFragment;
 | 
			
		||||
import org.mian.gitnex.helpers.Authorization;
 | 
			
		||||
import org.mian.gitnex.models.UserRepositories;
 | 
			
		||||
@@ -48,7 +48,7 @@ import android.net.Uri;
 | 
			
		||||
 * Author M M Arif
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class RepoDetailActivity extends BaseActivity implements RepoBottomSheetFragment.BottomSheetListener {
 | 
			
		||||
public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoFragment.BottomSheetListener {
 | 
			
		||||
 | 
			
		||||
    private TextView textViewBadge;
 | 
			
		||||
 | 
			
		||||
@@ -185,7 +185,7 @@ public class RepoDetailActivity extends BaseActivity implements RepoBottomSheetF
 | 
			
		||||
                finish();
 | 
			
		||||
                return true;
 | 
			
		||||
            case R.id.repoMenu:
 | 
			
		||||
                RepoBottomSheetFragment bottomSheet = new RepoBottomSheetFragment();
 | 
			
		||||
                BottomSheetRepoFragment bottomSheet = new BottomSheetRepoFragment();
 | 
			
		||||
                bottomSheet.show(getSupportFragmentManager(), "repoBottomSheet");
 | 
			
		||||
                return true;
 | 
			
		||||
            default:
 | 
			
		||||
@@ -197,6 +197,14 @@ public class RepoDetailActivity extends BaseActivity implements RepoBottomSheetF
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onButtonClicked(String text) {
 | 
			
		||||
 | 
			
		||||
        TinyDB tinyDb = new TinyDB(getApplicationContext());
 | 
			
		||||
        String repoFullName = tinyDb.getString("repoFullName");
 | 
			
		||||
        String instanceUrlWithProtocol = "https://" + tinyDb.getString("instanceUrlRaw");
 | 
			
		||||
        if(!tinyDb.getString("instanceUrlWithProtocol").isEmpty()) {
 | 
			
		||||
            instanceUrlWithProtocol = tinyDb.getString("instanceUrlWithProtocol");
 | 
			
		||||
        }
 | 
			
		||||
        Uri url = Uri.parse(instanceUrlWithProtocol + "/" + repoFullName);
 | 
			
		||||
 | 
			
		||||
        switch (text) {
 | 
			
		||||
            case "label":
 | 
			
		||||
                startActivity(new Intent(RepoDetailActivity.this, CreateLabelActivity.class));
 | 
			
		||||
@@ -214,16 +222,16 @@ public class RepoDetailActivity extends BaseActivity implements RepoBottomSheetF
 | 
			
		||||
                startActivity(new Intent(RepoDetailActivity.this, CreateReleaseActivity.class));
 | 
			
		||||
                break;
 | 
			
		||||
            case "openWebRepo":
 | 
			
		||||
                TinyDB tinyDb = new TinyDB(getApplicationContext());
 | 
			
		||||
                String repoFullName = tinyDb.getString("repoFullName");
 | 
			
		||||
                String instanceUrlWithProtocol = "https://" + tinyDb.getString("instanceUrlRaw");
 | 
			
		||||
                if(!tinyDb.getString("instanceUrlWithProtocol").isEmpty()) {
 | 
			
		||||
                    instanceUrlWithProtocol = tinyDb.getString("instanceUrlWithProtocol");
 | 
			
		||||
                }
 | 
			
		||||
                Uri url = Uri.parse(instanceUrlWithProtocol + "/" + repoFullName);
 | 
			
		||||
                Intent i = new Intent(Intent.ACTION_VIEW, url);
 | 
			
		||||
                startActivity(i);
 | 
			
		||||
                break;
 | 
			
		||||
            case "shareRepo":
 | 
			
		||||
                Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
 | 
			
		||||
                sharingIntent.setType("text/plain");
 | 
			
		||||
                sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, url);
 | 
			
		||||
                sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, url);
 | 
			
		||||
                startActivity(Intent.createChooser(sharingIntent, url.toString()));
 | 
			
		||||
                break;
 | 
			
		||||
            case "newFile":
 | 
			
		||||
                startActivity(new Intent(RepoDetailActivity.this, NewFileActivity.class));
 | 
			
		||||
                break;
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ public class ClosedIssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
 | 
			
		||||
        LayoutInflater inflater = LayoutInflater.from(context);
 | 
			
		||||
 | 
			
		||||
        if(viewType == TYPE_LOAD){
 | 
			
		||||
            return new ClosedIssuesAdapter.IssuesHolder(inflater.inflate(R.layout.repo_detail_issues_list, parent,false));
 | 
			
		||||
            return new ClosedIssuesAdapter.IssuesHolder(inflater.inflate(R.layout.repo_issues_list, parent,false));
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return new ClosedIssuesAdapter.LoadHolder(inflater.inflate(R.layout.row_load,parent,false));
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
 | 
			
		||||
        LayoutInflater inflater = LayoutInflater.from(context);
 | 
			
		||||
 | 
			
		||||
        if(viewType == TYPE_LOAD){
 | 
			
		||||
            return new IssuesHolder(inflater.inflate(R.layout.repo_detail_issues_list, parent,false));
 | 
			
		||||
            return new IssuesHolder(inflater.inflate(R.layout.repo_issues_list, parent,false));
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return new LoadHolder(inflater.inflate(R.layout.row_load,parent,false));
 | 
			
		||||
 
 | 
			
		||||
@@ -15,14 +15,14 @@ import org.mian.gitnex.R;
 | 
			
		||||
 * Author M M Arif
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class AdminUsersBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
public class BottomSheetAdminUsersFragment extends BottomSheetDialogFragment {
 | 
			
		||||
 | 
			
		||||
    private AdminUsersBottomSheetFragment.BottomSheetListener bmListener;
 | 
			
		||||
    private BottomSheetAdminUsersFragment.BottomSheetListener bmListener;
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    @Override
 | 
			
		||||
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 | 
			
		||||
        View v = inflater.inflate(R.layout.admin_users_bottom_sheet_layout, container, false);
 | 
			
		||||
        View v = inflater.inflate(R.layout.bottom_sheet_admin_users_layout, container, false);
 | 
			
		||||
 | 
			
		||||
        TextView createNewUser = v.findViewById(R.id.createNewUser);
 | 
			
		||||
 | 
			
		||||
@@ -46,7 +46,7 @@ public class AdminUsersBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
        super.onAttach(context);
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            bmListener = (AdminUsersBottomSheetFragment.BottomSheetListener) context;
 | 
			
		||||
            bmListener = (BottomSheetAdminUsersFragment.BottomSheetListener) context;
 | 
			
		||||
        } catch (ClassCastException e) {
 | 
			
		||||
            throw new ClassCastException(context.toString()
 | 
			
		||||
                    + " must implement BottomSheetListener");
 | 
			
		||||
@@ -16,12 +16,12 @@ import androidx.annotation.Nullable;
 | 
			
		||||
 * Author M M Arif
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class NavSubMenuBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
public class BottomSheetNavSubMenuFragment extends BottomSheetDialogFragment {
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    @Override
 | 
			
		||||
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 | 
			
		||||
        View v = inflater.inflate(R.layout.nav_sub_menu_bottom_sheet_layout, container, false);
 | 
			
		||||
        View v = inflater.inflate(R.layout.bottom_sheet_nav_sub_menu_layout, container, false);
 | 
			
		||||
 | 
			
		||||
        TextView adminUsers = v.findViewById(R.id.adminUsers);
 | 
			
		||||
 | 
			
		||||
@@ -15,14 +15,14 @@ import androidx.annotation.Nullable;
 | 
			
		||||
 * Author M M Arif
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class OrgBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
public class BottomSheetOrganizationFragment extends BottomSheetDialogFragment {
 | 
			
		||||
 | 
			
		||||
    private OrgBottomSheetFragment.BottomSheetListener bmListener;
 | 
			
		||||
    private BottomSheetOrganizationFragment.BottomSheetListener bmListener;
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    @Override
 | 
			
		||||
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 | 
			
		||||
        View v = inflater.inflate(R.layout.org_bottom_sheet_layout, container, false);
 | 
			
		||||
        View v = inflater.inflate(R.layout.bottom_sheet_organization_layout, container, false);
 | 
			
		||||
 | 
			
		||||
        TextView createTeam = v.findViewById(R.id.createTeam);
 | 
			
		||||
 | 
			
		||||
@@ -46,7 +46,7 @@ public class OrgBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
        super.onAttach(context);
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            bmListener = (OrgBottomSheetFragment.BottomSheetListener) context;
 | 
			
		||||
            bmListener = (BottomSheetOrganizationFragment.BottomSheetListener) context;
 | 
			
		||||
        } catch (ClassCastException e) {
 | 
			
		||||
            throw new ClassCastException(context.toString()
 | 
			
		||||
                    + " must implement BottomSheetListener");
 | 
			
		||||
@@ -16,12 +16,12 @@ import androidx.annotation.Nullable;
 | 
			
		||||
 * Author M M Arif
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class ProfileBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
public class BottomSheetProfileFragment extends BottomSheetDialogFragment {
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    @Override
 | 
			
		||||
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 | 
			
		||||
        View v = inflater.inflate(R.layout.profile_bottom_sheet_layout, container, false);
 | 
			
		||||
        View v = inflater.inflate(R.layout.bottom_sheet_profile_layout, container, false);
 | 
			
		||||
 | 
			
		||||
        TextView addNewEmailAddress = v.findViewById(R.id.addNewEmailAddress);
 | 
			
		||||
 | 
			
		||||
@@ -17,14 +17,14 @@ import androidx.annotation.Nullable;
 | 
			
		||||
 * Author M M Arif
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
 | 
			
		||||
 | 
			
		||||
    private BottomSheetListener bmListener;
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    @Override
 | 
			
		||||
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 | 
			
		||||
        View v = inflater.inflate(R.layout.repo_bottom_sheet_layout, container, false);
 | 
			
		||||
        View v = inflater.inflate(R.layout.bottom_sheet_repo_layout, container, false);
 | 
			
		||||
 | 
			
		||||
        final TinyDB tinyDb = new TinyDB(getContext());
 | 
			
		||||
 | 
			
		||||
@@ -39,6 +39,7 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
        TextView unStarRepository = v.findViewById(R.id.unStarRepository);
 | 
			
		||||
        TextView watchRepository = v.findViewById(R.id.watchRepository);
 | 
			
		||||
        TextView unWatchRepository = v.findViewById(R.id.unWatchRepository);
 | 
			
		||||
        TextView shareRepository = v.findViewById(R.id.shareRepository);
 | 
			
		||||
 | 
			
		||||
        createLabel.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
@@ -86,6 +87,14 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        shareRepository.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
                bmListener.onButtonClicked("shareRepo");
 | 
			
		||||
                dismiss();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        openWebRepo.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
@@ -27,13 +27,13 @@ import java.util.Objects;
 | 
			
		||||
 * Author M M Arif
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
 | 
			
		||||
 | 
			
		||||
    @Nullable
 | 
			
		||||
    @Override
 | 
			
		||||
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 | 
			
		||||
 | 
			
		||||
        View v = inflater.inflate(R.layout.single_issue_bottom_sheet_layout, container, false);
 | 
			
		||||
        View v = inflater.inflate(R.layout.bottom_sheet_single_issue_layout, container, false);
 | 
			
		||||
 | 
			
		||||
        final TinyDB tinyDB = new TinyDB(getContext());
 | 
			
		||||
 | 
			
		||||
@@ -46,6 +46,7 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
        TextView copyIssueUrl = v.findViewById(R.id.copyIssueUrl);
 | 
			
		||||
        TextView openFilesDiff = v.findViewById(R.id.openFilesDiff);
 | 
			
		||||
        TextView mergePullRequest = v.findViewById(R.id.mergePullRequest);
 | 
			
		||||
        TextView shareIssue = v.findViewById(R.id.shareIssue);
 | 
			
		||||
 | 
			
		||||
        replyToIssue.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
@@ -133,6 +134,29 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        shareIssue.setOnClickListener(v1 -> {
 | 
			
		||||
 | 
			
		||||
            // get url of repo
 | 
			
		||||
            String repoFullName = tinyDB.getString("repoFullName");
 | 
			
		||||
            String instanceUrlWithProtocol = "https://" + tinyDB.getString("instanceUrlRaw");
 | 
			
		||||
            if (!tinyDB.getString("instanceUrlWithProtocol").isEmpty()) {
 | 
			
		||||
                instanceUrlWithProtocol = tinyDB.getString("instanceUrlWithProtocol");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // get issue Url
 | 
			
		||||
            String issueUrl = instanceUrlWithProtocol + "/" + repoFullName + "/issues/" + tinyDB.getString("issueNumber");
 | 
			
		||||
 | 
			
		||||
            // share issue
 | 
			
		||||
            Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
 | 
			
		||||
            sharingIntent.setType("text/plain");
 | 
			
		||||
            sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getResources().getString(R.string.hash) + tinyDB.getString("issueNumber") + " " + tinyDB.getString("issueTitle"));
 | 
			
		||||
            sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, issueUrl);
 | 
			
		||||
            startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.hash) + tinyDB.getString("issueNumber") + " " + tinyDB.getString("issueTitle")));
 | 
			
		||||
 | 
			
		||||
            dismiss();
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        copyIssueUrl.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
@@ -170,7 +194,7 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public void onClick(View v) {
 | 
			
		||||
 | 
			
		||||
                        IssueActions.closeReopenIssue(getContext(), Integer.valueOf(tinyDB.getString("issueNumber")), "closed");
 | 
			
		||||
                        IssueActions.closeReopenIssue(getContext(), Integer.parseInt(tinyDB.getString("issueNumber")), "closed");
 | 
			
		||||
                        dismiss();
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
@@ -184,7 +208,7 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public void onClick(View v) {
 | 
			
		||||
 | 
			
		||||
                        IssueActions.closeReopenIssue(getContext(), Integer.valueOf(tinyDB.getString("issueNumber")), "open");
 | 
			
		||||
                        IssueActions.closeReopenIssue(getContext(), Integer.parseInt(tinyDB.getString("issueNumber")), "open");
 | 
			
		||||
                        dismiss();
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
@@ -52,7 +52,7 @@ public class ProfileFragment extends Fragment {
 | 
			
		||||
        userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin")));
 | 
			
		||||
        userEmail.setText(tinyDb.getString("userEmail"));
 | 
			
		||||
 | 
			
		||||
        ProfileFragment.SectionsPagerAdapter mSectionsPagerAdapter = new ProfileFragment.SectionsPagerAdapter(getFragmentManager());
 | 
			
		||||
        ProfileFragment.SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
 | 
			
		||||
 | 
			
		||||
        ViewPager mViewPager = v.findViewById(R.id.container);
 | 
			
		||||
        mViewPager.setAdapter(mSectionsPagerAdapter);
 | 
			
		||||
@@ -101,7 +101,7 @@ public class ProfileFragment extends Fragment {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
 | 
			
		||||
    public static class SectionsPagerAdapter extends FragmentStatePagerAdapter {
 | 
			
		||||
 | 
			
		||||
        SectionsPagerAdapter(FragmentManager fm) {
 | 
			
		||||
            super(fm);
 | 
			
		||||
@@ -147,9 +147,8 @@ public class ProfileFragment extends Fragment {
 | 
			
		||||
                ((MainActivity)ctx).finish();
 | 
			
		||||
                return true;
 | 
			
		||||
            case R.id.profileMenu:
 | 
			
		||||
                ProfileBottomSheetFragment bottomSheet = new ProfileBottomSheetFragment();
 | 
			
		||||
                assert getFragmentManager() != null;
 | 
			
		||||
                bottomSheet.show(getFragmentManager(), "profileBottomSheet");
 | 
			
		||||
                BottomSheetProfileFragment bottomSheet = new BottomSheetProfileFragment();
 | 
			
		||||
                bottomSheet.show(getChildFragmentManager(), "profileBottomSheet");
 | 
			
		||||
                return true;
 | 
			
		||||
            default:
 | 
			
		||||
                return super.onOptionsItemSelected(item);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								app/src/main/res/drawable/ic_share_24dp.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/src/main/res/drawable/ic_share_24dp.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
<vector android:autoMirrored="true" android:height="24dp"
 | 
			
		||||
    android:tint="#368F73" android:viewportHeight="24.0"
 | 
			
		||||
    android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
 | 
			
		||||
    <path android:fillColor="#FF000000" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
 | 
			
		||||
</vector>
 | 
			
		||||
@@ -10,7 +10,7 @@
 | 
			
		||||
 | 
			
		||||
    <androidx.core.widget.NestedScrollView
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="400dp">
 | 
			
		||||
        android:layout_height="wrap_content">
 | 
			
		||||
 | 
			
		||||
        <LinearLayout
 | 
			
		||||
            android:layout_width="match_parent"
 | 
			
		||||
@@ -83,7 +83,7 @@
 | 
			
		||||
                android:layout_marginTop="10dp"
 | 
			
		||||
                android:layout_marginBottom="10dp"
 | 
			
		||||
                android:layout_marginStart="64dp"
 | 
			
		||||
                android:background="?attr/inputBackgroundColor" />
 | 
			
		||||
                android:background="?attr/dividerColor" />
 | 
			
		||||
 | 
			
		||||
            <TextView
 | 
			
		||||
                android:id="@+id/addCollaborator"
 | 
			
		||||
@@ -151,7 +151,19 @@
 | 
			
		||||
                android:layout_marginTop="10dp"
 | 
			
		||||
                android:layout_marginBottom="10dp"
 | 
			
		||||
                android:layout_marginStart="64dp"
 | 
			
		||||
                android:background="?attr/inputBackgroundColor" />
 | 
			
		||||
                android:background="?attr/dividerColor" />
 | 
			
		||||
 | 
			
		||||
            <TextView
 | 
			
		||||
                android:id="@+id/shareRepository"
 | 
			
		||||
                android:layout_width="match_parent"
 | 
			
		||||
                android:layout_height="wrap_content"
 | 
			
		||||
                android:layout_gravity="center_vertical"
 | 
			
		||||
                android:drawableStart="@drawable/ic_share_24dp"
 | 
			
		||||
                android:drawablePadding="24dp"
 | 
			
		||||
                android:padding="16dp"
 | 
			
		||||
                android:text="@string/shareRepository"
 | 
			
		||||
                android:textColor="?attr/primaryTextColor"
 | 
			
		||||
                android:textSize="16sp" />
 | 
			
		||||
 | 
			
		||||
            <TextView
 | 
			
		||||
                android:id="@+id/openWebRepo"
 | 
			
		||||
@@ -10,7 +10,7 @@
 | 
			
		||||
 | 
			
		||||
    <androidx.core.widget.NestedScrollView
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="400dp">
 | 
			
		||||
        android:layout_height="wrap_content">
 | 
			
		||||
 | 
			
		||||
        <LinearLayout
 | 
			
		||||
            android:layout_width="match_parent"
 | 
			
		||||
@@ -96,7 +96,19 @@
 | 
			
		||||
                android:layout_marginTop="10dp"
 | 
			
		||||
                android:layout_marginBottom="10dp"
 | 
			
		||||
                android:layout_marginStart="64dp"
 | 
			
		||||
                android:background="?attr/inputBackgroundColor" />
 | 
			
		||||
                android:background="?attr/dividerColor" />
 | 
			
		||||
 | 
			
		||||
            <TextView
 | 
			
		||||
                android:id="@+id/shareIssue"
 | 
			
		||||
                android:layout_width="match_parent"
 | 
			
		||||
                android:layout_height="wrap_content"
 | 
			
		||||
                android:layout_gravity="center_vertical"
 | 
			
		||||
                android:drawableStart="@drawable/ic_share_24dp"
 | 
			
		||||
                android:drawablePadding="24dp"
 | 
			
		||||
                android:padding="16dp"
 | 
			
		||||
                android:text="@string/shareIssue"
 | 
			
		||||
                android:textColor="?attr/primaryTextColor"
 | 
			
		||||
                android:textSize="16sp" />
 | 
			
		||||
 | 
			
		||||
            <TextView
 | 
			
		||||
                android:id="@+id/copyIssueUrl"
 | 
			
		||||
@@ -116,7 +128,7 @@
 | 
			
		||||
                android:layout_marginTop="10dp"
 | 
			
		||||
                android:layout_marginBottom="10dp"
 | 
			
		||||
                android:layout_marginStart="64dp"
 | 
			
		||||
                android:background="?attr/inputBackgroundColor" />
 | 
			
		||||
                android:background="?attr/dividerColor" />
 | 
			
		||||
 | 
			
		||||
            <TextView
 | 
			
		||||
                android:id="@+id/closeIssue"
 | 
			
		||||
@@ -66,7 +66,7 @@
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="1dp"
 | 
			
		||||
        android:layout_marginTop="16dp"
 | 
			
		||||
        android:background="@color/divider" />
 | 
			
		||||
        android:background="@color/dividerColor" />
 | 
			
		||||
 | 
			
		||||
</LinearLayout>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -96,6 +96,6 @@
 | 
			
		||||
        android:layout_height="1dp"
 | 
			
		||||
        android:id="@+id/divider"
 | 
			
		||||
        android:layout_marginTop="15dp"
 | 
			
		||||
        android:background="?attr/inputBackgroundColor" />
 | 
			
		||||
        android:background="?attr/dividerColor" />
 | 
			
		||||
 | 
			
		||||
</RelativeLayout>
 | 
			
		||||
@@ -7,4 +7,5 @@
 | 
			
		||||
    <attr name="inputTextColor" format="reference" />
 | 
			
		||||
    <attr name="selectedTextColor" format="reference" />
 | 
			
		||||
    <attr name="alertDialogTheme" format="reference" />
 | 
			
		||||
    <attr name="dividerColor" format="reference" />
 | 
			
		||||
</resources>
 | 
			
		||||
@@ -34,4 +34,6 @@
 | 
			
		||||
    <color name="lightThemeInputBackground">#b6bbbf</color>
 | 
			
		||||
    <color name="lightThemeInputTextColor">#212121</color>
 | 
			
		||||
 | 
			
		||||
    <color name="dividerColor">#dbdbdb</color>
 | 
			
		||||
 | 
			
		||||
</resources>
 | 
			
		||||
 
 | 
			
		||||
@@ -555,4 +555,7 @@
 | 
			
		||||
    <string name="waitLoadingDownloadFile">Please wait for the file to load to memory</string>
 | 
			
		||||
    <string name="downloadFileSaved">File is saved to Download directory</string>
 | 
			
		||||
    <string name="excludeFilesInFileviewer">This file type is not supported in file viewer. Download it instead from the three dotted menu?</string>
 | 
			
		||||
 | 
			
		||||
    <string name="shareIssue">Share Issue</string>
 | 
			
		||||
    <string name="shareRepository">Share Repository</string>
 | 
			
		||||
</resources>
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,7 @@
 | 
			
		||||
        <item name="autoCompleteTextViewStyle">@style/AppThemeDarkSearchAutoCompleteTextView</item>
 | 
			
		||||
        <item name="hintColor">@color/hintColor</item>
 | 
			
		||||
        <item name="colorControlActivated">@color/darkGreen</item>
 | 
			
		||||
        <item name="dividerColor">@color/dividerColor</item>
 | 
			
		||||
    </style>
 | 
			
		||||
    <!-- Dark theme - default -->
 | 
			
		||||
 | 
			
		||||
@@ -40,6 +41,7 @@
 | 
			
		||||
        <item name="autoCompleteTextViewStyle">@style/AppThemeLightSearchAutoCompleteTextView</item>
 | 
			
		||||
        <item name="hintColor">@color/hintColor</item>
 | 
			
		||||
        <item name="colorControlActivated">@color/darkGreen</item>
 | 
			
		||||
        <item name="dividerColor">@color/dividerColor</item>
 | 
			
		||||
    </style>
 | 
			
		||||
    <!-- Light theme -->
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user