Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions OpenRedmine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
minSdkVersion 9
targetSdkVersion 23

versionCode 53
versionName '3.20'
versionCode 54
versionName '3.21-beta1'
testApplicationId "jp.redmine.redmineclienttest"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
testHandleProfiling true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import java.sql.SQLException;

import com.j256.ormlite.android.apptools.OrmLiteBaseActivity;
import com.j256.ormlite.android.apptools.OrmLiteFragmentActivity;

import jp.redmine.redmineclient.R;
import jp.redmine.redmineclient.activity.helper.ActivityHelper;
Expand All @@ -18,15 +18,11 @@
import android.view.View;
import android.view.View.OnClickListener;

public class FilterViewActivity extends OrmLiteBaseActivity<DatabaseCacheHelper> {
public class FilterViewActivity extends OrmLiteFragmentActivity<DatabaseCacheHelper> {
public FilterViewActivity(){
super();
}

@Override
protected void onDestroy() {
super.onDestroy();
}
private RedmineIssueFilter form;

/** Called when the activity is first created. */
Expand All @@ -35,6 +31,7 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityHelper.setupTheme(this);
setContentView(R.layout.page_issuefilter);
getSupportActionBar();

form = new RedmineIssueFilter();
form.setup(this,getHelper());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected QueryBuilder<RedmineIssue, Long> getSearchQueryBuilder(String search)

protected void setupWhere(RedmineFilter filter,
Where<RedmineIssue, Long> where) throws SQLException {
Hashtable<String, Object> dic = new Hashtable<String, Object>();
Hashtable<String, Object> dic = new Hashtable<>();
if(filter.getConnectionId() != null) dic.put(RedmineFilter.CONNECTION, filter.getConnectionId());
if(filter.getProject() != null) dic.put(RedmineFilter.PROJECT, filter.getProject() );
if(filter.getTracker() != null) dic.put(RedmineFilter.TRACKER, filter.getTracker() );
Expand All @@ -147,6 +147,13 @@ protected void setupWhere(RedmineFilter filter,
if(filter.getPriority() != null) dic.put(RedmineFilter.PRIORITY, filter.getPriority() );

boolean isFirst = true;
if(filter.isClosed() != null) {
isFirst = false;
if(filter.isClosed())
where.isNotNull(RedmineFilter.CLOSED);
else
where.isNull(RedmineFilter.CLOSED);
}
for(Enumeration<String> e = dic.keys() ; e.hasMoreElements() ;){
String key = e.nextElement();
if(dic.get(key) == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class IssueDetailForm extends IssueBaseForm {
public TextView textProject;
public TextView textPrivate;
public TextView textCreated;
public TextView textClosed;
public TextView textProgress;
public TextView textTimeEstimate;
public TextView textTimeEntry;
Expand All @@ -28,6 +29,7 @@ public class IssueDetailForm extends IssueBaseForm {
public TextView labelAssignedTo;
public TextView labelTime;
public TextView labelTimeSlice;
public TextView labelClosed;
public TextView labelProject;
public TextView textView;
public TextViewHelper textViewHelper;
Expand Down Expand Up @@ -60,6 +62,8 @@ public void setup(View view){
labelTime = (TextView)view.findViewById(R.id.labelTime);
labelTimeSlice = (TextView)view.findViewById(R.id.labelTimeSlice);
labelProject = (TextView)view.findViewById(R.id.labelProject);
textClosed = (TextView)view.findViewById(R.id.textClosed);
labelClosed = (TextView)view.findViewById(R.id.labelClosed);
textView = (TextView)view.findViewById(R.id.textView);
}

Expand All @@ -75,9 +79,11 @@ public void setValue(RedmineIssue rd){
setPrivate(rd.isPrivate());
setTime(textTimeEstimate,R.string.ticket_time_estimate,rd.getEstimatedHours());
setMasterName(textCategory,rd.getCategory());
setDateTime(textClosed, rd.getClosed());
setVisible(rd.getCategory(), labelCategory, textCategory);
setVisible(rd.getVersion(), labelVersion, textVersion);
setVisible(rd.getAssigned(), labelAssignedTo, textAssignedTo);
setVisible(rd.getClosed() != null, labelClosed, textClosed);
setVisible(!(rd.getDateStart() == null && rd.getDateDue() == null), labelDate,textDateFrom, textDateTo, labelDateArrow);
setVisible(rd.getEstimatedHours() != 0, labelTime, textTimeEstimate, labelTimeSlice);
setMasterName(textProject, rd.getProject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void genericSetValue(RedmineIssue rd){
textDescription.setText(rd.getDescription());

boolean isEnabled = true;
if(rd.getStatus() != null && rd.getStatus().isIs_close()){
if(rd.getStatus() != null && rd.getStatus().isClose()){
isEnabled = false;
}
performSetEnabled((ViewGroup)(textSubject.getParent()), isEnabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

public class DatabaseCacheHelper extends OrmLiteSqliteOpenHelper {
private static String DB_NAME="OpenRedmineCache.db";
private static int DB_VERSION=17;
private static int DB_VERSION=18;

public DatabaseCacheHelper(Context context) {
super(context, getDatabasePath(context), null, DB_VERSION);
Expand Down Expand Up @@ -123,6 +123,9 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource source, int older,int
TableUtils.createTable(source, RedmineRecentIssue.class);
case 16:
TableUtils.createTable(source, RedmineWatcher.class);
case 17:
if(older > 1)
addColumn(db, RedmineFilter.class,"is_closed INTEGER");
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ public boolean isSameInner(String a, String b) {
return a.equals(b);
}
};
Compare<Boolean> compareBoolean = new Compare<Boolean>() {
@Override
public boolean isSameInner(Boolean a, Boolean b) {
return a.equals(b);
}
};
for(RedmineFilter item : fetchAllByConnection(filter.getConnectionId())){
if(!compareMaster.isSame(filter.getProject(), item.getProject()))
continue;
Expand All @@ -120,8 +126,8 @@ public boolean isSameInner(String a, String b) {
continue;
if(!compareString.isSame(filter.getSort(), item.getSort()))
continue;


if(!compareBoolean.isSame(filter.isClosed(), item.isClosed()))
continue;
return item;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ public int delete(int id) throws SQLException{

public void refreshItem(RedmineIssue data) throws SQLException{
RedmineStatus item = refreshItem(data.getConnectionId(),data.getStatus());

if(!item.isClose() && data.getClosed() != null)
data.setClosed(null);
data.setStatus(item);
}
public RedmineStatus refreshItem(RedmineConnection info,RedmineStatus data) throws SQLException{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class RedmineFilter
public final static String CATEGORY = "category_id";
public final static String VERSION = "version_id";
public final static String CURRENT = "is_current";
public final static String CLOSED = "closed";

@DatabaseField(generatedId = true)
private Integer id;
Expand Down Expand Up @@ -59,6 +60,8 @@ public class RedmineFilter
private String name;
@DatabaseField
private String sort;
@DatabaseField
private Boolean is_closed;

@DatabaseField
private Date created_from;
Expand Down Expand Up @@ -410,4 +413,11 @@ public void setSortList(List<RedmineFilterSortItem> items){
}


public Boolean isClosed() {
return is_closed;
}

public void setClosed(Boolean is_closed) {
this.is_closed = is_closed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,34 +94,20 @@ public Date getModified() {
}


/**
* @param is_default セットする is_default
*/
public void setIs_default(boolean is_default) {
public void setDefault(boolean is_default) {
this.is_default = is_default;
}


/**
* @return is_default
*/
public boolean isIs_default() {
public boolean isDefault() {
return is_default;
}


/**
* @param is_close セットする is_close
*/
public void setIs_close(boolean is_close) {
public void setClose(boolean is_close) {
this.is_close = is_close;
}


/**
* @return is_close
*/
public boolean isIs_close() {
public boolean isClose() {
return is_close;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@

import android.annotation.SuppressLint;
import android.app.Activity;
import android.support.v7.widget.SwitchCompat;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

Expand All @@ -38,6 +42,10 @@ public class RedmineIssueFilter {
private HashMap<Integer,RedmineIssueFilterExpander> dic = new HashMap<Integer,RedmineIssueFilterExpander>();
public Button buttonSave;
public TabHost tabHost;
public SwitchCompat toggleClosed;
public RadioButton radioClosedOn;
public RadioButton radioClosedOff;
public RadioGroup radioClosed;
protected ArrayAdapter<RedmineFilterSortItem> adapterSort;
RedmineFilterModel mFilter;

Expand All @@ -54,11 +62,18 @@ protected void addTab(Activity context,int label,int container, Integer icon){
public void setup(final Activity activity, DatabaseCacheHelper helper){
if (tabHost != null)
return;
toggleClosed = (SwitchCompat)activity.findViewById(R.id.toggleClosed);
radioClosed = (RadioGroup)activity.findViewById(R.id.radioClosed);
radioClosedOn = (RadioButton) activity.findViewById(R.id.radioClosedOn);
radioClosedOff = (RadioButton) activity.findViewById(R.id.radioClosedOff);
radioClosedOff.setChecked(true);
buttonSave = (Button)activity.findViewById(R.id.buttonSave);
tabHost=(TabHost)activity.findViewById(android.R.id.tabhost);
tabHost.setup();
mFilter = new RedmineFilterModel(helper);

addTab(activity,R.string.ticket_other,R.id.tab9,null);

RedmineIssueFilterExpander expStatus = generate(activity, R.id.listViewStatus);
addList(expStatus,activity, new RedmineStatusModel(helper),R.string.ticket_status);
addTab(activity,R.string.ticket_status,R.id.tab1,null);
Expand Down Expand Up @@ -102,6 +117,16 @@ public void setupEvents(){
for(RedmineIssueFilterExpander ex: dic.values()){
ex.setupEvent();
}
CompoundButton.OnCheckedChangeListener handler = new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
radioClosed.setEnabled(isChecked);
radioClosedOn.setEnabled(isChecked);
radioClosedOff.setEnabled(isChecked);
}
};
toggleClosed.setOnCheckedChangeListener(handler);
handler.onCheckedChanged(toggleClosed, toggleClosed.isChecked());
}
public void refresh(){
for(RedmineIssueFilterExpander ex: dic.values()){
Expand Down Expand Up @@ -136,6 +161,9 @@ public void setFilter(RedmineFilter filter){
setFilter(R.string.ticket_author,filter.getAuthor());
setFilter(R.string.ticket_assigned,filter.getAssigned());
setFilter(R.string.ticket_sort,RedmineFilterSortItem.setupFilter(new RedmineFilterSortItem(), filter.getSort()));
toggleClosed.setChecked(filter.isClosed() != null);
if(filter.isClosed() != null)
(filter.isClosed() ? radioClosedOn : radioClosedOff).setChecked(true);

}

Expand All @@ -157,6 +185,7 @@ public RedmineFilter getFilter(RedmineFilter filter){
filter.setAssigned((RedmineUser) getFilter(R.string.ticket_assigned));

filter.setSort(RedmineFilterSortItem.getFilter((RedmineFilterSortItem)getFilter(R.string.ticket_sort)));
filter.setClosed(toggleClosed.isChecked() ? radioClosedOn.isChecked() : null);
return filter;
}
protected IMasterRecord getFilterRaw(int key){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,11 @@ protected void onRefresh(boolean isFlush){
DatabaseCacheHelper helper = getHelper();
RedmineConnection connection = ConnectionModel.getItem(getActivity(), intent.getConnectionId());

SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
if(intent.hasFilterId())
task = new SelectDataTask(helper,connection,null,intent.getFilterId());
else
task = new SelectDataTask(helper,connection,intent.getProjectId());

task.setFetchAll(sp.getBoolean("issue_get_all", false));
task.execute(0,10,isFlush ? 1 : 0);
if(isFlush && !intent.hasFilterId()){
RedmineProject project = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public void setValue(RedmineFilter item) {
addRow(item.getStatus(), R.string.ticket_status);
addRow(item.getTracker(), R.string.ticket_tracker);
addRow(item.getVersion(), R.string.ticket_version);
addRow(item.isClosed(), R.string.ticket_status, R.string.ticket_closed, R.string.ticket_open);

if (!TextUtils.isEmpty(item.getSort())) {
RedmineFilterSortItem sort = RedmineFilterSortItem.setupFilter(new RedmineFilterSortItem(), item.getSort());
Expand All @@ -49,6 +50,12 @@ protected void addRow(IMasterRecord changes, int title_id) {
return;
layoutTable.addView(generateRow(layoutTable.getContext(), changes.getName(), title_id));
}
protected void addRow(Boolean changes, int title_id, int positive, int negative) {
if (changes == null)
return;
String value = layoutTable.getContext().getString(changes ? positive : negative);
layoutTable.addView(generateRow(layoutTable.getContext(), value, title_id));
}

static protected TableRow generateRow(Context context, String setting, int title_id) {
TableRow row = new TableRow(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ protected void parseInternal(RedmineConnection con, RedmineStatus item)
if(xml.getDepth() <= 2)
return;
if("id".equalsIgnoreCase(xml.getName())){
String work = getNextText();
if("".equals(work)) return;
item.setStatusId(TypeConverter.parseInteger(work));
Integer work = TypeConverter.parseInteger(getNextText());
if(work == null) return;
item.setStatusId(work);
} else if("name".equalsIgnoreCase(xml.getName())){
item.setName(getNextText());
} else if("is_closed".equalsIgnoreCase(xml.getName())){
item.setIs_close("true".equalsIgnoreCase(getNextText()));
item.setClose("true".equalsIgnoreCase(getNextText()));
} else if("is_default".equalsIgnoreCase(xml.getName())){
item.setIs_default("true".equalsIgnoreCase(getNextText()));
item.setDefault("true".equalsIgnoreCase(getNextText()));

} else if("created_on".equalsIgnoreCase(xml.getName())){
item.setCreated(TypeConverter.parseDateTime(getNextText()));
Expand Down
Loading