mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Enhance log with scroll and zoom possibility
This commit is contained in:
+1
-1
@@ -199,7 +199,7 @@
|
||||
</activity>
|
||||
|
||||
<activity android:name=".LogViewActivity"
|
||||
android:label="@string/pref_view_log"
|
||||
android:label="@string/pref_log_header"
|
||||
android:windowSoftInputMode="stateHidden"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||
|
||||
|
||||
@@ -6,6 +6,4 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,8 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:title="@string/menu_copy_to_clipboard"
|
||||
android:id="@+id/copy_log_to_clipboard" />
|
||||
<item android:title="@string/menu_zoom_in"
|
||||
android:id="@+id/log_zoom_in" />
|
||||
<item android:title="@string/menu_zoom_out"
|
||||
android:id="@+id/log_zoom_out" />
|
||||
<item android:title="@string/menu_scroll_to_bottom"
|
||||
android:id="@+id/log_scroll_down" />
|
||||
<item android:title="@string/menu_scroll_to_top"
|
||||
android:id="@+id/log_scroll_up" />
|
||||
|
||||
</menu>
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
<string name="menu_play">Play</string>
|
||||
<string name="menu_pause">Pause</string>
|
||||
<string name="menu_scroll_to_bottom">Scroll to the bottom</string>
|
||||
<string name="menu_scroll_to_top">Scroll to the top</string>
|
||||
<string name="menu_invite">Invite friends</string>
|
||||
<string name="menu_help">Help</string>
|
||||
<string name="menu_select_all">Select all</string>
|
||||
@@ -146,6 +147,8 @@
|
||||
<string name="menu_deaddrop">Contact requests</string>
|
||||
<string name="menu_deaddrop_subtitle">Press message to start chatting</string>
|
||||
<string name="menu_view_profile">View profile</string>
|
||||
<string name="menu_zoom_in">Zoom in</string>
|
||||
<string name="menu_zoom_out">Zoom out</string>
|
||||
<string name="title_share_location">Share location with all group members</string>
|
||||
|
||||
<string name="mute_for_one_hour">Mute for 1 hour</string>
|
||||
@@ -380,6 +383,7 @@
|
||||
<string name="pref_in_chat_sounds">In-chat sounds</string>
|
||||
<string name="pref_message_text_size">Message font size</string>
|
||||
<string name="pref_view_log">View log</string>
|
||||
<string name="pref_log_header">Log</string>
|
||||
<string name="pref_other">Other</string>
|
||||
<string name="pref_backup">Backup</string>
|
||||
<string name="pref_backup_explain">Backup chats to external storage</string>
|
||||
|
||||
@@ -56,15 +56,29 @@ public class LogViewActivity extends BaseActionBarActivity {
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
super.onOptionsItemSelected(item);
|
||||
Float newSize;
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
|
||||
case R.id.copy_log_to_clipboard:
|
||||
Util.writeTextToClipboard(this, logViewFragment.getLogText());
|
||||
Toast.makeText(getApplicationContext(), R.string.done, Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
case R.id.log_zoom_in:
|
||||
newSize = logViewFragment.getLogTextSize() + 2.0f;
|
||||
logViewFragment.setLogTextSize(newSize);
|
||||
return false;
|
||||
case R.id.log_zoom_out:
|
||||
newSize = logViewFragment.getLogTextSize() - 2.0f;
|
||||
logViewFragment.setLogTextSize(newSize);
|
||||
return false;
|
||||
case R.id.log_scroll_down:
|
||||
logViewFragment.scrollDownLog();
|
||||
return false;
|
||||
case R.id.log_scroll_up:
|
||||
logViewFragment.scrollUpLog();
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.os.PowerManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -84,6 +85,16 @@ public class LogViewFragment extends Fragment {
|
||||
return logPreview==null? "null" : logPreview.getText().toString();
|
||||
}
|
||||
|
||||
public Float getLogTextSize() { return logPreview.getTextSize(); }
|
||||
|
||||
public void setLogTextSize(Float Textsize) {
|
||||
logPreview.setTextSize(TypedValue.COMPLEX_UNIT_PX, Textsize);
|
||||
}
|
||||
|
||||
public void scrollDownLog() { logPreview.setSelection(logPreview.getText().length()); }
|
||||
|
||||
public void scrollUpLog() { logPreview.setSelection(0); }
|
||||
|
||||
private static String grabLogcat() {
|
||||
try {
|
||||
final Process process = Runtime.getRuntime().exec("logcat -v threadtime -d");
|
||||
|
||||
Reference in New Issue
Block a user