Skip to content
Snippets Groups Projects
Commit c343d943 authored by John Carlson's avatar John Carlson
Browse files

Setup dialog for selecting tag or branch

parent 2500d009
No related branches found
No related tags found
No related merge requests found
Showing
with 741 additions and 95 deletions
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.commit451.gitlab">
package="com.commit451.gitlab">
 
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
 
<application
android:name=".App"
Loading
Loading
@@ -21,8 +21,8 @@
android:theme="@android:style/Theme.NoDisplay">
 
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
 
</activity>
Loading
Loading
@@ -30,46 +30,48 @@
<activity
android:name=".activity.ProjectsActivity"
android:launchMode="singleTask"
android:theme="@style/Activity.Projects"/>
android:theme="@style/Activity.Projects" />
<activity
android:name=".activity.GroupsActivity"
android:launchMode="singleTask"
android:theme="@style/Activity.Groups"/>
android:theme="@style/Activity.Groups" />
<activity
android:name=".activity.ActivityActivity"
android:launchMode="singleTask"
android:theme="@style/Activity.Activity"/>
android:theme="@style/Activity.Activity" />
<activity
android:name=".activity.TodosActivity"
android:launchMode="singleTask"
android:theme="@style/Activity.Todos"/>
<activity android:name=".activity.ProjectActivity"/>
<activity android:name=".activity.LoginActivity"
android:theme="@style/Activity.Login"/>
<activity android:name=".activity.FileActivity"/>
<activity android:name=".activity.IssueActivity"/>
<activity android:name=".activity.DiffActivity"/>
<activity android:name=".activity.AboutActivity"/>
<activity android:name=".activity.AddUserActivity"/>
android:theme="@style/Activity.Todos" />
<activity android:name=".activity.ProjectActivity" />
<activity
android:name=".activity.LoginActivity"
android:theme="@style/Activity.Login" />
<activity android:name=".activity.FileActivity" />
<activity android:name=".activity.IssueActivity" />
<activity android:name=".activity.DiffActivity" />
<activity android:name=".activity.AboutActivity" />
<activity android:name=".activity.AddUserActivity" />
<activity
android:name=".activity.UserActivity"
android:theme="@style/Activity.User"/>
<activity android:name=".activity.SearchActivity"/>
android:theme="@style/Activity.User" />
<activity android:name=".activity.SearchActivity" />
<activity
android:name=".activity.GroupActivity"
android:theme="@style/Activity.Group"/>
<activity android:name=".activity.MergeRequestActivity"/>
<activity android:name=".activity.AddIssueActivity"/>
<activity android:name=".activity.MilestoneActivity"/>
<activity android:name=".activity.AddMilestoneActivity"/>
<activity android:name=".activity.BuildActivity"/>
android:theme="@style/Activity.Group" />
<activity android:name=".activity.MergeRequestActivity" />
<activity android:name=".activity.AddIssueActivity" />
<activity android:name=".activity.MilestoneActivity" />
<activity android:name=".activity.AddMilestoneActivity" />
<activity android:name=".activity.BuildActivity" />
<activity
android:name=".activity.LoadSomeInfoActivity"
android:theme="@style/Activity.Translucent"/>
<activity android:name=".activity.SettingsActivity"/>
<activity android:name=".activity.AddLabelActivity"/>
<activity android:name=".activity.AddNewLabelActivity"/>
<activity android:name=".activity.WebviewLoginActivity"/>
android:theme="@style/Activity.Translucent" />
<activity android:name=".activity.SettingsActivity" />
<activity android:name=".activity.AddLabelActivity" />
<activity android:name=".activity.AddNewLabelActivity" />
<activity android:name=".activity.PickBranchOrTagActivity" />
<activity android:name=".activity.WebviewLoginActivity" />
<activity
android:name=".activity.RoutingActivity"
android:launchMode="singleTask"
Loading
Loading
@@ -77,18 +79,18 @@
android:theme="@android:style/Theme.NoDisplay">
<!-- Standard Url -->
<intent-filter android:label="@string/deeplink_text">
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.VIEW" />
 
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
 
<data android:scheme="@string/deeplink_scheme"/>
<data android:scheme="@string/deeplink_scheme" />
</intent-filter>
</activity>
 
<activity android:name=".widget.FeedWidgetConfigureActivity">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
 
Loading
Loading
@@ -96,16 +98,16 @@
android:name=".widget.FeedWidgetProvider"
android:label="GitLab Feed">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_feed"/>
android:resource="@xml/widget_feed" />
</receiver>
 
<service
android:name=".widget.FeedWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS"/>
android:permission="android.permission.BIND_REMOTEVIEWS" />
 
</application>
 
Loading
Loading
package com.commit451.gitlab.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import com.commit451.gitlab.R;
import com.commit451.gitlab.adapter.PickBranchOrTagPagerAdapter;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Intermediate activity when deep linking to another activity and things need to load
*/
public class PickBranchOrTagActivity extends AppCompatActivity {
private static final String EXTRA_PROJECT_ID = "project_id";
public static final String EXTRA_REF = "ref";
public static Intent newIntent(Context context, long projectId) {
Intent intent = new Intent(context, PickBranchOrTagActivity.class);
intent.putExtra(EXTRA_PROJECT_ID, projectId);
return intent;
}
@BindView(R.id.tabs)
TabLayout mTabLayout;
@BindView(R.id.pager)
ViewPager mViewPager;
@OnClick(R.id.root)
void onRootClicked() {
finish();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pick_branch_or_tag);
ButterKnife.bind(this);
long projectId = getIntent().getLongExtra(EXTRA_PROJECT_ID, -1);
mViewPager.setAdapter(new PickBranchOrTagPagerAdapter(this, getSupportFragmentManager(), projectId));
mTabLayout.setupWithViewPager(mViewPager);
}
@Override
public void finish() {
super.finish();
overridePendingTransition(R.anim.do_nothing, R.anim.fade_out);
}
}
Loading
Loading
@@ -14,21 +14,18 @@ import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
 
import com.commit451.easycallback.EasyCallback;
import com.commit451.gitlab.App;
import com.commit451.gitlab.R;
import com.commit451.gitlab.adapter.ProjectSectionsPagerAdapter;
import com.commit451.gitlab.animation.HideRunnable;
import com.commit451.easycallback.EasyCallback;
import com.commit451.gitlab.event.ProjectReloadEvent;
import com.commit451.gitlab.fragment.BaseFragment;
import com.commit451.gitlab.model.api.Branch;
import com.commit451.gitlab.model.api.Project;
import com.commit451.gitlab.navigation.Navigator;
import com.commit451.gitlab.util.IntentUtil;
 
import org.parceler.Parcels;
Loading
Loading
@@ -45,6 +42,8 @@ public class ProjectActivity extends BaseActivity {
private static final String EXTRA_PROJECT = "extra_project";
private static final String EXTRA_PROJECT_ID = "extra_project_id";
 
private static final int REQUEST_BRANCH_OR_TAG = 1;
public static Intent newIntent(Context context, Project project) {
Intent intent = new Intent(context, ProjectActivity.class);
intent.putExtra(EXTRA_PROJECT, Parcels.wrap(project));
Loading
Loading
@@ -63,29 +62,11 @@ public class ProjectActivity extends BaseActivity {
Toolbar mToolbar;
@BindView(R.id.tabs)
TabLayout mTabLayout;
@BindView(R.id.branch_spinner)
Spinner mBranchSpinner;
@BindView(R.id.progress)
View mProgress;
@BindView(R.id.pager)
ViewPager mViewPager;
 
private final AdapterView.OnItemSelectedListener mSpinnerItemSelectedListener = new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (!(view instanceof TextView)) {
return;
}
mBranchName = ((TextView) view).getText().toString();
broadcastLoad();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
};
Project mProject;
String mBranchName;
 
Loading
Loading
@@ -116,23 +97,12 @@ public class ProjectActivity extends BaseActivity {
.alpha(0.0f)
.withEndAction(new HideRunnable(mProgress));
 
if (response.isEmpty()) {
mBranchSpinner.setVisibility(View.GONE);
} else {
mBranchSpinner.setVisibility(View.VISIBLE);
mBranchSpinner.setAlpha(0.0f);
mBranchSpinner.animate().alpha(1.0f);
// Set up the dropdown list navigation in the action bar.
mBranchSpinner.setAdapter(new ArrayAdapter<>(ProjectActivity.this, android.R.layout.simple_list_item_1, android.R.id.text1, response));
}
for (int i = 0; i < response.size(); i++) {
if (response.get(i).getName().equals(mProject.getDefaultBranch())) {
mBranchSpinner.setSelection(i);
mBranchName = response.get(i).getName();
}
}
 
mBranchSpinner.setOnItemSelectedListener(mSpinnerItemSelectedListener);
if (response.isEmpty()) {
broadcastLoad();
}
Loading
Loading
@@ -153,6 +123,11 @@ public class ProjectActivity extends BaseActivity {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_branch:
if (mProject != null) {
Navigator.navigateToPickBranchOrTag(ProjectActivity.this, mProject.getId(), REQUEST_BRANCH_OR_TAG);
}
return true;
case R.id.action_share:
if (mProject != null) {
IntentUtil.share(mRoot, mProject.getWebUrl());
Loading
Loading
@@ -205,6 +180,19 @@ public class ProjectActivity extends BaseActivity {
}
}
 
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_BRANCH_OR_TAG:
if (resultCode == RESULT_OK) {
mBranchName = data.getStringExtra(PickBranchOrTagActivity.EXTRA_REF);
broadcastLoad();
}
break;
}
}
private void loadProject(String projectId) {
mProgress.setAlpha(0.0f);
mProgress.setVisibility(View.VISIBLE);
Loading
Loading
package com.commit451.gitlab.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import com.commit451.gitlab.R;
import com.commit451.gitlab.model.api.Branch;
import com.commit451.gitlab.model.rss.Entry;
import com.commit451.gitlab.viewHolder.BranchViewHolder;
import com.commit451.gitlab.viewHolder.FeedEntryViewHolder;
import java.util.ArrayList;
import java.util.Collection;
/**
* Adapts the feeds
*/
public class BranchesAdapter extends RecyclerView.Adapter<BranchViewHolder> {
public interface Listener {
void onBranchClicked(Branch entry);
}
private Listener mListener;
private ArrayList<Branch> mValues;
public BranchesAdapter(Listener listener) {
mListener = listener;
mValues = new ArrayList<>();
}
private final View.OnClickListener mOnItemClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = (int) v.getTag(R.id.list_position);
mListener.onBranchClicked(getEntry(position));
}
};
public void setEntries(Collection<Branch> entries) {
mValues.clear();
if (entries != null) {
mValues.addAll(entries);
}
notifyDataSetChanged();
}
@Override
public BranchViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
BranchViewHolder holder = BranchViewHolder.inflate(parent);
holder.itemView.setOnClickListener(mOnItemClickListener);
return holder;
}
@Override
public void onBindViewHolder(final BranchViewHolder holder, int position) {
holder.itemView.setTag(R.id.list_position, position);
holder.bind(getEntry(position));
}
@Override
public int getItemCount() {
return mValues.size();
}
private Branch getEntry(int position) {
return mValues.get(position);
}
}
package com.commit451.gitlab.adapter;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.commit451.gitlab.R;
import com.commit451.gitlab.fragment.PickBranchFragment;
import com.commit451.gitlab.fragment.PickTagFragment;
/**
* Projects Pager Adapter
*/
public class PickBranchOrTagPagerAdapter extends FragmentPagerAdapter {
private String[] mTitles;
private long mProjectId;
public PickBranchOrTagPagerAdapter(Context context, FragmentManager fm, long projectId) {
super(fm);
mTitles = context.getResources().getStringArray(R.array.tabs_branch_tag);
mProjectId = projectId;
}
@Override
public Fragment getItem(int position) {
switch(position) {
case 0:
return PickBranchFragment.newInstance(mProjectId);
case 1:
return PickTagFragment.newInstance(mProjectId);
}
throw new IllegalStateException("Position exceeded on view pager");
}
@Override
public int getCount() {
return mTitles.length;
}
@Override
public CharSequence getPageTitle(int position) {
return mTitles[position];
}
}
package com.commit451.gitlab.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import com.commit451.gitlab.R;
import com.commit451.gitlab.model.api.Tag;
import com.commit451.gitlab.viewHolder.TagViewHolder;
import java.util.ArrayList;
import java.util.Collection;
/**
* Adapts the feeds
*/
public class TagsAdapter extends RecyclerView.Adapter<TagViewHolder> {
public interface Listener {
void onTagClicked(Tag entry);
}
private Listener mListener;
private ArrayList<Tag> mValues;
public TagsAdapter(Listener listener) {
mListener = listener;
mValues = new ArrayList<>();
}
private final View.OnClickListener mOnItemClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = (int) v.getTag(R.id.list_position);
mListener.onTagClicked(getEntry(position));
}
};
public void setEntries(Collection<Tag> entries) {
mValues.clear();
if (entries != null) {
mValues.addAll(entries);
}
notifyDataSetChanged();
}
@Override
public TagViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
TagViewHolder holder = TagViewHolder.inflate(parent);
holder.itemView.setOnClickListener(mOnItemClickListener);
return holder;
}
@Override
public void onBindViewHolder(final TagViewHolder holder, int position) {
holder.itemView.setTag(R.id.list_position, position);
holder.bind(getEntry(position));
}
@Override
public int getItemCount() {
return mValues.size();
}
private Tag getEntry(int position) {
return mValues.get(position);
}
}
package com.commit451.gitlab.fragment;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.commit451.easycallback.EasyCallback;
import com.commit451.gitlab.App;
import com.commit451.gitlab.R;
import com.commit451.gitlab.activity.PickBranchOrTagActivity;
import com.commit451.gitlab.adapter.BranchesAdapter;
import com.commit451.gitlab.model.api.Branch;
import java.util.List;
import butterknife.BindView;
import timber.log.Timber;
/**
* Pick a branch, any branch
*/
public class PickBranchFragment extends ButterKnifeFragment {
private static final String EXTRA_PROJECT_ID = "project_id";
public static PickBranchFragment newInstance(long projectId) {
PickBranchFragment fragment = new PickBranchFragment();
Bundle args = new Bundle();
args.putLong(EXTRA_PROJECT_ID, projectId);
fragment.setArguments(args);
return fragment;
}
@BindView(R.id.list)
RecyclerView mProjectsListView;
@BindView(R.id.message_text)
TextView mMessageView;
BranchesAdapter mBranchesAdapter;
long mProjectId;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mProjectId = getArguments().getLong(EXTRA_PROJECT_ID);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_pick_branch, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mBranchesAdapter = new BranchesAdapter(new BranchesAdapter.Listener() {
@Override
public void onBranchClicked(Branch entry) {
Intent data = new Intent();
data.putExtra(PickBranchOrTagActivity.EXTRA_REF, entry.getName());
getActivity().setResult(Activity.RESULT_OK, data);
getActivity().finish();
}
});
mProjectsListView.setLayoutManager(new LinearLayoutManager(getActivity()));
mProjectsListView.setAdapter(mBranchesAdapter);
loadData();
}
@Override
protected void loadData() {
if (getView() == null) {
return;
}
mMessageView.setVisibility(View.GONE);
App.instance().getGitLab().getBranches(mProjectId).enqueue(new EasyCallback<List<Branch>>() {
@Override
public void success(@NonNull List<Branch> response) {
if (getView() == null) {
return;
}
mBranchesAdapter.setEntries(response);
}
@Override
public void failure(Throwable t) {
Timber.e(t, null);
if (getView() == null) {
return;
}
mMessageView.setVisibility(View.VISIBLE);
}
});
}
}
package com.commit451.gitlab.fragment;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.commit451.easycallback.EasyCallback;
import com.commit451.gitlab.App;
import com.commit451.gitlab.R;
import com.commit451.gitlab.activity.PickBranchOrTagActivity;
import com.commit451.gitlab.adapter.TagsAdapter;
import com.commit451.gitlab.model.api.Tag;
import java.util.List;
import butterknife.BindView;
import timber.log.Timber;
/**
* Pick a branch, any branch
*/
public class PickTagFragment extends ButterKnifeFragment {
private static final String EXTRA_PROJECT_ID = "project_id";
public static PickTagFragment newInstance(long projectId) {
PickTagFragment fragment = new PickTagFragment();
Bundle args = new Bundle();
args.putLong(EXTRA_PROJECT_ID, projectId);
fragment.setArguments(args);
return fragment;
}
@BindView(R.id.list)
RecyclerView mProjectsListView;
@BindView(R.id.message_text)
TextView mMessageView;
TagsAdapter mTagsAdapter;
long mProjectId;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mProjectId = getArguments().getLong(EXTRA_PROJECT_ID);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_pick_tag, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mTagsAdapter = new TagsAdapter(new TagsAdapter.Listener() {
@Override
public void onTagClicked(Tag entry) {
Intent data = new Intent();
data.putExtra(PickBranchOrTagActivity.EXTRA_REF, entry.getName());
getActivity().setResult(Activity.RESULT_OK, data);
getActivity().finish();
}
});
mProjectsListView.setLayoutManager(new LinearLayoutManager(getActivity()));
mProjectsListView.setAdapter(mTagsAdapter);
loadData();
}
@Override
protected void loadData() {
if (getView() == null) {
return;
}
mMessageView.setVisibility(View.GONE);
App.instance().getGitLab().getTags(mProjectId).enqueue(new EasyCallback<List<Tag>>() {
@Override
public void success(@NonNull List<Tag> response) {
if (getView() == null) {
return;
}
mTagsAdapter.setEntries(response);
}
@Override
public void failure(Throwable t) {
Timber.e(t, null);
if (getView() == null) {
return;
}
mMessageView.setVisibility(View.VISIBLE);
}
});
}
}
Loading
Loading
@@ -26,6 +26,7 @@ import com.commit451.gitlab.activity.IssueActivity;
import com.commit451.gitlab.activity.LoginActivity;
import com.commit451.gitlab.activity.MergeRequestActivity;
import com.commit451.gitlab.activity.MilestoneActivity;
import com.commit451.gitlab.activity.PickBranchOrTagActivity;
import com.commit451.gitlab.activity.ProjectActivity;
import com.commit451.gitlab.activity.ProjectsActivity;
import com.commit451.gitlab.activity.SearchActivity;
Loading
Loading
@@ -67,6 +68,10 @@ public class Navigator {
activity.startActivity(ProjectActivity.newIntent(activity, projectId));
}
 
public static void navigateToPickBranchOrTag(Activity activity, long projectId, int requestCode) {
activity.startActivityForResult(PickBranchOrTagActivity.newIntent(activity, projectId), requestCode);
}
public static void navigateToStartingActivity(Activity activity) {
int startingActivity = Prefs.getStartingView(activity);
switch (startingActivity) {
Loading
Loading
package com.commit451.gitlab.viewHolder;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.commit451.gitlab.R;
import com.commit451.gitlab.model.api.Branch;
import com.commit451.gitlab.model.api.Label;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Label
*/
public class BranchViewHolder extends RecyclerView.ViewHolder {
public static BranchViewHolder inflate(ViewGroup parent) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_branch, parent, false);
return new BranchViewHolder(view);
}
@BindView(R.id.title) public TextView title;
public BranchViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
}
public void bind(Branch branch) {
title.setText(branch.getName());
}
}
\ No newline at end of file
package com.commit451.gitlab.viewHolder;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.commit451.gitlab.R;
import com.commit451.gitlab.model.api.Tag;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Label
*/
public class TagViewHolder extends RecyclerView.ViewHolder {
public static TagViewHolder inflate(ViewGroup parent) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_tag, parent, false);
return new TagViewHolder(view);
}
@BindView(R.id.title) public TextView title;
public TagViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
}
public void bind(Tag tag) {
title.setText(tag.getName());
}
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M19,4h-4L7.11,16.63 4.5,12 9,4H5L0.5,12 5,20h4l7.89,-12.63L19.5,12 15,20h4l4.5,-8z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
style="@style/Card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:padding="16dp"
android:clickable="true"
android:layout_gravity="center"
android:background="@color/window_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
\ No newline at end of file
Loading
Loading
@@ -15,16 +15,7 @@
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/branch_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
</android.support.v7.widget.Toolbar>
android:layout_height="?attr/actionBarSize"/>
 
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
Loading
Loading
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.commit451.gitlab.view.LabCoatSwipeRefreshLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.commit451.gitlab.view.LabCoatSwipeRefreshLayout>
<TextView
android:id="@+id/message_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp"
android:gravity="center"
android:text="@string/no_branches"
android:visibility="gone"/>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.commit451.gitlab.view.LabCoatSwipeRefreshLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.commit451.gitlab.view.LabCoatSwipeRefreshLayout>
<TextView
android:id="@+id/message_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp"
android:gravity="center"
android:text="@string/no_tags"
android:visibility="gone"/>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?attr/selectableItemBackground"
android:padding="16dp">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="22sp"
tools:text="what a cool file" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?attr/selectableItemBackground"
android:padding="16dp">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="22sp"
tools:text="what a cool file" />
</FrameLayout>
\ No newline at end of file
Loading
Loading
@@ -2,6 +2,12 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
 
<item
android:id="@+id/action_branch"
app:showAsAction="ifRoom"
android:title="@string/branches"
android:icon="@drawable/ic_fork"/>
<item
android:id="@+id/action_share"
app:showAsAction="ifRoom"
Loading
Loading
Loading
Loading
@@ -21,7 +21,7 @@
<color name="other_blue">#5b6b7e</color>
 
<color name="card_background">@color/other_blue</color>
<color name="background_color">@color/blue_background</color>
<color name="window_background">#303030</color>
 
<color name="scrim">#99323232</color>
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment