Skip to content

Commit

Permalink
Renamed layout files to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
renard314 committed Jan 12, 2014
1 parent 2125c67 commit efbcb3b
Show file tree
Hide file tree
Showing 18 changed files with 245 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
129 changes: 129 additions & 0 deletions textfairy/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:padding="@dimen/default_padding"
android:orientation="vertical"
android:layout_height="wrap_content">


<LinearLayout
android:padding="@dimen/default_padding"
android:id="@+id/language_settings"
android:background="@drawable/btn_start_activity2"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">

<TextView
android:textAppearance="@android:style/TextAppearance.Medium"
android:text="@string/pref_title_default_ocr_lang"
android:gravity="left|center"
android:layout_marginBottom="@dimen/two_line_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<TextView
android:textAppearance="@android:style/TextAppearance.Small"
android:text="@string/pref_summary_default_ocr_lang"
android:gravity="left|center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/grey6" />

<LinearLayout
android:padding="@dimen/default_padding"
android:id="@+id/show_licences"
android:background="@drawable/btn_start_activity2"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">

<TextView
android:textAppearance="@android:style/TextAppearance.Medium"
android:text="@string/pref_title_license"
android:gravity="left|center"
android:layout_marginBottom="@dimen/two_line_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<TextView
android:textAppearance="@android:style/TextAppearance.Small"
android:text="@string/pref_summary_license"
android:gravity="left|center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/grey6" />

<LinearLayout
android:padding="@dimen/default_padding"
android:id="@+id/show_contact"
android:background="@drawable/btn_start_activity2"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">

<TextView
android:textAppearance="@android:style/TextAppearance.Medium"
android:text="@string/pref_title_contact"
android:gravity="left|center"
android:layout_marginBottom="@dimen/two_line_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<TextView
android:textAppearance="@android:style/TextAppearance.Small"
android:text="@string/pref_summary_contact"
android:gravity="left|center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/grey6" />

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/grey6" />

<LinearLayout
android:padding="@dimen/default_padding"
android:id="@+id/tessdata_directory"
android:background="@drawable/btn_start_activity2"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">

<TextView
android:textAppearance="@android:style/TextAppearance.Medium"
android:text="@string/pref_title_data_directory"
android:gravity="left|center"
android:layout_marginBottom="@dimen/two_line_item_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<TextView
android:textAppearance="@android:style/TextAppearance.Small"
android:text="@string/pref_summary_data_directory"
android:gravity="left|center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
File renamed without changes.
File renamed without changes.
File renamed without changes.
116 changes: 116 additions & 0 deletions textfairy/src/com/renard/ocr/help/AboutActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Copyright (C) 2012,2013 Renard Wellnitz
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.renard.ocr.help;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import android.view.View;

import com.lamerman.FileDialog;
import com.lamerman.SelectionMode;
import com.renard.ocr.R;
import com.renard.ocr.cropimage.MonitoredActivity;
import com.renard.util.PreferencesUtils;

/**
* preferences dialog for app wide settings or info stuff
*
* @author renard
*/

public class AboutActivity extends MonitoredActivity implements View.OnClickListener {

protected static final int REQUEST_LOAD_FILE = 474;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
initAppIcon(this, -1);

findViewById(R.id.language_settings).setOnClickListener(this);
findViewById(R.id.tessdata_directory).setOnClickListener(this);
}

@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.language_settings:
startActivity(new Intent(AboutActivity.this, OCRLanguageActivity.class));
break;
case R.id.tessdata_directory: {
Intent intent = new Intent(getBaseContext(), FileDialog.class);
intent.putExtra(FileDialog.START_PATH, Environment.getExternalStorageDirectory().getPath());

//can user select directories or not
intent.putExtra(FileDialog.CAN_SELECT_DIR, true);
intent.putExtra(FileDialog.SELECTION_MODE, SelectionMode.MODE_OPEN);
//alternatively you can set file filter
intent.putExtra(FileDialog.FORMAT_FILTER, new String[]{""});

startActivityForResult(intent, REQUEST_LOAD_FILE);
break;
}
}
}


@Override
protected void onPause() {
super.onPause();
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
public void setDialogId(int dialogId) {
// ignored
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == REQUEST_LOAD_FILE) {
if (resultCode == RESULT_OK) {
String filePath = data.getStringExtra(FileDialog.RESULT_PATH);
if (filePath != null) {
if (filePath.endsWith("tessdata")) {
filePath = filePath.substring(0, filePath.length() - "tessdata".length());
} else {
filePath += "/";
}
PreferencesUtils.saveTessDir(this, filePath);
}
}

}
}

}

0 comments on commit efbcb3b

Please sign in to comment.