Skip to content

Commit

Permalink
Code cleanup (mostly missing Override annotations)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Jan 24, 2013
1 parent a07d42c commit 2bbfbf4
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/de/geeksfactory/opacclient/OpacTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public abstract class OpacTask<Result> extends
AsyncTask<Object, Object, Result> {
protected OpacClient a;

@Override
protected Result doInBackground(Object... arg0) {
@SuppressWarnings("unused")
OpacClient a = (OpacClient) arg0[0];
Expand Down
10 changes: 10 additions & 0 deletions src/de/geeksfactory/opacclient/frontend/AccountActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,14 @@ protected void cancel(final String a) {
.setCancelable(true)
.setNegativeButton(R.string.no,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface d, int id) {
d.cancel();
}
})
.setPositiveButton(R.string.yes,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface d, int id) {
d.dismiss();
dialog = ProgressDialog.show(
Expand All @@ -270,6 +272,7 @@ public void onClick(DialogInterface d, int id) {
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface d) {
if (d != null)
d.cancel();
Expand Down Expand Up @@ -350,6 +353,7 @@ protected Integer doInBackground(Object... arg0) {
return 0;
}

@Override
protected void onPostExecute(Integer result) {
dialog.dismiss();
Button btSend = (Button) findViewById(R.id.btSend);
Expand Down Expand Up @@ -385,6 +389,7 @@ public void prolong_done(int result) {
.setCancelable(false)
.setNegativeButton(R.string.dismiss,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
dialog.cancel();
Expand Down Expand Up @@ -418,6 +423,7 @@ protected AccountData doInBackground(Object... arg0) {
return null;
}

@Override
protected void onPostExecute(AccountData result) {
if (success) {
loaded(result);
Expand Down Expand Up @@ -671,6 +677,7 @@ protected Integer doInBackground(Object... arg0) {
return STATUS_SUCCESS;
}

@Override
protected void onPostExecute(Integer result) {
dialog.dismiss();

Expand All @@ -683,6 +690,7 @@ protected void onPostExecute(Integer result) {
.setCancelable(true)
.setNegativeButton(R.string.dismiss,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
dialog.cancel();
Expand Down Expand Up @@ -720,6 +728,7 @@ protected Integer doInBackground(Object... arg0) {
return STATUS_SUCCESS;
}

@Override
protected void onPostExecute(Integer result) {
dialog.dismiss();

Expand All @@ -732,6 +741,7 @@ protected void onPostExecute(Integer result) {
.setCancelable(true)
.setNegativeButton(R.string.dismiss,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
dialog.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void onItemClick(AdapterView<?> parent, View view,

builder.setView(view).setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
Expand Down
7 changes: 4 additions & 3 deletions src/de/geeksfactory/opacclient/frontend/InfoActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ public void onCreate(Bundle savedInstanceState) {
wvInfo = (WebView) findViewById(R.id.wvInfo);
wvInfo.getSettings().setSupportZoom(true);
wvInfo.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int progress) {
ProgressBar Pbar = (ProgressBar) findViewById(R.id.pbWebProgress);
if (progress < 100 && Pbar.getVisibility() == ProgressBar.GONE) {
Pbar.setVisibility(ProgressBar.VISIBLE);
if (progress < 100 && Pbar.getVisibility() == View.GONE) {
Pbar.setVisibility(View.VISIBLE);
}
Pbar.setProgress(progress);
if (progress == 100) {
Pbar.setVisibility(ProgressBar.GONE);
Pbar.setVisibility(View.GONE);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import de.geeksfactory.opacclient.storage.SQLMetaDataSource;

public class MainPreferenceActivity extends OpacPreferenceActivity {
@Override
@SuppressWarnings("deprecation")
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -21,7 +22,7 @@ public void onCreate(Bundle savedInstanceState) {

addPreferencesFromResource(R.xml.settings);

Preference assistant = (Preference) findPreference("accounts");
Preference assistant = findPreference("accounts");
assistant.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
Expand All @@ -32,7 +33,7 @@ public boolean onPreferenceClick(Preference arg0) {
}
});

Preference meta = (Preference) findPreference("meta_clear");
Preference meta = findPreference("meta_clear");
meta.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

public class NavigationFragment extends Fragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.sliding_navigation, null);
Expand Down Expand Up @@ -93,6 +94,7 @@ public void onClick(View v) {
return v;
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

Expand Down
2 changes: 2 additions & 0 deletions src/de/geeksfactory/opacclient/frontend/OpacActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,14 @@ public void onItemClick(AdapterView<?> parent, View view,
.setView(view)
.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
adialog.cancel();
}
})
.setNeutralButton(R.string.accounts_edit,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
Intent intent = new Intent(OpacActivity.this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ protected Integer doInBackground(Object... arg0) {
return 0;
}

@Override
protected void onPostExecute(Integer result) {
dialog.dismiss();
onStart();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,21 @@ public void onCreate(Bundle savedInstanceState) {
}
}

@Override
protected void dialog_no_user() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.status_nouser)
.setCancelable(false)
.setNegativeButton(R.string.dismiss,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.setPositiveButton(R.string.accounts_edit,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(
SearchResultDetailsActivity.this,
Expand Down Expand Up @@ -144,13 +147,15 @@ public void onItemClick(AdapterView<?> parent, View view,
.setView(view)
.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
adialog.cancel();
}
})
.setNeutralButton(R.string.accounts_edit,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
dialog.dismiss();
Expand Down Expand Up @@ -202,6 +207,7 @@ public void onItemClick(AdapterView<?> parent, View view,
.setView(view)
.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
adialog.cancel();
}
Expand Down Expand Up @@ -234,6 +240,7 @@ protected Integer doInBackground(Object... arg0) {
return 0;
}

@Override
protected void onPostExecute(Integer result) {
}

Expand Down Expand Up @@ -275,6 +282,7 @@ protected DetailledItem doInBackground(Object... arg0) {
return null;
}

@Override
@SuppressLint("NewApi")
protected void onPostExecute(DetailledItem result) {
if (!success || result == null) {
Expand Down Expand Up @@ -439,12 +447,14 @@ public void onClick(View v) {
}
}

@Override
protected void dialog_wrong_credentials(String s, final boolean finish) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.opac_error) + " " + s)
.setCancelable(false)
.setNegativeButton(R.string.dismiss,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
if (finish)
Expand All @@ -453,6 +463,7 @@ public void onClick(DialogInterface dialog, int id) {
})
.setPositiveButton(R.string.prefs,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(
SearchResultDetailsActivity.this,
Expand Down Expand Up @@ -502,6 +513,7 @@ protected DetailledItem doInBackground(Object... arg0) {
public class ResTask extends OpacTask<Integer> {
private boolean success;

@Override
protected Integer doInBackground(Object... arg0) {
super.doInBackground(arg0);

Expand All @@ -526,6 +538,7 @@ protected Integer doInBackground(Object... arg0) {
return STATUS_SUCCESS;
}

@Override
protected void onPostExecute(Integer result) {
dialog.dismiss();

Expand All @@ -541,6 +554,7 @@ protected void onPostExecute(Integer result) {
.setCancelable(true)
.setNegativeButton(R.string.dismiss,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
dialog.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ protected List<SearchResult> doInBackground(Object... arg0) {
return null;
}

@Override
protected void onPostExecute(List<SearchResult> result) {
if (success) {
if (result == null) {
Expand Down Expand Up @@ -167,6 +168,7 @@ private void loaded() {

ListView lv = (ListView) findViewById(R.id.lvResults);
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent intent = new Intent(SearchResultsActivity.this,
Expand Down Expand Up @@ -211,6 +213,7 @@ protected List<SearchResult> doInBackground(Object... arg0) {
return null;
}

@Override
protected void onPostExecute(List<SearchResult> result) {
if (success) {
items = result;
Expand Down
2 changes: 2 additions & 0 deletions src/de/geeksfactory/opacclient/frontend/StarredActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class StarredActivity extends OpacActivity {

List<Starred> items;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
Expand All @@ -43,6 +44,7 @@ protected void onStart() {
setContentView(R.layout.starred_empty);
} else {
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if (items.get(position).getMNr() == null
Expand Down
2 changes: 2 additions & 0 deletions src/de/geeksfactory/opacclient/frontend/WelcomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void onCreate(Bundle savedInstanceState) {
}

lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
AccountDataSource data = new AccountDataSource(
Expand Down Expand Up @@ -88,6 +89,7 @@ protected Integer doInBackground(Object... arg0) {
return 0;
}

@Override
protected void onPostExecute(Integer result) {
dialog.dismiss();
Intent intent = new Intent(WelcomeActivity.this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ protected Long[] doInBackground(Object... params) {
affected_accounts };
}

@Override
protected void onPostExecute(Long[] result) {
Intent i = new Intent(ReminderCheckService.this,
ReminderAlarmReceiver.class);
Expand Down
7 changes: 7 additions & 0 deletions src/de/geeksfactory/opacclient/storage/SQLMetaDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ public SQLMetaDataSource(Context context) {
dbHelper = new MetaDatabase(context);
}

@Override
public void open() throws SQLException {
database = dbHelper.getWritableDatabase();
}

@Override
public void close() {
dbHelper.close();
}

@Override
public long addMeta(String type, String bib, String key, String value) {
ContentValues values = new ContentValues();
values.put("type", type);
Expand All @@ -36,6 +39,7 @@ public long addMeta(String type, String bib, String key, String value) {
return database.insert("meta", null, values);
}

@Override
public List<ContentValues> getMeta(String bib, String type) {
List<ContentValues> meta = new ArrayList<ContentValues>();
String[] selA = { bib, type };
Expand All @@ -53,6 +57,7 @@ public List<ContentValues> getMeta(String bib, String type) {
return meta;
}

@Override
public boolean hasMeta(String bib) {
String[] selA = { bib };
Cursor cursor = database.query("meta", allColumns, "bib = ?", selA,
Expand All @@ -72,11 +77,13 @@ private ContentValues cursorToMeta(Cursor cursor) {
return meta;
}

@Override
public void clearMeta(String bib) {
String[] selA = { bib };
database.delete("meta", "bib=?", selA);
}

@Override
public void clearMeta() {
database.delete("meta", null, null);
}
Expand Down

0 comments on commit 2bbfbf4

Please sign in to comment.