Skip to content

Commit

Permalink
Remove useless settings
Browse files Browse the repository at this point in the history
  • Loading branch information
wizmer committed Sep 20, 2016
1 parent f5afc9b commit 162d222
Show file tree
Hide file tree
Showing 15 changed files with 179 additions and 290 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public boolean onOptionsItemSelected(MenuItem item) {

case R.id.edit_menu_ok:

((EditNodeFragment)(getSupportFragmentManager().findFragmentByTag(EDIT_NODE_FRAGMENT))).onOKPressed();
finish();
boolean shouldFinish = ((EditNodeFragment)(getSupportFragmentManager().findFragmentByTag(EDIT_NODE_FRAGMENT))).onOKPressed();
if(shouldFinish) finish();
// Intent intent = new Intent(this, OrgNodeListActivity.class);
// startActivity(intent);
return true;
Expand Down
27 changes: 15 additions & 12 deletions MobileOrg/src/main/java/com/matburt/mobileorg/EditNodeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TimePicker;
import android.widget.Toast;

import com.matburt.mobileorg.orgdata.OrgContract;
import com.matburt.mobileorg.orgdata.OrgFile;
Expand All @@ -30,7 +31,9 @@
import com.matburt.mobileorg.util.TodoDialog;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;

public class EditNodeFragment extends Fragment {
public static String NODE_ID = "node_id";
Expand Down Expand Up @@ -248,8 +251,18 @@ public void onSaveInstanceState(Bundle outState) {
* Triggers the update mechanism
* First the new node is written to the DB
* Then the file is written to disk
* @return : whether or not, the fragment must finish
*/
public void onOKPressed(){
public boolean onOKPressed(){
List<OrgNodeTimeDate> timedates = Arrays.asList(node.getDeadline(), node.getScheduled());
for(OrgNodeTimeDate timedate: timedates){
if( (timedate.startMinute >= 0 || timedate.startTimeOfDay >= 0) &&
(timedate.dayOfMonth < 0 || timedate.monthOfYear < 0 || timedate.year < 0)){
Toast.makeText(context,R.string.pick_a_date,Toast.LENGTH_LONG).show();
return false;
}
}

ContentResolver resolver = getContext().getContentResolver();
String payload = "";

Expand All @@ -262,7 +275,7 @@ public void onOKPressed(){

node.write(getContext());
OrgFile.updateFile(node, context);

return true;
}

/**
Expand Down Expand Up @@ -304,7 +317,6 @@ public void onClick(DialogInterface dialog,

public static class TimePickerFragment extends DialogFragment
implements TimePickerDialog.OnTimeSetListener {
static private int day = -1, month = -1, year = -1;

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Expand All @@ -319,7 +331,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
}

public void onTimeSet(TimePicker view, int hourOfDay, int minuteOfDay) {
ContentResolver resolver = getActivity().getContentResolver();
timeDate.startTimeOfDay = hourOfDay;
timeDate.startMinute = minuteOfDay;
setupTimeStampButtons();
Expand Down Expand Up @@ -351,15 +362,7 @@ public void onDateSet(DatePicker view, int year, int month, int day) {
timeDate.year = year;
timeDate.monthOfYear = month;
timeDate.dayOfMonth = day;

setupTimeStampButtons();
// Bundle bundle = new Bundle();
// bundle.putInt("year",year);
// bundle.putInt("month",month);
// bundle.putInt("day",day);
// TimePickerFragment newFragment = new TimePickerFragment();
// newFragment.setArguments(bundle);
// newFragment.show(getActivity().getSupportFragmentManager(), "timePicker");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.InputType;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import android.net.Uri;

public class OrgContract {
public static final String CONTENT_AUTHORITY = "com.matburt.mobileorg.OrgData.OrgProvider";
public static final String CONTENT_AUTHORITY = "com.matburt.mobileorg.orgdata.OrgProvider";
private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
private static final String PATH_ORGDATA = OrgDatabase.Tables.ORGDATA;
private static final String PATH_TIMESTAMPS = OrgDatabase.Tables.TIMESTAMPS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,9 @@ public static ArrayList<OrgNode> getOrgNodePathFromTopLevel(long node_id, Conten


public static void clearDB(ContentResolver resolver) {
try {
resolver.delete(OrgData.CONTENT_URI, null, null);
resolver.delete(Files.CONTENT_URI, null, null);
resolver.delete(Timestamps.CONTENT_URI, null, null);
} catch( IllegalArgumentException e){
e.printStackTrace();
}

resolver.delete(OrgData.CONTENT_URI, null, null);
resolver.delete(Files.CONTENT_URI, null, null);
resolver.delete(Timestamps.CONTENT_URI, null, null);
}

public static boolean isTodoActive(String todo, ContentResolver resolver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public void onCreate() {
this.appSettings.registerOnSharedPreferenceChangeListener(this);
this.appInst = (MobileOrgApplication) this.getApplication();
this.alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);

// Log.v("trace", "sync service");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public boolean onPreferenceClick(Preference preference) {
@Override
public void onClick(DialogInterface dialog,
int which) {


OrgProviderUtils.clearDB(getContentResolver());
}

}).setNegativeButton(R.string.no, null).show();
Expand Down Expand Up @@ -83,10 +82,10 @@ protected void onCreate(Bundle savedInstanceState) {
addPreferencesFromResource(R.xml.preferences);

init();
populateSyncSources();
populateTodoKeywords();
// populateSyncSources();
// populateTodoKeywords();
populateVersionName();
findPreference("clearDB").setOnPreferenceClickListener(onClearDBClick);
// findPreference("clearDB").setOnPreferenceClickListener(onClearDBClick);
}

private void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public SyncResult synchronize(){
* @return
*/
public boolean isCredentialsRequired() {
return AuthData.getPublicKey(context).equals("") && authData.getPassword().equals("");
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public HashSet<String> runSynchronizer() {
return pulledFiles.changedFiles;
} catch (Exception e) {
showErrorNotification(e);
e.printStackTrace();
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static String read(Context context, String filename){
BufferedReader br = new BufferedReader(new FileReader(file));
return FileUtils.read(br);
} catch (IOException e) {
Toast.makeText(context, e.toString(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
return "";
}
Expand Down
10 changes: 0 additions & 10 deletions MobileOrg/src/main/res/layout/edit_node_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@
android:padding="20dp"
/>
</LinearLayout>

<Button
android:id="@+id/delete_node"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_menu_delete"
android:padding="20dp"
/>


</LinearLayout>
</LinearLayout>
</LinearLayout>
8 changes: 3 additions & 5 deletions MobileOrg/src/main/res/menu/outline_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
android:title="@string/menu_sync"
app:showAsAction="ifRoom" />

<item
android:id="@+id/menu_agenda"
android:icon="@drawable/ic_menu_agenda"
android:title="@string/menu_agenda"/>

<item
android:id="@+id/menu_help"
android:icon="@drawable/ic_menu_help"
android:title="@string/menu_help"/>
android:title="@string/menu_help"
/>

<item
android:id="@+id/menu_settings"
android:icon="@drawable/ic_menu_preferences"
Expand Down
63 changes: 0 additions & 63 deletions MobileOrg/src/main/res/values-es/arrays.xml

This file was deleted.

1 change: 1 addition & 0 deletions MobileOrg/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<string name="wizard_ubuntu_email_hint">[email protected]</string>
<string name="generate_dsa_keys">Generate DSA keys</string>
<string name="pubkey_copied">Public key copied to clipboard !</string>
<string name="pick_a_date">If you select a time, you must also select a date.</string>

<!-- preference strings -->
<string name="preferences">Preferences</string>
Expand Down
Loading

0 comments on commit 162d222

Please sign in to comment.